firefish/packages/client/src/navbar.ts

141 lines
3.1 KiB
TypeScript
Raw Normal View History

2023-12-06 05:02:20 +09:00
import { computed, reactive } from "vue";
2023-11-06 21:11:39 +09:00
import { ui } from "@/config";
import { i18n } from "@/i18n";
import * as os from "@/os";
2023-10-29 20:09:26 +09:00
import { $i } from "@/reactiveAccount";
2023-11-06 21:11:39 +09:00
import icon from "@/scripts/icon";
2023-07-20 04:17:05 +09:00
import { search } from "@/scripts/search";
import { unisonReload } from "@/scripts/unison-reload";
export const navbarItemDef = reactive({
notifications: {
title: "notifications",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-bell")}`,
2023-07-20 04:17:05 +09:00
show: computed(() => $i != null),
indicated: computed(() => $i?.hasUnreadNotification),
to: "/my/notifications",
},
messaging: {
title: "messaging",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-chats-teardrop")}`,
2023-07-20 04:17:05 +09:00
show: computed(() => $i != null),
indicated: computed(() => $i?.hasUnreadMessagingMessage),
to: "/my/messaging",
},
drive: {
title: "drive",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-cloud")}`,
2023-07-20 04:17:05 +09:00
show: computed(() => $i != null),
to: "/my/drive",
},
followRequests: {
title: "followRequests",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-hand-waving")}`,
2023-07-20 04:17:05 +09:00
show: computed(() => $i?.isLocked || $i?.hasPendingReceivedFollowRequest),
indicated: computed(() => $i?.hasPendingReceivedFollowRequest),
to: "/my/follow-requests",
},
explore: {
title: "explore",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-compass")}`,
2023-07-20 04:17:05 +09:00
to: "/explore",
},
announcements: {
title: "announcements",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-megaphone-simple")}`,
2023-07-20 04:17:05 +09:00
indicated: computed(() => $i?.hasUnreadAnnouncement),
to: "/announcements",
},
search: {
title: "search",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-magnifying-glass")}`,
2023-07-20 04:17:05 +09:00
action: () => search(),
},
lists: {
title: "lists",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-list-bullets")}`,
2023-07-20 04:17:05 +09:00
show: computed(() => $i != null),
to: "/my/lists",
},
antennas: {
title: "antennas",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-flying-saucer")}`,
2023-07-20 04:17:05 +09:00
show: computed(() => $i != null),
to: "/my/antennas",
},
favorites: {
title: "favorites",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-bookmark-simple")}`,
2023-07-20 04:17:05 +09:00
show: computed(() => $i != null),
to: "/my/favorites",
},
pages: {
title: "pages",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-file-text")}`,
2023-07-20 04:17:05 +09:00
to: "/pages",
},
gallery: {
title: "gallery",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-image-square")}`,
2023-07-20 04:17:05 +09:00
to: "/gallery",
},
clips: {
title: "clips",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-paperclip")}`,
2023-07-20 04:17:05 +09:00
show: computed(() => $i != null),
to: "/my/clips",
},
channels: {
title: "channel",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-television")}`,
2023-07-20 04:17:05 +09:00
to: "/channels",
},
groups: {
title: "groups",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-users-three")}`,
2023-07-20 04:17:05 +09:00
to: "/my/groups",
},
ui: {
title: "switchUi",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-layout")}`,
2023-07-20 04:17:05 +09:00
action: (ev) => {
os.popupMenu(
[
{
text: i18n.ts.default,
active: ui === "default" || ui === null,
action: () => {
localStorage.setItem("ui", "default");
unisonReload();
},
},
{
text: i18n.ts.classic,
active: ui === "classic",
action: () => {
localStorage.setItem("ui", "classic");
unisonReload();
},
},
{
text: i18n.ts.deck,
active: ui === "deck",
action: () => {
localStorage.setItem("ui", "deck");
unisonReload();
},
},
],
ev.currentTarget ?? ev.target,
);
},
},
reload: {
title: "reload",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-arrows-clockwise")}`,
2023-07-20 04:17:05 +09:00
action: (ev) => {
location.reload();
},
},
});