From 81ad52f5bcc910a2ad185cc9b3f052fce66f490c Mon Sep 17 00:00:00 2001 From: chihlasm Date: Thu, 2 Apr 2026 17:33:57 +0000 Subject: [PATCH] feat: add launch view preference toggle to StartSessionInput Co-Authored-By: Claude Opus 4.6 (1M context) --- .../dashboard/StartSessionInput.tsx | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/dashboard/StartSessionInput.tsx b/frontend/src/components/dashboard/StartSessionInput.tsx index 4b32c2ca..f93175ac 100644 --- a/frontend/src/components/dashboard/StartSessionInput.tsx +++ b/frontend/src/components/dashboard/StartSessionInput.tsx @@ -6,6 +6,8 @@ import { cn } from '@/lib/utils' import { uploadsApi } from '@/api/uploads' import { toast } from '@/lib/toast' import type { PendingUpload } from '@/types/upload' +import { useFeatureFlag } from '@/hooks/useFeatureFlag' +import { useUserPreferencesStore } from '@/store/userPreferencesStore' const SUGGESTIONS: { icon: LucideIcon; label: string }[] = [ { icon: Globe, label: 'VPN not connecting' }, @@ -25,6 +27,9 @@ export function StartSessionInput() { const [pendingUploads, setPendingUploads] = useState([]) const [isDragOver, setIsDragOver] = useState(false) const navigate = useNavigate() + const hasCockpit = useFeatureFlag('flowpilot_cockpit') + const preferredView = useUserPreferencesStore(s => s.preferredFlowPilotView) + const setPreferredView = useUserPreferencesStore(s => s.setPreferredFlowPilotView) const textareaRef = useRef(null) const fileInputRef = useRef(null) const dragCounterRef = useRef(0) @@ -52,7 +57,8 @@ export function StartSessionInput() { if (completedUploadIds.length > 0) { state.uploadIds = completedUploadIds } - navigate('/assistant', { state }) + const target = hasCockpit && preferredView === 'cockpit' ? '/cockpit' : '/assistant' + navigate(target, { state }) } const handleKeyDown = (e: React.KeyboardEvent) => { @@ -63,7 +69,8 @@ export function StartSessionInput() { } const handleSuggestionClick = (suggestion: string) => { - navigate('/assistant', { state: { prefill: suggestion } }) + const target = hasCockpit && preferredView === 'cockpit' ? '/cockpit' : '/assistant' + navigate(target, { state: { prefill: suggestion } }) } // ── File handling ────────────────────────────── @@ -319,6 +326,36 @@ export function StartSessionInput() { )} + {/* View preference toggle */} + {hasCockpit && ( +
+ + +
+ )} + {/* Send button */}