firefish/packages/client/src/scripts/helpMenu.ts

95 lines
2 KiB
TypeScript
Raw Normal View History

2023-09-04 17:47:24 +09:00
import XTutorial from "@/components/MkTutorialDialog.vue";
import XCheatSheet from "@/components/MkCheatSheetDialog.vue";
2023-07-20 04:17:05 +09:00
import { defaultStore } from "@/store";
import { instance } from "@/instance";
import { host } from "@/config";
import * as os from "@/os";
import { i18n } from "@/i18n";
2023-10-17 02:12:35 +09:00
import icon from "@/scripts/icon";
2023-07-20 04:17:05 +09:00
export function openHelpMenu_(ev: MouseEvent) {
os.popupMenu(
[
{
text: instance.name ?? host,
type: "label",
},
{
type: "link",
text: i18n.ts.instanceInfo,
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-info")}`,
2023-07-20 04:17:05 +09:00
to: "/about",
},
{
type: "link",
text: i18n.ts.aboutFirefish,
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-lightbulb")}`,
2023-07-20 04:17:05 +09:00
to: "/about-firefish",
},
2023-09-22 14:02:48 +09:00
instance.tosUrl
? {
type: "button",
text: i18n.ts.tos,
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-scroll")}`,
2023-09-22 14:02:48 +09:00
action: () => {
window.open(instance.tosUrl, "_blank");
},
}
: null,
2023-07-20 04:17:05 +09:00
{
type: "button",
text: i18n.ts.apps,
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-device-mobile")}`,
2023-07-20 04:17:05 +09:00
action: () => {
window.open("https://joinfirefish.org/apps", "_blank");
},
},
{
type: "button",
action: async () => {
defaultStore.set("tutorial", 0);
os.popup(XTutorial, {}, {}, "closed");
},
text: i18n.ts.replayTutorial,
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-circle-wavy-question")}`,
2023-07-20 04:17:05 +09:00
},
{
type: "button",
text: i18n.ts._mfm.cheatSheet,
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-question")}`,
action: async () => {
os.popup(XCheatSheet, {}, {}, "closed");
},
},
2023-07-20 04:17:05 +09:00
null,
{
type: "parent",
text: i18n.ts.developer,
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-code")}`,
2023-07-20 04:17:05 +09:00
children: [
{
type: "link",
to: "/api-console",
text: "API Console",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-terminal-window")}`,
2023-07-20 04:17:05 +09:00
},
{
text: i18n.ts.document,
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-file-doc")}`,
2023-07-20 04:17:05 +09:00
action: () => {
window.open("/api-doc", "_blank");
},
},
{
type: "link",
to: "/scratchpad",
text: "AiScript Scratchpad",
2023-10-17 02:12:35 +09:00
icon: `${icon("ph-scribble-loop")}`,
2023-07-20 04:17:05 +09:00
},
],
},
],
ev.currentTarget ?? ev.target,
);
}