diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 52637695e6..6dc1a88584 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -1026,6 +1026,10 @@ export default function ChatView({ threadId }: ChatViewProps) { () => shortcutLabelForCommand(keybindings, "terminal.split"), [keybindings], ); + const terminalToggleShortcutLabel = useMemo( + () => shortcutLabelForCommand(keybindings, "terminal.toggle"), + [keybindings], + ); const newTerminalShortcutLabel = useMemo( () => shortcutLabelForCommand(keybindings, "terminal.new"), [keybindings], @@ -3238,6 +3242,9 @@ export default function ChatView({ threadId }: ChatViewProps) { } keybindings={keybindings} availableEditors={availableEditors} + terminalAvailable={activeProject !== undefined} + terminalOpen={terminalState.terminalOpen} + terminalToggleShortcutLabel={terminalToggleShortcutLabel} diffToggleShortcutLabel={diffPanelShortcutLabel} gitCwd={gitCwd} diffOpen={diffOpen} @@ -3247,6 +3254,7 @@ export default function ChatView({ threadId }: ChatViewProps) { onAddProjectScript={saveProjectScript} onUpdateProjectScript={updateProjectScript} onDeleteProjectScript={deleteProjectScript} + onToggleTerminal={toggleTerminalVisibility} onToggleDiff={onToggleDiff} /> diff --git a/apps/web/src/components/chat/ChatHeader.tsx b/apps/web/src/components/chat/ChatHeader.tsx index ea7f911bec..39a4f6eedc 100644 --- a/apps/web/src/components/chat/ChatHeader.tsx +++ b/apps/web/src/components/chat/ChatHeader.tsx @@ -6,7 +6,7 @@ import { } from "@t3tools/contracts"; import { memo } from "react"; import GitActionsControl from "../GitActionsControl"; -import { DiffIcon } from "lucide-react"; +import { DiffIcon, TerminalSquareIcon } from "lucide-react"; import { Badge } from "../ui/badge"; import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip"; import ProjectScriptsControl, { type NewProjectScriptInput } from "../ProjectScriptsControl"; @@ -24,6 +24,9 @@ interface ChatHeaderProps { preferredScriptId: string | null; keybindings: ResolvedKeybindingsConfig; availableEditors: ReadonlyArray; + terminalAvailable: boolean; + terminalOpen: boolean; + terminalToggleShortcutLabel: string | null; diffToggleShortcutLabel: string | null; gitCwd: string | null; diffOpen: boolean; @@ -31,6 +34,7 @@ interface ChatHeaderProps { onAddProjectScript: (input: NewProjectScriptInput) => Promise; onUpdateProjectScript: (scriptId: string, input: NewProjectScriptInput) => Promise; onDeleteProjectScript: (scriptId: string) => Promise; + onToggleTerminal: () => void; onToggleDiff: () => void; } @@ -44,6 +48,9 @@ export const ChatHeader = memo(function ChatHeader({ preferredScriptId, keybindings, availableEditors, + terminalAvailable, + terminalOpen, + terminalToggleShortcutLabel, diffToggleShortcutLabel, gitCwd, diffOpen, @@ -51,6 +58,7 @@ export const ChatHeader = memo(function ChatHeader({ onAddProjectScript, onUpdateProjectScript, onDeleteProjectScript, + onToggleTerminal, onToggleDiff, }: ChatHeaderProps) { return ( @@ -94,6 +102,30 @@ export const ChatHeader = memo(function ChatHeader({ /> )} {activeProjectName && } + + + + + } + /> + + {!terminalAvailable + ? "Terminal is unavailable until this thread has an active project." + : terminalToggleShortcutLabel + ? `Toggle terminal drawer (${terminalToggleShortcutLabel})` + : "Toggle terminal drawer"} + +