From 0b9035c9fc0beb961423c9a320df8ba900cd93a6 Mon Sep 17 00:00:00 2001 From: HidemaruOwO Date: Wed, 29 Jan 2025 10:42:47 +0900 Subject: [PATCH] :eyes: format (packages/frontend/src/timelines.ts) --- packages/frontend/src/timelines.ts | 75 ++++++++++++++++++------------ 1 file changed, 45 insertions(+), 30 deletions(-) diff --git a/packages/frontend/src/timelines.ts b/packages/frontend/src/timelines.ts index 5080ef4b96..9716ea3f34 100644 --- a/packages/frontend/src/timelines.ts +++ b/packages/frontend/src/timelines.ts @@ -3,50 +3,63 @@ * SPDX-License-Identifier: AGPL-3.0-only */ -import { $i } from '@/account.js'; -import { instance } from '@/instance.js'; +import { $i } from "@/account.js"; +import { instance } from "@/instance.js"; export const basicTimelineTypes = [ - 'home', - 'local', - 'social', - 'bubble', - 'global', + "home", + "local", + "social", + "bubble", + "global", ] as const; -export type BasicTimelineType = typeof basicTimelineTypes[number]; +export type BasicTimelineType = (typeof basicTimelineTypes)[number]; -export function isBasicTimeline(timeline: string): timeline is BasicTimelineType { +export function isBasicTimeline( + timeline: string, +): timeline is BasicTimelineType { return basicTimelineTypes.includes(timeline as BasicTimelineType); } export function basicTimelineIconClass(timeline: BasicTimelineType): string { switch (timeline) { - case 'home': - return 'ti ti-home'; - case 'local': - return 'ti ti-planet'; - case 'social': - return 'ti ti-universe'; - case 'bubble': - return 'ph-drop ph-bold ph-lg'; - case 'global': - return 'ti ti-whirl'; + case "social": + return "ti ti-home"; + case "local": + return "ti ti-planet"; + case "social": + return "ti ti-universe"; + case "bubble": + return "ph-drop ph-bold ph-lg"; + case "global": + return "ti ti-whirl"; } } -export function isAvailableBasicTimeline(timeline: BasicTimelineType | undefined | null): boolean { +export function isAvailableBasicTimeline( + timeline: BasicTimelineType | undefined | null, +): boolean { switch (timeline) { - case 'home': + case "home": return $i != null; - case 'local': - return ($i == null && instance.policies.ltlAvailable) || ($i != null && $i.policies.ltlAvailable); - case 'social': + case "local": + return ( + ($i == null && instance.policies.ltlAvailable) || + ($i != null && $i.policies.ltlAvailable) + ); + case "social": return $i != null && $i.policies.ltlAvailable; - case 'bubble': - return ($i == null && instance.policies.btlAvailable) || ($i != null && $i.policies.btlAvailable); - case 'global': - return ($i == null && instance.policies.gtlAvailable) || ($i != null && $i.policies.gtlAvailable); + case "bubble": + return ( + ($i == null && instance.policies.btlAvailable) || + ($i != null && $i.policies.btlAvailable) + ); + case "global": + return ( + ($i == null && instance.policies.gtlAvailable) || + ($i != null && $i.policies.gtlAvailable) + ); default: return false; } @@ -56,6 +69,8 @@ export function availableBasicTimelines(): BasicTimelineType[] { return basicTimelineTypes.filter(isAvailableBasicTimeline); } -export function hasWithReplies(timeline: BasicTimelineType | undefined | null): boolean { - return timeline === 'local' || timeline === 'social'; +export function hasWithReplies( + timeline: BasicTimelineType | undefined | null, +): boolean { + return timeline === "local" || timeline === "social"; }