diff --git a/apps/client/src/widgets/buttons/ai_chat_button.ts b/apps/client/src/widgets/buttons/ai_chat_button.ts
deleted file mode 100644
index 5ad3f8033..000000000
--- a/apps/client/src/widgets/buttons/ai_chat_button.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import type { EventData } from "../../components/app_context.js";
-import type FNote from "../../entities/fnote.js";
-import options from "../../services/options.js";
-import CommandButtonWidget from "./command_button.js";
-
-export default class AiChatButton extends CommandButtonWidget {
-
- constructor(note: FNote) {
- super();
-
- this.command("createAiChat")
- .title(() => note.title)
- .icon(() => note.getIcon())
- .class("launcher-button");
- }
-
- isEnabled() {
- return options.get("aiEnabled") === "true";
- }
-
- entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
- if (loadResults.isOptionReloaded("aiEnabled")) {
- this.refresh();
- }
- }
-}
diff --git a/apps/client/src/widgets/containers/launcher.tsx b/apps/client/src/widgets/containers/launcher.tsx
index fbc40fe2c..19a46fbf0 100644
--- a/apps/client/src/widgets/containers/launcher.tsx
+++ b/apps/client/src/widgets/containers/launcher.tsx
@@ -10,10 +10,10 @@ import TodayLauncher from "../buttons/launcher/today_launcher.js";
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";
import SpacerWidget from "../launch_bar/SpacerWidget.jsx";
import HistoryNavigationButton from "../launch_bar/HistoryNavigation.jsx";
+import AiChatButton from "../launch_bar/AiChatButton.jsx";
interface InnerWidget extends BasicWidget {
settings?: {
@@ -125,7 +125,7 @@ export default class LauncherWidget extends BasicWidget {
case "quickSearch":
return new QuickSearchLauncherWidget(this.isHorizontalLayout);
case "aiChatLauncher":
- return new AiChatButton(note);
+ return
default:
throw new Error(`Unrecognized builtin widget ${builtinWidget} for launcher ${note.noteId} "${note.title}"`);
}
diff --git a/apps/client/src/widgets/launch_bar/AiChatButton.tsx b/apps/client/src/widgets/launch_bar/AiChatButton.tsx
new file mode 100644
index 000000000..2ca95069a
--- /dev/null
+++ b/apps/client/src/widgets/launch_bar/AiChatButton.tsx
@@ -0,0 +1,18 @@
+import FNote from "../../entities/fnote";
+import { escapeHtml } from "../../services/utils";
+import { useNoteLabel, useNoteProperty, useTriliumOptionBool } from "../react/hooks";
+import { LaunchBarActionButton } from "./launch_bar_widgets";
+
+export default function AiChatButton({ launcherNote }: { launcherNote: FNote }) {
+ const [ aiEnabled ] = useTriliumOptionBool("aiEnabled");
+ const [ iconClass ] = useNoteLabel(launcherNote, "iconClass");
+ const title = useNoteProperty(launcherNote, "title");
+
+ return aiEnabled && iconClass && title && (
+
+ )
+}