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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
140 changed files with 496 additions and 430 deletions

View File

@ -16,9 +16,9 @@ SPDX-License-Identifier: AGPL-3.0-only
@closed="$emit('closed')"
>
<template #header>
<template v-if="pageMetadata?.value">
<i v-if="pageMetadata.value.icon" :class="pageMetadata.value.icon" style="margin-right: 0.5em;"></i>
<span>{{ pageMetadata.value.title }}</span>
<template v-if="pageMetadata">
<i v-if="pageMetadata.icon" :class="pageMetadata.icon" style="margin-right: 0.5em;"></i>
<span>{{ pageMetadata.title }}</span>
</template>
</template>
@ -29,7 +29,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { computed, ComputedRef, onMounted, onUnmounted, provide, ref, shallowRef } from 'vue';
import { computed, onMounted, onUnmounted, provide, ref, shallowRef } from 'vue';
import RouterView from '@/components/global/RouterView.vue';
import MkWindow from '@/components/MkWindow.vue';
import { popout as _popout } from '@/scripts/popout.js';
@ -37,7 +37,7 @@ import copyToClipboard from '@/scripts/copy-to-clipboard.js';
import { url } from '@/config.js';
import { useScrollPositionManager } from '@/nirax.js';
import { i18n } from '@/i18n.js';
import { PageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata.js';
import { PageMetadata, provideMetadataReceiver, provideReactiveMetadata } from '@/scripts/page-metadata.js';
import { openingWindowsCount } from '@/os.js';
import { claimAchievement } from '@/scripts/achievements.js';
import { getScrollContainer } from '@/scripts/scroll.js';
@ -56,7 +56,7 @@ const routerFactory = useRouterFactory();
const windowRouter = routerFactory(props.initialPath);
const contents = shallowRef<HTMLElement | null>(null);
const pageMetadata = ref<null | ComputedRef<PageMetadata>>();
const pageMetadata = ref<null | PageMetadata>(null);
const windowEl = shallowRef<InstanceType<typeof MkWindow>>();
const history = ref<{ path: string; key: any; }[]>([{
path: windowRouter.getCurrentPath(),
@ -101,9 +101,11 @@ windowRouter.addListener('replace', ctx => {
windowRouter.init();
provide('router', windowRouter);
provideMetadataReceiver((info) => {
provideMetadataReceiver((metadataGetter) => {
const info = metadataGetter();
pageMetadata.value = info;
});
provideReactiveMetadata(pageMetadata);
provide('shouldOmitHeaderTitle', true);
provide('shouldHeaderThin', true);
provide('forceSpacerMin', true);

View File

@ -11,18 +11,18 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
<div v-else-if="!thin_ && narrow && !hideTitle" :class="$style.buttonsLeft"/>
<template v-if="metadata">
<template v-if="pageMetadata">
<div v-if="!hideTitle" :class="$style.titleContainer" @click="top">
<div v-if="metadata.avatar" :class="$style.titleAvatarContainer">
<MkAvatar :class="$style.titleAvatar" :user="metadata.avatar" indicator/>
<div v-if="pageMetadata.avatar" :class="$style.titleAvatarContainer">
<MkAvatar :class="$style.titleAvatar" :user="pageMetadata.avatar" indicator/>
</div>
<i v-else-if="metadata.icon" :class="[$style.titleIcon, metadata.icon]"></i>
<i v-else-if="pageMetadata.icon" :class="[$style.titleIcon, pageMetadata.icon]"></i>
<div :class="$style.title">
<MkUserName v-if="metadata.userName" :user="metadata.userName" :nowrap="true"/>
<div v-else-if="metadata.title">{{ metadata.title }}</div>
<div v-if="metadata.subtitle" :class="$style.subtitle">
{{ metadata.subtitle }}
<MkUserName v-if="pageMetadata.userName" :user="pageMetadata.userName" :nowrap="true"/>
<div v-else-if="pageMetadata.title">{{ pageMetadata.title }}</div>
<div v-if="pageMetadata.subtitle" :class="$style.subtitle">
{{ pageMetadata.subtitle }}
</div>
</div>
</div>
@ -46,7 +46,7 @@ import tinycolor from 'tinycolor2';
import XTabs, { Tab } from './MkPageHeader.tabs.vue';
import { scrollToTop } from '@/scripts/scroll.js';
import { globalEvents } from '@/events.js';
import { injectPageMetadata } from '@/scripts/page-metadata.js';
import { injectReactiveMetadata } from '@/scripts/page-metadata.js';
import { $i, openAccountMenu as openAccountMenu_ } from '@/account.js';
import { PageHeaderItem } from '@/types/page-header.js';
@ -64,7 +64,7 @@ const emit = defineEmits<{
(ev: 'update:tab', key: string);
}>();
const metadata = injectPageMetadata();
const pageMetadata = injectReactiveMetadata();
const hideTitle = inject('shouldOmitHeaderTitle', false);
const thin_ = props.thin || inject('shouldHeaderThin', false);

View File

@ -18,7 +18,7 @@ export const langs = _LANGS_;
const preParseLocale = miLocalStorage.getItem('locale');
export let locale = preParseLocale ? JSON.parse(preParseLocale) : null;
export const version = _VERSION_;
export const instanceName = siteName === 'Misskey' ? host : siteName;
export const instanceName = siteName === 'Misskey' || siteName == null ? host : siteName;
export const ui = miLocalStorage.getItem('ui');
export const debug = miLocalStorage.getItem('debug') === 'true';

View File

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

View File

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

View File

@ -164,10 +164,10 @@ const headerTabs = computed(() => [{
icon: 'ti ti-chart-line',
}]);
definePageMetadata(computed(() => ({
definePageMetadata(() => ({
title: i18n.ts.instanceInfo,
icon: 'ti ti-info-circle',
})));
}));
</script>
<style lang="scss" module>

View File

@ -48,10 +48,10 @@ onDeactivated(() => {
}
});
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.achievements,
icon: 'ti ti-medal',
});
}));
</script>
<style lang="scss" module>

View File

@ -140,10 +140,10 @@ const headerTabs = computed(() => [{
icon: 'ti ti-code',
}]);
definePageMetadata(computed(() => ({
title: file.value ? i18n.ts.file + ': ' + file.value.name : i18n.ts.file,
definePageMetadata(() => ({
title: file.value ? `${i18n.ts.file}: ${file.value.name}` : i18n.ts.file,
icon: 'ti ti-file',
})));
}));
</script>
<style lang="scss" scoped>

View File

@ -518,10 +518,10 @@ const headerTabs = computed(() => [{
icon: 'ti ti-code',
}]);
definePageMetadata(computed(() => ({
definePageMetadata(() => ({
title: user.value ? acct(user.value) : i18n.ts.userInfo,
icon: 'ti ti-user-exclamation',
})));
}));
</script>
<style lang="scss" scoped>

View File

@ -5,12 +5,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<div ref="el" class="fdidabkc" :style="{ background: bg }" @click="onClick">
<template v-if="metadata">
<template v-if="pageMetadata">
<div class="titleContainer" @click="showTabsPopup">
<i v-if="metadata.icon" class="icon" :class="metadata.icon"></i>
<i v-if="pageMetadata.icon" class="icon" :class="pageMetadata.icon"></i>
<div class="title">
<div class="title">{{ metadata.title }}</div>
<div class="title">{{ pageMetadata.title }}</div>
</div>
</div>
<div class="tabs">
@ -39,7 +39,7 @@ import { popupMenu } from '@/os.js';
import { scrollToTop } from '@/scripts/scroll.js';
import MkButton from '@/components/MkButton.vue';
import { globalEvents } from '@/events.js';
import { injectPageMetadata } from '@/scripts/page-metadata.js';
import { injectReactiveMetadata } from '@/scripts/page-metadata.js';
type Tab = {
key?: string | null;
@ -65,7 +65,7 @@ const emit = defineEmits<{
(ev: 'update:tab', key: string);
}>();
const metadata = injectPageMetadata();
const pageMetadata = injectReactiveMetadata();
const el = shallowRef<HTMLElement>(null);
const tabRefs = {};
@ -118,7 +118,7 @@ function onTabClick(tab: Tab, ev: MouseEvent): void {
}
const calcBg = () => {
const rawBg = metadata?.bg ?? 'var(--bg)';
const rawBg = pageMetadata.value?.bg ?? 'var(--bg)';
const tinyBg = tinycolor(rawBg.startsWith('var(') ? getComputedStyle(document.documentElement).getPropertyValue(rawBg.slice(4, -1)) : rawBg);
tinyBg.setAlpha(0.85);
bg.value = tinyBg.toRgbString();

View File

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

View File

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

View File

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

View File

@ -159,10 +159,10 @@ function save() {
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.branding,
icon: 'ti ti-paint',
});
}));
</script>
<style lang="scss" module>

View File

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

View File

@ -130,10 +130,10 @@ function save() {
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.emailServer,
icon: 'ti ti-mail',
});
}));
</script>
<style lang="scss" module>

View File

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

View File

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

View File

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

View File

@ -28,7 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { ComputedRef, Ref, onActivated, onMounted, onUnmounted, provide, watch, ref, computed } from 'vue';
import { onActivated, onMounted, onUnmounted, provide, watch, ref, computed } from 'vue';
import { i18n } from '@/i18n.js';
import MkSuperMenu from '@/components/MkSuperMenu.vue';
import MkInfo from '@/components/MkInfo.vue';
@ -36,7 +36,7 @@ import { instance } from '@/instance.js';
import * as os from '@/os.js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { lookupUser, lookupUserByEmail } from '@/scripts/lookup-user.js';
import { PageMetadata, definePageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata.js';
import { PageMetadata, definePageMetadata, provideMetadataReceiver, provideReactiveMetadata } from '@/scripts/page-metadata.js';
import { useRouter } from '@/router/supplier.js';
const isEmpty = (x: string | null) => x == null || x === '';
@ -52,7 +52,7 @@ const indexInfo = {
provide('shouldOmitHeaderTitle', false);
const INFO = ref(indexInfo);
const childInfo: Ref<ComputedRef<PageMetadata> | null> = ref(null);
const childInfo = ref<null | PageMetadata>(null);
const narrow = ref(false);
const view = ref(null);
const el = ref<HTMLDivElement | null>(null);
@ -257,14 +257,16 @@ watch(router.currentRef, (to) => {
}
});
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);
function invite() {
misskeyApi('admin/invite/create').then(x => {
@ -318,7 +320,7 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata(INFO.value);
definePageMetadata(() => INFO.value);
defineExpose({
header: {

View File

@ -66,8 +66,8 @@ const headerTabs = computed(() => [{
icon: 'ti ti-eye-off',
}]);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.instanceBlocking,
icon: 'ti ti-ban',
});
}));
</script>

View File

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

View File

@ -116,10 +116,10 @@ function save() {
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.moderation,
icon: 'ti ti-shield',
});
}));
</script>
<style lang="scss" module>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -68,8 +68,8 @@ const headerTabs = computed(() => [{
title: 'Inbox',
}]);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.jobQueue,
icon: 'ti ti-clock-play',
});
}));
</script>

View File

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

View File

@ -87,11 +87,8 @@ async function save() {
const headerTabs = computed(() => []);
definePageMetadata(computed(() => role.value ? {
title: i18n.ts._role.edit + ': ' + role.value.name,
icon: 'ti ti-badge',
} : {
title: i18n.ts._role.new,
definePageMetadata(() => ({
title: role.value ? `${i18n.ts._role.edit}: ${role.value.name}` : i18n.ts._role.new,
icon: 'ti ti-badge',
}));
</script>

View File

@ -170,10 +170,10 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata(computed(() => ({
title: i18n.ts.role + ': ' + role.name,
definePageMetadata(() => ({
title: `${i18n.ts.role}: ${role.name}`,
icon: 'ti ti-badge',
})));
}));
</script>
<style lang="scss" module>

View File

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

View File

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

View File

@ -67,10 +67,10 @@ const remove = (index: number): void => {
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.serverRules,
icon: 'ti ti-checkbox',
});
}));
</script>
<style lang="scss" module>

View File

@ -235,10 +235,10 @@ async function save(): void {
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.general,
icon: 'ti ti-settings',
});
}));
</script>
<style lang="scss" module>

View File

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

View File

@ -20,9 +20,9 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js';
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.ads,
icon: 'ti ti-ad',
});
}));
</script>

View File

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

View File

@ -91,10 +91,10 @@ const headerActions = computed(() => antenna.value ? [{
const headerTabs = computed(() => []);
definePageMetadata(computed(() => antenna.value ? {
title: antenna.value.name,
definePageMetadata(() => ({
title: antenna.value ? antenna.value.name : i18n.ts.antennas,
icon: 'ti ti-antenna',
} : null));
}));
</script>
<style lang="scss" module>

View File

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

View File

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

View File

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

View File

@ -202,11 +202,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata(computed(() => props.channelId ? {
title: i18n.ts._channel.edit,
icon: 'ti ti-device-tv',
} : {
title: i18n.ts._channel.create,
definePageMetadata(() => ({
title: props.channelId ? i18n.ts._channel.edit : i18n.ts._channel.create,
icon: 'ti ti-device-tv',
}));
</script>

View File

@ -258,10 +258,10 @@ const headerTabs = computed(() => [{
icon: 'ti ti-search',
}]);
definePageMetadata(computed(() => channel.value ? {
title: channel.value.name,
definePageMetadata(() => ({
title: channel.value ? channel.value.name : i18n.ts.channel,
icon: 'ti ti-device-tv',
} : null));
}));
</script>
<style lang="scss" module>

View File

@ -152,8 +152,8 @@ const headerTabs = computed(() => [{
icon: 'ti ti-edit',
}]);
definePageMetadata(computed(() => ({
definePageMetadata(() => ({
title: i18n.ts.channel,
icon: 'ti ti-device-tv',
})));
}));
</script>

View File

@ -16,10 +16,10 @@ SPDX-License-Identifier: AGPL-3.0-only
import MkClickerGame from '@/components/MkClickerGame.vue';
import { definePageMetadata } from '@/scripts/page-metadata.js';
definePageMetadata({
definePageMetadata(() => ({
title: '🍪👈',
icon: 'ti ti-cookie',
});
}));
</script>
<style lang="scss" module>

View File

@ -157,10 +157,10 @@ const headerActions = computed(() => clip.value && isOwned.value ? [{
},
}] : null);
definePageMetadata(computed(() => clip.value ? {
title: clip.value.name,
definePageMetadata(() => ({
title: clip.value ? clip.value.name : i18n.ts.clip,
icon: 'ti ti-paperclip',
} : null));
}));
</script>
<style lang="scss" module>

View File

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

View File

@ -48,8 +48,8 @@ const headerTabs = computed(() => [{
icon: 'ti ti-pencil',
}]);
definePageMetadata(computed(() => ({
definePageMetadata(() => ({
title: i18n.ts._fileViewer.title,
icon: 'ti ti-file',
})));
}));
</script>

View File

@ -22,9 +22,9 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata(computed(() => ({
definePageMetadata(() => ({
title: folder.value ? folder.value.name : i18n.ts.drive,
icon: 'ti ti-cloud',
hideHeader: true,
})));
}));
</script>

View File

@ -1204,10 +1204,10 @@ onDeactivated(() => {
bgmNodes?.soundSource.stop();
});
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.bubbleGame,
icon: 'ti ti-apple',
});
}));
</script>
<style lang="scss" module>

View File

@ -121,10 +121,10 @@ function onGameEnd() {
gameStarted.value = false;
}
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.bubbleGame,
icon: 'ti ti-device-gamepad',
});
}));
</script>
<style lang="scss" module>

View File

@ -60,8 +60,8 @@ const headerTabs = computed(() => [{
title: i18n.ts.roles,
}]);
definePageMetadata(computed(() => ({
definePageMetadata(() => ({
title: i18n.ts.explore,
icon: 'ti ti-hash',
})));
}));
</script>

View File

@ -38,10 +38,10 @@ const pagination = {
limit: 10,
};
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.favorites,
icon: 'ti ti-star',
});
}));
</script>
<style lang="scss" module>

View File

@ -452,9 +452,7 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata(computed(() => flash.value ? {
title: i18n.ts._play.edit + ': ' + flash.value.title,
} : {
title: i18n.ts._play.new,
definePageMetadata(() => ({
title: flash.value ? `${i18n.ts._play.edit}: ${flash.value.title}` : i18n.ts._play.new,
}));
</script>

View File

@ -90,8 +90,8 @@ const headerTabs = computed(() => [{
icon: 'ti ti-heart',
}]);
definePageMetadata(computed(() => ({
definePageMetadata(() => ({
title: 'Play',
icon: 'ti ti-player-play',
})));
}));
</script>

View File

@ -205,15 +205,17 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata(computed(() => flash.value ? {
title: flash.value.title,
avatar: flash.value.user,
path: `/play/${flash.value.id}`,
share: {
title: flash.value.title,
text: flash.value.summary,
},
} : null));
definePageMetadata(() => ({
title: flash.value ? flash.value.title : 'Play',
...flash.value ? {
avatar: flash.value.user,
path: `/play/${flash.value.id}`,
share: {
title: flash.value.title,
text: flash.value.summary,
},
} : {},
}));
</script>
<style lang="scss" module>

View File

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

View File

@ -122,11 +122,8 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata(computed(() => props.postId ? {
title: i18n.ts.edit,
icon: 'ti ti-pencil',
} : {
title: i18n.ts.postToGallery,
definePageMetadata(() => ({
title: props.postId ? i18n.ts.edit : i18n.ts.postToGallery,
icon: 'ti ti-pencil',
}));
</script>

View File

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

View File

@ -163,10 +163,12 @@ const headerActions = computed(() => [{
const headerTabs = computed(() => []);
definePageMetadata(computed(() => post.value ? {
title: post.value.title,
avatar: post.value.user,
} : null));
definePageMetadata(() => ({
title: post.value ? post.value.title : i18n.ts.gallery,
...post.value ? {
avatar: post.value.user,
} : {},
}));
</script>
<style lang="scss" scoped>

View File

@ -27,8 +27,8 @@ SPDX-License-Identifier: AGPL-3.0-only
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
definePageMetadata({
definePageMetadata(() => ({
title: 'Misskey Games',
icon: 'ti ti-device-gamepad',
});
}));
</script>

View File

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

View File

@ -245,10 +245,10 @@ const headerTabs = computed(() => [{
icon: 'ti ti-code',
}]);
definePageMetadata({
definePageMetadata(() => ({
title: props.host,
icon: 'ti ti-server',
});
}));
</script>
<style lang="scss" scoped>

View File

@ -93,10 +93,10 @@ async function update() {
update();
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.invite,
icon: 'ti ti-user-plus',
});
}));
</script>
<style lang="scss" module>

View File

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

View File

@ -93,10 +93,10 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: 'MiAuth',
icon: 'ti ti-apps',
});
}));
</script>
<style lang="scss" module>

View File

@ -38,8 +38,8 @@ function onAntennaCreated() {
router.push('/my/antennas');
}
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.manageAntennas,
icon: 'ti ti-antenna',
});
}));
</script>

View File

@ -36,8 +36,8 @@ misskeyApi('antennas/show', { antennaId: props.antennaId }).then((antennaRespons
antenna.value = antennaResponse;
});
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.manageAntennas,
icon: 'ti ti-antenna',
});
}));
</script>

View File

@ -55,10 +55,10 @@ const headerActions = computed(() => [{
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.manageAntennas,
icon: 'ti ti-antenna',
});
}));
onActivated(() => {
antennasCache.fetch();

View File

@ -104,14 +104,10 @@ const headerTabs = computed(() => [{
icon: 'ti ti-heart',
}]);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.clip,
icon: 'ti ti-paperclip',
action: {
icon: 'ti ti-plus',
handler: create,
},
});
}));
</script>
<style lang="scss" module>

View File

@ -71,10 +71,10 @@ const headerActions = computed(() => [{
const headerTabs = computed(() => []);
definePageMetadata({
definePageMetadata(() => ({
title: i18n.ts.manageLists,
icon: 'ti ti-list',
});
}));
onActivated(() => {
fetch();

View File

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

View File

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

View File

@ -141,16 +141,18 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata(computed(() => note.value ? {
definePageMetadata(() => ({
title: i18n.ts.note,
subtitle: dateString(note.value.createdAt),
avatar: note.value.user,
path: `/notes/${note.value.id}`,
share: {
title: i18n.tsx.noteOf({ user: note.value.user.name }),
text: note.value.text,
},
} : null));
...note.value ? {
subtitle: dateString(note.value.createdAt),
avatar: note.value.user,
path: `/notes/${note.value.id}`,
share: {
title: i18n.tsx.noteOf({ user: note.value.user.name }),
text: note.value.text,
},
} : {},
}));
</script>
<style lang="scss" module>

View File

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

View File

@ -51,10 +51,10 @@ function onLogin(res): void {
login(res.i);
}
definePageMetadata({
definePageMetadata(() => ({
title: 'OAuth',
icon: 'ti ti-apps',
});
}));
</script>
<style lang="scss" module>

View File

@ -284,17 +284,11 @@ const headerTabs = computed(() => [{
icon: 'ti ti-note',
}]);
definePageMetadata(computed(() => {
let title = i18n.ts._pages.newPage;
if (props.initPageId) {
title = i18n.ts._pages.editPage;
} else if (props.initPageName && props.initUser) {
title = i18n.ts._pages.readPage;
}
return {
title: title,
icon: 'ti ti-pencil',
};
definePageMetadata(() => ({
title: props.initPageId ? i18n.ts._pages.editPage
: props.initPageName && props.initUser ? i18n.ts._pages.readPage
: i18n.ts._pages.newPage,
icon: 'ti ti-pencil',
}));
</script>

View File

@ -187,15 +187,17 @@ const headerActions = computed(() => []);
const headerTabs = computed(() => []);
definePageMetadata(computed(() => page.value ? {
title: page.value.title || page.value.name,
avatar: page.value.user,
path: `/@${page.value.user.username}/pages/${page.value.name}`,
share: {
title: page.value.title || page.value.name,
text: page.value.summary,
},
} : null));
definePageMetadata(() => ({
title: page.value ? page.value.title || page.value.name : i18n.ts.pages,
...page.value ? {
avatar: page.value.user,
path: `/@${page.value.user.username}/pages/${page.value.name}`,
share: {
title: page.value.title || page.value.name,
text: page.value.summary,
},
} : {},
}));
</script>
<style lang="scss" scoped>

View File

@ -88,8 +88,8 @@ const headerTabs = computed(() => [{
icon: 'ti ti-heart',
}]);
definePageMetadata(computed(() => ({
definePageMetadata(() => ({
title: i18n.ts.pages,
icon: 'ti ti-note',
})));
}));
</script>

View File

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

View File

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

View File

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

View File

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

View File

@ -113,8 +113,8 @@ onUnmounted(() => {
}
});
definePageMetadata(computed(() => ({
definePageMetadata(() => ({
title: 'Reversi',
icon: 'ti ti-device-gamepad',
})));
}));
</script>

View File

@ -105,7 +105,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { computed, onDeactivated, onMounted, onUnmounted, ref } from 'vue';
import { onDeactivated, onMounted, onUnmounted, ref } from 'vue';
import * as Misskey from 'misskey-js';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -261,10 +261,10 @@ onUnmounted(() => {
cancelMatching();
});
definePageMetadata(computed(() => ({
definePageMetadata(() => ({
title: 'Reversi',
icon: 'ti ti-device-gamepad',
})));
}));
</script>
<style lang="scss" module>

View File

@ -93,10 +93,10 @@ const headerTabs = computed(() => [{
title: i18n.ts.timeline,
}]);
definePageMetadata(computed(() => ({
title: role.value?.name,
definePageMetadata(() => ({
title: role.value ? role.value.name : i18n.ts.role,
icon: 'ti ti-badge',
})));
}));
</script>
<style lang="scss" module>

View File

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

View File

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

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>

Some files were not shown because too many files have changed in this diff Show More