From aee29f1ad5995b779617f2683524ed06ed0d4632 Mon Sep 17 00:00:00 2001 From: Padreug Date: Mon, 25 May 2026 11:56:27 +0200 Subject: [PATCH] fix(activities): favorites tab shows login toast instead of navigating when logged out MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tapping Favorites used to drop the user onto an empty page that *then* fired the auth-prompt toast on mount — the navigation was wasted motion. Mirror the Create tab pattern: onClick checks auth first, fires the same toast (with Log in action) when unauthed, and only router-pushes when authed. `path` is kept on the tab so the active-highlight still works when the user is actually on /activities/favorites after logging in (BottomNav highlights via tab.path && isActive(tab.path)). The mount-time toast on ActivitiesFavoritesPage stays as a defensive fallback for direct URL access. --- src/activities-app/App.vue | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/activities-app/App.vue b/src/activities-app/App.vue index 41e9ad1..ac80413 100644 --- a/src/activities-app/App.vue +++ b/src/activities-app/App.vue @@ -54,7 +54,27 @@ const tabs = computed(() => [ disabled: !isAuthenticated.value, }, { name: t('activities.nav.map'), icon: Map, path: '/activities/map' }, - { name: t('activities.nav.favorites'), icon: Heart, path: '/activities/favorites' }, + { + name: t('activities.nav.favorites'), + icon: Heart, + // path kept so the tab stays active-highlighted while the user is + // on /activities/favorites; onClick wins for the actual tap so we + // can gate on auth (mirrors the Create tab pattern above). + path: '/activities/favorites', + onClick: () => { + if (!isAuthenticated.value) { + toast.info(t('activities.favorites.loginPrompt'), { + action: { + label: t('activities.favorites.logIn'), + onClick: () => router.push('/login'), + }, + }) + return + } + router.push('/activities/favorites') + }, + disabled: !isAuthenticated.value, + }, ]) // Feed tab is active for the bare /activities route AND all sub-paths that