@@ -34,15 +34,39 @@ const Header: React.FC = () => {
3434
3535 const input = searchAddress . trim ( ) ;
3636
37+ // Don't process empty searches
38+ if ( ! input ) return ;
39+
3740 try {
41+ // Check if it's a transaction hash (0x + 64 hex chars)
42+ if ( input . startsWith ( '0x' ) && input . length === 66 && / ^ 0 x [ 0 - 9 a - f A - F ] { 64 } $ / . test ( input ) ) {
43+ navigate ( `/transactions/${ encodeURIComponent ( input ) } ` ) ;
44+ setSearchAddress ( '' ) ;
45+ if ( searchInput . current ) {
46+ searchInput . current . blur ( ) ;
47+ }
48+ return ;
49+ }
50+
51+ // Check if it's a transaction version (numeric only)
52+ if ( / ^ \d + $ / . test ( input ) ) {
53+ navigate ( `/transactions/${ encodeURIComponent ( input ) } ` ) ;
54+ setSearchAddress ( '' ) ;
55+ if ( searchInput . current ) {
56+ searchInput . current . blur ( ) ;
57+ }
58+ return ;
59+ }
60+
61+ // Default case: treat as an account address
3862 const addr = normalizeAddress ( input ) ;
3963 navigate ( `/accounts/${ encodeURIComponent ( addr ) } /resources` ) ;
4064 setSearchAddress ( '' ) ;
4165 if ( searchInput . current ) {
4266 searchInput . current . blur ( ) ;
4367 }
4468 } catch ( error ) {
45- console . warn ( error ) ;
69+ console . warn ( 'Search error:' , error ) ;
4670 }
4771 } ;
4872
@@ -75,7 +99,30 @@ const Header: React.FC = () => {
7599 ) ) }
76100 </ div >
77101
78- < div className = "justify-end items-center gap-2 hidden justify-self-end lg:flex" >
102+ < div className = "justify-end items-center gap-2 hidden justify-self-end lg:flex flex-grow" >
103+ < form className = "w-full max-w-2xl" onSubmit = { onSearch } >
104+ < div className = "relative text-gray-400 focus-within:text-gray-600" >
105+ < div className = "pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3" >
106+ < MagnifyingGlassIcon className = "h-5 w-5" aria-hidden = "true" />
107+ </ div >
108+ < input
109+ id = "search"
110+ className = { clsx (
111+ 'ring-1' ,
112+ 'block w-full rounded-md border-0 bg-white py-1.5 pl-10 pr-3' ,
113+ 'text-gray-900 text-sm' ,
114+ 'focus:ring-2 ring-white ring-offset-2 ring-offset-primary-600' ,
115+ ) }
116+ placeholder = "Search Address / Hash / Version"
117+ type = "search"
118+ name = "search"
119+ ref = { searchInput }
120+ value = { searchAddress }
121+ onChange = { ( event ) => setSearchAddress ( event . target . value ) }
122+ />
123+ </ div >
124+ </ form >
125+
79126 { localStorage . getItem ( 'postero_enabled' ) === 'true' && (
80127 < div className = "flex items-baseline gap-2" >
81128 < div className = "flex items-baseline space-x-4" >
@@ -109,29 +156,6 @@ const Header: React.FC = () => {
109156 </ div >
110157 </ div >
111158 ) }
112-
113- < form className = "w-full max-w-xs" onSubmit = { onSearch } >
114- < div className = "relative text-gray-400 focus-within:text-gray-600" >
115- < div className = "pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3" >
116- < MagnifyingGlassIcon className = "h-5 w-5" aria-hidden = "true" />
117- </ div >
118- < input
119- id = "search"
120- className = { clsx (
121- 'ring-1' ,
122- 'block w-full rounded-md border-0 bg-white py-1 pl-10 pr-3' ,
123- 'text-gray-900 text-sm' ,
124- 'focus:ring-2 ring-white ring-offset-2 ring-offset-primary-600' ,
125- ) }
126- placeholder = "Search Address"
127- type = "search"
128- name = "search"
129- ref = { searchInput }
130- value = { searchAddress }
131- onChange = { ( event ) => setSearchAddress ( event . target . value ) }
132- />
133- </ div >
134- </ form >
135159 </ div >
136160
137161 < div className = "flex flex-grow justify-end lg:hidden" >
@@ -179,11 +203,11 @@ const Header: React.FC = () => {
179203 id = "search"
180204 className = { clsx (
181205 'ring-1' ,
182- 'block w-full rounded-md border-0 bg-white py-1 pl-10 pr-3' ,
206+ 'block w-full rounded-md border-0 bg-white py-1.5 pl-10 pr-3' ,
183207 'text-gray-900 text-sm' ,
184208 'focus:ring-2 ring-white ring-offset-2 ring-offset-primary-600' ,
185209 ) }
186- placeholder = "Search Address"
210+ placeholder = "Search Address / Hash / Version "
187211 type = "search"
188212 name = "search"
189213 ref = { searchInput }
0 commit comments