Gate My List behind auth modal instead of in-page prompt
- Clicking My List when not logged in now opens the auth modal directly instead of navigating to a page with a sign-in button - After successful login, auto-redirects to /library (My List) - Works on both desktop header and mobile tab bar - App.vue tracks a pending redirect path so the post-login navigation happens seamlessly - Direct URL navigation to /library when not logged in also triggers the modal and redirects back to Films Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<!-- Navigation - Desktop -->
|
||||
<nav v-if="showNav" class="hidden md:flex items-center gap-3">
|
||||
<button @click="handleFilmsClick" :class="isRoute('/') && !activeAlgorithm ? 'nav-button-active' : 'nav-button'">Films</button>
|
||||
<router-link to="/library" :class="isRoute('/library') && !activeAlgorithm ? 'nav-button-active' : 'nav-button'" @click="clearFilter">My List</router-link>
|
||||
<button @click="handleMyListClick" :class="isRoute('/library') && !activeAlgorithm ? 'nav-button-active' : 'nav-button'">My List</button>
|
||||
|
||||
<!-- Inline Algorithm Buttons (xl+ screens where they fit) -->
|
||||
<button
|
||||
@@ -223,7 +223,7 @@ interface Props {
|
||||
}
|
||||
|
||||
interface Emits {
|
||||
(e: 'openAuth'): void
|
||||
(e: 'openAuth', redirect?: string): void
|
||||
}
|
||||
|
||||
withDefaults(defineProps<Props>(), {
|
||||
@@ -232,7 +232,7 @@ withDefaults(defineProps<Props>(), {
|
||||
showAuth: true,
|
||||
})
|
||||
|
||||
defineEmits<Emits>()
|
||||
const emit = defineEmits<Emits>()
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
@@ -310,11 +310,21 @@ function handleFilmsClick() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Clear active filter (used when navigating to My List) */
|
||||
function clearFilter() {
|
||||
/**
|
||||
* Navigate to My List if logged in, otherwise open the auth modal
|
||||
* with a redirect so the user lands on My List after login.
|
||||
*/
|
||||
function handleMyListClick() {
|
||||
if (activeAlgorithm.value) {
|
||||
_setAlgorithm(activeAlgorithm.value as any) // toggle off
|
||||
}
|
||||
if (!isAuthenticated.value && !nostrLoggedIn.value) {
|
||||
emit('openAuth', '/library')
|
||||
return
|
||||
}
|
||||
if (route.path !== '/library') {
|
||||
router.push('/library')
|
||||
}
|
||||
}
|
||||
|
||||
function toggleDropdown() {
|
||||
|
||||
Reference in New Issue
Block a user