feat: "spa", but more like single entry-point

This commit is contained in:
2026-09-16 23:25:16 +02:00
parent 13b14abb12
commit 15590e5162
30 changed files with 252 additions and 277 deletions
@@ -0,0 +1,12 @@
<script setup lang="ts">
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const year = new Date().getFullYear();
</script>
<template>
<footer class="text-center text-sm text-base-content/50 py-6">
&copy; {{ year }} {{ t("common.appName") }}
</footer>
</template>
@@ -0,0 +1,52 @@
<script setup lang="ts">
import { computed } from "vue";
import { useRoute } from "vue-router";
import { useI18n } from "vue-i18n";
import { storeToRefs } from "pinia";
import { useUserStore } from "@/stores/user";
import { bootstrap } from "@/bootstrap";
const route = useRoute();
const { t } = useI18n();
const userStore = useUserStore();
const { userInfo } = storeToRefs(userStore);
const title = computed(() => {
const key = route.meta.titleKey;
if (!key) return t("common.appName");
return t(key, {
game: (bootstrap.gameName as string) ?? "",
scope: (bootstrap.scopeName as string) ?? "",
});
});
const backPath = computed(() => route.meta.getBackPath?.(route));
const goBack = () => {
if (backPath.value) {
window.location.href = backPath.value;
}
};
</script>
<template>
<div class="navbar bg-base-100 shadow-lg">
<div class="container min-w-3/4 mx-auto w-full flex items-center gap-4">
<button v-if="backPath" @click="goBack" class="btn btn-primary btn-sm">
<i class="mdi mdi-arrow-left"></i>
{{ t("common.back") }}
</button>
<h1 class="text-xl font-bold">{{ title }}</h1>
<div class="flex-1"></div>
<div v-if="userInfo.isAuthenticated" class="flex items-center gap-2">
<div class="text-sm">
<span class="font-medium">{{ userInfo.username }}</span>
<span v-if="userInfo.isStaff" class="badge badge-warning badge-xs ml-1">{{ t("common.admin") }}</span>
</div>
</div>
<div v-else class="text-sm text-base-content/70">{{ t("common.notLoggedIn") }}</div>
<a href="/api/docs" class="btn btn-xs">{{ t("common.apiDocs") }}</a>
<a v-if="userInfo.isStaff" href="/admin" class="btn btn-xs btn-warning">{{ t("common.adminPanel") }}</a>
</div>
</div>
</template>