refactor(hidden-subtree): deduplicate launchers

This commit is contained in:
Elian Doran 2025-02-08 10:37:17 +02:00
parent 303cf65020
commit 96dc063b50
No known key found for this signature in database

View File

@ -1,23 +1,26 @@
import { t } from "i18next"; import { t } from "i18next";
import type { HiddenSubtreeItem } from "./hidden_subtree.js"; import type { HiddenSubtreeItem } from "./hidden_subtree.js";
export const desktopAvailableLaunchers: HiddenSubtreeItem[] = [ const sharedLaunchers: Record<string, Omit<HiddenSubtreeItem, "id">> = {
{ backInHistory: {
id: "_lbBackInHistory",
title: t("hidden-subtree.go-to-previous-note-title"), title: t("hidden-subtree.go-to-previous-note-title"),
type: "launcher", type: "launcher",
builtinWidget: "backInHistoryButton", builtinWidget: "backInHistoryButton",
icon: "bx bxs-chevron-left", icon: "bx bxs-chevron-left",
attributes: [{ type: "label", name: "docName", value: "launchbar_history_navigation" }] attributes: [{ type: "label", name: "docName", value: "launchbar_history_navigation" }]
}, },
{ forwardInHistory: {
id: "_lbForwardInHistory",
title: t("hidden-subtree.go-to-next-note-title"), title: t("hidden-subtree.go-to-next-note-title"),
type: "launcher", type: "launcher",
builtinWidget: "forwardInHistoryButton", builtinWidget: "forwardInHistoryButton",
icon: "bx bxs-chevron-right", icon: "bx bxs-chevron-right",
attributes: [{ type: "label", name: "docName", value: "launchbar_history_navigation" }] attributes: [{ type: "label", name: "docName", value: "launchbar_history_navigation" }]
}, }
};
export const desktopAvailableLaunchers: HiddenSubtreeItem[] = [
{ id: "_lbBackInHistory", ...sharedLaunchers.backInHistory },
{ id: "_lbForwardInHistory", ...sharedLaunchers.forwardInHistory },
{ id: "_lbBackendLog", title: t("hidden-subtree.backend-log-title"), type: "launcher", targetNoteId: "_backendLog", icon: "bx bx-terminal" } { id: "_lbBackendLog", title: t("hidden-subtree.backend-log-title"), type: "launcher", targetNoteId: "_backendLog", icon: "bx bx-terminal" }
]; ];
@ -64,21 +67,7 @@ export const mobileAvailableLaunchers: HiddenSubtreeItem[] = [
]; ];
export const mobileVisibleLaunchers: HiddenSubtreeItem[] = [ export const mobileVisibleLaunchers: HiddenSubtreeItem[] = [
{ { id: "_lbMobileBackInHistory", ...sharedLaunchers.backInHistory },
id: "_lbMobileBackInHistory", { id: "_lbMobileForwardInHistory", ...sharedLaunchers.forwardInHistory },
title: t("hidden-subtree.go-to-previous-note-title"),
type: "launcher",
builtinWidget: "backInHistoryButton",
icon: "bx bxs-chevron-left",
attributes: [{ type: "label", name: "docName", value: "launchbar_history_navigation" }]
},
{
id: "_lbMobileForwardInHistory",
title: t("hidden-subtree.go-to-next-note-title"),
type: "launcher",
builtinWidget: "forwardInHistoryButton",
icon: "bx bxs-chevron-right",
attributes: [{ type: "label", name: "docName", value: "launchbar_history_navigation" }]
},
{ id: "_lbMobileJumpTo", title: t("hidden-subtree.jump-to-note-title"), type: "launcher", command: "jumpToNote", icon: "bx bx-plus-circle" } { id: "_lbMobileJumpTo", title: t("hidden-subtree.jump-to-note-title"), type: "launcher", command: "jumpToNote", icon: "bx bx-plus-circle" }
]; ];