feat(ui): bring back quick launcher (#5144)

Signed-off-by: Abhijay007 <Abhijay007j@gmail.com>
Co-authored-by: Alex Hancock <alexhancock@block.xyz>
This commit is contained in:
Abhijay Jain
2025-11-06 21:05:31 +05:30
committed by GitHub
parent 803bb78308
commit 0a4cf49064
5 changed files with 191 additions and 45 deletions
+9 -2
View File
@@ -32,7 +32,11 @@ interface BaseChatProps {
renderHeader?: () => React.ReactNode;
customChatInputProps?: Record<string, unknown>;
customMainLayoutProps?: Record<string, unknown>;
contentClassName?: string;
disableSearch?: boolean;
showPopularTopics?: boolean;
suppressEmptyState: boolean;
autoSubmit?: boolean;
sessionId: string;
initialMessage?: string;
}
@@ -44,6 +48,7 @@ function BaseChatContent({
customMainLayoutProps = {},
sessionId,
initialMessage,
autoSubmit = false,
}: BaseChatProps) {
const location = useLocation();
const scrollRef = useRef<ScrollAreaHandle>(null);
@@ -186,7 +191,9 @@ function BaseChatContent({
name: session?.name || 'No Session',
};
const initialPrompt = messages.length == 0 && recipe?.prompt ? recipe.prompt : '';
const initialPrompt =
initialMessage || (messages.length == 0 && recipe?.prompt ? recipe.prompt : '');
const shouldAutoSubmit = autoSubmit || !!initialMessage;
return (
<div className="h-full flex flex-col min-h-0">
@@ -299,7 +306,7 @@ function BaseChatContent({
recipeAccepted={!hasNotAcceptedRecipe}
initialPrompt={initialPrompt}
toolCount={toolCount || 0}
autoSubmit={false}
autoSubmit={shouldAutoSubmit}
{...customChatInputProps}
/>
</div>
@@ -0,0 +1,44 @@
import { useRef, useState } from 'react';
export default function LauncherView() {
const [query, setQuery] = useState('');
const inputRef = useRef<HTMLInputElement>(null);
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
if (query.trim()) {
// Create a new chat window with the query
const workingDir = window.appConfig?.get('GOOSE_WORKING_DIR') as string;
window.electron.createChatWindow(query, workingDir);
setQuery('');
// Don't manually close - the blur handler will close the launcher when the new window takes focus
}
};
const handleKeyDown = (e: React.KeyboardEvent) => {
// Close on Escape
if (e.key === 'Escape') {
window.electron.closeWindow();
}
};
return (
<div className="h-screen w-screen flex bg-transparent overflow-hidden">
<form
onSubmit={handleSubmit}
className="w-full h-full bg-background-default/95 backdrop-blur-lg shadow-2xl border border-border-default"
>
<input
ref={inputRef}
type="text"
value={query}
onChange={(e) => setQuery(e.target.value)}
onKeyDown={handleKeyDown}
className="w-full h-full bg-transparent text-text-default text-xl px-6 outline-none placeholder-text-muted"
placeholder="Ask goose anything..."
autoFocus
/>
</form>
</div>
);
}