@@ -54,6 +54,10 @@ const matchesKeyword = (item: RegistryItem, keyword: string) => {
5454 ) ;
5555} ;
5656
57+ const getPresetKey = ( ) => {
58+ return new URLSearchParams ( window . location . search ) . get ( "preset" ) ;
59+ } ;
60+
5761const SearchPage : React . FC = ( ) => {
5862 const dispatch = useAppDispatch ( ) ;
5963 const [ hasSearched , setHasSearched ] = useState ( false ) ;
@@ -115,6 +119,20 @@ const SearchPage: React.FC = () => {
115119 value !== "any"
116120 ) ;
117121
122+ useEffect ( ( ) => {
123+ // If a #query=... already exists, existing effect will handle it.
124+ if ( window . location . hash . startsWith ( "#query=" ) ) return ;
125+
126+ const key = getPresetKey ( ) ; // "openneuro"
127+ if ( key === "openneuro" ) {
128+ const initial = { database : "openneuro" } ;
129+ // set initial form/filter state
130+ setFormData ( initial ) ;
131+ setAppliedFilters ( initial ) ;
132+ setHasSearched ( false ) ; // set it to true if want to auto-run search
133+ }
134+ } , [ ] ) ;
135+
118136 // parse query from url on page load
119137 useEffect ( ( ) => {
120138 const hash = window . location . hash ;
@@ -359,7 +377,7 @@ const SearchPage: React.FC = () => {
359377 const showNoResults =
360378 hasSearched &&
361379 ! loading &&
362- ! hasDbMatches &&
380+ // !hasDbMatches &&
363381 ( ! hasDatasetMatches || backendEmpty ) ;
364382 return (
365383 < Container
@@ -838,10 +856,23 @@ const SearchPage: React.FC = () => {
838856
839857 { /* Single place to show the red message */ }
840858 { showNoResults && (
841- < Typography sx = { { color : Colors . error } } >
842- No results found based on your criteria. Please adjust
843- the filters and try again.
844- </ Typography >
859+ < Box sx = { { minHeight : 200 } } >
860+ < Typography
861+ variant = "h6"
862+ sx = { {
863+ mb : 1.5 ,
864+ mt : 1.5 ,
865+ borderBottom : "1px solid lightgray" ,
866+ } }
867+ >
868+ Search Results
869+ </ Typography >
870+
871+ < Typography sx = { { color : Colors . error } } >
872+ No datasets or subjects found. Please adjust the
873+ filters and try again.
874+ </ Typography >
875+ </ Box >
845876 ) }
846877
847878 { hasSearched &&
0 commit comments