package components import ( "fmt" ) templ Invoice(hash string, bolt11 string, msats int, expiresIn int, paid bool, redirectUrl templ.SafeURL) {
Payment Required
@Qr(bolt11, "lightning:"+bolt11)
{ format(msats) }
@InvoiceStatus(hash, expiresIn, paid, redirectUrl)
} templ InvoiceStatus(hash string, expiresIn int, paid bool, redirectUrl templ.SafeURL) { if paid {
PAID
} else if expiresIn <= 0 {
EXPIRED
} else {
} } func format(msats int) string { sats := msats / 1000 if sats == 1 { return fmt.Sprintf("%d sat", sats) } return fmt.Sprintf("%d sats", sats) }