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

View file

@ -1,6 +1,6 @@
<template>
<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">
<div ref="rootEl" v-hotkey.global="keymap" class="cmuxhskf">
<XTutorial v-if="$i && $store.reactiveState.tutorial.value != -1" class="tutorial _block"/>
@ -118,7 +118,6 @@ const headerTabs = $computed(() => [{
title: i18n.ts._timelines.home,
icon: 'fas fa-home',
iconOnly: true,
loginRequired: true,
}, ...(isLocalTimelineAvailable ? [{
key: 'local',
title: i18n.ts._timelines.local,
@ -129,7 +128,6 @@ const headerTabs = $computed(() => [{
title: i18n.ts._timelines.social,
icon: 'fas fa-share-alt',
iconOnly: true,
loginRequired: true,
}] : []), ...(isGlobalTimelineAvailable ? [{
key: 'global',
title: i18n.ts._timelines.global,
@ -139,22 +137,34 @@ const headerTabs = $computed(() => [{
icon: 'fas fa-list-ul',
title: i18n.ts.lists,
iconOnly: true,
loginRequired: true,
onClick: chooseList,
}, {
icon: 'fas fa-satellite',
title: i18n.ts.antennas,
iconOnly: true,
loginRequired: true,
onClick: chooseAntenna,
}, {
icon: 'fas fa-satellite-dish',
title: i18n.ts.channel,
iconOnly: true,
loginRequired: true,
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(() => ({
title: i18n.ts.timeline,
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 {
narrow: null,
showMenu: false,
isTimelineAvailable = !instance.disableLocalTimeline || !instance.disableGlobalTimeline,
isTimelineAvailable: !instance.disableLocalTimeline || !instance.disableGlobalTimeline,
};
},