Fix missing formatting

This commit is contained in:
ekzyis 2024-09-05 23:11:29 +02:00
parent 9296bd5866
commit 9df7ce8338
4 changed files with 110 additions and 112 deletions

View File

@ -1,14 +1,14 @@
package components package components
import ( import "fmt"
"fmt"
)
templ Invoice(hash string, bolt11 string, msats int, expiresIn int, paid bool, redirectUrl templ.SafeURL) { templ Invoice(hash string, bolt11 string, msats int, expiresIn int, paid bool, redirectUrl templ.SafeURL) {
<div class="p-5 border border-muted bg-background text-center font-mono"> <div class="p-5 border border-muted bg-background text-center font-mono">
<div id="close" class="flex justify-end"><button class="w-fit text-muted hitbox hover:text-reset">X</button></div> <div id="close" class="flex justify-end"><button class="w-fit text-muted hitbox hover:text-reset">X</button></div>
<div>Payment Required</div> <div>Payment Required</div>
<div class="my-1">@Qr(bolt11, "lightning:"+bolt11)</div> <div class="my-1">
@Qr(bolt11, "lightning:"+bolt11)
</div>
<div class="my-1">{ format(msats) }</div> <div class="my-1">{ format(msats) }</div>
@InvoiceStatus(hash, expiresIn, paid, redirectUrl) @InvoiceStatus(hash, expiresIn, paid, redirectUrl)
<div class="none" id="bolt11-data" bolt11-data={ templ.JSONString(bolt11) } hx-preserve></div> <div class="none" id="bolt11-data" bolt11-data={ templ.JSONString(bolt11) } hx-preserve></div>
@ -34,9 +34,9 @@ templ InvoiceStatus(hash string, expiresIn int, paid bool, redirectUrl templ.Saf
hx-swap="outerHTML" hx-swap="outerHTML"
hx-select="#content" hx-select="#content"
hx-push-url="true" hx-push-url="true"
hx-select-oob="#modal" /> hx-select-oob="#modal"
} ></div>
else if expiresIn <= 0 { } else if expiresIn <= 0 {
<div class="font-mono neon error my-1">EXPIRED</div> <div class="font-mono neon error my-1">EXPIRED</div>
} else { } else {
<!-- invoice is pending --> <!-- invoice is pending -->
@ -71,7 +71,8 @@ templ InvoiceStatus(hash string, expiresIn int, paid bool, redirectUrl templ.Saf
hx-trigger="load delay:1s" hx-trigger="load delay:1s"
hx-target="#modal" hx-target="#modal"
hx-swap="outerHTML" hx-swap="outerHTML"
hx-select="#modal" /> hx-select="#modal"
></div>
} }
} }

View File

@ -1,9 +1,8 @@
package components package components
import ( import (
"git.ekzyis.com/ekzyis/delphi.market/types"
"fmt" "fmt"
"git.ekzyis.com/ekzyis/delphi.market/types"
"strconv" "strconv"
) )
@ -18,7 +17,7 @@ templ MarketForm(m types.Market, outcome int, q types.MarketQuote, uQ int) {
hx-select="#modal" hx-select="#modal"
> >
<input type="hidden" name="o" value={ fmt.Sprint(outcome) }/> <input type="hidden" name="o" value={ fmt.Sprint(outcome) }/>
<div class="none col-span-2 htmx-request" /> <div class="none col-span-2 htmx-request"></div>
<label for="p">avg price per share:</label> <label for="p">avg price per share:</label>
<div id="p">{ formatPrice(q.AvgPrice) }</div> <div id="p">{ formatPrice(q.AvgPrice) }</div>
<label for="q">how many?</label> <label for="q">how many?</label>

View File

@ -1,10 +1,10 @@
package pages package pages
import ( import (
"fmt"
c "git.ekzyis.com/ekzyis/delphi.market/server/router/context" c "git.ekzyis.com/ekzyis/delphi.market/server/router/context"
"git.ekzyis.com/ekzyis/delphi.market/server/router/pages/components" "git.ekzyis.com/ekzyis/delphi.market/server/router/pages/components"
"git.ekzyis.com/ekzyis/delphi.market/types" "git.ekzyis.com/ekzyis/delphi.market/types"
"fmt"
"github.com/dustin/go-humanize" "github.com/dustin/go-humanize"
) )

View File

@ -7,14 +7,14 @@ import (
) )
// TODO: Add countdown? Use or at least show somewhere precise timestamps? // TODO: Add countdown? Use or at least show somewhere precise timestamps?
templ Market(m types.Market, q0 types.MarketQuote, q1 types.MarketQuote, uQ0 int, uQ1 int) { templ Market(m types.Market, q0 types.MarketQuote, q1 types.MarketQuote, uQ0 int, uQ1 int) {
<html> <html>
@components.Head() @components.Head()
<body <body
x-data="{ outcome: undefined }" x-data="{ outcome: undefined }"
class="container" class="container"
hx-preserve> hx-preserve
>
@components.Nav() @components.Nav()
<div id="content" class="flex flex-col"> <div id="content" class="flex flex-col">
<small> <small>
@ -55,11 +55,9 @@ templ Market(m types.Market, q0 types.MarketQuote, q1 types.MarketQuote, uQ0 int
@components.MarketForm(m, 0, q0, uQ0) @components.MarketForm(m, 0, q0, uQ0)
</div> </div>
</div> </div>
</div> </div>
@components.Modal(nil) @components.Modal(nil)
@components.Footer() @components.Footer()
</body> </body>
</html> </html>
} }