diff --git a/apps/sim/app/(landing)/components/hero/hero.tsx b/apps/sim/app/(landing)/components/hero/hero.tsx
index 154edbe7fa..7169925df1 100644
--- a/apps/sim/app/(landing)/components/hero/hero.tsx
+++ b/apps/sim/app/(landing)/components/hero/hero.tsx
@@ -32,6 +32,7 @@ import {
StripeIcon,
SupabaseIcon,
} from '@/components/icons'
+import { LandingPromptStorage } from '@/lib/browser-storage'
import { soehne } from '@/app/fonts/soehne/soehne'
import {
CARD_WIDTH,
@@ -271,6 +272,7 @@ export default function Hero() {
*/
const handleSubmit = () => {
if (!isEmpty) {
+ LandingPromptStorage.store(textValue)
router.push('/signup')
}
}
diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/welcome/welcome.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/welcome/welcome.tsx
index 79415b13ad..84aafbbd03 100644
--- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/welcome/welcome.tsx
+++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/components/welcome/welcome.tsx
@@ -1,6 +1,6 @@
'use client'
-import { Blocks, Bot, LibraryBig, Workflow } from 'lucide-react'
+import { Blocks, LibraryBig, Workflow } from 'lucide-react'
interface CopilotWelcomeProps {
onQuestionClick?: (question: string) => void
@@ -59,7 +59,6 @@ export function CopilotWelcome({ onQuestionClick, mode = 'ask' }: CopilotWelcome
{/* Header */}
-
{subtitle}
diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx
index 8bfa7a0e6e..1665032e7a 100644
--- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx
+++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/copilot/copilot.tsx
@@ -30,6 +30,7 @@ interface CopilotProps {
interface CopilotRef {
createNewChat: () => void
+ setInputValueAndFocus: (value: string) => void
}
export const Copilot = forwardRef
(({ panelWidth }, ref) => {
@@ -326,13 +327,24 @@ export const Copilot = forwardRef(({ panelWidth }, ref
}, 100) // Small delay to ensure DOM updates are complete
}, [createNewChat])
+ const handleSetInputValueAndFocus = useCallback(
+ (value: string) => {
+ setInputValue(value)
+ setTimeout(() => {
+ userInputRef.current?.focus()
+ }, 150)
+ },
+ [setInputValue]
+ )
+
// Expose functions to parent
useImperativeHandle(
ref,
() => ({
createNewChat: handleStartNewChat,
+ setInputValueAndFocus: handleSetInputValueAndFocus,
}),
- [handleStartNewChat]
+ [handleStartNewChat, handleSetInputValueAndFocus]
)
// Handle abort action
diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx
index 6c26be1b9b..e0d2a7a51c 100644
--- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx
+++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx
@@ -9,6 +9,7 @@ import {
} from '@/components/ui/dropdown-menu'
import { ScrollArea } from '@/components/ui/scroll-area'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
+import { LandingPromptStorage } from '@/lib/browser-storage'
import { createLogger } from '@/lib/logs/console/logger'
import { useCopilotStore } from '@/stores/copilot/store'
import { useChatStore } from '@/stores/panel/chat/store'
@@ -31,6 +32,7 @@ export function Panel() {
const [resizeStartWidth, setResizeStartWidth] = useState(0)
const copilotRef = useRef<{
createNewChat: () => void
+ setInputValueAndFocus: (value: string) => void
}>(null)
const lastLoadedWorkflowRef = useRef(null)
@@ -289,17 +291,40 @@ export function Panel() {
}
}, [activeWorkflowId, copilotWorkflowId, ensureCopilotDataLoaded])
+ useEffect(() => {
+ const storedPrompt = LandingPromptStorage.consume()
+
+ if (storedPrompt && storedPrompt.trim().length > 0) {
+ setActiveTab('copilot')
+ if (!isOpen) {
+ togglePanel()
+ }
+
+ setTimeout(() => {
+ if (copilotRef.current) {
+ copilotRef.current.setInputValueAndFocus(storedPrompt)
+ } else {
+ setTimeout(() => {
+ if (copilotRef.current) {
+ copilotRef.current.setInputValueAndFocus(storedPrompt)
+ }
+ }, 500)
+ }
+ }, 200)
+ }
+ }, []) // eslint-disable-line react-hooks/exhaustive-deps -- Run only on mount
+
return (
<>
{/* Tab Selector - Always visible */}