Skip to content

Commit

Permalink
allow to refresh page, set back url
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevie-Ray committed Jan 8, 2025
1 parent 49a02a2 commit ccef53b
Show file tree
Hide file tree
Showing 17 changed files with 283 additions and 336 deletions.
447 changes: 225 additions & 222 deletions package-lock.json

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"@googlemaps/js-api-loader": "^1.16.8",
"@hangtime/grip-connect": "^0.5.10",
"@mdi/js": "^7.4.47",
"@unhead/vue": "^1.11.14",
"@unhead/vue": "^1.11.15",
"@vueuse/core": "^12.3.0",
"core-js": "^3.39.0",
"core-js": "^3.40.0",
"firebase": "^11.1.0",
"ircra": "^2.2.4",
"js-video-url-parser": "^0.5.1",
Expand Down Expand Up @@ -62,12 +62,12 @@
"jsdom": "^25.0.1",
"npm-run-all2": "^7.0.2",
"prettier": "^3.4.2",
"rollup-plugin-visualizer": "^5.13.1",
"rollup-plugin-visualizer": "^5.14.0",
"sass": "^1.83.1",
"typescript": "^5.7.2",
"typescript": "^5.7.3",
"vite": "^6.0.7",
"vite-plugin-pwa": "^0.21.1",
"vite-plugin-vue-devtools": "^7.6.8",
"vite-plugin-vue-devtools": "^7.7.0",
"vite-plugin-vuetify": "^2.0.4",
"vitest": "^2.1.8",
"vue-tsc": "^2.2.0"
Expand Down
18 changes: 14 additions & 4 deletions src/components/organisms/AppContainer/AppContainer.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
<script setup lang="ts">
import { storeToRefs } from 'pinia'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import { useAuthenticationStore } from '@/stores/authentication.store'
const { t } = useI18n()
const router = useRouter()
const { user } = storeToRefs(useAuthenticationStore())
const {
extension = false,
prepend = false,
toolbarPrepend = false,
hideFooter = false
} = defineProps<{
extension?: boolean
prepend?: boolean
toolbarPrepend?: boolean
toolbarPrependUrl?: string
hideFooter?: boolean
}>()
</script>

<template>
<v-app-bar app>
<template v-if="prepend" #prepend>
<slot name="prepend"></slot>
<!-- toolbar prepend -->
<template v-if="toolbarPrepend" #prepend>
<slot name="prepend">
<router-link v-if="toolbarPrependUrl" :to="toolbarPrependUrl" style="color: inherit">
<v-icon>$arrowLeft</v-icon>
</router-link>
<v-icon v-else @click="router.go(-1)">$arrowLeft</v-icon>
</slot>
</template>

<!-- toolbar titles -->
Expand Down
4 changes: 2 additions & 2 deletions src/stores/workouts.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export const useWorkoutsStore = defineStore('workouts', () => {
await userWorkoutsDb.update(workout as IWorkout & { id: string })
}

const getWorkoutById = computed(() => (id: string | string[]): Workout | undefined => {
const getWorkoutById = (id: string | string[]): Workout | undefined => {
if (id === 'new') {
const newWorkout = new Workout()
newWorkout.addExercise()
Expand All @@ -138,7 +138,7 @@ export const useWorkoutsStore = defineStore('workouts', () => {
if (workoutsCommunity.value.find((workout) => workout.id === id)) {
return reactive(new Workout(workoutsCommunity.value.find((workout) => workout.id === id)))
}
})
}

/**
* Get the Users hangboards of a certain hangboard / company.
Expand Down
9 changes: 1 addition & 8 deletions src/views/account/AccountGeneralPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { storeToRefs } from 'pinia'
import { useI18n } from 'vue-i18n'
// import { useTheme } from 'vuetify'
import { useHead } from '@unhead/vue'
import { useRouter } from 'vue-router'
import IRCRA from 'ircra'
import AppContainer from '@/components/organisms/AppContainer/AppContainer.vue'
import { useAuthenticationStore } from '@/stores/authentication.store'
Expand All @@ -26,8 +25,6 @@ const { updateUser } = useAuthenticationStore()
// const theme = useTheme()
const router = useRouter()
const language = [
{
title: '简体中文',
Expand Down Expand Up @@ -127,11 +124,7 @@ useHead({
</script>

<template>
<app-container prepend>
<template #prepend>
<v-icon @click="router.go(-1)">$arrowLeft</v-icon>
</template>

<app-container toolbar-prepend toolbar-prepend-url="/account">
<template #title>
{{ t('General') }}
</template>
Expand Down
9 changes: 1 addition & 8 deletions src/views/account/AccountHangboardsPage.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script setup lang="ts">
import { useHead } from '@unhead/vue'
import { useRouter } from 'vue-router'
import { storeToRefs } from 'pinia'
import { useI18n } from 'vue-i18n'
import AppContainer from '@/components/organisms/AppContainer/AppContainer.vue'
Expand Down Expand Up @@ -45,20 +44,14 @@ const removeHangboard = (index: number) => {
}
}
const router = useRouter()
useHead({
title: 'Hangboards',
meta: [{ name: 'description', content: '' }]
})
</script>

<template>
<app-container prepend>
<template #prepend>
<v-icon @click="router.go(-1)">$arrowLeft</v-icon>
</template>

<app-container toolbar-prepend toolbar-prepend-url="/account">
<template #title>
{{ t('Hangboards') }}
</template>
Expand Down
9 changes: 1 addition & 8 deletions src/views/account/AccountHelpPage.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import { useHead } from '@unhead/vue'
import { useRouter } from 'vue-router'
import AppContainer from '@/components/organisms/AppContainer/AppContainer.vue'
const { t } = useI18n()
const router = useRouter()
useHead({
title: 'Help',
meta: [{ name: 'description', content: '' }]
})
</script>

<template>
<app-container prepend>
<template #prepend>
<v-icon @click="router.go(-1)">$arrowLeft</v-icon>
</template>

<app-container toolbar-prepend toolbar-prepend-url="/account">
<template #title>
{{ t('Help') }}
</template>
Expand Down
9 changes: 1 addition & 8 deletions src/views/account/AccountPrivacyPage.vue
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
<script setup lang="ts">
import { useHead } from '@unhead/vue'
import { useRouter } from 'vue-router'
import { useI18n } from 'vue-i18n'
import AppContainer from '@/components/organisms/AppContainer/AppContainer.vue'
const { t } = useI18n()
const router = useRouter()
useHead({
title: 'Terms and Privacy Policy',
meta: [{ name: 'description', content: '' }]
})
</script>

<template>
<app-container prepend>
<template #prepend>
<v-icon @click="router.go(-1)">$arrowLeft</v-icon>
</template>

<app-container toolbar-prepend toolbar-prepend-url="/account">
<template #title>
{{ t('Terms and Privacy Policy') }}
</template>
Expand Down
6 changes: 1 addition & 5 deletions src/views/account/AccountProfilePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@ useHead({
</script>

<template>
<app-container prepend>
<template #prepend>
<v-icon @click="router.go(-1)">$arrowLeft</v-icon>
</template>

<app-container toolbar-prepend toolbar-prepend-url="/account">
<template #title>
{{ t('Profile') }}
</template>
Expand Down
7 changes: 1 addition & 6 deletions src/views/account/AccountSubscriptionPage.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import { computed } from 'vue'
import { useHead } from '@unhead/vue'
import { useRouter } from 'vue-router'
import { storeToRefs } from 'pinia'
import { useI18n } from 'vue-i18n'
import { useAuthenticationStore } from '@/stores/authentication.store'
Expand All @@ -10,7 +9,6 @@ import { time } from '@/helpers'
import { usePlayBilling } from '@/composables/usePlayBilling'
const { t } = useI18n()
const router = useRouter()
const { user } = storeToRefs(useAuthenticationStore())
const {
Expand Down Expand Up @@ -43,10 +41,7 @@ useHead({
</script>

<template>
<app-container prepend>
<template #prepend>
<v-icon @click="router.go(-1)">$arrowLeft</v-icon>
</template>
<app-container toolbar-prepend toolbar-prepend-url="/account">
<template #title>
{{ t('Subscription') }}
</template>
Expand Down
9 changes: 1 addition & 8 deletions src/views/account/AccountWorkoutsPage.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script setup lang="ts">
import { useHead } from '@unhead/vue'
import { useRouter } from 'vue-router'
import { onMounted, reactive, computed } from 'vue'
import { storeToRefs } from 'pinia'
import { useI18n } from 'vue-i18n'
Expand Down Expand Up @@ -70,20 +69,14 @@ function greet(item: SpeechSynthesisVoice | undefined) {
}
}
const router = useRouter()
useHead({
title: 'Workouts',
meta: [{ name: 'description', content: '' }]
})
</script>

<template>
<app-container prepend>
<template #prepend>
<v-icon @click="router.go(-1)">$arrowLeft</v-icon>
</template>

<app-container toolbar-prepend toolbar-prepend-url="/account">
<template #title>
{{ t('Workouts') }}
</template>
Expand Down
9 changes: 1 addition & 8 deletions src/views/activity/ActivityNotificationsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ref, Ref } from 'vue'
import { storeToRefs } from 'pinia'
import { useI18n } from 'vue-i18n'
import { useHead } from '@unhead/vue'
import { useRouter } from 'vue-router'
import { getMessaging, getToken, deleteToken, onMessage, MessagePayload } from 'firebase/messaging'
import firebaseApp from '@/plugins/firebase'
Expand All @@ -15,8 +14,6 @@ const { updateUser } = useAuthenticationStore()
const { user } = storeToRefs(useAuthenticationStore())
const router = useRouter()
const { t } = useI18n()
const currentToken = ref('')
Expand Down Expand Up @@ -200,11 +197,7 @@ useHead({
</script>

<template>
<app-container prepend>
<template #prepend>
<v-icon @click="router.go(-1)">$arrowLeft</v-icon>
</template>

<app-container toolbar-prepend toolbar-prepend-url="/account">
<template #title>
{{ t('Notifications') }}
</template>
Expand Down
11 changes: 3 additions & 8 deletions src/views/brands/BrandsDetailPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { computed, ref } from 'vue'
import { useHead } from '@unhead/vue'
import { storeToRefs } from 'pinia'
import { useRoute, useRouter } from 'vue-router'
import { useRoute } from 'vue-router'
import { useI18n } from 'vue-i18n'
import { useUserStore } from '@/stores/user.store'
import { useRandomImage } from '@/helpers'
Expand All @@ -25,9 +25,8 @@ const { online } = storeToRefs(useAppStore())
const { getCompanyByUrlKey, getHangboardByIds } = useUserStore()
// router
// route
const route = useRoute()
const router = useRouter()
const getCompany = computed(() => getCompanyByUrlKey(route.params.id.toString()))
Expand All @@ -48,11 +47,7 @@ useHead({
</script>

<template>
<app-container prepend>
<template #prepend>
<v-icon @click="router.push('/brands')">$arrowLeft</v-icon>
</template>

<app-container toolbar-prepend toolbar-prepend-url="/brands">
<template #title>
{{
`${
Expand Down
11 changes: 1 addition & 10 deletions src/views/brands/BrandsPage.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import { useHead } from '@unhead/vue'
import { useI18n } from 'vue-i18n'
import { useRouter } from 'vue-router'
import { useUserStore } from '@/stores/user.store'
import countries from '@/helpers/countries'
Expand All @@ -12,26 +11,18 @@ const { t } = useI18n()
const { getCompanies } = useUserStore()
const router = useRouter()
useHead({
title: t('Supported Hangboards'),
meta: [{ name: 'description', content: '' }]
})
</script>

<template>
<app-container prepend>
<template #prepend>
<v-icon @click="router.go(-1)">$arrowLeft</v-icon>
</template>

<app-container toolbar-prepend toolbar-prepend-url="/">
<template #title>
{{ t('Supported Hangboards') }}
</template>

<template #icons> </template>

<template #default>
<v-container>
<v-row>
Expand Down
Loading

0 comments on commit ccef53b

Please sign in to comment.