mirror of
https://github.com/zadam/trilium.git
synced 2025-12-16 21:29:56 +01:00
refactor(widgets): relocate AI chat button
This commit is contained in:
@@ -1,16 +0,0 @@
|
||||
import FNote from "../../entities/fnote";
|
||||
import { useTriliumOptionBool } from "../react/hooks";
|
||||
import { LaunchBarActionButton, useLauncherIconAndTitle } from "./launch_bar_widgets";
|
||||
|
||||
export default function AiChatButton({ launcherNote }: { launcherNote: FNote }) {
|
||||
const [ aiEnabled ] = useTriliumOptionBool("aiEnabled");
|
||||
const { icon, title } = useLauncherIconAndTitle(launcherNote);
|
||||
|
||||
return aiEnabled && (
|
||||
<LaunchBarActionButton
|
||||
icon={icon}
|
||||
text={title}
|
||||
triggerCommand="createAiChat"
|
||||
/>
|
||||
)
|
||||
}
|
||||
@@ -8,8 +8,7 @@ import BookmarkButtons from "./BookmarkButtons";
|
||||
import ProtectedSessionStatusWidget from "./ProtectedSessionStatusWidget";
|
||||
import SyncStatus from "./SyncStatus";
|
||||
import HistoryNavigationButton from "./HistoryNavigation";
|
||||
import { CommandButton, CustomWidget, NoteLauncher, QuickSearchLauncherWidget, ScriptLauncher, TodayLauncher } from "./LauncherDefinitions";
|
||||
import AiChatButton from "./AiChatButton";
|
||||
import AiChatButton, { CommandButton, CustomWidget, NoteLauncher, QuickSearchLauncherWidget, ScriptLauncher, TodayLauncher } from "./LauncherDefinitions";
|
||||
import { useTriliumEvent } from "../react/hooks";
|
||||
|
||||
export default function LauncherContainer({ isHorizontalLayout }: { isHorizontalLayout: boolean }) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useContext, useEffect, useMemo, useState } from "preact/hooks";
|
||||
import { useLegacyWidget, useNoteContext, useNoteLabel, useNoteRelationTarget } from "../react/hooks";
|
||||
import { useLegacyWidget, useNoteContext, useNoteLabel, useNoteRelationTarget, useTriliumOptionBool } from "../react/hooks";
|
||||
import { ParentComponent } from "../react/react_utils";
|
||||
import BasicWidget from "../basic_widget";
|
||||
import FNote from "../../entities/fnote";
|
||||
@@ -70,6 +70,19 @@ export function ScriptLauncher({ launcherNote }: { launcherNote: FNote }) {
|
||||
)
|
||||
}
|
||||
|
||||
export default function AiChatButton({ launcherNote }: { launcherNote: FNote }) {
|
||||
const [ aiEnabled ] = useTriliumOptionBool("aiEnabled");
|
||||
const { icon, title } = useLauncherIconAndTitle(launcherNote);
|
||||
|
||||
return aiEnabled && (
|
||||
<LaunchBarActionButton
|
||||
icon={icon}
|
||||
text={title}
|
||||
triggerCommand="createAiChat"
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export function TodayLauncher({ launcherNote }: { launcherNote: FNote }) {
|
||||
return (
|
||||
<CustomNoteLauncher
|
||||
|
||||
Reference in New Issue
Block a user