beginnings of game state management

This commit is contained in:
DecDuck
2024-10-17 21:05:25 +11:00
parent 01b092c5fe
commit bf46dec359
6 changed files with 84 additions and 32 deletions

View File

@ -33,7 +33,7 @@
</NuxtLink>
</ul>
</div>
<div class="grow">
<div class="grow overflow-y-scroll">
<NuxtPage />
</div>
</div>

View File

@ -5,12 +5,22 @@
<!-- banner image -->
<div class="absolute flex top-0 h-fit inset-x-0 -z-[20]">
<img :src="bannerUrl" class="w-full h-auto object-cover" />
<h1
class="absolute inset-x-0 w-full text-center top-32 -translate-y-[50%] text-4xl text-zinc-100 font-bold font-display z-50"
>
{{ game.mName }}
</h1>
<div
class="absolute inset-0 bg-gradient-to-b from-transparent to-50% to-zinc-900"
/>
</div>
<!-- main page -->
<div class="w-full min-h-screen mx-auto bg-zinc-900 px-16 py-12"></div>
<div class="w-full min-h-screen mx-auto bg-zinc-900 px-5 py-6">
<!-- game toolbar -->
<div>
<GameButton v-model="status" />
</div>
</div>
</div>
</template>
@ -21,8 +31,11 @@ import { invoke } from "@tauri-apps/api/core";
const route = useRoute();
const id = route.params.id;
const rawGame = await invoke<string>("fetch_game", { id: id });
const game: Game = JSON.parse(rawGame);
const raw: { game: Game; status: any } = JSON.parse(
await invoke<string>("fetch_game", { id: id })
);
const game = ref(raw.game);
const status = ref(raw.status);
const bannerUrl = await useObject(game.mBannerId);
const bannerUrl = await useObject(game.value.mBannerId);
</script>