commit b1cc696451e349ddd71fd384aebd86cb9a1846fd
parent c19a205ef55c6a1da80891946a897c021338c3bb
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Sat, 16 Dec 2023 01:00:00 -0500
improve UI
Diffstat:
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/pkg/database/tablePokerTables.go b/pkg/database/tablePokerTables.go
@@ -2,6 +2,7 @@ package database
import (
"fmt"
+ "github.com/dustin/go-humanize"
"github.com/sirupsen/logrus"
)
@@ -43,12 +44,18 @@ func (p Piconero) UsdStr() string {
return fmt.Sprintf("$%.2f", float64(p)/1_000_000_000_000*MoneroPrice)
}
+func (p Piconero) RawString() string { return fmt.Sprintf("%d", p) }
+
+func (p Piconero) String() string { return humanize.Comma(int64(p)) }
+
type PokerChip uint64
func (p PokerChip) ToPiconero() Piconero {
return Piconero(p * 10_000_000)
}
+func (p PokerChip) String() string { return humanize.Comma(int64(p)) }
+
type PokerTableAccount struct {
ID int64
UserID UserID
diff --git a/pkg/web/public/views/pages/poker.gohtml b/pkg/web/public/views/pages/poker.gohtml
@@ -12,17 +12,17 @@
<img src="data:image/png;base64,{{ .Data.Img }}" class="img-thumbnail" alt="" />
{{ end }}
</div>
- 0.01xmr == 1000chips<br />
+ 0.01 <small>XMR</small> == 1,000 <small>chips</small><br />
rake is max 7% (rounded down)<br />
rake is capped at 15*big_blind<br />
10 confirmations needed for deposits (~20min)<br />
<div class="clearfix"></div>
</div>
<div class="mb-3">
- Balance: {{ .Data.XmrBalance }}<br />
- <small>({{ .Data.XmrBalance.XmrStr }} XMR | {{ .Data.XmrBalance.ToPokerChip }} chips | ~{{ .Data.XmrBalance.UsdStr }})</small><br />
+ Balance: {{ .Data.XmrBalance }} <small>pXMR</small><br />
+ <small>({{ .Data.XmrBalance.XmrStr }} <small>XMR</small> | {{ .Data.XmrBalance.ToPokerChip }} <small>chips</small> | ~{{ .Data.XmrBalance.UsdStr }})</small><br />
<br />
- Free tables balance: {{ .Data.ChipsTest }} chips
+ Free tables balance: {{ .Data.ChipsTest }} <small>chips</small>
<form method="post" class="d-inline ml-3">
<input type="hidden" name="csrf" value="{{ .CSRF }}" />
<input type="hidden" name="form_name" value="reset_chips" />
@@ -41,7 +41,7 @@
<input type="number" name="withdraw_amount" value="{{ .Data.WithdrawAmount }}" min="{{ .Data.MinWithdrawAmount }}" max="{{ .Data.XmrBalance }}" placeholder="amount" class="form-control mr-2" style="width: 150px;" />
<button class="btn btn-primary">Withdraw</button>
</form>
- <div>To withdraw, use the "balance" (<small>{{ .Data.XmrBalance }}</small>) which denomination is in <a href="https://www.getmonero.org/resources/moneropedia/denominations.html" rel="noopener noreferrer" target="_blank">piconero</a></div>
+ <div>To withdraw, use the "balance" (<small>{{ .Data.XmrBalance.RawString }} <small>pXMR</small></small>) which denomination is in <a href="https://www.getmonero.org/resources/moneropedia/denominations.html" rel="noopener noreferrer" target="_blank">piconero</a></div>
<hr />
</div>
<h3>Tables</h3>