| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 129dced commit 96ffb5c
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,7 +34,7 @@ jobs: | |||
| 34 | 34 | - uses: pnpm/action-setup@v6 | |
| 35 | 35 | name: Install pnpm | |
| 36 | 36 | with: | |
| 37 | - version: 11 | ||
| 37 | + version: 11.11.0 | ||
| 38 | 38 | ||
| 39 | 39 | - name: Install dependencies 📦 | |
| 40 | 40 | run: pnpm install | |
@@ -66,7 +66,7 @@ jobs: | |||
| 66 | 66 | - uses: pnpm/action-setup@v6 | |
| 67 | 67 | name: Install pnpm | |
| 68 | 68 | with: | |
| 69 | - version: 11 | ||
| 69 | + version: 11.11.0 | ||
| 70 | 70 | ||
| 71 | 71 | - name: Install dependencies 📦 | |
| 72 | 72 | run: pnpm install | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,6 +27,7 @@ const phonesStore = usePhonesStore() | |||
| 27 | 27 | const threadsStore = useThreadsStore() | |
| 28 | 28 | const appStore = useAppStore() | |
| 29 | 29 | const notificationsStore = useNotificationsStore() | |
| 30 | + const redirectPreferenceStore = useRedirectPreferenceStore() | ||
| 30 | 31 | ||
| 31 | 32 | const selectedMenuItem = ref(-1) | |
| 32 | 33 | ||
@@ -71,6 +72,7 @@ async function logout() { | |||
| 71 | 72 | authStore.resetState() | |
| 72 | 73 | phonesStore.resetState() | |
| 73 | 74 | threadsStore.resetState() | |
| 75 | + redirectPreferenceStore.resetState() | ||
| 74 | 76 | notificationsStore.addNotification({ | |
| 75 | 77 | type: 'info', | |
| 76 | 78 | message: 'You have successfully logged out', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,59 @@ | |||
| 1 | + <script setup lang="ts"> | ||
| 2 | + import { computed } from 'vue' | ||
| 3 | + import { mdiClose, mdiArrowRight } from '@mdi/js' | ||
| 4 | + | ||
| 5 | + const route = useRoute() | ||
| 6 | + const authStore = useAuthStore() | ||
| 7 | + const redirectStore = useRedirectPreferenceStore() | ||
| 8 | + | ||
| 9 | + const showPopover = computed( | ||
| 10 | + () => | ||
| 11 | + route.name === 'index' && | ||
| 12 | + authStore.authUser !== null && | ||
| 13 | + !redirectStore.enabled && | ||
| 14 | + !redirectStore.dismissedThisSession, | ||
| 15 | + ) | ||
| 16 | + | ||
| 17 | + const menuOpen = computed({ | ||
| 18 | + get: () => showPopover.value, | ||
| 19 | + set: (value: boolean) => { | ||
| 20 | + if (!value) redirectStore.dismiss() | ||
| 21 | + }, | ||
| 22 | + }) | ||
| 23 | + </script> | ||
| 24 | + | ||
| 25 | + <template> | ||
| 26 | + <v-menu | ||
| 27 | + v-model="menuOpen" | ||
| 28 | + activator="parent" | ||
| 29 | + location="bottom end" | ||
| 30 | + offset="8" | ||
| 31 | + :open-on-click="false" | ||
| 32 | + :close-on-content-click="false" | ||
| 33 | + > | ||
| 34 | + <v-list width="280" class="py-0" rounded="lg" elevation="8"> | ||
| 35 | + <v-list-item> | ||
| 36 | + <v-list-item-title class="text-body-1"> | ||
| 37 | + Skip this page next time? | ||
| 38 | + </v-list-item-title> | ||
| 39 | + <template #append> | ||
| 40 | + <v-btn | ||
| 41 | + :icon="mdiClose" | ||
| 42 | + variant="text" | ||
| 43 | + size="small" | ||
| 44 | + color="warning" | ||
| 45 | + density="comfortable" | ||
| 46 | + aria-label="Dismiss" | ||
| 47 | + @click="redirectStore.dismiss()" | ||
| 48 | + /> | ||
| 49 | + </template> | ||
| 50 | + </v-list-item> | ||
| 51 | + <v-list-item class="text-primary" @click="redirectStore.enable()"> | ||
| 52 | + <v-list-item-title>Always open dashboard</v-list-item-title> | ||
| 53 | + <template #append> | ||
| 54 | + <v-icon :icon="mdiArrowRight" size="small" /> | ||
| 55 | + </template> | ||
| 56 | + </v-list-item> | ||
| 57 | + </v-list> | ||
| 58 | + </v-menu> | ||
| 59 | + </template> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -80,7 +80,11 @@ function goToPricing() { | |||
| 80 | 80 | Blog | |
| 81 | 81 | </v-btn> | |
| 82 | 82 | <v-btn | |
| 83 | - v-show="lgAndUp && authStore.authUser === null" | ||
| 83 | + v-show=" | ||
| 84 | + lgAndUp && | ||
| 85 | + authStore.authStateChanged && | ||
| 86 | + authStore.authUser === null | ||
| 87 | + " | ||
| 84 | 88 | size="large" | |
| 85 | 89 | variant="text" | |
| 86 | 90 | color="primary" | |
@@ -90,7 +94,7 @@ function goToPricing() { | |||
| 90 | 94 | Login | |
| 91 | 95 | </v-btn> | |
| 92 | 96 | <v-btn | |
| 93 | - v-show="authStore.authUser === null" | ||
| 97 | + v-show="authStore.authStateChanged && authStore.authUser === null" | ||
| 94 | 98 | color="primary" | |
| 95 | 99 | variant="flat" | |
| 96 | 100 | :class="{ 'mt-5': mdAndUp, 'mt-1': !mdAndUp }" | |
@@ -100,16 +104,21 @@ function goToPricing() { | |||
| 100 | 104 | Get Started | |
| 101 | 105 | <span v-show="lgAndUp"> For Free</span> | |
| 102 | 106 | </v-btn> | |
| 103 | - <v-btn | ||
| 104 | - v-show="authStore.authUser !== null" | ||
| 105 | - color="primary" | ||
| 106 | - variant="flat" | ||
| 107 | - :class="{ 'mt-5': mdAndUp, 'mt-1': !mdAndUp }" | ||
| 108 | - :size="lgAndUp ? 'large' : 'default'" | ||
| 109 | - :to="{ name: 'threads' }" | ||
| 107 | + <div | ||
| 108 | + v-show="authStore.authStateChanged && authStore.authUser !== null" | ||
| 109 | + class="position-relative d-inline-block" | ||
| 110 | 110 | > | |
| 111 | - Dashboard | ||
| 112 | - </v-btn> | ||
| 111 | + <v-btn | ||
| 112 | + color="primary" | ||
| 113 | + variant="flat" | ||
| 114 | + :class="{ 'mt-5': mdAndUp, 'mt-1': !mdAndUp }" | ||
| 115 | + :size="lgAndUp ? 'large' : 'default'" | ||
| 116 | + :to="{ name: 'threads' }" | ||
| 117 | + > | ||
| 118 | + Dashboard | ||
| 119 | + </v-btn> | ||
| 120 | + <RedirectPromptPopover /> | ||
| 121 | + </div> | ||
| 113 | 122 | </v-col> | |
| 114 | 123 | </v-row> | |
| 115 | 124 | </v-container> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,11 @@ | |||
| 1 | + import { STORAGE_KEY } from '~/stores/redirectPreference' | ||
| 2 | + | ||
| 3 | + export default defineNuxtRouteMiddleware(() => { | ||
| 4 | + try { | ||
| 5 | + if (localStorage.getItem(STORAGE_KEY) === 'true') { | ||
| 6 | + return navigateTo('/threads', { replace: true }) | ||
| 7 | + } | ||
| 8 | + } catch (error) { | ||
| 9 | + console.error(error) | ||
| 10 | + } | ||
| 11 | + }) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,6 +28,7 @@ import { | |||
| 28 | 28 | ||
| 29 | 29 | definePageMeta({ | |
| 30 | 30 | layout: 'website', | |
| 31 | + middleware: ['redirect-to-threads'], | ||
| 31 | 32 | }) | |
| 32 | 33 | ||
| 33 | 34 | useSeoMeta({ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,6 +47,7 @@ const authStore = useAuthStore() | |||
| 47 | 47 | const phonesStore = usePhonesStore() | |
| 48 | 48 | const billingStore = useBillingStore() | |
| 49 | 49 | const notificationsStore = useNotificationsStore() | |
| 50 | + const redirectPreferenceStore = useRedirectPreferenceStore() | ||
| 50 | 51 | ||
| 51 | 52 | const firebaseUser = ref<FirebaseUser | null>(null) | |
| 52 | 53 | const gravatarUrl = ref<string | null>(null) | |
@@ -773,6 +774,7 @@ async function deleteUserAccount() { | |||
| 773 | 774 | await signOut(auth) | |
| 774 | 775 | authStore.resetState() | |
| 775 | 776 | phonesStore.resetState() | |
| 777 | + redirectPreferenceStore.resetState() | ||
| 776 | 778 | notificationsStore.addNotification({ | |
| 777 | 779 | type: 'info', | |
| 778 | 780 | message: 'You have successfully logged out', | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,47 @@ | |||
| 1 | + import { defineStore } from 'pinia' | ||
| 2 | + import { ref } from 'vue' | ||
| 3 | + | ||
| 4 | + export const STORAGE_KEY = 'httpsms_redirect_to_threads' | ||
| 5 | + | ||
| 6 | + function readFlag(): boolean { | ||
| 7 | + try { | ||
| 8 | + return localStorage.getItem(STORAGE_KEY) === 'true' | ||
| 9 | + } catch (error) { | ||
| 10 | + console.error(error) | ||
| 11 | + return false | ||
| 12 | + } | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + export const useRedirectPreferenceStore = defineStore( | ||
| 16 | + 'redirectPreference', | ||
| 17 | + () => { | ||
| 18 | + const enabled = ref(readFlag()) | ||
| 19 | + const dismissedThisSession = ref(false) | ||
| 20 | + | ||
| 21 | + function enable() { | ||
| 22 | + try { | ||
| 23 | + localStorage.setItem(STORAGE_KEY, 'true') | ||
| 24 | + enabled.value = true | ||
| 25 | + navigateTo('/threads', { replace: true }) | ||
| 26 | + } catch (error) { | ||
| 27 | + console.error(error) | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + function dismiss() { | ||
| 32 | + dismissedThisSession.value = true | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + function resetState() { | ||
| 36 | + enabled.value = false | ||
| 37 | + dismissedThisSession.value = false | ||
| 38 | + try { | ||
| 39 | + localStorage.removeItem(STORAGE_KEY) | ||
| 40 | + } catch (error) { | ||
| 41 | + console.error(error) | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + return { enabled, dismissedThisSession, enable, dismiss, resetState } | ||
| 46 | + }, | ||
| 47 | + ) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments