magicwallet/pages/index.templ
ekzyis 92876c5011 users, sessions and wallets w/o authentication
* if a request has no session cookie, a new user, session and wallet is created and session cookie is set
* if a request has a session cookie and session exists in db, we will fetch user and wallet from db
* this means that we have a user and wallet during each render without any login required
2024-12-15 21:56:26 +01:00

39 lines
1.1 KiB
Plaintext

package pages
import (
"fmt"
"github.com/ekzyis/magicwallet/pages/components"
"github.com/ekzyis/magicwallet/db/models"
)
templ Index() {
{{ u := ctx.Value("user").(models.User)}}
{{ w := ctx.Value("wallet").(models.Wallet) }}
<html>
@components.Head()
<body
class="container"
data-commit={ templ.JSONString(ctx.Value("commit")) }
data-user={ templ.JSONString(u) }
data-wallet={ templ.JSONString(w) }
>
<div id="content" class="grid mt-3">
<div class="grid gap-10 self-center justify-self-center">
<h1 class="text-center text-5xl font-bold">{ fmt.Sprintf("%d sats", w.Msats) }</h1>
<div class="flex justify-self-center">
<button class="flex items-center justify-center text-xl mx-3 w-[120px]">
<img src="/svg/arrow-left-down-line.svg" width="24px" height="24px"/>
receive
</button>
<button class="flex items-center justify-center text-xl mx-3 w-[120px]">
<img src="/svg/arrow-right-up-line.svg" width="24px" height="24px"/>
send
</button>
</div>
</div>
</div>
</body>
</html>
}