@@ -6,12 +6,13 @@ import { ChatBoxToolbar } from "@/features/chat/components/chatBox/chatBoxToolba
6
6
import { LanguageModelInfo , SearchScope } from "@/features/chat/types" ;
7
7
import { useCreateNewChatThread } from "@/features/chat/useCreateNewChatThread" ;
8
8
import { RepositoryQuery , SearchContextQuery } from "@/lib/types" ;
9
- import { useState } from "react" ;
9
+ import { useCallback , useState } from "react" ;
10
10
import { SearchModeSelector , SearchModeSelectorProps } from "./toolbar" ;
11
11
import { useLocalStorage } from "usehooks-ts" ;
12
12
import { DemoExamples } from "@/types" ;
13
13
import { AskSourcebotDemoCards } from "./askSourcebotDemoCards" ;
14
- import { AskSourcebotTutorial } from "./askSourcebotTutorial" ;
14
+ import { AgenticSearchTutorialDialog } from "./agenticSearchTutorialDialog" ;
15
+ import { setAgenticSearchTutorialDismissedCookie } from "@/actions" ;
15
16
16
17
interface AgenticSearchProps {
17
18
searchModeSelectorProps : SearchModeSelectorProps ;
@@ -24,6 +25,7 @@ interface AgenticSearchProps {
24
25
name : string | null ;
25
26
} [ ] ;
26
27
demoExamples : DemoExamples | undefined ;
28
+ isTutorialDismissed : boolean ;
27
29
}
28
30
29
31
export const AgenticSearch = ( {
@@ -32,11 +34,17 @@ export const AgenticSearch = ({
32
34
repos,
33
35
searchContexts,
34
36
demoExamples,
37
+ isTutorialDismissed,
35
38
} : AgenticSearchProps ) => {
36
39
const { createNewChatThread, isLoading } = useCreateNewChatThread ( ) ;
37
40
const [ selectedSearchScopes , setSelectedSearchScopes ] = useLocalStorage < SearchScope [ ] > ( "selectedSearchScopes" , [ ] , { initializeWithValue : false } ) ;
38
41
const [ isContextSelectorOpen , setIsContextSelectorOpen ] = useState ( false ) ;
39
- const [ isTutorialOpen , setIsTutorialOpen ] = useState ( true ) ;
42
+
43
+ const [ isTutorialOpen , setIsTutorialOpen ] = useState ( ! isTutorialDismissed ) ;
44
+ const onTutorialDismissed = useCallback ( ( ) => {
45
+ setIsTutorialOpen ( false ) ;
46
+ setAgenticSearchTutorialDismissedCookie ( true ) ;
47
+ } , [ ] ) ;
40
48
41
49
return (
42
50
< div className = "flex flex-col items-center w-full" >
@@ -78,10 +86,11 @@ export const AgenticSearch = ({
78
86
/>
79
87
) }
80
88
81
- < AskSourcebotTutorial
82
- isOpen = { isTutorialOpen }
83
- onClose = { ( ) => setIsTutorialOpen ( false ) }
84
- />
89
+ { isTutorialOpen && (
90
+ < AgenticSearchTutorialDialog
91
+ onClose = { onTutorialDismissed }
92
+ />
93
+ ) }
85
94
</ div >
86
95
)
87
96
}
0 commit comments