{{define "base"}}
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>{{if .Title}}{{.Title}} | {{end}}Update Server</title>
  <link rel="stylesheet" href="/static/app.css">
</head>
<body>
  <div class="page-shell">
    <header class="site-header">
      <a class="brand" href="/">Update Server</a>
      <nav class="site-nav">
        <a href="/">Home</a>
        <a href="/admin">Dashboard</a>
        {{if .CurrentUser}}
        <a href="/admin/projects">Projects</a>
        <a href="/admin/tags">Tags</a>
        <a href="/admin/api-keys">API Keys</a>
        {{else}}
        <a href="/admin/login">Login</a>
        {{end}}
        <a href="/api/v1">API</a>
        <a href="/healthz">Health</a>
        {{if .CurrentUser}}
        <span class="nav-user">{{.CurrentUser.Email}}</span>
        <form class="nav-form" method="post" action="/admin/logout">
          {{template "csrf_field" .}}
          <button class="nav-button" type="submit">Log out</button>
        </form>
        {{end}}
      </nav>
    </header>
    <main class="content-card">
      {{if .Flash}}
      <section class="alert-card {{if eq .Flash.Kind "error"}}alert-error{{else}}alert-success{{end}}">
        <p>{{.Flash.Message}}</p>
      </section>
      {{end}}
      {{template "content" .}}
    </main>
  </div>
</body>
</html>
{{end}}
