dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 9a06c926211f67e71bd80421c995317dc822c5b9
parent ee617ff83f8a62d498dd30fad5070c93f590d86c
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Fri, 15 Dec 2023 18:52:21 -0500

improve ui

Diffstat:
Mpkg/database/tablePokerCasino.go | 2+-
Mpkg/database/tablePokerTables.go | 6++++++
Mpkg/web/public/views/pages/admin/poker-transactions.gohtml | 6+++---
Mpkg/web/public/views/pages/poker.gohtml | 2+-
4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/pkg/database/tablePokerCasino.go b/pkg/database/tablePokerCasino.go @@ -5,7 +5,7 @@ import "fmt" // PokerCasino table, should always be one row type PokerCasino struct { ID int64 - Rake uint64 + Rake PokerChip } func (PokerCasino) TableName() string { return "poker_casino" } diff --git a/pkg/database/tablePokerTables.go b/pkg/database/tablePokerTables.go @@ -25,6 +25,8 @@ func (d *DkfDB) GetPokerTableBySlug(slug string) (out PokerTable, err error) { return } +const MoneroPrice = 168.2 + // Piconero the smallest unit of Monero is 1 piconero (0.000000000001 XMR) also known as the atomic unit // https://www.getmonero.org/resources/moneropedia/denominations.html type Piconero uint64 @@ -37,6 +39,10 @@ func (p Piconero) XmrStr() string { return fmt.Sprintf("%.12f", float64(p)/1_000_000_000_000) } +func (p Piconero) UsdStr() string { + return fmt.Sprintf("$%.2f", float64(p)/1_000_000_000_000*MoneroPrice) +} + type PokerChip uint64 func (p PokerChip) ToPiconero() Piconero { diff --git a/pkg/web/public/views/pages/admin/poker-transactions.gohtml b/pkg/web/public/views/pages/admin/poker-transactions.gohtml @@ -4,9 +4,9 @@ </div> <div class="mb-3"> - Rake: {{ .Data.PokerCasino.Rake }}<br /> - Wallet balance: {{ .Data.Balance.XmrStr }} xmr<br /> - Wallet unlocked balance: {{ .Data.UnlockedBalance.XmrStr }} xmr<br /> + Rake: {{ .Data.PokerCasino.Rake }} ({{ .Data.PokerCasino.Rake.ToPiconero.XmrStr }} xmr ~{{ .Data.PokerCasino.Rake.ToPiconero.UsdStr }})<br /> + Wallet balance: {{ .Data.Balance.XmrStr }} xmr ~{{ .Data.Balance.UsdStr }}<br /> + Wallet unlocked balance: {{ .Data.UnlockedBalance.XmrStr }} xmr ~{{ .Data.UnlockedBalance.UsdStr }}<br /> </div> <table class="table table-striped table-sm table-novpadding table-dark"> diff --git a/pkg/web/public/views/pages/poker.gohtml b/pkg/web/public/views/pages/poker.gohtml @@ -19,7 +19,7 @@ </div> <div class="mb-3"> Balance: {{ .Data.XmrBalance }}<br /> - <small>({{ .Data.XmrBalance | fmtPiconero }} XMR)</small><br /> + <small>({{ .Data.XmrBalance.XmrStr }} XMR | ~{{ .Data.XmrBalance.UsdStr }})</small><br /> <br /> Free tables balance: {{ .Data.ChipsTest }} <form method="post" class="d-inline ml-3">