Compare commits

...

9 commits

Author SHA1 Message Date
userquin
e3cf72f7fd chore: update nuxt-docus 2023-02-18 04:24:34 +01:00
userquin
38f18fdbf1 chore: update nuxt also on docs 2023-02-18 04:18:43 +01:00
userquin
ef8a2bec32 chore: cleanup 2023-02-18 04:17:43 +01:00
userquin
71923d30dd chore: use await changing locale on initial load 2023-02-18 02:53:24 +01:00
userquin
8fe904d0b5 chore: update pages with useHydratedHeader and use isHydrated on nav side and settings 2023-02-18 01:26:28 +01:00
userquin
da76c0076b fix: configure i18n locale from user preferences on load 2023-02-18 01:25:03 +01:00
userquin
d6d413a191 chore: add useHydratedHead 2023-02-18 01:23:50 +01:00
Daniel Roe
a7cec9e67d chore: deduplicate lockfile 2023-02-17 22:28:04 +00:00
userquin
1cb2069f64 chore: remove useHeadFixed workaround 2023-02-17 23:20:50 +01:00
46 changed files with 710 additions and 669 deletions

View file

@ -29,7 +29,7 @@ router.afterEach(() => {
@click.prevent="onClickLogo" @click.prevent="onClickLogo"
> >
<NavLogo shrink-0 aspect="1/1" sm:h-8 xl:h-10 class="rtl-flip" /> <NavLogo shrink-0 aspect="1/1" sm:h-8 xl:h-10 class="rtl-flip" />
<div hidden xl:block text-secondary> <div v-show="isHydrated" hidden xl:block text-secondary>
{{ $t('app_name') }} <sup text-sm italic mt-1>{{ env === 'release' ? 'alpha' : env }}</sup> {{ $t('app_name') }} <sup text-sm italic mt-1>{{ env === 'release' ? 'alpha' : env }}</sup>
</div> </div>
</NuxtLink> </NuxtLink>

View file

@ -22,7 +22,7 @@ const createdAt = useFormattedDateTime(status.createdAt)
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => `${getDisplayName(status.account)} ${t('common.in')} ${t('app_name')}: "${removeHTMLTags(status.content) || ''}"`, title: () => `${getDisplayName(status.account)} ${t('common.in')} ${t('app_name')}: "${removeHTMLTags(status.content) || ''}"`,
}) })

View file

@ -12,7 +12,7 @@ export function setupPageHeader() {
return acc return acc
}, {} as Record<string, Directions>) }, {} as Record<string, Directions>)
useHeadFixed({ useHydratedHead({
htmlAttrs: { htmlAttrs: {
lang: () => locale.value, lang: () => locale.value,
dir: () => localeMap[locale.value] ?? 'ltr', dir: () => localeMap[locale.value] ?? 'ltr',

View file

@ -38,9 +38,7 @@ export function onReactivated(hook: Function, target?: ComponentInternalInstance
onDeactivated(() => initial.value = false) onDeactivated(() => initial.value = false)
} }
// TODO: Workaround for Nuxt bug: https://github.com/elk-zone/elk/pull/199#issuecomment-1329771961 export function useHydratedHead<T extends HeadAugmentations>(input: UseHeadInput<T>, options?: HeadEntryOptions): ActiveHeadEntry<UseHeadInput<T>> | void {
export function useHeadFixed<T extends HeadAugmentations>(input: UseHeadInput<T>, options?: HeadEntryOptions): ActiveHeadEntry<UseHeadInput<T>> | void {
const deactivated = useDeactivated()
if (input && typeof input === 'object' && !('value' in input)) { if (input && typeof input === 'object' && !('value' in input)) {
const title = 'title' in input ? input.title : undefined const title = 'title' in input ? input.title : undefined
if (process.server && title) { if (process.server && title) {
@ -56,7 +54,7 @@ export function useHeadFixed<T extends HeadAugmentations>(input: UseHeadInput<T>
} }
} }
return useHead(() => { return useHead(() => {
if (deactivated.value) if (!isHydrated.value)
return {} return {}
return resolveUnref(input) return resolveUnref(input)
}, options) }, options)

View file

@ -9,7 +9,7 @@
"preview": "nuxi preview" "preview": "nuxi preview"
}, },
"devDependencies": { "devDependencies": {
"@nuxt-themes/docus": "^1.8.1", "@nuxt-themes/docus": "^1.8.2",
"nuxt": "^3.2.0" "nuxt": "^3.2.2"
} }
} }

View file

@ -107,7 +107,7 @@
}, },
"devDependencies": { "devDependencies": {
"@antfu/eslint-config": "^0.34.1", "@antfu/eslint-config": "^0.34.1",
"@antfu/ni": "^0.19.0", "@antfu/ni": "^0.20.0",
"@types/chroma-js": "^2.1.4", "@types/chroma-js": "^2.1.4",
"@types/file-saver": "^2.0.5", "@types/file-saver": "^2.0.5",
"@types/flat": "^5.0.2", "@types/flat": "^5.0.2",
@ -122,7 +122,7 @@
"flat": "^5.0.2", "flat": "^5.0.2",
"fs-extra": "^11.1.0", "fs-extra": "^11.1.0",
"lint-staged": "^13.1.0", "lint-staged": "^13.1.0",
"nuxt": "3.2.0", "nuxt": "3.2.2",
"prettier": "^2.8.3", "prettier": "^2.8.3",
"simple-git-hooks": "^2.8.1", "simple-git-hooks": "^2.8.1",
"typescript": "^4.9.5", "typescript": "^4.9.5",

View file

@ -11,7 +11,7 @@ const paginator = account ? useMastoClient().v1.accounts.listFollowers(account.i
const isSelf = useSelfAccount(account) const isSelf = useSelfAccount(account)
if (account) { if (account) {
useHeadFixed({ useHydratedHead({
title: () => `${t('account.followers')} | ${getDisplayName(account)} (@${account.acct})`, title: () => `${t('account.followers')} | ${getDisplayName(account)} (@${account.acct})`,
}) })
} }

View file

@ -11,7 +11,7 @@ const paginator = account ? useMastoClient().v1.accounts.listFollowing(account.i
const isSelf = useSelfAccount(account) const isSelf = useSelfAccount(account)
if (account) { if (account) {
useHeadFixed({ useHydratedHead({
title: () => `${t('account.following')} | ${getDisplayName(account)} (@${account.acct})`, title: () => `${t('account.following')} | ${getDisplayName(account)} (@${account.acct})`,
}) })
} }

View file

@ -15,7 +15,7 @@ const reorderAndFilter = (items: mastodon.v1.Status[]) => reorderedTimeline(item
const paginator = useMastoClient().v1.accounts.listStatuses(account.id, { limit: 30, excludeReplies: true }) const paginator = useMastoClient().v1.accounts.listStatuses(account.id, { limit: 30, excludeReplies: true })
if (account) { if (account) {
useHeadFixed({ useHydratedHead({
title: () => `${t('account.posts')} | ${getDisplayName(account)} (@${account.acct})`, title: () => `${t('account.posts')} | ${getDisplayName(account)} (@${account.acct})`,
}) })
} }

View file

@ -10,7 +10,7 @@ const account = await fetchAccountByHandle(handle)
const paginator = useMastoClient().v1.accounts.listStatuses(account.id, { onlyMedia: true, excludeReplies: false }) const paginator = useMastoClient().v1.accounts.listStatuses(account.id, { onlyMedia: true, excludeReplies: false })
if (account) { if (account) {
useHeadFixed({ useHydratedHead({
title: () => `${t('tab.media')} | ${getDisplayName(account)} (@${account.acct})`, title: () => `${t('tab.media')} | ${getDisplayName(account)} (@${account.acct})`,
}) })
} }

View file

@ -10,7 +10,7 @@ const account = await fetchAccountByHandle(handle)
const paginator = useMastoClient().v1.accounts.listStatuses(account.id, { excludeReplies: false }) const paginator = useMastoClient().v1.accounts.listStatuses(account.id, { excludeReplies: false })
if (account) { if (account) {
useHeadFixed({ useHydratedHead({
title: () => `${t('tab.posts_with_replies')} | ${getDisplayName(account)} (@${account.acct})`, title: () => `${t('tab.posts_with_replies')} | ${getDisplayName(account)} (@${account.acct})`,
}) })
} }

View file

@ -7,7 +7,7 @@ const paginator = useMastoClient().v1.trends.listStatuses()
const hideNewsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_POSTS_TIPS, false) const hideNewsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_POSTS_TIPS, false)
useHeadFixed({ useHydratedHead({
title: () => `${t('tab.posts')} | ${t('nav.explore')}`, title: () => `${t('tab.posts')} | ${t('nav.explore')}`,
}) })
</script> </script>

View file

@ -7,7 +7,7 @@ const paginator = useMastoClient().v1.trends.listLinks()
const hideNewsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_NEWS_TIPS, false) const hideNewsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_NEWS_TIPS, false)
useHeadFixed({ useHydratedHead({
title: () => `${t('tab.news')} | ${t('nav.explore')}`, title: () => `${t('tab.news')} | ${t('nav.explore')}`,
}) })
</script> </script>

View file

@ -10,7 +10,7 @@ const paginator = client.v1.trends.listTags({
const hideTagsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_TAGS_TIPS, false) const hideTagsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_TAGS_TIPS, false)
useHeadFixed({ useHydratedHead({
title: () => `${t('tab.hashtags')} | ${t('nav.explore')}`, title: () => `${t('tab.hashtags')} | ${t('nav.explore')}`,
}) })
</script> </script>

View file

@ -4,7 +4,7 @@ const { t } = useI18n()
// limit: 20 is the default configuration of the official client // limit: 20 is the default configuration of the official client
const paginator = useMastoClient().v2.suggestions.list({ limit: 20 }) const paginator = useMastoClient().v2.suggestions.list({ limit: 20 })
useHeadFixed({ useHydratedHead({
title: () => `${t('tab.for_you')} | ${t('nav.explore')}`, title: () => `${t('tab.for_you')} | ${t('nav.explore')}`,
}) })
</script> </script>

View file

@ -35,7 +35,7 @@ const { client } = $(useMasto())
const { data: listInfo, refresh } = $(await useAsyncData(() => client.v1.lists.fetch(list), { default: () => shallowRef() })) const { data: listInfo, refresh } = $(await useAsyncData(() => client.v1.lists.fetch(list), { default: () => shallowRef() }))
if (listInfo) { if (listInfo) {
useHeadFixed({ useHydratedHead({
title: () => `${listInfo.title} | ${route.fullPath.endsWith('/accounts') ? t('tab.accounts') : t('tab.posts')} | ${t('nav.lists')}`, title: () => `${listInfo.title} | ${route.fullPath.endsWith('/accounts') ? t('tab.accounts') : t('tab.posts')} | ${t('nav.lists')}`,
}) })
} }

View file

@ -11,7 +11,7 @@ const client = useMastoClient()
const paginator = client.v1.lists.list() const paginator = client.v1.lists.list()
useHeadFixed({ useHydratedHead({
title: () => t('nav.lists'), title: () => t('nav.lists'),
}) })

View file

@ -1,9 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => t('title.federated_timeline'), title: () => t('title.federated_timeline'),
}) })
</script> </script>

View file

@ -1,8 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => t('title.local_timeline'), title: () => t('title.local_timeline'),
}) })
</script> </script>

View file

@ -13,7 +13,7 @@ const paginator = client.v1.timelines.listHashtag(tagName)
const stream = useStreaming(client => client.v1.stream.streamTagTimeline(tagName)) const stream = useStreaming(client => client.v1.stream.streamTagTimeline(tagName))
if (tag) { if (tag) {
useHeadFixed({ useHydratedHead({
title: () => `#${tag.name}`, title: () => `#${tag.name}`,
}) })
} }

View file

@ -5,7 +5,7 @@ definePageMeta({
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => t('nav.blocked_users'), title: () => t('nav.blocked_users'),
}) })
</script> </script>

View file

@ -5,7 +5,7 @@ definePageMeta({
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => t('nav.bookmarks'), title: () => t('nav.bookmarks'),
}) })
</script> </script>

View file

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => t('nav.compose'), title: () => t('nav.compose'),
}) })
</script> </script>

View file

@ -5,7 +5,7 @@ definePageMeta({
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => t('nav.conversations'), title: () => t('nav.conversations'),
}) })
</script> </script>

View file

@ -5,7 +5,7 @@ definePageMeta({
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => t('nav.blocked_domains'), title: () => t('nav.blocked_domains'),
}) })
</script> </script>

View file

@ -5,7 +5,7 @@ definePageMeta({
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => t('nav.favourites'), title: () => t('nav.favourites'),
}) })
</script> </script>

View file

@ -1,6 +1,4 @@
<script setup lang="ts"> <script setup lang="ts">
import { useI18n } from 'vue-i18n'
definePageMeta({ definePageMeta({
middleware: 'auth', middleware: 'auth',
alias: ['/signin/callback'], alias: ['/signin/callback'],
@ -12,7 +10,7 @@ if (process.client && route.path === '/signin/callback')
router.push('/home') router.push('/home')
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => t('nav.home'), title: () => t('nav.home'),
}) })
</script> </script>

View file

@ -5,7 +5,7 @@ definePageMeta({
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => t('nav.muted_users'), title: () => t('nav.muted_users'),
}) })
</script> </script>

View file

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => `${t('tab.notifications_all')} | ${t('nav.notifications')}`, title: () => `${t('tab.notifications_all')} | ${t('nav.notifications')}`,
}) })
</script> </script>

View file

@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => `${t('tab.notifications_mention')} | ${t('nav.notifications')}`, title: () => `${t('tab.notifications_mention')} | ${t('nav.notifications')}`,
}) })
</script> </script>

View file

@ -5,7 +5,7 @@ definePageMeta({
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => t('account.pinned'), title: () => t('account.pinned'),
}) })
</script> </script>

View file

@ -5,7 +5,7 @@ definePageMeta({
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => t('nav.settings'), title: () => t('nav.settings'),
}) })
@ -22,7 +22,7 @@ const isRootPath = computedEager(() => route.name === 'settings')
<template #title> <template #title>
<div timeline-title-style flex items-center gap-2 @click="$scrollToTop"> <div timeline-title-style flex items-center gap-2 @click="$scrollToTop">
<div i-ri:settings-3-line /> <div i-ri:settings-3-line />
<span>{{ $t('nav.settings') }}</span> <span>{{ isHydrated ? $t('nav.settings') : '' }}</span>
</div> </div>
</template> </template>
<div xl:w-97 lg:w-78 w-full> <div xl:w-97 lg:w-78 w-full>
@ -37,7 +37,7 @@ const isRootPath = computedEager(() => route.name === 'settings')
<SettingsItem <SettingsItem
command command
icon="i-ri-compasses-2-line" icon="i-ri-compasses-2-line"
:text="$t('settings.interface.label')" :text="isHydrated ? $t('settings.interface.label') : ''"
to="/settings/interface" to="/settings/interface"
:match="$route.path.startsWith('/settings/interface/')" :match="$route.path.startsWith('/settings/interface/')"
/> />
@ -52,28 +52,28 @@ const isRootPath = computedEager(() => route.name === 'settings')
<SettingsItem <SettingsItem
command command
icon="i-ri-globe-line" icon="i-ri-globe-line"
:text="$t('settings.language.label')" :text="isHydrated ? $t('settings.language.label') : ''"
to="/settings/language" to="/settings/language"
:match="$route.path.startsWith('/settings/language/')" :match="$route.path.startsWith('/settings/language/')"
/> />
<SettingsItem <SettingsItem
command command
icon="i-ri-equalizer-line" icon="i-ri-equalizer-line"
:text="$t('settings.preferences.label')" :text="isHydrated ? $t('settings.preferences.label') : ''"
to="/settings/preferences" to="/settings/preferences"
:match="$route.path.startsWith('/settings/preferences/')" :match="$route.path.startsWith('/settings/preferences/')"
/> />
<SettingsItem <SettingsItem
command command
icon="i-ri-group-line" icon="i-ri-group-line"
:text="$t('settings.users.label')" :text="isHydrated ? $t('settings.users.label') : ''"
to="/settings/users" to="/settings/users"
:match="$route.path.startsWith('/settings/users/')" :match="$route.path.startsWith('/settings/users/')"
/> />
<SettingsItem <SettingsItem
command command
icon="i-ri:information-line" icon="i-ri:information-line"
:text="$t('settings.about.label')" :text="isHydrated ? $t('settings.about.label') : ''"
to="/settings/about" to="/settings/about"
:match="$route.path.startsWith('/settings/about/')" :match="$route.path.startsWith('/settings/about/')"
/> />

View file

@ -2,7 +2,7 @@
const buildInfo = useBuildInfo() const buildInfo = useBuildInfo()
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => `${t('settings.about.label')} | ${t('nav.settings')}`, title: () => `${t('settings.about.label')} | ${t('nav.settings')}`,
}) })

View file

@ -2,7 +2,7 @@
<div min-h-screen flex justify-center items-center> <div min-h-screen flex justify-center items-center>
<div text-center flex="~ col gap-2" items-center> <div text-center flex="~ col gap-2" items-center>
<div i-ri:settings-3-line text-5xl /> <div i-ri:settings-3-line text-5xl />
<span text-xl>{{ $t('settings.select_a_settings') }}</span> <span text-xl>{{ isHydrated ? $t('settings.select_a_settings') : '' }}</span>
</div> </div>
</div> </div>
</template> </template>

View file

@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => `${t('settings.interface.label')} | ${t('nav.settings')}`, title: () => `${t('settings.interface.label')} | ${t('nav.settings')}`,
}) })
</script> </script>

View file

@ -5,7 +5,7 @@ const { t, locale } = useI18n()
const translationStatus: ElkTranslationStatus = await import('~/elk-translation-status.json').then(m => m.default) const translationStatus: ElkTranslationStatus = await import('~/elk-translation-status.json').then(m => m.default)
useHeadFixed({ useHydratedHead({
title: () => `${t('settings.language.label')} | ${t('nav.settings')}`, title: () => `${t('settings.language.label')} | ${t('nav.settings')}`,
}) })
const status = computed(() => { const status = computed(() => {

View file

@ -6,7 +6,7 @@ definePageMeta({
const { t } = useI18n() const { t } = useI18n()
const pwaEnabled = useAppConfig().pwaEnabled const pwaEnabled = useAppConfig().pwaEnabled
useHeadFixed({ useHydratedHead({
title: () => `${t('settings.notifications.label')} | ${t('nav.settings')}`, title: () => `${t('settings.notifications.label')} | ${t('nav.settings')}`,
}) })
</script> </script>
@ -15,20 +15,20 @@ useHeadFixed({
<MainContent back-on-small-screen> <MainContent back-on-small-screen>
<template #title> <template #title>
<div text-lg font-bold flex items-center gap-2 @click="$scrollToTop"> <div text-lg font-bold flex items-center gap-2 @click="$scrollToTop">
<span>{{ $t('settings.notifications.label') }}</span> <span>{{ isHydrated ? $t('settings.notifications.label') : '' }}</span>
</div> </div>
</template> </template>
<SettingsItem <SettingsItem
command command
:text="$t('settings.notifications.notifications.label')" :text="isHydrated ? $t('settings.notifications.notifications.label') : ''"
to="/settings/notifications/notifications" to="/settings/notifications/notifications"
/> />
<SettingsItem <SettingsItem
command command
:disabled="!pwaEnabled" :disabled="!pwaEnabled"
:text="$t('settings.notifications.push_notifications.label')" :text="isHydrated ? $t('settings.notifications.push_notifications.label') : ''"
:description="$t('settings.notifications.push_notifications.description')" :description="isHydrated ? $t('settings.notifications.push_notifications.description') : ''"
to="/settings/notifications/push-notifications" to="/settings/notifications/push-notifications"
/> />
</MainContent> </MainContent>

View file

@ -5,7 +5,7 @@ definePageMeta({
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => `${t('settings.notifications.notifications.label')} | ${t('settings.notifications.label')} | ${t('nav.settings')}`, title: () => `${t('settings.notifications.notifications.label')} | ${t('settings.notifications.label')} | ${t('nav.settings')}`,
}) })
</script> </script>
@ -14,14 +14,14 @@ useHeadFixed({
<MainContent back> <MainContent back>
<template #title> <template #title>
<div text-lg font-bold flex items-center gap-2 @click="$scrollToTop"> <div text-lg font-bold flex items-center gap-2 @click="$scrollToTop">
<span>{{ $t('settings.notifications.notifications.label') }}</span> <span>{{ isHydrated ? $t('settings.notifications.notifications.label') : '' }}</span>
</div> </div>
</template> </template>
<h3 px6 py4 mt2 font-bold text-xl flex="~ gap-1" items-center> <h3 px6 py4 mt2 font-bold text-xl flex="~ gap-1" items-center>
{{ $t('settings.notifications.notifications.label') }} {{ isHydrated ? $t('settings.notifications.notifications.label') : '' }}
</h3> </h3>
<p text-4xl text-center> <p text-4xl text-center>
<span sr-only>{{ $t('settings.notifications.under_construction') }}</span> 🚧 <span sr-only>{{ isHydrated ? $t('settings.notifications.under_construction') : '' }}</span> 🚧
</p> </p>
</MainContent> </MainContent>
</template> </template>

View file

@ -8,7 +8,7 @@ definePageMeta({
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => `${t('settings.notifications.push_notifications.label')} | ${t('settings.notifications.label')} | ${t('nav.settings')}`, title: () => `${t('settings.notifications.push_notifications.label')} | ${t('settings.notifications.label')} | ${t('nav.settings')}`,
}) })
</script> </script>
@ -17,7 +17,7 @@ useHeadFixed({
<MainContent back> <MainContent back>
<template #title> <template #title>
<div text-lg font-bold flex items-center gap-2 @click="$scrollToTop"> <div text-lg font-bold flex items-center gap-2 @click="$scrollToTop">
<span>{{ $t('settings.notifications.push_notifications.label') }}</span> <span>{{ isHydrated ? $t('settings.notifications.push_notifications.label') : '' }}</span>
</div> </div>
</template> </template>
<NotificationPreferences show /> <NotificationPreferences show />

View file

@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => `${t('settings.preferences.label')} | ${t('nav.settings')}`, title: () => `${t('settings.preferences.label')} | ${t('nav.settings')}`,
}) })

View file

@ -11,7 +11,7 @@ definePageMeta({
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => `${t('settings.profile.appearance.title')} | ${t('nav.settings')}`, title: () => `${t('settings.profile.appearance.title')} | ${t('nav.settings')}`,
}) })

View file

@ -5,7 +5,7 @@ definePageMeta({
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => `${t('settings.profile.featured_tags.label')} | ${t('nav.settings')}`, title: () => `${t('settings.profile.featured_tags.label')} | ${t('nav.settings')}`,
}) })
</script> </script>

View file

@ -5,7 +5,7 @@ definePageMeta({
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => `${t('settings.profile.label')} | ${t('nav.settings')}`, title: () => `${t('settings.profile.label')} | ${t('nav.settings')}`,
}) })
</script> </script>
@ -14,22 +14,22 @@ useHeadFixed({
<MainContent back-on-small-screen> <MainContent back-on-small-screen>
<template #title> <template #title>
<div text-lg font-bold flex items-center gap-2 @click="$scrollToTop"> <div text-lg font-bold flex items-center gap-2 @click="$scrollToTop">
<span>{{ $t('settings.profile.label') }}</span> <span>{{ isHydrated ? $t('settings.profile.label') : '' }}</span>
</div> </div>
</template> </template>
<SettingsItem <SettingsItem
command large command large
icon="i-ri:user-settings-line" icon="i-ri:user-settings-line"
:text="$t('settings.profile.appearance.label')" :text="isHydrated ? $t('settings.profile.appearance.label') : ''"
:description="$t('settings.profile.appearance.description')" :description="isHydrated ? $t('settings.profile.appearance.description') : ''"
to="/settings/profile/appearance" to="/settings/profile/appearance"
/> />
<SettingsItem <SettingsItem
command large command large
icon="i-ri:hashtag" icon="i-ri:hashtag"
:text="$t('settings.profile.featured_tags.label')" :text="isHydrated ? $t('settings.profile.featured_tags.label') : ''"
:description="$t('settings.profile.featured_tags.description')" :description="isHydrated ? $t('settings.profile.featured_tags.description') : ''"
to="/settings/profile/featured-tags" to="/settings/profile/featured-tags"
/> />
<SettingsItem <SettingsItem

View file

@ -5,7 +5,7 @@ import type { UserLogin } from '~/types'
const { t } = useI18n() const { t } = useI18n()
useHeadFixed({ useHydratedHead({
title: () => `${t('settings.users.label')} | ${t('nav.settings')}`, title: () => `${t('settings.users.label')} | ${t('nav.settings')}`,
}) })

View file

@ -11,6 +11,9 @@ export default defineNuxtPlugin(async (nuxt) => {
if (!supportLanguages.includes(lang)) if (!supportLanguages.includes(lang))
userSettings.value.language = getDefaultLanguage(supportLanguages) userSettings.value.language = getDefaultLanguage(supportLanguages)
if (lang !== i18n.locale)
await setLocale(userSettings.value.language)
watch([$$(lang), isHydrated], () => { watch([$$(lang), isHydrated], () => {
if (isHydrated.value && lang !== i18n.locale) if (isHydrated.value && lang !== i18n.locale)
setLocale(lang) setLocale(lang)

File diff suppressed because it is too large Load diff