feat(SearchAssembly64, SearchCommoServe, SearchPane): update fetch headers and improve UI responsiveness

This commit is contained in:
Jaime Idolpx 2026-06-15 13:42:47 -04:00
parent 80bffaf9ad
commit e00081a9f6
3 changed files with 23 additions and 12 deletions

View File

@ -21,8 +21,9 @@ function leetFetch(path: string, query?: Record<string, string>) {
// allows both headers, so the browser accepts this request. // allows both headers, so the browser accepts this request.
return fetch(url.toString(), { return fetch(url.toString(), {
headers: { headers: {
'Client-Id': 'Ultimate', 'Host': 'hackerswithstyle.se',
'User-Agent': 'Assembly Query', 'User-Agent': 'Assembly Query',
'Client-Id': 'Ultimate',
}, },
}); });
} }
@ -316,15 +317,15 @@ export default function SearchAssembly64({ config, setConfig, onClose }: SearchA
return ( return (
<> <>
<div className="flex flex-col h-full overflow-hidden"> <div className="flex flex-col h-full overflow-hidden">
{/* Panel header */} {/* Panel header — X on the left so it's never behind a top-right camera */}
<div className="flex-shrink-0 flex items-center border-b border-neutral-200/70 px-4"> <div className="flex-shrink-0 flex items-center gap-2 border-b border-neutral-200/70 px-4">
<button onClick={onClose} className="p-1.5 my-1.5 rounded-lg hover:bg-neutral-100 text-neutral-500 transition-colors flex-shrink-0" aria-label="Close search">
<X className="w-5 h-5" />
</button>
<div className="flex items-center gap-2 flex-1 py-3 min-w-0"> <div className="flex items-center gap-2 flex-1 py-3 min-w-0">
<img src={`${import.meta.env.BASE_URL}assets/favicon.a64.png`} className="w-5 h-5 flex-shrink-0 object-contain" alt="" aria-hidden="true" /> <img src={`${import.meta.env.BASE_URL}assets/favicon.a64.png`} className="w-5 h-5 flex-shrink-0 object-contain" alt="" aria-hidden="true" />
<span className="text-sm font-semibold text-neutral-700">Assembly64</span> <span className="text-sm font-semibold text-neutral-700">Assembly64</span>
</div> </div>
<button onClick={onClose} className="p-1.5 my-1.5 rounded-lg hover:bg-neutral-100 text-neutral-500 transition-colors" aria-label="Close search">
<X className="w-5 h-5" />
</button>
</div> </div>
{/* Header */} {/* Header */}
<div className="flex-shrink-0 px-4 pt-3 pb-3 border-b border-neutral-200/70"> <div className="flex-shrink-0 px-4 pt-3 pb-3 border-b border-neutral-200/70">
@ -339,6 +340,8 @@ export default function SearchAssembly64({ config, setConfig, onClose }: SearchA
onChange={e => setQuery(e.target.value)} onChange={e => setQuery(e.target.value)}
onKeyDown={e => e.key === 'Enter' && !isSearching && handleSearch()} onKeyDown={e => e.key === 'Enter' && !isSearching && handleSearch()}
placeholder="name:manic* group:ultimate year:1983…" placeholder="name:manic* group:ultimate year:1983…"
inputMode="search"
enterKeyHint="search"
className="w-full pl-9 pr-9 py-2.5 bg-neutral-100 border-0 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:bg-white transition-colors" className="w-full pl-9 pr-9 py-2.5 bg-neutral-100 border-0 rounded-xl text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:bg-white transition-colors"
disabled={isSearching} disabled={isSearching}
/> />

View File

@ -16,8 +16,9 @@ function leetFetch(path: string, query?: Record<string, string>) {
if (query) Object.entries(query).forEach(([k, v]) => url.searchParams.set(k, v)); if (query) Object.entries(query).forEach(([k, v]) => url.searchParams.set(k, v));
return fetch(url.toString(), { return fetch(url.toString(), {
headers: { headers: {
'Client-Id': 'Ultimate', 'Host': 'commoserve.files.commodore.net',
'User-Agent': 'Assembly Query', 'User-Agent': 'Assembly Query',
'Client-Id': 'Commodore',
}, },
}); });
} }

View File

@ -10,7 +10,6 @@ import {
openLocateDb, openLocateDb,
isLocateDbLoaded, isLocateDbLoaded,
subscribeLoadProgress, subscribeLoadProgress,
type DbProgress,
} from '../locate-db'; } from '../locate-db';
interface SearchPaneProps { interface SearchPaneProps {
@ -48,6 +47,7 @@ export default function SearchPane({ config, setConfig, initialTab, onClose, onO
return subscribeLoadProgress(s => { return subscribeLoadProgress(s => {
if (s.phase === 'idle') setLoadState({ kind: 'idle', received: 0, total: null }); if (s.phase === 'idle') setLoadState({ kind: 'idle', received: 0, total: null });
else if (s.phase === 'ready') setLoadState({ kind: 'ready', received: 0, total: null }); else if (s.phase === 'ready') setLoadState({ kind: 'ready', received: 0, total: null });
else if (s.phase === 'error') setLoadState({ kind: 'error', received: 0, total: null });
else setLoadState({ kind: s.phase, received: s.received, total: s.total }); else setLoadState({ kind: s.phase, received: s.received, total: s.total });
}); });
}, []); }, []);
@ -89,7 +89,14 @@ export default function SearchPane({ config, setConfig, initialTab, onClose, onO
animate={{ y: 0 }} animate={{ y: 0 }}
exit={{ y: '100%' }} exit={{ y: '100%' }}
transition={{ type: 'spring', damping: 28, stiffness: 280 }} transition={{ type: 'spring', damping: 28, stiffness: 280 }}
className="fixed inset-0 bg-white/80 backdrop-blur-md flex flex-col overflow-hidden" className="fixed inset-x-0 top-0 bg-white/80 backdrop-blur-md flex flex-col overflow-hidden"
style={{
// 100dvh (dynamic viewport height) shrinks automatically when the
// software keyboard opens, so content is never hidden behind it.
height: '100dvh',
paddingTop: 'env(safe-area-inset-top)',
paddingBottom: 'env(safe-area-inset-bottom)',
}}
> >
{/* Locate-database load bar. Visible only while a transfer is in {/* Locate-database load bar. Visible only while a transfer is in
flight; collapses to zero height otherwise so it doesn't take flight; collapses to zero height otherwise so it doesn't take