chore: avoid `useHead` naming conflicts
parent
0acc0f7689
commit
98a647f8ca
|
@ -5,7 +5,7 @@ const isPreview = window.location.hostname.includes('deploy-preview')
|
||||||
|
|
||||||
export function usePageHeader() {
|
export function usePageHeader() {
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
useHead({
|
useHeadFixed({
|
||||||
htmlAttrs: {
|
htmlAttrs: {
|
||||||
lang: () => i18n.locale.value,
|
lang: () => i18n.locale.value,
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import type { ActiveHeadEntry, HeadEntryOptions, UseHeadInput } from '@vueuse/head'
|
import type { ActiveHeadEntry, HeadEntryOptions, UseHeadInput } from '@vueuse/head'
|
||||||
import type { HeadAugmentations } from '@nuxt/schema'
|
import type { HeadAugmentations } from '@nuxt/schema'
|
||||||
import { useHead as _useHead } from '#head'
|
import { useHead } from '#head'
|
||||||
|
|
||||||
export function useHead<T extends HeadAugmentations>(input: UseHeadInput<T>, options?: HeadEntryOptions): ActiveHeadEntry<UseHeadInput<T>> | void {
|
// TODO: Workaround for Nuxt bug: https://github.com/elk-zone/elk/pull/199#issuecomment-1329771961
|
||||||
|
export function useHeadFixed<T extends HeadAugmentations>(input: UseHeadInput<T>, options?: HeadEntryOptions): ActiveHeadEntry<UseHeadInput<T>> | void {
|
||||||
const deactivated = useDeactivated()
|
const deactivated = useDeactivated()
|
||||||
return _useHead(() => {
|
return useHead(() => {
|
||||||
if (deactivated.value)
|
if (deactivated.value)
|
||||||
return {}
|
return {}
|
||||||
return resolveUnref(input)
|
return resolveUnref(input)
|
||||||
|
|
|
@ -7,7 +7,7 @@ const { t } = useI18n()
|
||||||
const { data: account, refresh } = $(await useAsyncData(() => fetchAccountByName(accountName).catch(() => null)))
|
const { data: account, refresh } = $(await useAsyncData(() => fetchAccountByName(accountName).catch(() => null)))
|
||||||
|
|
||||||
if (account) {
|
if (account) {
|
||||||
useHead({
|
useHeadFixed({
|
||||||
title: () => `${getDisplayName(account)} (@${account.acct})`,
|
title: () => `${getDisplayName(account)} (@${account.acct})`,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ definePageMeta({
|
||||||
|
|
||||||
const paginator = useMasto().blocks.getIterator()
|
const paginator = useMasto().blocks.getIterator()
|
||||||
|
|
||||||
useHead({
|
useHeadFixed({
|
||||||
title: 'Blocked users',
|
title: 'Blocked users',
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -7,7 +7,7 @@ const paginator = useMasto().bookmarks.getIterator()
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
useHead({
|
useHeadFixed({
|
||||||
title: () => t('nav_side.bookmarks'),
|
title: () => t('nav_side.bookmarks'),
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -7,7 +7,7 @@ const paginator = useMasto().conversations.getIterator()
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
useHead({
|
useHeadFixed({
|
||||||
title: () => t('nav_side.conversations'),
|
title: () => t('nav_side.conversations'),
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -5,7 +5,7 @@ definePageMeta({
|
||||||
|
|
||||||
const paginator = useMasto().domainBlocks.getIterator()
|
const paginator = useMasto().domainBlocks.getIterator()
|
||||||
|
|
||||||
useHead({
|
useHeadFixed({
|
||||||
title: 'Blocked domains',
|
title: 'Blocked domains',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ const paginator = useMasto().trends.getStatuses()
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
useHead({
|
useHeadFixed({
|
||||||
title: () => t('nav_side.explore'),
|
title: () => t('nav_side.explore'),
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -6,7 +6,7 @@ definePageMeta({
|
||||||
const paginator = useMasto().favourites.getIterator()
|
const paginator = useMasto().favourites.getIterator()
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
useHead({
|
useHeadFixed({
|
||||||
title: () => t('nav_side.favourites'),
|
title: () => t('nav_side.favourites'),
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -16,7 +16,7 @@ const stream = await useMasto().stream.streamUser()
|
||||||
onBeforeUnmount(() => stream.disconnect())
|
onBeforeUnmount(() => stream.disconnect())
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
useHead({
|
useHeadFixed({
|
||||||
title: () => t('nav_side.home'),
|
title: () => t('nav_side.home'),
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -5,7 +5,7 @@ definePageMeta({
|
||||||
|
|
||||||
const paginator = useMasto().mutes.getIterator()
|
const paginator = useMasto().mutes.getIterator()
|
||||||
|
|
||||||
useHead({
|
useHeadFixed({
|
||||||
title: 'Muted users',
|
title: 'Muted users',
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -14,7 +14,7 @@ const paginator = $computed(() => {
|
||||||
return useMasto().notifications.getIterator(tab === 'All' ? undefined : { types: ['mention'] })
|
return useMasto().notifications.getIterator(tab === 'All' ? undefined : { types: ['mention'] })
|
||||||
})
|
})
|
||||||
|
|
||||||
useHead({
|
useHeadFixed({
|
||||||
title: () => t('nav_side.notifications'),
|
title: () => t('nav_side.notifications'),
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -6,7 +6,7 @@ definePageMeta({
|
||||||
const paginator = useMasto().accounts.getStatusesIterable(currentUser.value!.account.id, { pinned: true })
|
const paginator = useMasto().accounts.getStatusesIterable(currentUser.value!.account.id, { pinned: true })
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
useHead({
|
useHeadFixed({
|
||||||
title: () => t('account.pinned'),
|
title: () => t('account.pinned'),
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -5,7 +5,7 @@ onBeforeUnmount(() => stream.disconnect())
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
useHead({
|
useHeadFixed({
|
||||||
title: () => t('title.federated_timeline'),
|
title: () => t('title.federated_timeline'),
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -5,7 +5,7 @@ onBeforeUnmount(() => stream.disconnect())
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
useHead({
|
useHeadFixed({
|
||||||
title: () => t('title.local_timeline'),
|
title: () => t('title.local_timeline'),
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -9,7 +9,7 @@ const stream = await useMasto().stream.streamTagTimeline(tagName)
|
||||||
onBeforeUnmount(() => stream.disconnect())
|
onBeforeUnmount(() => stream.disconnect())
|
||||||
|
|
||||||
if (tag) {
|
if (tag) {
|
||||||
useHead({
|
useHeadFixed({
|
||||||
title: () => `#${tag.name}`,
|
title: () => `#${tag.name}`,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue