@@ -6,11 +6,13 @@ import { ChatBoxToolbar } from "@/features/chat/components/chatBox/chatBoxToolba
66import { LanguageModelInfo , SearchScope } from "@/features/chat/types" ;
77import { useCreateNewChatThread } from "@/features/chat/useCreateNewChatThread" ;
88import { RepositoryQuery , SearchContextQuery } from "@/lib/types" ;
9- import { useState } from "react" ;
9+ import { useCallback , useState } from "react" ;
1010import { SearchModeSelector , SearchModeSelectorProps } from "./toolbar" ;
1111import { useLocalStorage } from "usehooks-ts" ;
1212import { DemoExamples } from "@/types" ;
1313import { AskSourcebotDemoCards } from "./askSourcebotDemoCards" ;
14+ import { AgenticSearchTutorialDialog } from "./agenticSearchTutorialDialog" ;
15+ import { setAgenticSearchTutorialDismissedCookie } from "@/actions" ;
1416
1517interface AgenticSearchProps {
1618 searchModeSelectorProps : SearchModeSelectorProps ;
@@ -23,6 +25,7 @@ interface AgenticSearchProps {
2325 name : string | null ;
2426 } [ ] ;
2527 demoExamples : DemoExamples | undefined ;
28+ isTutorialDismissed : boolean ;
2629}
2730
2831export const AgenticSearch = ( {
@@ -31,11 +34,18 @@ export const AgenticSearch = ({
3134 repos,
3235 searchContexts,
3336 demoExamples,
37+ isTutorialDismissed,
3438} : AgenticSearchProps ) => {
3539 const { createNewChatThread, isLoading } = useCreateNewChatThread ( ) ;
3640 const [ selectedSearchScopes , setSelectedSearchScopes ] = useLocalStorage < SearchScope [ ] > ( "selectedSearchScopes" , [ ] , { initializeWithValue : false } ) ;
3741 const [ isContextSelectorOpen , setIsContextSelectorOpen ] = useState ( false ) ;
3842
43+ const [ isTutorialOpen , setIsTutorialOpen ] = useState ( ! isTutorialDismissed ) ;
44+ const onTutorialDismissed = useCallback ( ( ) => {
45+ setIsTutorialOpen ( false ) ;
46+ setAgenticSearchTutorialDismissedCookie ( true ) ;
47+ } , [ ] ) ;
48+
3949 return (
4050 < div className = "flex flex-col items-center w-full" >
4151 < div className = "mt-4 w-full border rounded-md shadow-sm max-w-[800px]" >
@@ -75,6 +85,12 @@ export const AgenticSearch = ({
7585 demoExamples = { demoExamples }
7686 />
7787 ) }
88+
89+ { isTutorialOpen && (
90+ < AgenticSearchTutorialDialog
91+ onClose = { onTutorialDismissed }
92+ />
93+ ) }
7894 </ div >
7995 )
8096}
0 commit comments