package components import ( "git.ekzyis.com/ekzyis/delphi.market/types" "fmt" "strconv" ) templ MarketForm(m types.Market, outcome int, q types.MarketQuote, uQ int) {
{formatPrice(q.AvgPrice)}
{formatPrice(q.TotalPrice)}
+{formatPrice(q.Reward)}
{ fmt.Sprint(uQ) }
} func formId (outcome int) string { return fmt.Sprintf("outcome-%d-form", outcome) } func inputId (outcome int) string { return fmt.Sprintf("outcome-%d-q", outcome) } func hxIndicator (outcome int) string { return fmt.Sprintf( "#%s>#p, #%s>#total, #%s>#reward", formId(outcome), formId(outcome), formId(outcome)) } func formatPrice(p float64) string { return fmt.Sprintf("%v sats", strconv.FormatFloat(p, 'f', 3, 64)) }