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