loginRequired プロパティを使わないように

This commit is contained in:
futchitwo 2022-07-17 00:42:02 +09:00 committed by GitHub
parent 1f51b2aba7
commit b55b37634a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 10 deletions

View File

@ -39,7 +39,6 @@ import tinycolor from 'tinycolor2';
import { popupMenu } from '@/os'; import { popupMenu } from '@/os';
import { scrollToTop } from '@/scripts/scroll'; import { scrollToTop } from '@/scripts/scroll';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { $i } from '@/account';
import { globalEvents } from '@/events'; import { globalEvents } from '@/events';
import { injectPageMetadata } from '@/scripts/page-metadata'; import { injectPageMetadata } from '@/scripts/page-metadata';
@ -48,7 +47,6 @@ type Tab = {
title: string; title: string;
icon?: string; icon?: string;
iconOnly?: boolean; iconOnly?: boolean;
loginRequired?: boolean;
onClick?: (ev: MouseEvent) => void; onClick?: (ev: MouseEvent) => void;
}; };
@ -73,7 +71,6 @@ const hideTitle = inject('shouldOmitHeaderTitle', false);
const thin_ = props.thin || inject('shouldHeaderThin', false); const thin_ = props.thin || inject('shouldHeaderThin', false);
const el = $ref<HTMLElement | null>(null); const el = $ref<HTMLElement | null>(null);
const tabs = $i ? props.tabs : props.tabs?.filter(tab => !tab.loginRequired);
const tabRefs = {}; const tabRefs = {};
const tabHighlightEl = $ref<HTMLElement | null>(null); const tabHighlightEl = $ref<HTMLElement | null>(null);
const bg = ref(null); const bg = ref(null);

View File

@ -1,6 +1,6 @@
<template> <template>
<MkStickyContainer> <MkStickyContainer>
<template #header><MkPageHeader v-model:tab="src" :actions="headerActions" :tabs="headerTabs"/></template> <template #header><MkPageHeader v-model:tab="src" :actions="headerActions" :tabs="$i ? headerTabs : headerTabsWhenNotLogin"/></template>
<MkSpacer :content-max="800"> <MkSpacer :content-max="800">
<div ref="rootEl" v-hotkey.global="keymap" class="cmuxhskf"> <div ref="rootEl" v-hotkey.global="keymap" class="cmuxhskf">
<XTutorial v-if="$i && $store.reactiveState.tutorial.value != -1" class="tutorial _block"/> <XTutorial v-if="$i && $store.reactiveState.tutorial.value != -1" class="tutorial _block"/>
@ -118,7 +118,6 @@ const headerTabs = $computed(() => [{
title: i18n.ts._timelines.home, title: i18n.ts._timelines.home,
icon: 'fas fa-home', icon: 'fas fa-home',
iconOnly: true, iconOnly: true,
loginRequired: true,
}, ...(isLocalTimelineAvailable ? [{ }, ...(isLocalTimelineAvailable ? [{
key: 'local', key: 'local',
title: i18n.ts._timelines.local, title: i18n.ts._timelines.local,
@ -129,7 +128,6 @@ const headerTabs = $computed(() => [{
title: i18n.ts._timelines.social, title: i18n.ts._timelines.social,
icon: 'fas fa-share-alt', icon: 'fas fa-share-alt',
iconOnly: true, iconOnly: true,
loginRequired: true,
}] : []), ...(isGlobalTimelineAvailable ? [{ }] : []), ...(isGlobalTimelineAvailable ? [{
key: 'global', key: 'global',
title: i18n.ts._timelines.global, title: i18n.ts._timelines.global,
@ -139,22 +137,34 @@ const headerTabs = $computed(() => [{
icon: 'fas fa-list-ul', icon: 'fas fa-list-ul',
title: i18n.ts.lists, title: i18n.ts.lists,
iconOnly: true, iconOnly: true,
loginRequired: true,
onClick: chooseList, onClick: chooseList,
}, { }, {
icon: 'fas fa-satellite', icon: 'fas fa-satellite',
title: i18n.ts.antennas, title: i18n.ts.antennas,
iconOnly: true, iconOnly: true,
loginRequired: true,
onClick: chooseAntenna, onClick: chooseAntenna,
}, { }, {
icon: 'fas fa-satellite-dish', icon: 'fas fa-satellite-dish',
title: i18n.ts.channel, title: i18n.ts.channel,
iconOnly: true, iconOnly: true,
loginRequired: true,
onClick: chooseChannel, onClick: chooseChannel,
}]); }]);
const headerTabsWhenNotLogin = $computed(() => [
...(isLocalTimelineAvailable ? [{
key: 'local',
title: i18n.ts._timelines.local,
icon: 'fas fa-comments',
iconOnly: true,
}] : []),
...(isGlobalTimelineAvailable ? [{
key: 'global',
title: i18n.ts._timelines.global,
icon: 'fas fa-globe',
iconOnly: true,
}] : []),
]);
definePageMetadata(computed(() => ({ definePageMetadata(computed(() => ({
title: i18n.ts.timeline, title: i18n.ts.timeline,
icon: src === 'local' ? 'fas fa-comments' : src === 'social' ? 'fas fa-share-alt' : src === 'global' ? 'fas fa-globe' : 'fas fa-home', icon: src === 'local' ? 'fas fa-comments' : src === 'social' ? 'fas fa-share-alt' : src === 'global' ? 'fas fa-globe' : 'fas fa-home',

View File

@ -60,7 +60,7 @@ export default defineComponent({
return { return {
narrow: null, narrow: null,
showMenu: false, showMenu: false,
isTimelineAvailable = !instance.disableLocalTimeline || !instance.disableGlobalTimeline, isTimelineAvailable: !instance.disableLocalTimeline || !instance.disableGlobalTimeline,
}; };
}, },