Skip to content

Commit f8f1e53

Browse files
committed
feat(mobile): add new note launcher bar (fixes #1105)
1 parent 96dc063 commit f8f1e53

File tree

2 files changed

+84
-67
lines changed

2 files changed

+84
-67
lines changed

src/services/hidden_subtree.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import log from "./log.js";
77
import migrationService from "./migration.js";
88
import { t } from "i18next";
99
import { getHelpHiddenSubtreeData } from "./in_app_help.js";
10-
import * as launchbarConfig from "./hidden_subtree_launcherbar.js";
10+
import buildLaunchBarConfig from "./hidden_subtree_launcherbar.js";
1111

1212
const LBTPL_ROOT = "_lbTplRoot";
1313
const LBTPL_BASE = "_lbTplBase";
@@ -59,6 +59,8 @@ enum Command {
5959
let hiddenSubtreeDefinition: HiddenSubtreeItem;
6060

6161
function buildHiddenSubtreeDefinition(): HiddenSubtreeItem {
62+
const launchbarConfig = buildLaunchBarConfig();
63+
6264
return {
6365
id: "_hidden",
6466
title: t("hidden-subtree.root-title"),
+81-66
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,88 @@
11
import { t } from "i18next";
22
import type { HiddenSubtreeItem } from "./hidden_subtree.js";
33

4-
const sharedLaunchers: Record<string, Omit<HiddenSubtreeItem, "id">> = {
5-
backInHistory: {
6-
title: t("hidden-subtree.go-to-previous-note-title"),
7-
type: "launcher",
8-
builtinWidget: "backInHistoryButton",
9-
icon: "bx bxs-chevron-left",
10-
attributes: [{ type: "label", name: "docName", value: "launchbar_history_navigation" }]
11-
},
12-
forwardInHistory: {
13-
title: t("hidden-subtree.go-to-next-note-title"),
14-
type: "launcher",
15-
builtinWidget: "forwardInHistoryButton",
16-
icon: "bx bxs-chevron-right",
17-
attributes: [{ type: "label", name: "docName", value: "launchbar_history_navigation" }]
18-
}
19-
};
4+
export default function buildLaunchBarConfig() {
5+
const sharedLaunchers: Record<string, Omit<HiddenSubtreeItem, "id">> = {
6+
newNote: {
7+
title: t("hidden-subtree.new-note-title"),
8+
type: "launcher",
9+
command: "createNoteIntoInbox",
10+
icon: "bx bx-file-blank"
11+
},
12+
backInHistory: {
13+
title: t("hidden-subtree.go-to-previous-note-title"),
14+
type: "launcher",
15+
builtinWidget: "backInHistoryButton",
16+
icon: "bx bxs-chevron-left",
17+
attributes: [{ type: "label", name: "docName", value: "launchbar_history_navigation" }]
18+
},
19+
forwardInHistory: {
20+
title: t("hidden-subtree.go-to-next-note-title"),
21+
type: "launcher",
22+
builtinWidget: "forwardInHistoryButton",
23+
icon: "bx bxs-chevron-right",
24+
attributes: [{ type: "label", name: "docName", value: "launchbar_history_navigation" }]
25+
}
26+
};
27+
28+
const desktopAvailableLaunchers: HiddenSubtreeItem[] = [
29+
{ id: "_lbBackInHistory", ...sharedLaunchers.backInHistory },
30+
{ id: "_lbForwardInHistory", ...sharedLaunchers.forwardInHistory },
31+
{ id: "_lbBackendLog", title: t("hidden-subtree.backend-log-title"), type: "launcher", targetNoteId: "_backendLog", icon: "bx bx-terminal" }
32+
];
2033

21-
export const desktopAvailableLaunchers: HiddenSubtreeItem[] = [
22-
{ id: "_lbBackInHistory", ...sharedLaunchers.backInHistory },
23-
{ id: "_lbForwardInHistory", ...sharedLaunchers.forwardInHistory },
24-
{ id: "_lbBackendLog", title: t("hidden-subtree.backend-log-title"), type: "launcher", targetNoteId: "_backendLog", icon: "bx bx-terminal" }
25-
];
34+
const desktopVisibleLaunchers: HiddenSubtreeItem[] = [
35+
{ id: "_lbNewNote", ...sharedLaunchers.newNote },
36+
{
37+
id: "_lbSearch",
38+
title: t("hidden-subtree.search-notes-title"),
39+
type: "launcher",
40+
command: "searchNotes",
41+
icon: "bx bx-search",
42+
attributes: [{ type: "label", name: "desktopOnly" }]
43+
},
44+
{
45+
id: "_lbJumpTo",
46+
title: t("hidden-subtree.jump-to-note-title"),
47+
type: "launcher",
48+
command: "jumpToNote",
49+
icon: "bx bx-send",
50+
attributes: [{ type: "label", name: "desktopOnly" }]
51+
},
52+
{ id: "_lbNoteMap", title: t("hidden-subtree.note-map-title"), type: "launcher", targetNoteId: "_globalNoteMap", icon: "bx bxs-network-chart" },
53+
{ id: "_lbCalendar", title: t("hidden-subtree.calendar-title"), type: "launcher", builtinWidget: "calendar", icon: "bx bx-calendar" },
54+
{
55+
id: "_lbRecentChanges",
56+
title: t("hidden-subtree.recent-changes-title"),
57+
type: "launcher",
58+
command: "showRecentChanges",
59+
icon: "bx bx-history",
60+
attributes: [{ type: "label", name: "desktopOnly" }]
61+
},
62+
{ id: "_lbSpacer1", title: t("hidden-subtree.spacer-title"), type: "launcher", builtinWidget: "spacer", baseSize: "50", growthFactor: "0" },
63+
{ id: "_lbBookmarks", title: t("hidden-subtree.bookmarks-title"), type: "launcher", builtinWidget: "bookmarks", icon: "bx bx-bookmark" },
64+
{ id: "_lbToday", title: t("hidden-subtree.open-today-journal-note-title"), type: "launcher", builtinWidget: "todayInJournal", icon: "bx bx-calendar-star" },
65+
{ id: "_lbSpacer2", title: t("hidden-subtree.spacer-title"), type: "launcher", builtinWidget: "spacer", baseSize: "0", growthFactor: "1" },
66+
{ id: "_lbQuickSearch", title: t("hidden-subtree.quick-search-title"), type: "launcher", builtinWidget: "quickSearch", icon: "bx bx-rectangle" },
67+
{ id: "_lbProtectedSession", title: t("hidden-subtree.protected-session-title"), type: "launcher", builtinWidget: "protectedSession", icon: "bx bx bx-shield-quarter" },
68+
{ id: "_lbSyncStatus", title: t("hidden-subtree.sync-status-title"), type: "launcher", builtinWidget: "syncStatus", icon: "bx bx-wifi" },
69+
{ id: "_lbSettings", title: t("hidden-subtree.settings-title"), type: "launcher", command: "showOptions", icon: "bx bx-cog" }
70+
]
2671

27-
export const desktopVisibleLaunchers: HiddenSubtreeItem[] = [
28-
{ id: "_lbNewNote", title: t("hidden-subtree.new-note-title"), type: "launcher", command: "createNoteIntoInbox", icon: "bx bx-file-blank" },
29-
{
30-
id: "_lbSearch",
31-
title: t("hidden-subtree.search-notes-title"),
32-
type: "launcher",
33-
command: "searchNotes",
34-
icon: "bx bx-search",
35-
attributes: [{ type: "label", name: "desktopOnly" }]
36-
},
37-
{
38-
id: "_lbJumpTo",
39-
title: t("hidden-subtree.jump-to-note-title"),
40-
type: "launcher",
41-
command: "jumpToNote",
42-
icon: "bx bx-send",
43-
attributes: [{ type: "label", name: "desktopOnly" }]
44-
},
45-
{ id: "_lbNoteMap", title: t("hidden-subtree.note-map-title"), type: "launcher", targetNoteId: "_globalNoteMap", icon: "bx bxs-network-chart" },
46-
{ id: "_lbCalendar", title: t("hidden-subtree.calendar-title"), type: "launcher", builtinWidget: "calendar", icon: "bx bx-calendar" },
47-
{
48-
id: "_lbRecentChanges",
49-
title: t("hidden-subtree.recent-changes-title"),
50-
type: "launcher",
51-
command: "showRecentChanges",
52-
icon: "bx bx-history",
53-
attributes: [{ type: "label", name: "desktopOnly" }]
54-
},
55-
{ id: "_lbSpacer1", title: t("hidden-subtree.spacer-title"), type: "launcher", builtinWidget: "spacer", baseSize: "50", growthFactor: "0" },
56-
{ id: "_lbBookmarks", title: t("hidden-subtree.bookmarks-title"), type: "launcher", builtinWidget: "bookmarks", icon: "bx bx-bookmark" },
57-
{ id: "_lbToday", title: t("hidden-subtree.open-today-journal-note-title"), type: "launcher", builtinWidget: "todayInJournal", icon: "bx bx-calendar-star" },
58-
{ id: "_lbSpacer2", title: t("hidden-subtree.spacer-title"), type: "launcher", builtinWidget: "spacer", baseSize: "0", growthFactor: "1" },
59-
{ id: "_lbQuickSearch", title: t("hidden-subtree.quick-search-title"), type: "launcher", builtinWidget: "quickSearch", icon: "bx bx-rectangle" },
60-
{ id: "_lbProtectedSession", title: t("hidden-subtree.protected-session-title"), type: "launcher", builtinWidget: "protectedSession", icon: "bx bx bx-shield-quarter" },
61-
{ id: "_lbSyncStatus", title: t("hidden-subtree.sync-status-title"), type: "launcher", builtinWidget: "syncStatus", icon: "bx bx-wifi" },
62-
{ id: "_lbSettings", title: t("hidden-subtree.settings-title"), type: "launcher", command: "showOptions", icon: "bx bx-cog" }
63-
]
72+
const mobileAvailableLaunchers: HiddenSubtreeItem[] = [
73+
{ id: "_lbMobileNewNote", ...sharedLaunchers.newNote }
74+
];
6475

65-
export const mobileAvailableLaunchers: HiddenSubtreeItem[] = [
66-
// None for now.
67-
];
76+
const mobileVisibleLaunchers: HiddenSubtreeItem[] = [
77+
{ id: "_lbMobileBackInHistory", ...sharedLaunchers.backInHistory },
78+
{ id: "_lbMobileForwardInHistory", ...sharedLaunchers.forwardInHistory },
79+
{ id: "_lbMobileJumpTo", title: t("hidden-subtree.jump-to-note-title"), type: "launcher", command: "jumpToNote", icon: "bx bx-plus-circle" }
80+
];
6881

69-
export const mobileVisibleLaunchers: HiddenSubtreeItem[] = [
70-
{ id: "_lbMobileBackInHistory", ...sharedLaunchers.backInHistory },
71-
{ id: "_lbMobileForwardInHistory", ...sharedLaunchers.forwardInHistory },
72-
{ id: "_lbMobileJumpTo", title: t("hidden-subtree.jump-to-note-title"), type: "launcher", command: "jumpToNote", icon: "bx bx-plus-circle" }
73-
];
82+
return {
83+
desktopAvailableLaunchers,
84+
desktopVisibleLaunchers,
85+
mobileAvailableLaunchers,
86+
mobileVisibleLaunchers
87+
}
88+
}

0 commit comments

Comments
 (0)