2023-07-27 08:31:52 +03:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-02-16 16:09:41 +02:00
|
|
|
import { computed, reactive } from 'vue';
|
2023-09-19 10:37:43 +03:00
|
|
|
import { $i } from '@/account.js';
|
|
|
|
import { miLocalStorage } from '@/local-storage.js';
|
2023-11-01 13:20:03 +02:00
|
|
|
import { openInstanceMenu } from '@/ui/_common_/common.js';
|
2023-09-19 10:37:43 +03: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';
|
2023-09-29 01:57:38 +03:00
|
|
|
import { instance } from './instance.js';
|
2020-10-17 14:12:00 +03:00
|
|
|
|
2022-07-14 11:42:12 +03:00
|
|
|
export const navbarItemDef = reactive({
|
2020-10-17 14:12:00 +03:00
|
|
|
notifications: {
|
2023-01-05 06:59:48 +02:00
|
|
|
title: i18n.ts.notifications,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-bell ph-bold ph-lg',
|
2020-12-19 03:55:52 +02:00
|
|
|
show: computed(() => $i != null),
|
|
|
|
indicated: computed(() => $i != null && $i.hasUnreadNotification),
|
2023-11-01 06:34:05 +02:00
|
|
|
indicateValue: computed(() => {
|
|
|
|
if (!$i || $i.unreadNotificationsCount === 0) return '';
|
|
|
|
|
|
|
|
if ($i.unreadNotificationsCount > 99) {
|
|
|
|
return '99+';
|
|
|
|
} else {
|
|
|
|
return $i.unreadNotificationsCount.toString();
|
|
|
|
}
|
|
|
|
}),
|
2020-10-17 14:12:00 +03:00
|
|
|
to: '/my/notifications',
|
|
|
|
},
|
|
|
|
drive: {
|
2023-01-05 06:59:48 +02:00
|
|
|
title: i18n.ts.drive,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-cloud ph-bold ph-lg',
|
2020-12-19 03:55:52 +02:00
|
|
|
show: computed(() => $i != null),
|
2020-10-17 14:12:00 +03:00
|
|
|
to: '/my/drive',
|
|
|
|
},
|
|
|
|
followRequests: {
|
2023-01-05 06:59:48 +02:00
|
|
|
title: i18n.ts.followRequests,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-user-plus ph-bold ph-lg',
|
2020-12-19 03:55:52 +02:00
|
|
|
show: computed(() => $i != null && $i.isLocked),
|
|
|
|
indicated: computed(() => $i != null && $i.hasPendingReceivedFollowRequest),
|
2020-10-17 14:12:00 +03:00
|
|
|
to: '/my/follow-requests',
|
|
|
|
},
|
|
|
|
explore: {
|
2023-01-05 06:59:48 +02:00
|
|
|
title: i18n.ts.explore,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-hash ph-bold ph-lg',
|
2020-10-17 14:12:00 +03:00
|
|
|
to: '/explore',
|
|
|
|
},
|
|
|
|
announcements: {
|
2023-01-05 06:59:48 +02:00
|
|
|
title: i18n.ts.announcements,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-megaphone ph-bold ph-lg',
|
2020-12-19 03:55:52 +02:00
|
|
|
indicated: computed(() => $i != null && $i.hasUnreadAnnouncement),
|
2020-10-17 14:12:00 +03:00
|
|
|
to: '/announcements',
|
|
|
|
},
|
|
|
|
search: {
|
2023-01-05 06:59:48 +02:00
|
|
|
title: i18n.ts.search,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-magnifying-glass ph-bold ph-lg',
|
2023-02-25 02:01:21 +02:00
|
|
|
to: '/search',
|
2020-10-17 14:12:00 +03:00
|
|
|
},
|
2023-03-16 04:56:20 +02:00
|
|
|
lookup: {
|
|
|
|
title: i18n.ts.lookup,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-binoculars ph-bold ph-lg',
|
2023-03-16 04:56:20 +02:00
|
|
|
action: (ev) => {
|
|
|
|
lookup();
|
|
|
|
},
|
|
|
|
},
|
2020-10-17 14:12:00 +03:00
|
|
|
lists: {
|
2023-01-05 06:59:48 +02:00
|
|
|
title: i18n.ts.lists,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-list ph-bold ph-lg',
|
2020-12-19 03:55:52 +02:00
|
|
|
show: computed(() => $i != null),
|
2022-07-07 11:28:13 +03:00
|
|
|
to: '/my/lists',
|
2020-10-17 14:12:00 +03:00
|
|
|
},
|
|
|
|
antennas: {
|
2023-01-05 06:59:48 +02:00
|
|
|
title: i18n.ts.antennas,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-flying-saucer ph-bold ph-lg',
|
2020-12-19 03:55:52 +02:00
|
|
|
show: computed(() => $i != null),
|
2022-07-07 11:28:13 +03:00
|
|
|
to: '/my/antennas',
|
2020-10-17 14:12:00 +03:00
|
|
|
},
|
|
|
|
favorites: {
|
2023-01-05 06:59:48 +02:00
|
|
|
title: i18n.ts.favorites,
|
2023-11-04 00:20:53 +02:00
|
|
|
icon: 'ph-star ph-bold ph-lg',
|
2020-12-19 03:55:52 +02:00
|
|
|
show: computed(() => $i != null),
|
2020-10-17 14:12:00 +03:00
|
|
|
to: '/my/favorites',
|
|
|
|
},
|
|
|
|
pages: {
|
2023-01-05 06:59:48 +02:00
|
|
|
title: i18n.ts.pages,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-newspaper ph-bold ph-lg',
|
2020-11-17 07:59:15 +02:00
|
|
|
to: '/pages',
|
2020-10-17 14:12:00 +03:00
|
|
|
},
|
2023-01-05 06:59:48 +02:00
|
|
|
play: {
|
|
|
|
title: 'Play',
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-play ph-bold ph-lg',
|
2023-01-05 06:59:48 +02:00
|
|
|
to: '/play',
|
|
|
|
},
|
2021-04-24 16:38:24 +03:00
|
|
|
gallery: {
|
2023-01-05 06:59:48 +02:00
|
|
|
title: i18n.ts.gallery,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-images ph-bold ph-lg',
|
2021-04-24 16:38:24 +03:00
|
|
|
to: '/gallery',
|
|
|
|
},
|
2020-11-15 05:04:54 +02:00
|
|
|
clips: {
|
2023-01-05 06:59:48 +02:00
|
|
|
title: i18n.ts.clip,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-paperclip ph-bold ph-lg',
|
2020-12-19 03:55:52 +02:00
|
|
|
show: computed(() => $i != null),
|
2020-11-15 05:04:54 +02:00
|
|
|
to: '/my/clips',
|
|
|
|
},
|
2020-10-17 14:12:00 +03:00
|
|
|
channels: {
|
2023-01-05 06:59:48 +02:00
|
|
|
title: i18n.ts.channel,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-television ph-bold ph-lg',
|
2020-10-17 14:12:00 +03:00
|
|
|
to: '/channels',
|
|
|
|
},
|
2023-01-21 06:14:55 +02:00
|
|
|
achievements: {
|
|
|
|
title: i18n.ts.achievements,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-trophy ph-bold ph-lg',
|
2023-09-29 01:57:38 +03:00
|
|
|
show: computed(() => $i != null && instance.enableAchievements),
|
2023-01-21 06:14:55 +02:00
|
|
|
to: '/my/achievements',
|
|
|
|
},
|
2020-11-03 10:00:47 +02:00
|
|
|
ui: {
|
2023-01-05 06:59:48 +02:00
|
|
|
title: i18n.ts.switchUi,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-devices ph-bold ph-lg',
|
2020-11-03 10:00:47 +02:00
|
|
|
action: (ev) => {
|
2021-08-08 06:19:10 +03:00
|
|
|
os.popupMenu([{
|
2022-01-28 04:39:49 +02:00
|
|
|
text: i18n.ts.default,
|
2021-10-24 08:50:00 +03:00
|
|
|
active: ui === 'default' || ui === null,
|
2020-11-03 10:00:47 +02:00
|
|
|
action: () => {
|
2023-01-07 03:13:02 +02:00
|
|
|
miLocalStorage.setItem('ui', 'default');
|
2021-02-17 14:36:56 +02:00
|
|
|
unisonReload();
|
2022-06-20 11:38:49 +03:00
|
|
|
},
|
2020-11-03 10:00:47 +02:00
|
|
|
}, {
|
2022-01-28 04:39:49 +02:00
|
|
|
text: i18n.ts.deck,
|
2021-10-24 08:50:00 +03:00
|
|
|
active: ui === 'deck',
|
2020-11-03 10:00:47 +02:00
|
|
|
action: () => {
|
2023-01-07 03:13:02 +02:00
|
|
|
miLocalStorage.setItem('ui', 'deck');
|
2021-02-17 14:36:56 +02:00
|
|
|
unisonReload();
|
2022-06-20 11:38:49 +03:00
|
|
|
},
|
2021-04-10 06:40:50 +03:00
|
|
|
}, {
|
2022-01-28 04:39:49 +02:00
|
|
|
text: i18n.ts.classic,
|
2021-10-24 08:50:00 +03:00
|
|
|
active: ui === 'classic',
|
2021-04-10 06:40:50 +03:00
|
|
|
action: () => {
|
2023-01-07 03:13:02 +02:00
|
|
|
miLocalStorage.setItem('ui', 'classic');
|
2021-04-10 06:40:50 +03:00
|
|
|
unisonReload();
|
2022-06-20 11:38:49 +03:00
|
|
|
},
|
|
|
|
}], ev.currentTarget ?? ev.target);
|
2020-10-17 14:12:00 +03:00
|
|
|
},
|
|
|
|
},
|
2023-02-26 05:50:34 +02:00
|
|
|
about: {
|
|
|
|
title: i18n.ts.about,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-info ph-bold ph-lg',
|
2023-02-26 05:50:34 +02:00
|
|
|
action: (ev) => {
|
|
|
|
openInstanceMenu(ev);
|
|
|
|
},
|
|
|
|
},
|
2022-07-05 13:29:44 +03:00
|
|
|
reload: {
|
2023-01-05 06:59:48 +02:00
|
|
|
title: i18n.ts.reload,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-arrows-clockwise ph-bold ph-lg',
|
2022-07-05 13:29:44 +03:00
|
|
|
action: (ev) => {
|
|
|
|
location.reload();
|
|
|
|
},
|
|
|
|
},
|
2023-03-15 11:01:56 +02:00
|
|
|
profile: {
|
|
|
|
title: i18n.ts.profile,
|
2023-09-30 22:53:52 +03:00
|
|
|
icon: 'ph-user ph-bold ph-lg',
|
2023-03-15 11:01:56 +02:00
|
|
|
show: computed(() => $i != null),
|
|
|
|
to: `/@${$i?.username}`,
|
|
|
|
},
|
2021-12-03 15:09:40 +02:00
|
|
|
});
|