@@ -122,6 +122,8 @@ export default function App() {
122122 const [ filterOpen , setFilterOpen ] = useState ( true ) ;
123123 const [ bottomH , setBottomH ] = useState ( 504 ) ;
124124 const [ activeBands , setActiveBands ] = useState ( null ) ;
125+ const [ searchInput , setSearchInput ] = useState ( '' ) ;
126+ const [ searchError , setSearchError ] = useState ( null ) ;
125127
126128 const containerRef = useRef ( null ) ;
127129 const dsRef = useRef ( null ) ;
@@ -191,6 +193,26 @@ export default function App() {
191193 }
192194 } ;
193195
196+ const searchByID = async ( ) => {
197+ const id = searchInput . trim ( ) ;
198+ if ( ! id || ! dsRef . current ) return ;
199+ setLoading ( true ) ;
200+ setSearchError ( null ) ;
201+ setError ( null ) ;
202+ try {
203+ const found = await dsRef . current . findBySourceId ( id ) ;
204+ if ( found ) {
205+ setCurrentRow ( found ) ;
206+ } else {
207+ setSearchError ( `No star with ID ${ id } ` ) ;
208+ }
209+ } catch ( err ) {
210+ setSearchError ( err . message ) ;
211+ } finally {
212+ setLoading ( false ) ;
213+ }
214+ } ;
215+
194216 const toggleClass = ( cls ) =>
195217 setEnabledClasses ( ( prev ) => {
196218 const next = new Set ( prev ) ;
@@ -499,6 +521,58 @@ export default function App() {
499521 </ svg >
500522 Random star
501523 </ button >
524+
525+ < form
526+ onSubmit = { ( e ) => { e . preventDefault ( ) ; searchByID ( ) ; } }
527+ style = { { ...GLASS , padding : '14px 16px' } }
528+ >
529+ < div style = { { ...KICKER , marginBottom : 8 } } >
530+ Search by Gaia DR3 ID
531+ </ div >
532+ < div style = { { display : 'flex' , gap : 6 } } >
533+ < input
534+ type = "text"
535+ inputMode = "numeric"
536+ value = { searchInput }
537+ onChange = { ( e ) => { setSearchInput ( e . target . value ) ; setSearchError ( null ) ; } }
538+ disabled = { loading }
539+ style = { {
540+ flex : 1 , minWidth : 0 ,
541+ padding : '8px 10px' , borderRadius : 6 ,
542+ border : '1px solid rgba(125,169,255,0.2)' ,
543+ background : 'rgba(125,169,255,0.08)' ,
544+ color : '#e8ecf6' ,
545+ fontFamily : 'JetBrains Mono, monospace' , fontSize : 15 ,
546+ letterSpacing : 0.3 , outline : 'none' ,
547+ } }
548+ />
549+ < button
550+ type = "submit"
551+ disabled = { loading || ! searchInput . trim ( ) }
552+ style = { {
553+ padding : '0 14px' , borderRadius : 6 ,
554+ border : '1px solid rgba(125,169,255,0.25)' ,
555+ background : 'rgba(125,169,255,0.12)' ,
556+ color : ACCENT ,
557+ fontFamily : 'JetBrains Mono, monospace' , fontSize : 14 ,
558+ fontWeight : 700 , letterSpacing : 1.1 , textTransform : 'uppercase' ,
559+ cursor : ( loading || ! searchInput . trim ( ) ) ? 'default' : 'pointer' ,
560+ opacity : ( loading || ! searchInput . trim ( ) ) ? 0.45 : 1 ,
561+ } }
562+ >
563+ Go
564+ </ button >
565+ </ div >
566+ { searchError && (
567+ < div style = { {
568+ marginTop : 8 ,
569+ fontFamily : 'JetBrains Mono, monospace' , fontSize : 13 ,
570+ color : '#ff8a72' , wordBreak : 'break-all' ,
571+ } } >
572+ { searchError }
573+ </ div >
574+ ) }
575+ </ form >
502576 </ div >
503577 ) }
504578
0 commit comments