2024-07-15 10:57:51 +00:00
|
|
|
package pages
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.ekzyis.com/ekzyis/delphi.market/server/router/pages/components"
|
|
|
|
"git.ekzyis.com/ekzyis/delphi.market/types"
|
|
|
|
"github.com/dustin/go-humanize"
|
2024-08-25 05:48:00 +00:00
|
|
|
"strconv"
|
|
|
|
"fmt"
|
2024-07-15 10:57:51 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// TODO: Add countdown? Use or at least show somewhere precise timestamps?
|
|
|
|
|
2024-08-25 05:48:00 +00:00
|
|
|
templ Market(m types.Market, p types.MarketP) {
|
2024-07-15 10:57:51 +00:00
|
|
|
<html>
|
|
|
|
@components.Head()
|
|
|
|
<body class="container">
|
|
|
|
@components.Nav()
|
|
|
|
<div id="content" class="flex flex-col">
|
|
|
|
<small>
|
|
|
|
@components.Figlet("random", "market")
|
|
|
|
</small>
|
|
|
|
<div class="text-center font-bold my-1">{ m.Question }</div>
|
|
|
|
<div class="text-center text-muted my-1">{humanize.Time(m.EndDate)}</div>
|
|
|
|
<div class="text-center text-muted my-1"></div>
|
|
|
|
<blockquote cite="ekzyis" class="p-4 mb-4 border-s-4 border-muted">
|
|
|
|
{ m.Description }
|
|
|
|
<div class="text-muted text-right pt-4">― {m.User.Name}, { humanize.Time(m.CreatedAt) }</div>
|
|
|
|
</blockquote>
|
|
|
|
<div class="flex justify-center my-1">
|
|
|
|
<button class="neon success mx-1">BET YES</button>
|
|
|
|
<button class="neon error mx-1">BET NO</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
@components.Modal(nil)
|
|
|
|
@components.Footer()
|
|
|
|
</body>
|
|
|
|
</html>
|
2024-08-25 05:48:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func formatPrice(p float64) string {
|
|
|
|
return fmt.Sprintf("%v msats", strconv.FormatInt(pToPrice(p), 10))
|
|
|
|
}
|
|
|
|
|
|
|
|
func pToPrice(p float64) int64 {
|
|
|
|
// 0.513 means 513 msats
|
|
|
|
return int64(p * 1e3)
|
2024-07-15 10:57:51 +00:00
|
|
|
}
|