From 2ded96af18e204058b73c69b266e0dcac687bc6b Mon Sep 17 00:00:00 2001 From: futchitwo <74236683+futchitwo@users.noreply.github.com> Date: Sat, 2 Jul 2022 20:08:31 +0900 Subject: [PATCH 1/6] feature(client): Timeline page for non-login users --- packages/client/src/components/global/page-header.vue | 3 +++ packages/client/src/pages/timeline.vue | 11 +++++++++-- packages/client/src/router.ts | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/client/src/components/global/page-header.vue b/packages/client/src/components/global/page-header.vue index 5395a8796..9109436bd 100644 --- a/packages/client/src/components/global/page-header.vue +++ b/packages/client/src/components/global/page-header.vue @@ -39,6 +39,7 @@ 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'; @@ -47,6 +48,7 @@ type Tab = { title: string; icon?: string; iconOnly?: boolean; + loginRequired?: boolean; onClick?: (ev: MouseEvent) => void; }; @@ -71,6 +73,7 @@ const hideTitle = inject('shouldOmitHeaderTitle', false); const thin_ = props.thin || inject('shouldHeaderThin', false); const el = $ref(null); +const tabs = $i ? props.tabs : props.tabs?.filter(tab => !tab.loginRequired); const tabRefs = {}; const tabHighlightEl = $ref(null); const bg = ref(null); diff --git a/packages/client/src/pages/timeline.vue b/packages/client/src/pages/timeline.vue index 40eb85ff4..09de90199 100644 --- a/packages/client/src/pages/timeline.vue +++ b/packages/client/src/pages/timeline.vue @@ -3,7 +3,7 @@
- +
@@ -45,7 +45,8 @@ const tlComponent = $ref>(); const rootEl = $ref(); let queue = $ref(0); -const src = $computed({ get: () => defaultStore.reactiveState.tl.value.src, set: (x) => saveSrc(x) }); +const src = $computed({ get: () => ($i ? defaultStore.reactiveState.tl.value.src : logoutSrc), set: (x) => saveSrc(x) }); +let logoutSrc = $ref(isLocalTimelineAvailable ? 'local' : 'global'); watch ($$(src), () => queue = 0); @@ -94,6 +95,7 @@ function saveSrc(newSrc: 'home' | 'local' | 'social' | 'global'): void { ...defaultStore.state.tl, src: newSrc, }); + logoutSrc = newSrc ; } async function timetravel(): Promise { @@ -116,6 +118,7 @@ const headerTabs = $computed(() => [{ title: i18n.ts._timelines.home, icon: 'fas fa-home', iconOnly: true, + loginRequired: true, }, ...(isLocalTimelineAvailable ? [{ key: 'local', title: i18n.ts._timelines.local, @@ -126,6 +129,7 @@ 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, @@ -135,16 +139,19 @@ 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, }]); diff --git a/packages/client/src/router.ts b/packages/client/src/router.ts index b3baad188..f5c433264 100644 --- a/packages/client/src/router.ts +++ b/packages/client/src/router.ts @@ -224,6 +224,9 @@ export const routes = [{ path: '/timeline/antenna/:antennaId', component: page(() => import('./pages/antenna-timeline.vue')), loginRequired: true, +}, { + path: '/timeline', + component: page(() => import('./pages/timeline.vue')), }, { name: 'index', path: '/', From 6cf854a044c9bbfab1702927a5d956a7d93f6fd3 Mon Sep 17 00:00:00 2001 From: futchitwo <74236683+futchitwo@users.noreply.github.com> Date: Sat, 2 Jul 2022 20:33:03 +0900 Subject: [PATCH 2/6] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ddc12399..5b2e672db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ You should also include the user name that made the change. - Client: Add rss-marquee widget @syuilo - Client: Removing entries from a clip @futchitwo - Client: Poll highlights in explore page @syuilo +- Client: Add timeline page that can be viewed when not logged in @futchitwo - Make possible to delete an account by admin @syuilo - Improve player detection in URL preview @mei23 - Add Badge Image to Push Notification #8012 @tamaina From c020418bdb915bd9d54e7e78326ba82884cfcb5e Mon Sep 17 00:00:00 2001 From: futchitwo <74236683+futchitwo@users.noreply.github.com> Date: Sat, 2 Jul 2022 20:55:20 +0900 Subject: [PATCH 3/6] =?UTF-8?q?=E5=B0=8E=E7=B7=9A=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/client/src/ui/visitor/b.vue | 4 +++- packages/client/src/ui/visitor/header.vue | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/client/src/ui/visitor/b.vue b/packages/client/src/ui/visitor/b.vue index 09be12d68..8fa00cbf9 100644 --- a/packages/client/src/ui/visitor/b.vue +++ b/packages/client/src/ui/visitor/b.vue @@ -33,9 +33,11 @@