From 8903a4691f4b567fc0dcea3574039edc0b87e76a Mon Sep 17 00:00:00 2001
From: futchitwo <74236683+futchitwo@users.noreply.github.com>
Date: Sun, 17 Jul 2022 00:42:02 +0900
Subject: [PATCH] =?UTF-8?q?loginRequired=20=E3=83=97=E3=83=AD=E3=83=91?=
 =?UTF-8?q?=E3=83=86=E3=82=A3=E3=82=92=E4=BD=BF=E3=82=8F=E3=81=AA=E3=81=84?=
 =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../src/components/global/page-header.vue     |  3 ---
 packages/client/src/pages/timeline.vue        | 22 ++++++++++++++-----
 packages/client/src/ui/visitor/header.vue     |  2 +-
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/packages/client/src/components/global/page-header.vue b/packages/client/src/components/global/page-header.vue
index 9109436bd..5395a8796 100644
--- a/packages/client/src/components/global/page-header.vue
+++ b/packages/client/src/components/global/page-header.vue
@@ -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);
diff --git a/packages/client/src/pages/timeline.vue b/packages/client/src/pages/timeline.vue
index 0e88c288c..af5f4f651 100644
--- a/packages/client/src/pages/timeline.vue
+++ b/packages/client/src/pages/timeline.vue
@@ -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',
diff --git a/packages/client/src/ui/visitor/header.vue b/packages/client/src/ui/visitor/header.vue
index ef073887f..50d295a29 100644
--- a/packages/client/src/ui/visitor/header.vue
+++ b/packages/client/src/ui/visitor/header.vue
@@ -60,7 +60,7 @@ export default defineComponent({
 		return {
 			narrow: null,
 			showMenu: false,
-			isTimelineAvailable = !instance.disableLocalTimeline || !instance.disableGlobalTimeline,
+			isTimelineAvailable: !instance.disableLocalTimeline || !instance.disableGlobalTimeline,
 		};
 	},