From d575f176310929b0aae55984e9dc1deb502c403c Mon Sep 17 00:00:00 2001 From: Kylejeong2 Date: Mon, 29 Sep 2025 10:59:18 -0700 Subject: [PATCH 1/2] update urls, ts ignore fix --- app/api/session/route.ts | 2 +- app/components/NavBar.tsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/api/session/route.ts b/app/api/session/route.ts index 41f11c6..0965b60 100644 --- a/app/api/session/route.ts +++ b/app/api/session/route.ts @@ -86,7 +86,7 @@ async function createSession(timezone?: string) { width: 2560, height: 1440, }, - // @ts-ignore + // @ts-expect-error - os is not a valid property os: "windows", blockAds: true, advancedStealth: true diff --git a/app/components/NavBar.tsx b/app/components/NavBar.tsx index 2e94247..a170cb8 100644 --- a/app/components/NavBar.tsx +++ b/app/components/NavBar.tsx @@ -31,7 +31,7 @@ export default function NavBar({ >
@@ -69,7 +69,7 @@ export default function NavBar({ {showGitHubButton && ( From dcecf5225c13c620aabe9753e4da951601d5f0dd Mon Sep 17 00:00:00 2001 From: Kylejeong2 Date: Fri, 3 Oct 2025 18:18:46 -0700 Subject: [PATCH 2/2] added query param parsing to instatiate chatfeed with query params --- app/page.tsx | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/app/page.tsx b/app/page.tsx index 5a0059c..32a7660 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -2,6 +2,7 @@ import { useState, useEffect, useCallback, useRef } from "react"; import { AnimatePresence, motion } from "framer-motion"; +import { useSearchParams } from "next/navigation"; import AnimatedButton from "./components/ui/AnimatedButton"; import posthog from "posthog-js"; import ChatFeed from "./components/ChatFeed"; @@ -47,10 +48,30 @@ const Tooltip = ({ }; export default function Home() { - const [isChatVisible, setIsChatVisible] = useState(false); - const [initialMessage, setInitialMessage] = useState(null); + const searchParams = useSearchParams(); + const rawChatParam = searchParams.get("chat"); + const chatParam = rawChatParam?.replace(/^["']|["']$/g, '') || null; + + const [isChatVisible, setIsChatVisible] = useState(() => !!chatParam); + const [initialMessage, setInitialMessage] = useState(() => chatParam); const inputRef = useRef(null); + const startChat = useCallback( + (finalMessage: string) => { + setInitialMessage(finalMessage); + setIsChatVisible(true); + + try { + posthog.capture("google_cua_submit_message", { + message: finalMessage, + }); + } catch (e) { + console.error(e); + } + }, + [] + ); + useEffect(() => { const handleKeyDown = (e: KeyboardEvent) => { // Handle CMD+Enter to submit the form when chat is not visible @@ -84,22 +105,6 @@ export default function Home() { return () => window.removeEventListener("keydown", handleKeyDown); }, [isChatVisible]); - const startChat = useCallback( - (finalMessage: string) => { - setInitialMessage(finalMessage); - setIsChatVisible(true); - - try { - posthog.capture("google_cua_submit_message", { - message: finalMessage, - }); - } catch (e) { - console.error(e); - } - }, - [setInitialMessage, setIsChatVisible] - ); - return ( {!isChatVisible ? (