2023-07-27 14:31:52 +09:00
|
|
|
/*
|
2024-02-14 00:59:27 +09:00
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 14:31:52 +09:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-02-16 23:09:41 +09:00
|
|
|
import { computed, reactive } from 'vue';
|
2024-01-15 13:51:59 +09:00
|
|
|
import { clearCache } from './scripts/clear-cache.js';
|
2023-09-19 16:37:43 +09:00
|
|
|
import { $i } from '@/account.js';
|
|
|
|
import { miLocalStorage } from '@/local-storage.js';
|
2023-10-31 17:28:13 +09:00
|
|
|
import { openInstanceMenu, openToolsMenu } from '@/ui/_common_/common.js';
|
2023-09-19 16:37:43 +09:00
|
|
|
import { lookup } from '@/scripts/lookup.js';
|
|
|
|
import * as os from '@/os.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { ui } from '@/config.js';
|
|
|
|
import { unisonReload } from '@/scripts/unison-reload.js';
|
2020-10-17 20:12:00 +09:00
|
|
|
|
2022-07-14 17:42:12 +09:00
|
|
|
export const navbarItemDef = reactive({
|
2020-10-17 20:12:00 +09:00
|
|
|
notifications: {
|
2023-01-05 13:59:48 +09:00
|
|
|
title: i18n.ts.notifications,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-bell',
|
2020-12-19 10:55:52 +09:00
|
|
|
show: computed(() => $i != null),
|
|
|
|
indicated: computed(() => $i != null && $i.hasUnreadNotification),
|
2023-11-01 13:34:05 +09:00
|
|
|
indicateValue: computed(() => {
|
|
|
|
if (!$i || $i.unreadNotificationsCount === 0) return '';
|
|
|
|
|
|
|
|
if ($i.unreadNotificationsCount > 99) {
|
|
|
|
return '99+';
|
|
|
|
} else {
|
|
|
|
return $i.unreadNotificationsCount.toString();
|
|
|
|
}
|
|
|
|
}),
|
2020-10-17 20:12:00 +09:00
|
|
|
to: '/my/notifications',
|
|
|
|
},
|
|
|
|
drive: {
|
2023-01-05 13:59:48 +09:00
|
|
|
title: i18n.ts.drive,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-cloud',
|
2020-12-19 10:55:52 +09:00
|
|
|
show: computed(() => $i != null),
|
2020-10-17 20:12:00 +09:00
|
|
|
to: '/my/drive',
|
|
|
|
},
|
|
|
|
followRequests: {
|
2023-01-05 13:59:48 +09:00
|
|
|
title: i18n.ts.followRequests,
|
2022-12-26 17:15:30 +09:00
|
|
|
icon: 'ti ti-user-plus',
|
2020-12-19 10:55:52 +09:00
|
|
|
show: computed(() => $i != null && $i.isLocked),
|
|
|
|
indicated: computed(() => $i != null && $i.hasPendingReceivedFollowRequest),
|
2020-10-17 20:12:00 +09:00
|
|
|
to: '/my/follow-requests',
|
|
|
|
},
|
|
|
|
explore: {
|
2023-01-05 13:59:48 +09:00
|
|
|
title: i18n.ts.explore,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-hash',
|
2020-10-17 20:12:00 +09:00
|
|
|
to: '/explore',
|
|
|
|
},
|
|
|
|
announcements: {
|
2023-01-05 13:59:48 +09:00
|
|
|
title: i18n.ts.announcements,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-speakerphone',
|
2020-12-19 10:55:52 +09:00
|
|
|
indicated: computed(() => $i != null && $i.hasUnreadAnnouncement),
|
2020-10-17 20:12:00 +09:00
|
|
|
to: '/announcements',
|
|
|
|
},
|
|
|
|
search: {
|
2023-01-05 13:59:48 +09:00
|
|
|
title: i18n.ts.search,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-search',
|
2023-02-25 09:01:21 +09:00
|
|
|
to: '/search',
|
2020-10-17 20:12:00 +09:00
|
|
|
},
|
2023-03-16 11:56:20 +09:00
|
|
|
lookup: {
|
|
|
|
title: i18n.ts.lookup,
|
|
|
|
icon: 'ti ti-world-search',
|
|
|
|
action: (ev) => {
|
|
|
|
lookup();
|
|
|
|
},
|
|
|
|
},
|
2020-10-17 20:12:00 +09:00
|
|
|
lists: {
|
2023-01-05 13:59:48 +09:00
|
|
|
title: i18n.ts.lists,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-list',
|
2020-12-19 10:55:52 +09:00
|
|
|
show: computed(() => $i != null),
|
2022-07-07 17:28:13 +09:00
|
|
|
to: '/my/lists',
|
2020-10-17 20:12:00 +09:00
|
|
|
},
|
|
|
|
antennas: {
|
2023-01-05 13:59:48 +09:00
|
|
|
title: i18n.ts.antennas,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-antenna',
|
2020-12-19 10:55:52 +09:00
|
|
|
show: computed(() => $i != null),
|
2022-07-07 17:28:13 +09:00
|
|
|
to: '/my/antennas',
|
2020-10-17 20:12:00 +09:00
|
|
|
},
|
|
|
|
favorites: {
|
2023-01-05 13:59:48 +09:00
|
|
|
title: i18n.ts.favorites,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-star',
|
2020-12-19 10:55:52 +09:00
|
|
|
show: computed(() => $i != null),
|
2020-10-17 20:12:00 +09:00
|
|
|
to: '/my/favorites',
|
|
|
|
},
|
|
|
|
pages: {
|
2023-01-05 13:59:48 +09:00
|
|
|
title: i18n.ts.pages,
|
2022-12-20 08:35:49 +09:00
|
|
|
icon: 'ti ti-news',
|
2020-11-17 14:59:15 +09:00
|
|
|
to: '/pages',
|
2020-10-17 20:12:00 +09:00
|
|
|
},
|
2023-01-05 13:59:48 +09:00
|
|
|
play: {
|
|
|
|
title: 'Play',
|
|
|
|
icon: 'ti ti-player-play',
|
|
|
|
to: '/play',
|
|
|
|
},
|
2021-04-24 22:38:24 +09:00
|
|
|
gallery: {
|
2023-01-05 13:59:48 +09:00
|
|
|
title: i18n.ts.gallery,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-icons',
|
2021-04-24 22:38:24 +09:00
|
|
|
to: '/gallery',
|
|
|
|
},
|
2020-11-15 12:04:54 +09:00
|
|
|
clips: {
|
2023-01-05 13:59:48 +09:00
|
|
|
title: i18n.ts.clip,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-paperclip',
|
2020-12-19 10:55:52 +09:00
|
|
|
show: computed(() => $i != null),
|
2020-11-15 12:04:54 +09:00
|
|
|
to: '/my/clips',
|
|
|
|
},
|
2020-10-17 20:12:00 +09:00
|
|
|
channels: {
|
2023-01-05 13:59:48 +09:00
|
|
|
title: i18n.ts.channel,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-device-tv',
|
2020-10-17 20:12:00 +09:00
|
|
|
to: '/channels',
|
|
|
|
},
|
2023-01-21 13:14:55 +09:00
|
|
|
achievements: {
|
|
|
|
title: i18n.ts.achievements,
|
2023-01-24 14:10:26 +09:00
|
|
|
icon: 'ti ti-medal',
|
2023-01-21 13:14:55 +09:00
|
|
|
show: computed(() => $i != null),
|
|
|
|
to: '/my/achievements',
|
|
|
|
},
|
2024-01-15 13:51:59 +09:00
|
|
|
games: {
|
|
|
|
title: 'Misskey Games',
|
|
|
|
icon: 'ti ti-device-gamepad',
|
|
|
|
to: '/games',
|
|
|
|
},
|
2020-11-03 17:00:47 +09:00
|
|
|
ui: {
|
2023-01-05 13:59:48 +09:00
|
|
|
title: i18n.ts.switchUi,
|
2022-12-21 08:39:28 +09:00
|
|
|
icon: 'ti ti-devices',
|
2020-11-03 17:00:47 +09:00
|
|
|
action: (ev) => {
|
2021-08-08 12:19:10 +09:00
|
|
|
os.popupMenu([{
|
2022-01-28 11:39:49 +09:00
|
|
|
text: i18n.ts.default,
|
2021-10-24 14:50:00 +09:00
|
|
|
active: ui === 'default' || ui === null,
|
2020-11-03 17:00:47 +09:00
|
|
|
action: () => {
|
2023-01-07 10:13:02 +09:00
|
|
|
miLocalStorage.setItem('ui', 'default');
|
2021-02-17 21:36:56 +09:00
|
|
|
unisonReload();
|
2022-06-20 17:38:49 +09:00
|
|
|
},
|
2020-11-03 17:00:47 +09:00
|
|
|
}, {
|
2022-01-28 11:39:49 +09:00
|
|
|
text: i18n.ts.deck,
|
2021-10-24 14:50:00 +09:00
|
|
|
active: ui === 'deck',
|
2020-11-03 17:00:47 +09:00
|
|
|
action: () => {
|
2023-01-07 10:13:02 +09:00
|
|
|
miLocalStorage.setItem('ui', 'deck');
|
2021-02-17 21:36:56 +09:00
|
|
|
unisonReload();
|
2022-06-20 17:38:49 +09:00
|
|
|
},
|
2021-04-10 12:40:50 +09:00
|
|
|
}, {
|
2022-01-28 11:39:49 +09:00
|
|
|
text: i18n.ts.classic,
|
2021-10-24 14:50:00 +09:00
|
|
|
active: ui === 'classic',
|
2021-04-10 12:40:50 +09:00
|
|
|
action: () => {
|
2023-01-07 10:13:02 +09:00
|
|
|
miLocalStorage.setItem('ui', 'classic');
|
2021-04-10 12:40:50 +09:00
|
|
|
unisonReload();
|
2022-06-20 17:38:49 +09:00
|
|
|
},
|
|
|
|
}], ev.currentTarget ?? ev.target);
|
2020-10-17 20:12:00 +09:00
|
|
|
},
|
|
|
|
},
|
2023-02-26 12:50:34 +09:00
|
|
|
about: {
|
|
|
|
title: i18n.ts.about,
|
|
|
|
icon: 'ti ti-info-circle',
|
|
|
|
action: (ev) => {
|
|
|
|
openInstanceMenu(ev);
|
|
|
|
},
|
|
|
|
},
|
2023-10-31 17:28:13 +09:00
|
|
|
tools: {
|
|
|
|
title: i18n.ts.tools,
|
|
|
|
icon: 'ti ti-tool',
|
|
|
|
action: (ev) => {
|
|
|
|
openToolsMenu(ev);
|
|
|
|
},
|
|
|
|
},
|
2022-07-05 19:29:44 +09:00
|
|
|
reload: {
|
2023-01-05 13:59:48 +09:00
|
|
|
title: i18n.ts.reload,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-refresh',
|
2022-07-05 19:29:44 +09:00
|
|
|
action: (ev) => {
|
|
|
|
location.reload();
|
|
|
|
},
|
|
|
|
},
|
2023-03-15 18:01:56 +09:00
|
|
|
profile: {
|
|
|
|
title: i18n.ts.profile,
|
|
|
|
icon: 'ti ti-user',
|
|
|
|
show: computed(() => $i != null),
|
|
|
|
to: `/@${$i?.username}`,
|
|
|
|
},
|
2023-11-30 14:48:02 +09:00
|
|
|
cacheClear: {
|
2023-12-02 12:05:03 +09:00
|
|
|
title: i18n.ts.clearCache,
|
2023-11-30 14:48:02 +09:00
|
|
|
icon: 'ti ti-trash',
|
|
|
|
action: (ev) => {
|
|
|
|
clearCache();
|
|
|
|
},
|
|
|
|
},
|
2021-12-03 22:09:40 +09:00
|
|
|
});
|