mirror of
https://github.com/TriliumNext/Trilium.git
synced 2025-12-11 19:44:00 -06:00
refactor(widgets): relocate AI chat button
This commit is contained in:
parent
83e599f0e9
commit
f5f38ca670
@ -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 ProtectedSessionStatusWidget from "./ProtectedSessionStatusWidget";
|
||||||
import SyncStatus from "./SyncStatus";
|
import SyncStatus from "./SyncStatus";
|
||||||
import HistoryNavigationButton from "./HistoryNavigation";
|
import HistoryNavigationButton from "./HistoryNavigation";
|
||||||
import { CommandButton, CustomWidget, NoteLauncher, QuickSearchLauncherWidget, ScriptLauncher, TodayLauncher } from "./LauncherDefinitions";
|
import AiChatButton, { CommandButton, CustomWidget, NoteLauncher, QuickSearchLauncherWidget, ScriptLauncher, TodayLauncher } from "./LauncherDefinitions";
|
||||||
import AiChatButton from "./AiChatButton";
|
|
||||||
import { useTriliumEvent } from "../react/hooks";
|
import { useTriliumEvent } from "../react/hooks";
|
||||||
|
|
||||||
export default function LauncherContainer({ isHorizontalLayout }: { isHorizontalLayout: boolean }) {
|
export default function LauncherContainer({ isHorizontalLayout }: { isHorizontalLayout: boolean }) {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { useContext, useEffect, useMemo, useState } from "preact/hooks";
|
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 { ParentComponent } from "../react/react_utils";
|
||||||
import BasicWidget from "../basic_widget";
|
import BasicWidget from "../basic_widget";
|
||||||
import FNote from "../../entities/fnote";
|
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 }) {
|
export function TodayLauncher({ launcherNote }: { launcherNote: FNote }) {
|
||||||
return (
|
return (
|
||||||
<CustomNoteLauncher
|
<CustomNoteLauncher
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user