2024-06-11 09:24:32 +02:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
|
|
|
import { reactive } from 'vue';
|
|
|
|
import { i18n } from '@/i18n.js';
|
2024-06-11 10:38:38 +02:00
|
|
|
import { userListsCache } from '@/cache.js';
|
2024-06-11 12:19:42 +02:00
|
|
|
import { isLocalTimelineAvailable, isGlobalTimelineAvailable } from '@/scripts/get-timeline-available.js';
|
|
|
|
|
|
|
|
export type TimelineHeaderItem =
|
|
|
|
'home' |
|
|
|
|
'local' |
|
|
|
|
'social' |
|
|
|
|
'global' |
|
|
|
|
'lists' |
|
|
|
|
'antennas' |
|
|
|
|
'channels' |
|
|
|
|
`list:${string}`
|
|
|
|
|
|
|
|
type TimelineHeaderItemsDef = {
|
|
|
|
title: string;
|
|
|
|
icon: string;
|
|
|
|
iconOnly?: boolean; // わからん
|
|
|
|
}
|
|
|
|
|
2024-06-11 10:38:38 +02:00
|
|
|
const lists = await userListsCache.fetch();
|
2024-06-11 12:19:42 +02:00
|
|
|
export const timelineHeaderItemDef = reactive<Partial<Record<TimelineHeaderItem, TimelineHeaderItemsDef>>>({
|
2024-06-11 09:24:32 +02:00
|
|
|
home: {
|
|
|
|
title: i18n.ts._timelines.home,
|
|
|
|
icon: 'ti ti-home',
|
2024-06-11 12:19:42 +02:00
|
|
|
iconOnly: true,
|
2024-06-11 09:24:32 +02:00
|
|
|
},
|
|
|
|
...(isLocalTimelineAvailable ? {
|
|
|
|
local: {
|
|
|
|
title: i18n.ts._timelines.local,
|
|
|
|
icon: 'ti ti-planet',
|
|
|
|
iconOnly: true,
|
|
|
|
},
|
|
|
|
social: {
|
|
|
|
title: i18n.ts._timelines.social,
|
|
|
|
icon: 'ti ti-universe',
|
|
|
|
iconOnly: true,
|
|
|
|
} } : {}),
|
|
|
|
...(isGlobalTimelineAvailable ? { global: {
|
|
|
|
title: i18n.ts._timelines.global,
|
|
|
|
icon: 'ti ti-whirl',
|
|
|
|
iconOnly: true,
|
|
|
|
} } : {}),
|
|
|
|
lists: {
|
|
|
|
icon: 'ti ti-list',
|
|
|
|
title: i18n.ts.lists,
|
|
|
|
iconOnly: true,
|
|
|
|
},
|
|
|
|
antennas: {
|
|
|
|
icon: 'ti ti-antenna',
|
|
|
|
title: i18n.ts.antennas,
|
|
|
|
iconOnly: true,
|
|
|
|
},
|
|
|
|
channels: {
|
|
|
|
icon: 'ti ti-device-tv',
|
|
|
|
title: i18n.ts.channel,
|
|
|
|
iconOnly: true,
|
|
|
|
},
|
2024-06-11 10:38:38 +02:00
|
|
|
...lists.reduce((acc, l) => {
|
|
|
|
acc['list:' + l.id] = {
|
|
|
|
title: i18n.ts.lists + ':' + l.name,
|
|
|
|
icon: 'ti ti-star',
|
|
|
|
iconOnly: true,
|
|
|
|
};
|
|
|
|
return acc;
|
|
|
|
}, {}),
|
2024-06-11 09:24:32 +02:00
|
|
|
});
|