feat(SearchAssembly64, SearchCommoServe, SearchPane): update fetch headers and improve UI responsiveness
This commit is contained in:
parent
80bffaf9ad
commit
e00081a9f6
|
|
@ -21,8 +21,9 @@ function leetFetch(path: string, query?: Record<string, string>) {
|
|||
// allows both headers, so the browser accepts this request.
|
||||
return fetch(url.toString(), {
|
||||
headers: {
|
||||
'Client-Id': 'Ultimate',
|
||||
'Host': 'hackerswithstyle.se',
|
||||
'User-Agent': 'Assembly Query',
|
||||
'Client-Id': 'Ultimate',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
@ -316,15 +317,15 @@ export default function SearchAssembly64({ config, setConfig, onClose }: SearchA
|
|||
return (
|
||||
<>
|
||||
<div className="flex flex-col h-full overflow-hidden">
|
||||
{/* Panel header */}
|
||||
<div className="flex-shrink-0 flex items-center border-b border-neutral-200/70 px-4">
|
||||
{/* Panel header — X on the left so it's never behind a top-right camera */}
|
||||
<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">
|
||||
<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>
|
||||
</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>
|
||||
{/* Header */}
|
||||
<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)}
|
||||
onKeyDown={e => e.key === 'Enter' && !isSearching && handleSearch()}
|
||||
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"
|
||||
disabled={isSearching}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
return fetch(url.toString(), {
|
||||
headers: {
|
||||
'Client-Id': 'Ultimate',
|
||||
'Host': 'commoserve.files.commodore.net',
|
||||
'User-Agent': 'Assembly Query',
|
||||
'Client-Id': 'Commodore',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import {
|
|||
openLocateDb,
|
||||
isLocateDbLoaded,
|
||||
subscribeLoadProgress,
|
||||
type DbProgress,
|
||||
} from '../locate-db';
|
||||
|
||||
interface SearchPaneProps {
|
||||
|
|
@ -46,9 +45,10 @@ export default function SearchPane({ config, setConfig, initialTab, onClose, onO
|
|||
openLocateDb().catch(() => { /* errors are surfaced via loadState */ });
|
||||
}
|
||||
return subscribeLoadProgress(s => {
|
||||
if (s.phase === 'idle') setLoadState({ kind: 'idle', received: 0, total: null });
|
||||
else if (s.phase === 'ready') setLoadState({ kind: 'ready', received: 0, total: null });
|
||||
else setLoadState({ kind: s.phase, received: s.received, total: s.total });
|
||||
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 === 'error') setLoadState({ kind: 'error', received: 0, total: null });
|
||||
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 }}
|
||||
exit={{ y: '100%' }}
|
||||
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
|
||||
flight; collapses to zero height otherwise so it doesn't take
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user