diff --git a/src/pages/Hub.vue b/src/pages/Hub.vue index 77f6a76..d4cf911 100644 --- a/src/pages/Hub.vue +++ b/src/pages/Hub.vue @@ -57,7 +57,7 @@ const token = computed(() => localStorage.getItem('lnbits_access_token') || '') function hubLink(m: Module): string | null { if (!m.envKey) return null - // Auth-only modules (wallet, chat, castle) are ghosted when not logged in. + // Auth-only modules (wallet, chat, castle, tasks) are ghosted when not logged in. if (m.authRequired && !isAuthenticated.value) return null const url = import.meta.env[m.envKey] as string | undefined if (!url) return null @@ -68,6 +68,24 @@ function hubLink(m: Module): string | null { return url } +function isAuthGated(m: Module): boolean { + return !!(m.authRequired && !isAuthenticated.value) +} + +function onTileClick(m: Module, event: Event) { + // Ghosted auth-required tiles aren't anchors; intercept and toast. + if (isAuthGated(m)) { + event.preventDefault() + toast.info(`${m.label} requires login`, { + action: { + label: 'Log in', + onClick: () => router.push('/login'), + }, + }) + } + // "Coming soon" tiles (no envKey, no authRequired) silently do nothing. +} + const showProfile = ref(false) function notImplemented() { @@ -107,14 +125,17 @@ function notImplemented() {