mirror of
https://github.com/zadam/trilium.git
synced 2025-12-04 14:34:24 +01:00
chore(react/launch_bar): get launch bar to render React widgets
This commit is contained in:
parent
b8585594cd
commit
1af6200655
@ -1,9 +1,8 @@
|
|||||||
import CalendarWidget from "../buttons/calendar.js";
|
import CalendarWidget from "../buttons/calendar.js";
|
||||||
import SpacerWidget from "../spacer.js";
|
import SpacerWidget from "../spacer.js";
|
||||||
import BookmarkButtons from "../bookmark_buttons.js";
|
|
||||||
import ProtectedSessionStatusWidget from "../buttons/protected_session_status.js";
|
import ProtectedSessionStatusWidget from "../buttons/protected_session_status.js";
|
||||||
import SyncStatusWidget from "../sync_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 NoteLauncher from "../buttons/launcher/note_launcher.js";
|
||||||
import ScriptLauncher from "../buttons/launcher/script_launcher.js";
|
import ScriptLauncher from "../buttons/launcher/script_launcher.js";
|
||||||
import CommandButtonWidget from "../buttons/command_button.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 FNote from "../../entities/fnote.js";
|
||||||
import type { CommandNames } from "../../components/app_context.js";
|
import type { CommandNames } from "../../components/app_context.js";
|
||||||
import AiChatButton from "../buttons/ai_chat_button.js";
|
import AiChatButton from "../buttons/ai_chat_button.js";
|
||||||
|
import BookmarkButtons from "../launch_bar/BookmarkButtons.jsx";
|
||||||
|
|
||||||
interface InnerWidget extends BasicWidget {
|
interface InnerWidget extends BasicWidget {
|
||||||
settings?: {
|
settings?: {
|
||||||
@ -64,7 +64,7 @@ export default class LauncherWidget extends BasicWidget {
|
|||||||
} else if (launcherType === "customWidget") {
|
} else if (launcherType === "customWidget") {
|
||||||
widget = await this.initCustomWidget(note);
|
widget = await this.initCustomWidget(note);
|
||||||
} else if (launcherType === "builtinWidget") {
|
} else if (launcherType === "builtinWidget") {
|
||||||
widget = this.initBuiltinWidget(note);
|
widget = wrapReactWidgets<BasicWidget>([ this.initBuiltinWidget(note) ])[0];
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Unrecognized launcher type '${launcherType}' for launcher '${note.noteId}' title '${note.title}'`);
|
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);
|
return new SpacerWidget(baseSize, growthFactor);
|
||||||
case "bookmarks":
|
case "bookmarks":
|
||||||
return new BookmarkButtons(this.isHorizontalLayout);
|
return <BookmarkButtons isHorizontalLayout={this.isHorizontalLayout} />
|
||||||
case "protectedSession":
|
case "protectedSession":
|
||||||
return new ProtectedSessionStatusWidget();
|
return new ProtectedSessionStatusWidget();
|
||||||
case "syncStatus":
|
case "syncStatus":
|
||||||
5
apps/client/src/widgets/launch_bar/BookmarkButtons.tsx
Normal file
5
apps/client/src/widgets/launch_bar/BookmarkButtons.tsx
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import type { LaunchBarWidgetProps } from "./launch_bar_widget";
|
||||||
|
|
||||||
|
export default function BookmarkButtons({ }: LaunchBarWidgetProps) {
|
||||||
|
return <p>Bookmarks goes here.</p>;
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
export default function RightDropdownButton() {
|
||||||
|
return <p>Button goes here.</p>;
|
||||||
|
}
|
||||||
3
apps/client/src/widgets/launch_bar/launch_bar_widget.ts
Normal file
3
apps/client/src/widgets/launch_bar/launch_bar_widget.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export interface LaunchBarWidgetProps {
|
||||||
|
isHorizontalLayout: boolean;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user