fix(frontend/pageMetadata): ページタイトルが更新されない問題 (#13289)

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
This commit is contained in:
taiy
2024-02-16 16:17:09 +09:00
committed by GitHub
parent bb83ee844e
commit 860e8bb5d8
140 changed files with 496 additions and 430 deletions

View File

@@ -106,10 +106,10 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.accounts,
icon: 'ti ti-users',
});
}));
</script>
<style lang="scss" module>

View File

@@ -45,8 +45,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: 'API',
icon: 'ti ti-api',
});
}));
</script>

View File

@@ -75,10 +75,10 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.installedApps,
icon: 'ti ti-plug',
});
}));
</script>
<style lang="scss" module>

View File

@@ -128,10 +128,10 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.avatarDecorations,
icon: 'ti ti-sparkles',
});
}));
</script>
<style lang="scss" module>

View File

@@ -45,8 +45,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.customCss,
icon: 'ti ti-code',
});
}));
</script>

View File

@@ -36,8 +36,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.deck,
icon: 'ti ti-columns',
});
}));
</script>

View File

@@ -117,10 +117,10 @@ function onContextMenu(ev: MouseEvent, file): void {
os.contextMenu(getDriveFileMenu(file), ev);
}
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.drivecleaner,
icon: 'ti ti-trash',
});
}));
</script>
<style lang="scss" module>

View File

@@ -143,10 +143,10 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.drive,
icon: 'ti ti-cloud',
});
}));
</script>
<style lang="scss" module>

View File

@@ -113,8 +113,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.email,
icon: 'ti ti-mail',
});
}));
</script>

View File

@@ -237,10 +237,10 @@ watch(pinnedEmojis, () => {
deep: true,
});
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.emojiPicker,
icon: 'ti ti-mood-happy',
});
}));
</script>
<style lang="scss" module>

View File

@@ -465,8 +465,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.general,
icon: 'ti ti-adjustments',
});
}));
</script>

View File

@@ -225,10 +225,10 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.importAndExport,
icon: 'ti ti-package',
});
}));
</script>
<style module>

View File

@@ -28,14 +28,14 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script setup lang="ts">
import { ComputedRef, Ref, computed, onActivated, onMounted, onUnmounted, ref, shallowRef, watch } from 'vue';
import { computed, onActivated, onMounted, onUnmounted, ref, shallowRef, watch } from 'vue';
import { i18n } from '@/i18n.js';
import MkInfo from '@/components/MkInfo.vue';
import MkSuperMenu from '@/components/MkSuperMenu.vue';
import { signout, $i } from '@/account.js';
import { clearCache } from '@/scripts/clear-cache.js';
import { instance } from '@/instance.js';
import { PageMetadata, definePageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata.js';
import { PageMetadata, definePageMetadata, provideMetadataReceiver, provideReactiveMetadata } from '@/scripts/page-metadata.js';
import * as os from '@/os.js';
import { useRouter } from '@/router/supplier.js';
@@ -46,7 +46,7 @@ const indexInfo = {
};
const INFO = ref(indexInfo);
const el = shallowRef<HTMLElement | null>(null);
const childInfo: Ref<ComputedRef<PageMetadata> | null> = ref(null);
const childInfo = ref<null | PageMetadata>(null);
const router = useRouter();
@@ -231,20 +231,22 @@ watch(router.currentRef, (to) => {
const emailNotConfigured = computed(() => instance.enableEmail && ($i.email == null || !$i.emailVerified));
provideMetadataReceiver((info) => {
provideMetadataReceiver((metadataGetter) => {
const info = metadataGetter();
if (info == null) {
childInfo.value = null;
} else {
childInfo.value = info;
INFO.value.needWideArea = info.value.needWideArea ?? undefined;
INFO.value.needWideArea = info.needWideArea ?? undefined;
}
});
provideReactiveMetadata(INFO);
const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata(INFO);
definePageMetadata(() => INFO.value);
// w 890
// h 700
</script>

View File

@@ -121,10 +121,10 @@ async function save(): Promise<void> {
init();
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.accountMigration,
icon: 'ti ti-plane',
});
}));
</script>
<style lang="scss">

View File

@@ -230,10 +230,10 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.muteAndBlock,
icon: 'ti ti-ban',
});
}));
</script>
<style lang="scss" module>

View File

@@ -118,10 +118,10 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.navbar,
icon: 'ti ti-list',
});
}));
</script>
<style lang="scss" module>

View File

@@ -117,8 +117,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.notifications,
icon: 'ti ti-bell',
});
}));
</script>

View File

@@ -162,8 +162,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.other,
icon: 'ti ti-dots',
});
}));
</script>

View File

@@ -53,8 +53,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts._plugin.install,
icon: 'ti ti-download',
});
}));
</script>

View File

@@ -125,8 +125,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.plugins,
icon: 'ti ti-plug',
});
}));
</script>

View File

@@ -37,7 +37,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { computed, onMounted, onUnmounted, ref } from 'vue';
import { onMounted, onUnmounted, ref } from 'vue';
import { v4 as uuid } from 'uuid';
import FormSection from '@/components/form/section.vue';
import MkButton from '@/components/MkButton.vue';
@@ -437,10 +437,10 @@ onUnmounted(() => {
connection?.off('registryUpdated');
});
definePageMetadata(computed(() => ({
definePageMetadata(() => ({
title: ts.preferencesBackups,
icon: 'ti ti-device-floppy',
})));
}));
</script>
<style lang="scss" module>

View File

@@ -118,8 +118,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.privacy,
icon: 'ti ti-lock-open',
});
}));
</script>

View File

@@ -260,10 +260,10 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.profile,
icon: 'ti ti-user',
});
}));
</script>
<style lang="scss" module>

View File

@@ -37,10 +37,10 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.roles,
icon: 'ti ti-badges',
});
}));
</script>
<style lang="scss" module>

View File

@@ -103,10 +103,10 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.security,
icon: 'ti ti-lock',
});
}));
</script>
<style lang="scss" scoped>

View File

@@ -94,8 +94,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.sounds,
icon: 'ti ti-music',
});
}));
</script>

View File

@@ -50,8 +50,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.statusbar,
icon: 'ti ti-list',
});
}));
</script>

View File

@@ -59,8 +59,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts._theme.install,
icon: 'ti ti-download',
});
}));
</script>

View File

@@ -76,8 +76,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts._theme.manage,
icon: 'ti ti-tool',
});
}));
</script>

View File

@@ -177,10 +177,10 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.theme,
icon: 'ti ti-palette',
});
}));
</script>
<style lang="scss" scoped>

View File

@@ -114,8 +114,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: 'Edit webhook',
icon: 'ti ti-webhook',
});
}));
</script>

View File

@@ -82,8 +82,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: 'Create new webhook',
icon: 'ti ti-webhook',
});
}));
</script>

View File

@@ -50,8 +50,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: 'Webhook',
icon: 'ti ti-webhook',
});
}));
</script>