From 43cad4f36b43e8f6771d8cc63d9bcaed16fa36e4 Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Fri, 13 Feb 2026 15:59:45 +0100 Subject: [PATCH] feat(gallery): fix router back navigation from gallery and unlock achievements after visiting instead of before --- app/pages/gallery.vue | 3 --- app/stores/app.ts | 3 ++- app/stores/gallery.ts | 1 + app/stores/home.ts | 6 ++++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/pages/gallery.vue b/app/pages/gallery.vue index 1013747..3188d04 100644 --- a/app/pages/gallery.vue +++ b/app/pages/gallery.vue @@ -132,8 +132,6 @@ const animateIntro = async () => { ); }; -const galleryStore = useGalleryStore(); - const animateOutro = async () => { isAnimating.value = true; @@ -157,7 +155,6 @@ const animateOutro = async () => { typeText(descriptionText, description.value, DESCRIPTION_DURATION, true, { onComplete: async () => { await promiseTimeout(ANIMATION_SLEEP * 1000); - galleryStore.shouldAnimateOutro = true; router.push("/"); }, }); diff --git a/app/stores/app.ts b/app/stores/app.ts index d39e82f..2b950e3 100644 --- a/app/stores/app.ts +++ b/app/stores/app.ts @@ -49,6 +49,7 @@ export const useAppStore = defineStore("app", { settings, previousScreen: "home" as AppScreen, screen: "home" as AppScreen, + visitedGallery: false, camera: null as THREE.Camera | null, }; }, @@ -76,7 +77,7 @@ export const useAppStore = defineStore("app", { break; case "gallery": - achievements.unlock("gallery_visit"); + this.visitedGallery = true; break; case "contact": diff --git a/app/stores/gallery.ts b/app/stores/gallery.ts index 882ce4f..7e0ba85 100644 --- a/app/stores/gallery.ts +++ b/app/stores/gallery.ts @@ -90,6 +90,7 @@ export const useGalleryStore = defineStore("gallery", { } setTimeout(() => { + this.shouldAnimateOutro = true; navigateTo("/gallery"); }, ANIMATION.NAVIGATE_DELAY); }, diff --git a/app/stores/home.ts b/app/stores/home.ts index 0eda6d9..5c06898 100644 --- a/app/stores/home.ts +++ b/app/stores/home.ts @@ -40,6 +40,12 @@ export const useHomeStore = defineStore("home", { this.$reset(); this.selectedButton = selectedButton; this.animateIntro(); + + if (app.visitedGallery) { + app.visitedGallery = false; + const achievements = useAchievementsStore(); + achievements.unlock("gallery_visit"); + } }, animateIntro() {