From 1af62006550d47c35797b67b2afe1359361b4d3c Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 4 Dec 2025 13:24:47 +0200 Subject: [PATCH] chore(react/launch_bar): get launch bar to render React widgets --- .../src/widgets/containers/{launcher.ts => launcher.tsx} | 8 ++++---- apps/client/src/widgets/launch_bar/BookmarkButtons.tsx | 5 +++++ .../client/src/widgets/launch_bar/RightDropdownButton.tsx | 3 +++ apps/client/src/widgets/launch_bar/launch_bar_widget.ts | 3 +++ 4 files changed, 15 insertions(+), 4 deletions(-) rename apps/client/src/widgets/containers/{launcher.ts => launcher.tsx} (94%) create mode 100644 apps/client/src/widgets/launch_bar/BookmarkButtons.tsx create mode 100644 apps/client/src/widgets/launch_bar/RightDropdownButton.tsx create mode 100644 apps/client/src/widgets/launch_bar/launch_bar_widget.ts diff --git a/apps/client/src/widgets/containers/launcher.ts b/apps/client/src/widgets/containers/launcher.tsx similarity index 94% rename from apps/client/src/widgets/containers/launcher.ts rename to apps/client/src/widgets/containers/launcher.tsx index e1bfc5a8b..41d7fee9d 100644 --- a/apps/client/src/widgets/containers/launcher.ts +++ b/apps/client/src/widgets/containers/launcher.tsx @@ -1,9 +1,8 @@ import CalendarWidget from "../buttons/calendar.js"; import SpacerWidget from "../spacer.js"; -import BookmarkButtons from "../bookmark_buttons.js"; import ProtectedSessionStatusWidget from "../buttons/protected_session_status.js"; import SyncStatusWidget from "../sync_status.js"; -import BasicWidget from "../basic_widget.js"; +import BasicWidget, { wrapReactWidgets } from "../basic_widget.js"; import NoteLauncher from "../buttons/launcher/note_launcher.js"; import ScriptLauncher from "../buttons/launcher/script_launcher.js"; import CommandButtonWidget from "../buttons/command_button.js"; @@ -14,6 +13,7 @@ import QuickSearchLauncherWidget from "../quick_search_launcher.js"; import type FNote from "../../entities/fnote.js"; import type { CommandNames } from "../../components/app_context.js"; import AiChatButton from "../buttons/ai_chat_button.js"; +import BookmarkButtons from "../launch_bar/BookmarkButtons.jsx"; interface InnerWidget extends BasicWidget { settings?: { @@ -64,7 +64,7 @@ export default class LauncherWidget extends BasicWidget { } else if (launcherType === "customWidget") { widget = await this.initCustomWidget(note); } else if (launcherType === "builtinWidget") { - widget = this.initBuiltinWidget(note); + widget = wrapReactWidgets([ this.initBuiltinWidget(note) ])[0]; } else { throw new Error(`Unrecognized launcher type '${launcherType}' for launcher '${note.noteId}' title '${note.title}'`); } @@ -111,7 +111,7 @@ export default class LauncherWidget extends BasicWidget { return new SpacerWidget(baseSize, growthFactor); case "bookmarks": - return new BookmarkButtons(this.isHorizontalLayout); + return case "protectedSession": return new ProtectedSessionStatusWidget(); case "syncStatus": diff --git a/apps/client/src/widgets/launch_bar/BookmarkButtons.tsx b/apps/client/src/widgets/launch_bar/BookmarkButtons.tsx new file mode 100644 index 000000000..4d6abec7d --- /dev/null +++ b/apps/client/src/widgets/launch_bar/BookmarkButtons.tsx @@ -0,0 +1,5 @@ +import type { LaunchBarWidgetProps } from "./launch_bar_widget"; + +export default function BookmarkButtons({ }: LaunchBarWidgetProps) { + return

Bookmarks goes here.

; +} diff --git a/apps/client/src/widgets/launch_bar/RightDropdownButton.tsx b/apps/client/src/widgets/launch_bar/RightDropdownButton.tsx new file mode 100644 index 000000000..e47b5624c --- /dev/null +++ b/apps/client/src/widgets/launch_bar/RightDropdownButton.tsx @@ -0,0 +1,3 @@ +export default function RightDropdownButton() { + return

Button goes here.

; +} diff --git a/apps/client/src/widgets/launch_bar/launch_bar_widget.ts b/apps/client/src/widgets/launch_bar/launch_bar_widget.ts new file mode 100644 index 000000000..36284797d --- /dev/null +++ b/apps/client/src/widgets/launch_bar/launch_bar_widget.ts @@ -0,0 +1,3 @@ +export interface LaunchBarWidgetProps { + isHorizontalLayout: boolean; +}