superbanka/web/templates/layouts/base.gohtml
2026-04-08 21:42:09 +02:00

81 lines
2.8 KiB
Text

{{ define "layouts/base" }}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ .Title }}</title>
<link rel="stylesheet" href="/static/app.css">
</head>
<body>
<header class="site-header">
<div class="shell header-row">
<a class="brand" href="/">Superbanka</a>
<nav class="nav">
{{ if .Admin }}
<a href="/admin">Dashboard</a>
<a href="/leaderboard">Leaderboard</a>
<a href="/admin/users">Users</a>
<a href="/admin/audit-logs">Audit logs</a>
<form method="post" action="/admin/logout" class="inline-form">
<input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
<button class="nav-button" type="submit">Admin logout</button>
</form>
{{ else if .User }}
<a href="/app">Dashboard</a>
<a href="/leaderboard">Leaderboard</a>
<a href="/app/transfer">Transfer</a>
<a href="/app/lottery">Lottery</a>
<a href="/app/transactions">Transactions</a>
<form method="post" action="/logout" class="inline-form">
<input type="hidden" name="csrf_token" value="{{ .CSRFToken }}">
<button class="nav-button" type="submit">Logout</button>
</form>
{{ else }}
<a href="/leaderboard">Leaderboard</a>
<a href="/register">Register</a>
<a href="/login">Login</a>
<a href="/admin/login">Admin</a>
{{ end }}
</nav>
</div>
</header>
<main class="shell main-content">
{{ if .Flash }}
<div class="flash success">{{ .Flash }}</div>
{{ end }}
{{ if .Error }}
<div class="flash error">{{ .Error }}</div>
{{ end }}
{{ if eq .Page "home" }}
{{ template "home" . }}
{{ else if eq .Page "register" }}
{{ template "register" . }}
{{ else if eq .Page "login" }}
{{ template "login" . }}
{{ else if eq .Page "admin_login" }}
{{ template "admin_login" . }}
{{ else if eq .Page "dashboard" }}
{{ template "dashboard" . }}
{{ else if eq .Page "leaderboard" }}
{{ template "leaderboard" . }}
{{ else if eq .Page "transfer" }}
{{ template "transfer" . }}
{{ else if eq .Page "lottery" }}
{{ template "lottery" . }}
{{ else if eq .Page "transactions" }}
{{ template "transactions" . }}
{{ else if eq .Page "admin_dashboard" }}
{{ template "admin_dashboard" . }}
{{ else if eq .Page "admin_users" }}
{{ template "admin_users" . }}
{{ else if eq .Page "admin_user_detail" }}
{{ template "admin_user_detail" . }}
{{ else if eq .Page "admin_audit_logs" }}
{{ template "admin_audit_logs" . }}
{{ end }}
</main>
</body>
</html>
{{ end }}