diff --git a/src/composables/useTitle.ts b/src/composables/useTitle.ts index 62d30623..981e4d59 100644 --- a/src/composables/useTitle.ts +++ b/src/composables/useTitle.ts @@ -1,12 +1,21 @@ -import { computed, watchEffect } from 'vue' -import type { ComputedGetter } from 'vue' +import { computed } from 'vue' +import type { Ref } from 'vue' -import { setTitle } from '@/helpers/setTitle' +import {useTitle as useTitleVueUse, resolveRef} from '@vueuse/core' -export function useTitle(titleGetter: ComputedGetter) { - const titleRef = computed(titleGetter) +type UseTitleParameters = Parameters - watchEffect(() => setTitle(titleRef.value)) +export function useTitle(...args: UseTitleParameters) { - return titleRef + const [newTitle, ...restArgs] = args + + const pageTitle = resolveRef(newTitle) as Ref + + const completeTitle = computed(() => + (typeof pageTitle.value === 'undefined' || pageTitle.value === '') + ? 'Vikunja' + : `${pageTitle.value} | Vikunja`, + ) + + return useTitleVueUse(completeTitle, ...restArgs) } \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index 2b3e6304..b69ea366 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -238,6 +238,7 @@ const router = createRouter({ meta: { showAsModal: true, }, + props: route => ({ namespaceId: parseInt(route.params.id as string) }), }, { path: '/namespaces/:id/settings/delete', diff --git a/src/views/namespaces/settings/archive.vue b/src/views/namespaces/settings/archive.vue index 7903ef61..950c1c12 100644 --- a/src/views/namespaces/settings/archive.vue +++ b/src/views/namespaces/settings/archive.vue @@ -7,50 +7,79 @@ + +