forkey/packages/frontend/src/navbar.ts
sugar 0c8e7b8fc7
Some checks failed
Dockle / dockle (pull_request) Failing after 40s
Test (frontend) / vitest (22.x) (pull_request) Failing after 6s
Lint / pnpm_install (pull_request) Successful in 1m57s
Pull Request Labeler / triage (pull_request_target) Failing after 2s
Test (production install and build) / production (22.x) (pull_request) Successful in 2m52s
Lint / lint (backend) (pull_request) Successful in 2m31s
Lint / lint (misskey-js) (pull_request) Successful in 1m57s
Lint / lint (sw) (pull_request) Successful in 1m57s
Lint / typecheck (backend) (pull_request) Successful in 2m54s
Lint / typecheck (misskey-js) (pull_request) Successful in 1m56s
Lint / lint (frontend) (pull_request) Successful in 9m45s
Remove kawaii mode
Fixes #18.
2025-01-11 19:54:20 +01:00

195 lines
4.2 KiB
TypeScript

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { computed, reactive } from 'vue';
import { clearCache } from './scripts/clear-cache.js';
import { $i } from '@/account.js';
import { miLocalStorage } from '@/local-storage.js';
import { openInstanceMenu, openToolsMenu } from '@/ui/_common_/common.js';
import { lookup } from '@/scripts/lookup.js';
import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
import { ui, host } from '@/config.js';
import { unisonReload } from '@/scripts/unison-reload.js';
import { instance } from '@/instance.js';
export const navbarItemDef = reactive({
notifications: {
title: i18n.ts.notifications,
icon: 'ti ti-bell',
show: computed(() => $i != null),
indicated: computed(() => $i != null && $i.hasUnreadNotification),
indicateValue: computed(() => {
if (!$i || $i.unreadNotificationsCount === 0) return '';
if ($i.unreadNotificationsCount > 99) {
return '99+';
} else {
return $i.unreadNotificationsCount.toString();
}
}),
to: '/my/notifications',
},
drive: {
title: i18n.ts.drive,
icon: 'ti ti-cloud',
show: computed(() => $i != null),
to: '/my/drive',
},
followRequests: {
title: i18n.ts.followRequests,
icon: 'ti ti-user-plus',
show: computed(() => $i != null && $i.isLocked),
indicated: computed(() => $i != null && $i.hasPendingReceivedFollowRequest),
to: '/my/follow-requests',
},
explore: {
title: i18n.ts.explore,
icon: 'ti ti-hash',
to: '/explore',
},
announcements: {
title: i18n.ts.announcements,
icon: 'ti ti-speakerphone',
indicated: computed(() => $i != null && $i.hasUnreadAnnouncement),
to: '/announcements',
},
search: {
title: i18n.ts.search,
icon: 'ti ti-search',
to: '/search',
},
lookup: {
title: i18n.ts.lookup,
icon: 'ti ti-world-search',
action: (ev) => {
lookup();
},
},
lists: {
title: i18n.ts.lists,
icon: 'ti ti-list',
show: computed(() => $i != null),
to: '/my/lists',
},
antennas: {
title: i18n.ts.antennas,
icon: 'ti ti-antenna',
show: computed(() => $i != null),
to: '/my/antennas',
},
favorites: {
title: i18n.ts.favorites,
icon: 'ti ti-star',
show: computed(() => $i != null),
to: '/my/favorites',
},
pages: {
title: i18n.ts.pages,
icon: 'ti ti-news',
to: '/pages',
},
play: {
title: 'Play',
icon: 'ti ti-player-play',
to: '/play',
},
gallery: {
title: i18n.ts.gallery,
icon: 'ti ti-icons',
to: '/gallery',
},
clips: {
title: i18n.ts.clip,
icon: 'ti ti-paperclip',
show: computed(() => $i != null),
to: '/my/clips',
},
channels: {
title: i18n.ts.channel,
icon: 'ti ti-device-tv',
to: '/channels',
},
achievements: {
title: i18n.ts.achievements,
icon: 'ti ti-medal',
show: computed(() => $i != null),
to: '/my/achievements',
},
games: {
title: 'Misskey Games',
icon: 'ti ti-device-gamepad',
to: '/games',
},
ui: {
title: i18n.ts.switchUi,
icon: 'ti ti-devices',
action: (ev) => {
os.popupMenu([{
text: i18n.ts.default,
active: ui === 'default' || ui === null,
action: () => {
miLocalStorage.setItem('ui', 'default');
unisonReload();
},
}, {
text: i18n.ts.deck,
active: ui === 'deck',
action: () => {
miLocalStorage.setItem('ui', 'deck');
unisonReload();
},
}, {
text: i18n.ts.classic,
active: ui === 'classic',
action: () => {
miLocalStorage.setItem('ui', 'classic');
unisonReload();
},
}], ev.currentTarget ?? ev.target);
},
},
about: {
title: i18n.ts.about,
icon: 'ti ti-info-circle',
action: (ev) => {
openInstanceMenu(ev);
},
},
tools: {
title: i18n.ts.tools,
icon: 'ti ti-tool',
action: (ev) => {
openToolsMenu(ev);
},
},
reload: {
title: i18n.ts.reload,
icon: 'ti ti-refresh',
action: (ev) => {
location.reload();
},
},
profile: {
title: i18n.ts.profile,
icon: 'ti ti-user',
show: computed(() => $i != null),
to: `/@${$i?.username}`,
},
support: {
title: i18n.tsx.supportThisInstance({ name: instance.name ?? host }),
icon: 'ti ti-pig-money',
action: (ev) => {
window.open('https://go.misskey.io/donate', '_blank', 'noopener');
},
},
cacheClear: {
title: i18n.ts.clearCache,
icon: 'ti ti-trash',
action: (ev) => {
clearCache();
},
},
});