fixed some navigation issues

This commit is contained in:
roormonger
2026-03-23 17:09:47 -04:00
parent f6ae56c848
commit 4e0b510d7f
5 changed files with 43 additions and 16 deletions

26
package-lock.json generated
View File

@@ -18,6 +18,8 @@
"framer-motion": "^11.5.0", "framer-motion": "^11.5.0",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-gamepad": "^1.0.3",
"react-intersection-observer": "^10.0.3",
"react-router-dom": "^6.26.0", "react-router-dom": "^6.26.0",
"tailwind-merge": "^2.5.2" "tailwind-merge": "^2.5.2"
}, },
@@ -6768,6 +6770,30 @@
"react": "^18.3.1" "react": "^18.3.1"
} }
}, },
"node_modules/react-gamepad": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/react-gamepad/-/react-gamepad-1.0.3.tgz",
"integrity": "sha512-gMwITmfoHtCaMFpDaEshcjeibHAgynXD28NnS2pa+dG+stwNoN66YDVizN7GfyIrYiW5Ft1ubRxs6/2xW9sRhQ==",
"license": "GPLv3",
"peerDependencies": {
"react": ">=15.0.0"
}
},
"node_modules/react-intersection-observer": {
"version": "10.0.3",
"resolved": "https://registry.npmjs.org/react-intersection-observer/-/react-intersection-observer-10.0.3.tgz",
"integrity": "sha512-luICLMbs0zxTO/70Zy7K5jOXkABPEVSAF8T3FdZUlctsrIaPLmx8TZe2SSA+CY2HGWfz2INyNTnp82pxNNsShA==",
"license": "MIT",
"peerDependencies": {
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
},
"peerDependenciesMeta": {
"react-dom": {
"optional": true
}
}
},
"node_modules/react-refresh": { "node_modules/react-refresh": {
"version": "0.17.0", "version": "0.17.0",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz",

View File

@@ -20,6 +20,8 @@
"framer-motion": "^11.5.0", "framer-motion": "^11.5.0",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-gamepad": "^1.0.3",
"react-intersection-observer": "^10.0.3",
"react-router-dom": "^6.26.0", "react-router-dom": "^6.26.0",
"tailwind-merge": "^2.5.2" "tailwind-merge": "^2.5.2"
}, },

View File

@@ -112,15 +112,14 @@ export const rommApiClient = {
}, },
async fetchRecentGames(): Promise<Game[]> { async fetchRecentGames(): Promise<Game[]> {
// Ordering by internal id desc is functionally identical to created_at logic natively const res = await fetch(`${this.apiBase}/roms?limit=50&order_by=id&order_dir=desc`, { headers: this.headers });
const res = await fetch(`${this.apiBase}/roms?limit=20&order_by=id&order_dir=desc`, { headers: this.headers });
if (!res.ok) throw new Error('Failed to fetch recents.'); if (!res.ok) throw new Error('Failed to fetch recents.');
const json = await res.json(); const json = await res.json();
return json.items ? json.items.map(mapRomToGame) : []; return json.items ? json.items.map(mapRomToGame) : [];
}, },
async fetchFavorites(): Promise<Game[]> { async fetchFavorites(): Promise<Game[]> {
const res = await fetch(`${this.apiBase}/roms?favorite=true&limit=20`, { headers: this.headers }); const res = await fetch(`${this.apiBase}/roms?favorite=true&limit=50`, { headers: this.headers });
if (!res.ok) throw new Error('Failed to fetch favorites.'); if (!res.ok) throw new Error('Failed to fetch favorites.');
const json = await res.json(); const json = await res.json();
return json.items ? json.items.map(mapRomToGame) : []; return json.items ? json.items.map(mapRomToGame) : [];

View File

@@ -40,7 +40,7 @@ const ScrollableSection = ({ title, children, showViewAll }: { title: string, ch
</div> </div>
{showViewAll && <a className="text-[10px] font-black text-[#2563eb] hover:underline uppercase geist-mono tracking-[0.3em]" href="#">View All</a>} {showViewAll && <a className="text-[10px] font-black text-[#2563eb] hover:underline uppercase geist-mono tracking-[0.3em]" href="#">View All</a>}
</div> </div>
<div ref={scrollRef} className="flex overflow-x-auto no-scrollbar -mx-3 scroll-smooth relative pt-2 pb-4"> <div ref={scrollRef} className="flex overflow-x-auto no-scrollbar -mx-3 scroll-smooth relative pt-2 pb-4 px-4">
{children} {children}
</div> </div>
</section> </section>

View File

@@ -8,7 +8,7 @@ export const useFocusableAutoScroll = (config?: UseFocusableConfig) => {
useEffect(() => { useEffect(() => {
if (mode === 'gamepad' && result.focused && result.ref.current) { if (mode === 'gamepad' && result.focused && result.ref.current) {
result.ref.current.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'nearest' }); result.ref.current.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' });
} }
}, [result.focused, mode]); }, [result.focused, mode]);