Skip to content

Commit 96dc063

Browse files
committed
refactor(hidden-subtree): deduplicate launchers
1 parent 303cf65 commit 96dc063

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

src/services/hidden_subtree_launcherbar.ts

+11-22
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
import { t } from "i18next";
22
import type { HiddenSubtreeItem } from "./hidden_subtree.js";
33

4-
export const desktopAvailableLaunchers: HiddenSubtreeItem[] = [
5-
{
6-
id: "_lbBackInHistory",
4+
const sharedLaunchers: Record<string, Omit<HiddenSubtreeItem, "id">> = {
5+
backInHistory: {
76
title: t("hidden-subtree.go-to-previous-note-title"),
87
type: "launcher",
98
builtinWidget: "backInHistoryButton",
109
icon: "bx bxs-chevron-left",
1110
attributes: [{ type: "label", name: "docName", value: "launchbar_history_navigation" }]
1211
},
13-
{
14-
id: "_lbForwardInHistory",
12+
forwardInHistory: {
1513
title: t("hidden-subtree.go-to-next-note-title"),
1614
type: "launcher",
1715
builtinWidget: "forwardInHistoryButton",
1816
icon: "bx bxs-chevron-right",
1917
attributes: [{ type: "label", name: "docName", value: "launchbar_history_navigation" }]
20-
},
18+
}
19+
};
20+
21+
export const desktopAvailableLaunchers: HiddenSubtreeItem[] = [
22+
{ id: "_lbBackInHistory", ...sharedLaunchers.backInHistory },
23+
{ id: "_lbForwardInHistory", ...sharedLaunchers.forwardInHistory },
2124
{ id: "_lbBackendLog", title: t("hidden-subtree.backend-log-title"), type: "launcher", targetNoteId: "_backendLog", icon: "bx bx-terminal" }
2225
];
2326

@@ -64,21 +67,7 @@ export const mobileAvailableLaunchers: HiddenSubtreeItem[] = [
6467
];
6568

6669
export const mobileVisibleLaunchers: HiddenSubtreeItem[] = [
67-
{
68-
id: "_lbMobileBackInHistory",
69-
title: t("hidden-subtree.go-to-previous-note-title"),
70-
type: "launcher",
71-
builtinWidget: "backInHistoryButton",
72-
icon: "bx bxs-chevron-left",
73-
attributes: [{ type: "label", name: "docName", value: "launchbar_history_navigation" }]
74-
},
75-
{
76-
id: "_lbMobileForwardInHistory",
77-
title: t("hidden-subtree.go-to-next-note-title"),
78-
type: "launcher",
79-
builtinWidget: "forwardInHistoryButton",
80-
icon: "bx bxs-chevron-right",
81-
attributes: [{ type: "label", name: "docName", value: "launchbar_history_navigation" }]
82-
},
70+
{ id: "_lbMobileBackInHistory", ...sharedLaunchers.backInHistory },
71+
{ id: "_lbMobileForwardInHistory", ...sharedLaunchers.forwardInHistory },
8372
{ id: "_lbMobileJumpTo", title: t("hidden-subtree.jump-to-note-title"), type: "launcher", command: "jumpToNote", icon: "bx bx-plus-circle" }
8473
];

0 commit comments

Comments
 (0)