[eric] onboarding: flip starters back to click-to-open (drop hover preview), click opens the composer prefilled + translucent

This commit is contained in:
ciregenz
2026-06-11 01:49:30 -07:00
parent 6beace94a4
commit 351c055794
3 changed files with 12 additions and 30 deletions
@@ -73,7 +73,7 @@ interface DashboardCanvasProps {
onNewAgent: () => void;
onToolbarCancel: () => void;
onToolbarSend: (...args: any[]) => void;
onStarter: (action: 'hover' | 'leave' | 'commit', prompt?: string) => void;
onStarter: (prompt: string) => void;
toolbarPrefill?: string;
onAddView: (outputId: string) => void;
onHistoryResume: (sessionId: string) => void;
@@ -62,9 +62,8 @@ const STARTER_CATEGORIES: StarterCategory[] = [
const DashboardEmptyState: React.FC<{
c: ClaudeTokens;
onLaunch?: (prompt: string, mode: string, model: string) => void;
// hover = preview-open the composer (translucent), leave = close it,
// commit = lock it open so the user can move to send.
onStarter?: (action: 'hover' | 'leave' | 'commit', prompt?: string) => void;
// Open the composer with the prompt typed in (translucent, unsent) on click.
onStarter?: (prompt: string) => void;
}> = ({ c, onLaunch, onStarter }) => {
// The host hides Dashboard with visibility:hidden (not display:none), which keeps
// CSS animations ticking; gate on active so the shimmer only burns while watched.
@@ -84,7 +83,7 @@ const DashboardEmptyState: React.FC<{
const isAppBuilder = currentCategory?.target === 'app-builder';
// Click commits the query into the composer (locks it open); the user then sends.
// Click opens the composer with the prompt typed in (unsent); the user then sends.
const launch = (prompt: string) => {
if (launching) return;
if (isAppBuilder) {
@@ -92,7 +91,7 @@ const DashboardEmptyState: React.FC<{
return;
}
if (onStarter) {
onStarter('commit', prompt);
onStarter(prompt);
return;
}
if (!onLaunch) return;
@@ -202,16 +201,12 @@ const DashboardEmptyState: React.FC<{
>
<ArrowLeft size={15} /> back
</Box>
<Box
onMouseLeave={() => { if (!isAppBuilder) onStarter?.('leave'); }}
sx={{ display: 'flex', flexDirection: 'column', gap: 0.9, width: '100%', maxWidth: 480 }}
>
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 0.9, width: '100%', maxWidth: 480 }}>
{currentPrompts.map((prompt) => (
<Box
component="button"
key={prompt}
onClick={() => launch(prompt)}
onMouseEnter={() => { if (!isAppBuilder) onStarter?.('hover', prompt); }}
disabled={launching}
sx={{
textAlign: 'left',
@@ -159,28 +159,15 @@ export function useDashboardController(dashboardId: string, isActive: boolean) {
setSearchPaletteOpen,
});
// Starter-prompt preview: HOVER opens the composer with the prompt typed in
// (translucent, unsent); leaving closes it again; CLICK locks it open so the
// user can move to the send button without it vanishing. Then they hit send.
// Starter-prompt click: opens the composer with the prompt typed in (translucent,
// unsent), so the user reviews and hits send. Cleared when the composer closes.
const [toolbarPrefill, setToolbarPrefill] = useState<string | undefined>(undefined);
const starterLockedRef = useRef(false);
const handleStarter = useCallback((action: 'hover' | 'leave' | 'commit', prompt?: string) => {
if (action === 'hover' && prompt) {
setToolbarPrefill(prompt);
setToolbarOpen(true);
} else if (action === 'commit' && prompt) {
starterLockedRef.current = true;
setToolbarPrefill(prompt);
setToolbarOpen(true);
} else if (action === 'leave' && !starterLockedRef.current) {
setToolbarOpen(false);
}
const handleStarter = useCallback((prompt: string) => {
setToolbarPrefill(prompt);
setToolbarOpen(true);
}, [setToolbarOpen]);
useEffect(() => {
if (!toolbarOpen) {
starterLockedRef.current = false;
if (toolbarPrefill) setToolbarPrefill(undefined);
}
if (!toolbarOpen && toolbarPrefill) setToolbarPrefill(undefined);
}, [toolbarOpen, toolbarPrefill]);
useDashboardClipboard({