Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(react/launch_bar): get launch bar to render React widgets
Elian Doran1af62006550d
diff --git a/apps/client/src/widgets/containers/launcher.ts b/apps/client/src/widgets/containers/launcher.tsxsimilarity index 94%rename from apps/client/src/widgets/containers/launcher.tsrename to apps/client/src/widgets/containers/launcher.tsxindex e1bfc5a8b9..41d7fee9de 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<BasicWidget>([ 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 <BookmarkButtons isHorizontalLayout={this.isHorizontalLayout} />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.tsxnew file mode 100644index 0000000000..4d6abec7df--- /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 <p>Bookmarks goes here.</p>;+}diff --git a/apps/client/src/widgets/launch_bar/RightDropdownButton.tsx b/apps/client/src/widgets/launch_bar/RightDropdownButton.tsxnew file mode 100644index 0000000000..e47b5624cf--- /dev/null+++ b/apps/client/src/widgets/launch_bar/RightDropdownButton.tsx@@ -0,0 +1,3 @@+export default function RightDropdownButton() {+ return <p>Button goes here.</p>;+}diff --git a/apps/client/src/widgets/launch_bar/launch_bar_widget.ts b/apps/client/src/widgets/launch_bar/launch_bar_widget.tsnew file mode 100644index 0000000000..36284797d5--- /dev/null+++ b/apps/client/src/widgets/launch_bar/launch_bar_widget.ts@@ -0,0 +1,3 @@+export interface LaunchBarWidgetProps {+ isHorizontalLayout: boolean;+}