@@ -6,7 +6,7 @@ import { Search, LibraryBigIcon, Code, Info } from "lucide-react";
66import { Badge } from "@/components/ui/badge" ;
77import { Card } from "@/components/ui/card" ;
88import { CardContent } from "@/components/ui/card" ;
9- import { DemoExamples , DemoSearchExample , DemoSearchContext } from "@/types" ;
9+ import { DemoExamples , DemoSearchExample , DemoSearchScope } from "@/types" ;
1010import { cn , getCodeHostIcon } from "@/lib/utils" ;
1111import useCaptureEvent from "@/hooks/useCaptureEvent" ;
1212import { SearchScopeInfoCard } from "@/components/searchScopeInfoCard" ;
@@ -19,7 +19,7 @@ export const AskSourcebotDemoCards = ({
1919 demoExamples,
2020} : AskSourcebotDemoCardsProps ) => {
2121 const captureEvent = useCaptureEvent ( ) ;
22- const [ selectedFilterContext , setSelectedFilterContext ] = useState < number | null > ( null ) ;
22+ const [ selectedFilterSearchScope , setSelectedFilterSearchScope ] = useState < number | null > ( null ) ;
2323
2424 const handleExampleClick = ( example : DemoSearchExample ) => {
2525 captureEvent ( 'wa_demo_search_example_card_pressed' , {
@@ -32,16 +32,16 @@ export const AskSourcebotDemoCards = ({
3232 }
3333 }
3434
35- const getContextIcon = ( context : DemoSearchContext , size : number = 20 , isSelected : boolean = false ) => {
35+ const getSearchScopeIcon = ( searchScope : DemoSearchScope , size : number = 20 , isSelected : boolean = false ) => {
3636 const sizeClass = size === 12 ? "h-3 w-3" : "h-5 w-5" ;
3737 const colorClass = isSelected ? "text-primary-foreground" : "text-muted-foreground" ;
3838
39- if ( context . type === "set " ) {
39+ if ( searchScope . type === "reposet " ) {
4040 return < LibraryBigIcon className = { cn ( sizeClass , colorClass ) } /> ;
4141 }
4242
43- if ( context . codeHostType ) {
44- const codeHostIcon = getCodeHostIcon ( context . codeHostType ) ;
43+ if ( searchScope . codeHostType ) {
44+ const codeHostIcon = getCodeHostIcon ( searchScope . codeHostType ) ;
4545 if ( codeHostIcon ) {
4646 // When selected, icons need to match the inverted badge colors
4747 // In light mode selected: light icon on dark bg (invert)
@@ -53,7 +53,7 @@ export const AskSourcebotDemoCards = ({
5353 return (
5454 < Image
5555 src = { codeHostIcon . src }
56- alt = { `${ context . codeHostType } icon` }
56+ alt = { `${ searchScope . codeHostType } icon` }
5757 width = { size }
5858 height = { size }
5959 className = { cn ( sizeClass , selectedIconClass ) }
@@ -92,7 +92,7 @@ export const AskSourcebotDemoCards = ({
9292 </ div >
9393 </ div >
9494
95- { /* Search Context Filter */ }
95+ { /* Search Scope Filter */ }
9696 < div className = "flex flex-wrap items-center justify-center gap-2 mb-6" >
9797 < div className = "flex items-center gap-2 mr-2" >
9898 < div className = "relative group" >
@@ -102,42 +102,42 @@ export const AskSourcebotDemoCards = ({
102102 < div className = "absolute top-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-l-4 border-r-4 border-t-4 border-transparent border-t-border" > </ div >
103103 </ div >
104104 </ div >
105- < span className = "text-sm font-medium text-muted-foreground" > Search Context :</ span >
105+ < span className = "text-sm font-medium text-muted-foreground" > Search Scope :</ span >
106106 </ div >
107107 < Badge
108- variant = { selectedFilterContext === null ? "default" : "secondary" }
109- className = { `cursor-pointer transition-all duration-200 hover:shadow-sm ${ selectedFilterContext === null ? "bg-primary text-primary-foreground" : "hover:bg-secondary/80"
108+ variant = { selectedFilterSearchScope === null ? "default" : "secondary" }
109+ className = { `cursor-pointer transition-all duration-200 hover:shadow-sm ${ selectedFilterSearchScope === null ? "bg-primary text-primary-foreground" : "hover:bg-secondary/80"
110110 } `}
111111 onClick = { ( ) => {
112- setSelectedFilterContext ( null ) ;
112+ setSelectedFilterSearchScope ( null ) ;
113113 } }
114114 >
115115 All
116116 </ Badge >
117- { demoExamples . searchContexts . map ( ( context ) => (
117+ { demoExamples . searchScopes . map ( ( searchScope ) => (
118118 < Badge
119- key = { context . id }
120- variant = { selectedFilterContext === context . id ? "default" : "secondary" }
121- className = { `cursor-pointer transition-all duration-200 hover:shadow-sm flex items-center gap-1 ${ selectedFilterContext === context . id ? "bg-primary text-primary-foreground" : "hover:bg-secondary/80"
119+ key = { searchScope . id }
120+ variant = { selectedFilterSearchScope === searchScope . id ? "default" : "secondary" }
121+ className = { `cursor-pointer transition-all duration-200 hover:shadow-sm flex items-center gap-1 ${ selectedFilterSearchScope === searchScope . id ? "bg-primary text-primary-foreground" : "hover:bg-secondary/80"
122122 } `}
123123 onClick = { ( ) => {
124- setSelectedFilterContext ( context . id ) ;
124+ setSelectedFilterSearchScope ( searchScope . id ) ;
125125 } }
126126 >
127- { getContextIcon ( context , 12 , selectedFilterContext === context . id ) }
128- { context . displayName }
127+ { getSearchScopeIcon ( searchScope , 12 , selectedFilterSearchScope === searchScope . id ) }
128+ { searchScope . displayName }
129129 </ Badge >
130130 ) ) }
131131 </ div >
132132
133133 < div className = "flex flex-wrap justify-center gap-3" >
134134 { demoExamples . searchExamples
135135 . filter ( ( example ) => {
136- if ( selectedFilterContext === null ) return true ;
137- return example . searchContext . includes ( selectedFilterContext ) ;
136+ if ( selectedFilterSearchScope === null ) return true ;
137+ return example . searchScopes . includes ( selectedFilterSearchScope ) ;
138138 } )
139139 . map ( ( example ) => {
140- const searchContexts = demoExamples . searchContexts . filter ( ( context ) => example . searchContext . includes ( context . id ) )
140+ const searchScopes = demoExamples . searchScopes . filter ( ( searchScope ) => example . searchScopes . includes ( searchScope . id ) )
141141 return (
142142 < Card
143143 key = { example . url }
@@ -147,10 +147,10 @@ export const AskSourcebotDemoCards = ({
147147 < CardContent className = "p-4" >
148148 < div className = "space-y-3" >
149149 < div className = "flex items-center justify-between" >
150- { searchContexts . map ( ( context ) => (
151- < Badge key = { context . value } variant = "secondary" className = "text-[10px] px-1.5 py-0.5 h-4 flex items-center gap-1" >
152- { getContextIcon ( context , 12 ) }
153- { context . displayName }
150+ { searchScopes . map ( ( searchScope ) => (
151+ < Badge key = { searchScope . value } variant = "secondary" className = "text-[10px] px-1.5 py-0.5 h-4 flex items-center gap-1" >
152+ { getSearchScopeIcon ( searchScope , 12 ) }
153+ { searchScope . displayName }
154154 </ Badge >
155155 ) ) }
156156 </ div >
0 commit comments