feat(mobile/tab_switcher): integrate into launch bar

This commit is contained in:
Elian Doran 2026-01-31 18:49:25 +02:00
parent 48db6e1756
commit 0a7b2e3304
No known key found for this signature in database
5 changed files with 22 additions and 13 deletions

View File

@ -13,7 +13,6 @@ import LauncherContainer from "../widgets/launch_bar/LauncherContainer.jsx";
import MobileDetailMenu from "../widgets/mobile_widgets/mobile_detail_menu.js"; import MobileDetailMenu from "../widgets/mobile_widgets/mobile_detail_menu.js";
import ScreenContainer from "../widgets/mobile_widgets/screen_container.js"; import ScreenContainer from "../widgets/mobile_widgets/screen_container.js";
import SidebarContainer from "../widgets/mobile_widgets/sidebar_container.js"; import SidebarContainer from "../widgets/mobile_widgets/sidebar_container.js";
import TabSwitcher from "../widgets/mobile_widgets/TabSwitcher.jsx";
import ToggleSidebarButton from "../widgets/mobile_widgets/toggle_sidebar_button.jsx"; import ToggleSidebarButton from "../widgets/mobile_widgets/toggle_sidebar_button.jsx";
import NoteTitleWidget from "../widgets/note_title.js"; import NoteTitleWidget from "../widgets/note_title.js";
import NoteTreeWidget from "../widgets/note_tree.js"; import NoteTreeWidget from "../widgets/note_tree.js";
@ -185,7 +184,6 @@ export default class MobileLayout {
.class("horizontal") .class("horizontal")
.css("height", "53px") .css("height", "53px")
.child(<LauncherContainer isHorizontalLayout />) .child(<LauncherContainer isHorizontalLayout />)
.child(<TabSwitcher />)
.child(<GlobalMenuWidget isHorizontalLayout />) .child(<GlobalMenuWidget isHorizontalLayout />)
.id("launcher-pane")) .id("launcher-pane"))
) )

View File

@ -3,6 +3,7 @@ import { useCallback, useLayoutEffect, useState } from "preact/hooks";
import FNote from "../../entities/fnote"; import FNote from "../../entities/fnote";
import froca from "../../services/froca"; import froca from "../../services/froca";
import { isDesktop, isMobile } from "../../services/utils"; import { isDesktop, isMobile } from "../../services/utils";
import TabSwitcher from "../mobile_widgets/TabSwitcher";
import { useTriliumEvent } from "../react/hooks"; import { useTriliumEvent } from "../react/hooks";
import { onWheelHorizontalScroll } from "../widget_utils"; import { onWheelHorizontalScroll } from "../widget_utils";
import BookmarkButtons from "./BookmarkButtons"; import BookmarkButtons from "./BookmarkButtons";
@ -97,6 +98,8 @@ function initBuiltinWidget(note: FNote, isHorizontalLayout: boolean) {
return <QuickSearchLauncherWidget />; return <QuickSearchLauncherWidget />;
case "aiChatLauncher": case "aiChatLauncher":
return <AiChatButton launcherNote={note} />; return <AiChatButton launcherNote={note} />;
case "mobileTabSwitcher":
return <TabSwitcher />;
default: default:
throw new Error(`Unrecognized builtin widget ${builtinWidget} for launcher ${note.noteId} "${note.title}"`); throw new Error(`Unrecognized builtin widget ${builtinWidget} for launcher ${note.noteId} "${note.title}"`);
} }

View File

@ -356,7 +356,8 @@
"visible-launchers-title": "Visible Launchers", "visible-launchers-title": "Visible Launchers",
"user-guide": "User Guide", "user-guide": "User Guide",
"localization": "Language & Region", "localization": "Language & Region",
"inbox-title": "Inbox" "inbox-title": "Inbox",
"tab-switcher-title": "Tab Switcher"
}, },
"notes": { "notes": {
"new-note": "New note", "new-note": "New note",

View File

@ -48,7 +48,7 @@ export default function buildLaunchBarConfig() {
id: "_lbBackInHistory", id: "_lbBackInHistory",
...sharedLaunchers.backInHistory ...sharedLaunchers.backInHistory
}, },
{ {
id: "_lbForwardInHistory", id: "_lbForwardInHistory",
...sharedLaunchers.forwardInHistory ...sharedLaunchers.forwardInHistory
}, },
@ -59,12 +59,12 @@ export default function buildLaunchBarConfig() {
command: "commandPalette", command: "commandPalette",
icon: "bx bx-chevron-right-square" icon: "bx bx-chevron-right-square"
}, },
{ {
id: "_lbBackendLog", id: "_lbBackendLog",
title: t("hidden-subtree.backend-log-title"), title: t("hidden-subtree.backend-log-title"),
type: "launcher", type: "launcher",
targetNoteId: "_backendLog", targetNoteId: "_backendLog",
icon: "bx bx-detail" icon: "bx bx-detail"
}, },
{ {
id: "_zenMode", id: "_zenMode",
@ -128,7 +128,7 @@ export default function buildLaunchBarConfig() {
baseSize: "50", baseSize: "50",
growthFactor: "0" growthFactor: "0"
}, },
{ {
id: "_lbBookmarks", id: "_lbBookmarks",
title: t("hidden-subtree.bookmarks-title"), title: t("hidden-subtree.bookmarks-title"),
type: "launcher", type: "launcher",
@ -139,7 +139,7 @@ export default function buildLaunchBarConfig() {
id: "_lbToday", id: "_lbToday",
...sharedLaunchers.openToday ...sharedLaunchers.openToday
}, },
{ {
id: "_lbSpacer2", id: "_lbSpacer2",
title: t("hidden-subtree.spacer-title"), title: t("hidden-subtree.spacer-title"),
type: "launcher", type: "launcher",
@ -179,7 +179,11 @@ export default function buildLaunchBarConfig() {
const mobileAvailableLaunchers: HiddenSubtreeItem[] = [ const mobileAvailableLaunchers: HiddenSubtreeItem[] = [
{ id: "_lbMobileNewNote", ...sharedLaunchers.newNote }, { id: "_lbMobileNewNote", ...sharedLaunchers.newNote },
{ id: "_lbMobileToday", ...sharedLaunchers.openToday } { id: "_lbMobileToday", ...sharedLaunchers.openToday },
{
id: "_lbMobileRecentChanges",
...sharedLaunchers.recentChanges
}
]; ];
const mobileVisibleLaunchers: HiddenSubtreeItem[] = [ const mobileVisibleLaunchers: HiddenSubtreeItem[] = [
@ -203,8 +207,10 @@ export default function buildLaunchBarConfig() {
...sharedLaunchers.calendar ...sharedLaunchers.calendar
}, },
{ {
id: "_lbMobileRecentChanges", id: "_lbMobileTabSwitcher",
...sharedLaunchers.recentChanges title: t("hidden-subtree.tab-switcher-title"),
type: "launcher",
builtinWidget: "mobileTabSwitcher"
} }
]; ];
@ -214,4 +220,4 @@ export default function buildLaunchBarConfig() {
mobileAvailableLaunchers, mobileAvailableLaunchers,
mobileVisibleLaunchers mobileVisibleLaunchers
}; };
} }

View File

@ -45,7 +45,8 @@ export interface HiddenSubtreeItem {
| "quickSearch" | "quickSearch"
| "aiChatLauncher" | "aiChatLauncher"
| "commandPalette" | "commandPalette"
| "toggleZenMode"; | "toggleZenMode"
| "mobileTabSwitcher";
command?: keyof typeof Command; command?: keyof typeof Command;
/** /**
* If set to true, then branches will be enforced to be in the correct place. * If set to true, then branches will be enforced to be in the correct place.