@@ -19,6 +19,7 @@ import {
1919} from '@/components/palette/paletteUrlState'
2020import { resolveFlowHandoff } from '@/components/palette/runDispatch'
2121import {
22+ usePaletteEndpointAvailable ,
2223 usePaletteQuery ,
2324 usePlatformShortcutLabel ,
2425 useRecentSearches ,
@@ -143,11 +144,14 @@ export function Palette({ variant, onClose, autoFocus }: PaletteProps) {
143144 return ( ) => window . clearInterval ( handle )
144145 } , [ q . length , placeholderPool . length ] )
145146
147+ const paletteAvailable = usePaletteEndpointAvailable ( )
148+
146149 const { data, loading, error } = usePaletteQuery ( {
147150 q,
148151 scope,
149152 filters,
150- enabled : q . trim ( ) . length > 0 || filters . length > 0 ,
153+ enabled :
154+ paletteAvailable && ( q . trim ( ) . length > 0 || filters . length > 0 ) ,
151155 } )
152156
153157 const results = useMemo ( ( ) => data ?. results ?? [ ] , [ data ] )
@@ -537,6 +541,31 @@ export function Palette({ variant, onClose, autoFocus }: PaletteProps) {
537541 ? 'w-full'
538542 : 'flex min-h-0 w-full max-w-2xl flex-1 flex-col'
539543
544+ if ( variant === 'homepage' && ! paletteAvailable ) {
545+ return (
546+ < div className = "w-full" role = "search" aria-labelledby = { headingId } >
547+ < h2 id = { headingId } className = "sr-only" >
548+ Explore protocols
549+ </ h2 >
550+ < p className = "mb-2 text-xs text-surface-500" >
551+ Content search requires a palette index on the backend (
552+ < code className = "text-surface-400" > SHOWCASE_PALETTE_DB</ code >
553+ ). See the{ ' ' }
554+ < a href = "https://docs.protocolsoup.com/deploy/palette-index/" className = "text-amber-300/90 hover:underline" >
555+ palette index
556+ </ a > { ' ' }
557+ deployment guide.
558+ </ p >
559+ < EmptyState
560+ variant = "homepage"
561+ onPick = { setEntryChip }
562+ recent = { recentSearches }
563+ onClearRecent = { clearRecent }
564+ />
565+ </ div >
566+ )
567+ }
568+
540569 return (
541570 < div className = { shellClass } role = "search" aria-labelledby = { headingId } >
542571 < h2 id = { headingId } className = "sr-only" > Palette search</ h2 >
0 commit comments