<template>
  <section class="hero is-small is-primary">
    <div class="hero-body">
      <h1 class="title is-uppercase">{{ store.site_config.title }}</h1>
      <h2 class="subtitle">{{ store.site_config.subtitle }}</h2>
    </div>
  </section>

  <section class="section px-3">
    <progress
      v-if="store.background_image === 'loading'"
      class="progress is-primary"
      max="100"
    />
    <div
      v-else-if="store.background_image === 'error'"
      class="notification is-danger"
    >
      Hintergrundbild konnte nicht geladen werden
    </div>
    <div v-else class="container">
      <AdminView v-if="store.is_admin" />
      <UserView v-else />
    </div>
  </section>

  <div class="is-flex-grow-1" />

  <footer class="footer">
    <div class="level">
      <div class="level-item">
        <p v-html="store.site_config.footer" />
      </div>
      <div class="level-right">
        <div class="level-item">
          <TouchButton class="is-small is-warning" />
        </div>
        <div class="level-item">
          <AdminButton class="is-small is-link is-outlined" />
        </div>
      </div>
    </div>
  </footer>
</template>

<script setup lang="ts">
import { advent22Store } from "./lib/store";

import AdminView from "./components/admin/AdminView.vue";
import AdminButton from "./components/AdminButton.vue";
import TouchButton from "./components/TouchButton.vue";
import UserView from "./components/UserView.vue";

const store = advent22Store();
</script>

<style>
html {
  overflow-y: auto !important;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
</style>
