mirror of
https://github.com/mileswolfallen2/OmniEmu2.0.git
synced 2026-12-04 15:57:45 +00:00
feat: integrate SteamGridDB cover art search and selection
- Added `searchCoverSGDB` API method to preload and scraper for fetching cover art from SteamGridDB. - Implemented `CoverPickerModal` component for selecting cover art with search functionality. - Updated settings to include SteamGridDB API key. - Enhanced game detail modal to allow changing and resetting cover art. - Improved gamepad navigation and sidebar layout for better user experience. - Introduced new themes: Midnight, Ember, Lavender, and Jade.
This commit is contained in:
1 parent
51f3e5b987
commit
e32046848d
15 files changed
+707
-192
No files matched your search
@@ -989,6 +989,7 @@ export function scanRoms(directory: string): GameEntry[] {
|
||||
const fullPath = join(dir, file);
|
||||
const stat = require('fs').statSync(fullPath);
|
||||
if (stat.isDirectory()) {
|
||||
if (file.toLowerCase() === 'bios') continue;
|
||||
scanDir(fullPath);
|
||||
} else {
|
||||
const ext = extname(file).toLowerCase();
|
||||
|
||||
+8
-1
@@ -21,7 +21,7 @@ import { settings } from './settings';
|
||||
import { getSystemInfo, platformName, getPlatform, getArch } from './platform';
|
||||
import { checkForUpdates, downloadUpdate, quitAndInstall } from './updater';
|
||||
import { InstallProgress, AppSettings, GameEntry, AchievementInfo } from '../shared/types';
|
||||
import { addRecentGame, parseGameTitle, buildScrapeTitle, findValidThumbnail, cacheCovers, scrapeGameMetadata } from './scraper';
|
||||
import { addRecentGame, parseGameTitle, buildScrapeTitle, findValidThumbnail, cacheCovers, scrapeGameMetadata, searchSteamGridDB } from './scraper';
|
||||
import { getGameAchievements } from './ra';
|
||||
import { scanBiosDirectory, getKnownBiosList, getDefaultBiosDir, updateRetroarchBiosPath } from './bios';
|
||||
|
||||
@@ -224,6 +224,13 @@ export function registerIpcHandlers(): void {
|
||||
return true;
|
||||
});
|
||||
|
||||
// Search SteamGridDB for cover art options
|
||||
ipcMain.handle('games:search-cover-sgdb', async (_event, title: string, platform: string) => {
|
||||
const s = settings.get();
|
||||
if (!s.steamGridDbApiKey) return [];
|
||||
return searchSteamGridDB(buildScrapeTitle(title), platform, s.steamGridDbApiKey);
|
||||
});
|
||||
|
||||
// Scrape game metadata (description, year, genre, publisher, screenshots)
|
||||
ipcMain.handle('games:scrape-metadata', async (_event, romPath: string, title: string, platform: string) => {
|
||||
return scrapeGameMetadata(romPath, buildScrapeTitle(title), platform);
|
||||
|
||||
@@ -81,6 +81,8 @@ const api = {
|
||||
ipcRenderer.invoke('games:scrape-art', title, platform),
|
||||
cacheCovers: (entries: { romPath: string; coverUrl: string }[]): Promise<boolean> =>
|
||||
ipcRenderer.invoke('games:cache-covers', entries),
|
||||
searchCoverSGDB: (title: string, platform: string): Promise<any[]> =>
|
||||
ipcRenderer.invoke('games:search-cover-sgdb', title, platform),
|
||||
scrapeMetadata: (romPath: string, title: string, platform: string): Promise<GameMetadata> =>
|
||||
ipcRenderer.invoke('games:scrape-metadata', romPath, title, platform),
|
||||
achievements: (romPath: string, title: string, platform: string): Promise<AchievementInfo | null> =>
|
||||
|
||||
+169
-2
@@ -177,11 +177,15 @@ export function getCachedCover(romPath: string): string | undefined {
|
||||
return readCache()[romPath];
|
||||
}
|
||||
|
||||
/** Save cover URLs to cache */
|
||||
/** Save cover URLs to cache (empty string removes the entry) */
|
||||
export function cacheCovers(entries: { romPath: string; coverUrl: string }[]): void {
|
||||
const cache = readCache();
|
||||
for (const e of entries) {
|
||||
if (e.coverUrl) cache[e.romPath] = e.coverUrl;
|
||||
if (e.coverUrl) {
|
||||
cache[e.romPath] = e.coverUrl;
|
||||
} else {
|
||||
delete cache[e.romPath];
|
||||
}
|
||||
}
|
||||
writeCache(cache);
|
||||
}
|
||||
@@ -389,3 +393,166 @@ export async function scrapeGameMetadata(romPath: string, title: string, platfor
|
||||
cacheMetadata(romPath, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// ---- SteamGridDB cover art search ----
|
||||
|
||||
export interface SGDBSearchResult {
|
||||
id: number;
|
||||
name: string;
|
||||
url: string;
|
||||
width: number;
|
||||
height: number;
|
||||
thumb: string;
|
||||
}
|
||||
|
||||
/** Platform ID mapping for SteamGridDB */
|
||||
const sgdbPlatformMap: Record<string, number> = {
|
||||
nes: 3, snes: 4, n64: 6, gb: 9, gbc: 10, gba: 11, nds: 13,
|
||||
ps1: 28, ps2: 29, ps3: 30, psp: 31,
|
||||
gc: 17, wii: 18, switch: 146,
|
||||
'sega-md': 29, 'sega-saturn': 29, dreamcast: 17,
|
||||
arcade: 52, pce: 15,
|
||||
};
|
||||
|
||||
function sgdbFetch(url: string, apiKey: string, retries = 2): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const req = httpsGet(url, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${apiKey}`,
|
||||
'User-Agent': 'OmniEmu/0.1.3',
|
||||
},
|
||||
timeout: 10000,
|
||||
}, (res) => {
|
||||
let data = '';
|
||||
res.on('data', (chunk: string) => data += chunk);
|
||||
res.on('end', () => {
|
||||
if (res.statusCode === 429 && retries > 0) {
|
||||
const retryAfter = parseInt(res.headers['retry-after'] as string) || 5;
|
||||
setTimeout(() => {
|
||||
sgdbFetch(url, apiKey, retries - 1).then(resolve, reject);
|
||||
}, retryAfter * 1000);
|
||||
return;
|
||||
}
|
||||
if (res.statusCode && res.statusCode >= 400) {
|
||||
reject(new Error(`SGDB ${res.statusCode}: ${data}`));
|
||||
} else {
|
||||
resolve(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
req.on('error', reject);
|
||||
req.on('timeout', () => { req.destroy(); reject(new Error('timeout')); });
|
||||
});
|
||||
}
|
||||
|
||||
function sgdbDownloadBuffer(url: string, apiKey: string, retries = 2): Promise<Buffer> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const req = httpsGet(url, {
|
||||
headers: {
|
||||
'User-Agent': 'OmniEmu/0.1.3',
|
||||
},
|
||||
timeout: 15000,
|
||||
}, (res) => {
|
||||
const chunks: Buffer[] = [];
|
||||
res.on('data', (chunk: Buffer) => chunks.push(chunk));
|
||||
res.on('end', () => {
|
||||
if (res.statusCode === 429 && retries > 0) {
|
||||
const retryAfter = parseInt(res.headers['retry-after'] as string) || 5;
|
||||
setTimeout(() => {
|
||||
sgdbDownloadBuffer(url, apiKey, retries - 1).then(resolve, reject);
|
||||
}, retryAfter * 1000);
|
||||
return;
|
||||
}
|
||||
if (res.statusCode && res.statusCode >= 400) {
|
||||
reject(new Error(`SGDB download ${res.statusCode}`));
|
||||
} else {
|
||||
resolve(Buffer.concat(chunks));
|
||||
}
|
||||
});
|
||||
});
|
||||
req.on('error', reject);
|
||||
req.on('timeout', () => { req.destroy(); reject(new Error('timeout')); });
|
||||
});
|
||||
}
|
||||
|
||||
function sgdbCacheDir(): string {
|
||||
const dir = join(app.getPath('userData'), 'cache', 'sgdb');
|
||||
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
||||
return dir;
|
||||
}
|
||||
|
||||
/** Download a remote image to local cache, return file:// path */
|
||||
async function downloadToCache(remoteUrl: string, filename: string, apiKey: string): Promise<string> {
|
||||
const buf = await sgdbDownloadBuffer(remoteUrl, apiKey);
|
||||
const ext = remoteUrl.includes('.png') ? '.png' : remoteUrl.includes('.jpg') ? '.jpg' : '.webp';
|
||||
const safeName = filename.replace(/[^a-zA-Z0-9_-]/g, '_');
|
||||
const localPath = join(sgdbCacheDir(), `${safeName}${ext}`);
|
||||
writeFileSync(localPath, buf);
|
||||
return `file://${localPath}`;
|
||||
}
|
||||
|
||||
/** Search SteamGridDB for cover art options — returns local file:// paths */
|
||||
export async function searchSteamGridDB(
|
||||
title: string,
|
||||
platform: string,
|
||||
apiKey: string
|
||||
): Promise<SGDBSearchResult[]> {
|
||||
if (!apiKey) return [];
|
||||
|
||||
const q = encodeURIComponent(title.trim());
|
||||
const searchUrl = `https://www.steamgriddb.com/api/v2/search/autocomplete/${q}`;
|
||||
|
||||
try {
|
||||
const html = await sgdbFetch(searchUrl, apiKey);
|
||||
const parsed = JSON.parse(html);
|
||||
if (!parsed.data || !Array.isArray(parsed.data) || parsed.data.length === 0) return [];
|
||||
|
||||
const game = parsed.data[0];
|
||||
if (!game || !game.id) return [];
|
||||
|
||||
const artUrl = `https://www.steamgriddb.com/api/v2/grids/game/${game.id}?dimensions=600x900`;
|
||||
const artHtml = await sgdbFetch(artUrl, apiKey);
|
||||
const artParsed = JSON.parse(artHtml);
|
||||
if (!artParsed.data || !Array.isArray(artParsed.data)) return [];
|
||||
|
||||
const results: SGDBSearchResult[] = [];
|
||||
const items = artParsed.data.slice(0, 20);
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
const item = items[i];
|
||||
const remoteThumb = item.thumb || item.url || '';
|
||||
if (!remoteThumb) continue;
|
||||
try {
|
||||
const localPath = await downloadToCache(remoteThumb, `sgdb_${game.id}_${item.id}`, apiKey);
|
||||
results.push({
|
||||
id: item.id,
|
||||
name: item.name || 'Cover',
|
||||
url: remoteThumb,
|
||||
width: item.width || 0,
|
||||
height: item.height || 0,
|
||||
thumb: localPath,
|
||||
});
|
||||
} catch {
|
||||
results.push({
|
||||
id: item.id,
|
||||
name: item.name || 'Cover',
|
||||
url: remoteThumb,
|
||||
width: item.width || 0,
|
||||
height: item.height || 0,
|
||||
thumb: '',
|
||||
});
|
||||
}
|
||||
if (i < items.length - 1) {
|
||||
await new Promise(r => setTimeout(r, 100));
|
||||
}
|
||||
}
|
||||
return results;
|
||||
} catch (e: any) {
|
||||
const msg = e?.message || String(e);
|
||||
if (msg.includes('429')) {
|
||||
console.error('SteamGridDB rate limited — try again in a minute');
|
||||
throw new Error('Rate limited by SteamGridDB. Try again in a minute.');
|
||||
}
|
||||
console.error('SteamGridDB search failed:', e);
|
||||
throw new Error(`SteamGridDB search failed: ${msg}`);
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,7 @@ const defaultSettings: AppSettings = {
|
||||
retroAchievementsUsername: '',
|
||||
retroAchievementsPassword: '',
|
||||
retroAchievementsApiKey: '',
|
||||
steamGridDbApiKey: '',
|
||||
};
|
||||
|
||||
let cached: AppSettings | null = null;
|
||||
|
||||
+4
-18
@@ -45,22 +45,10 @@ export function App() {
|
||||
}
|
||||
};
|
||||
|
||||
const pageTitle: Record<Page, string> = {
|
||||
dashboard: 'Dashboard',
|
||||
emulators: 'Emulators',
|
||||
library: 'Library',
|
||||
settings: 'Settings',
|
||||
controller: 'Controller',
|
||||
utilities: 'Utilities',
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="app-layout">
|
||||
<Sidebar currentPage={currentPage} onNavigate={setCurrentPage} />
|
||||
<div className="main-content">
|
||||
<div className="topbar">
|
||||
<h2>{pageTitle[currentPage]}</h2>
|
||||
</div>
|
||||
<div className="page-content">
|
||||
{renderPage()}
|
||||
</div>
|
||||
@@ -68,17 +56,15 @@ export function App() {
|
||||
|
||||
{connected && showLegend && (
|
||||
<div className="controller-legend" onClick={dismissLegend}>
|
||||
<span>DPad: Navigate</span>
|
||||
<span>D-Pad: Navigate</span>
|
||||
<span className="sep">|</span>
|
||||
<span>A: Select</span>
|
||||
<span className="sep">|</span>
|
||||
<span>B/X/Select: Back</span>
|
||||
<span>B: Back</span>
|
||||
<span className="sep">|</span>
|
||||
<span>LB/RB: Tabs</span>
|
||||
<span>LB/RB: Switch Tabs</span>
|
||||
<span className="sep">|</span>
|
||||
<span>Start: Focus</span>
|
||||
<span className="sep">|</span>
|
||||
<span>Guide: Dashboard</span>
|
||||
<span>Start: Focus Content</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
|
||||
interface CoverResult {
|
||||
id: number;
|
||||
name: string;
|
||||
url: string;
|
||||
width: number;
|
||||
height: number;
|
||||
thumb: string;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
gameTitle: string;
|
||||
platform: string;
|
||||
onSelect: (url: string) => void;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
export function CoverPickerModal({ gameTitle, platform, onSelect, onClose }: Props) {
|
||||
const [results, setResults] = useState<CoverResult[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [selectedId, setSelectedId] = useState<number | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
window.omni.settings.get().then((s) => {
|
||||
if (cancelled) return;
|
||||
if (!s.steamGridDbApiKey) {
|
||||
setLoading(false);
|
||||
setError('No SteamGridDB API key set. Add one in Utilities.');
|
||||
return;
|
||||
}
|
||||
window.omni.game.searchCoverSGDB(gameTitle, platform)
|
||||
.then((data) => {
|
||||
if (cancelled) return;
|
||||
setResults(data);
|
||||
setLoading(false);
|
||||
if (data.length === 0) setError('No results found. Try a different search term.');
|
||||
})
|
||||
.catch((err) => {
|
||||
if (cancelled) return;
|
||||
setLoading(false);
|
||||
setError(`Search failed: ${err?.message || 'Unknown error'}`);
|
||||
});
|
||||
});
|
||||
return () => { cancelled = true; };
|
||||
}, [gameTitle, platform]);
|
||||
|
||||
const handleKeyDown = useCallback((e: KeyboardEvent) => {
|
||||
if (e.key === 'Escape') onClose();
|
||||
}, [onClose]);
|
||||
|
||||
useEffect(() => {
|
||||
document.addEventListener('keydown', handleKeyDown);
|
||||
return () => document.removeEventListener('keydown', handleKeyDown);
|
||||
}, [handleKeyDown]);
|
||||
|
||||
return (
|
||||
<div className="modal-overlay" onClick={onClose}>
|
||||
<div className="cover-picker-modal" onClick={(e) => e.stopPropagation()}>
|
||||
<div className="cover-picker-header">
|
||||
<h3>Choose Cover Art</h3>
|
||||
<span className="cover-picker-subtitle">SteamGridDB — {gameTitle}</span>
|
||||
<button className="btn btn-secondary btn-sm" onClick={onClose}>Close</button>
|
||||
</div>
|
||||
|
||||
<div className="cover-picker-body">
|
||||
{loading && (
|
||||
<div className="cover-picker-loading">Searching SteamGridDB...</div>
|
||||
)}
|
||||
|
||||
{error && (
|
||||
<div className="cover-picker-error">{error}</div>
|
||||
)}
|
||||
|
||||
{!loading && !error && results.length > 0 && (
|
||||
<div className="cover-picker-grid">
|
||||
{results.map((item) => (
|
||||
<div
|
||||
key={item.id}
|
||||
className={`cover-picker-item ${selectedId === item.id ? 'selected' : ''}`}
|
||||
onClick={() => setSelectedId(item.id)}
|
||||
onDoubleClick={() => onSelect(item.thumb || item.url)}
|
||||
>
|
||||
<img src={item.thumb} alt={item.name} />
|
||||
<div className="cover-picker-item-info">
|
||||
<span>{item.width}x{item.height}</span>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{selectedId !== null && (
|
||||
<div className="cover-picker-footer">
|
||||
<button
|
||||
className="btn btn-primary"
|
||||
onClick={() => {
|
||||
const item = results.find(r => r.id === selectedId);
|
||||
if (item) onSelect(item.thumb || item.url);
|
||||
}}
|
||||
>
|
||||
Use This Cover
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import React, { useEffect, useCallback, useState } from 'react';
|
||||
import type { GameEntry, GameMetadata, AchievementInfo, RetroAchievement } from '../../shared/types';
|
||||
import { CoverPickerModal } from './CoverPickerModal';
|
||||
|
||||
interface Props {
|
||||
game: GameEntry;
|
||||
@@ -25,6 +26,7 @@ export function GameDetailModal({ game, onClose, onLaunch }: Props) {
|
||||
const [achievements, setAchievements] = useState<AchievementInfo | null>(null);
|
||||
const [loadingAchievements, setLoadingAchievements] = useState(false);
|
||||
const [currentScreenshot, setCurrentScreenshot] = useState(0);
|
||||
const [showCoverPicker, setShowCoverPicker] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setLoadingMeta(true);
|
||||
@@ -98,6 +100,25 @@ export function GameDetailModal({ game, onClose, onLaunch }: Props) {
|
||||
|
||||
<div className="game-detail-right">
|
||||
<div className="game-detail-right-scroll">
|
||||
<div style={{ display: 'flex', gap: 8, marginBottom: 12, alignSelf: 'flex-start' }}>
|
||||
<button
|
||||
className="btn btn-secondary btn-sm"
|
||||
onClick={() => setShowCoverPicker(true)}
|
||||
>
|
||||
Change Cover
|
||||
</button>
|
||||
{game.coverUrl && (
|
||||
<button
|
||||
className="btn btn-secondary btn-sm"
|
||||
onClick={async () => {
|
||||
game.coverUrl = undefined;
|
||||
await window.omni.game.cacheCovers([{ romPath: game.romPath, coverUrl: '' }]);
|
||||
}}
|
||||
>
|
||||
Reset Cover
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{loadingMeta ? (
|
||||
<div className="text-sm text-muted" style={{ padding: 12 }}>Loading metadata...</div>
|
||||
) : (
|
||||
@@ -181,6 +202,19 @@ export function GameDetailModal({ game, onClose, onLaunch }: Props) {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{showCoverPicker && (
|
||||
<CoverPickerModal
|
||||
gameTitle={game.title}
|
||||
platform={game.platform}
|
||||
onSelect={async (url) => {
|
||||
game.coverUrl = url;
|
||||
await window.omni.game.cacheCovers([{ romPath: game.romPath, coverUrl: url }]);
|
||||
setShowCoverPicker(false);
|
||||
}}
|
||||
onClose={() => setShowCoverPicker(false)}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ import React from 'react';
|
||||
|
||||
type Page = 'dashboard' | 'emulators' | 'library' | 'settings' | 'controller' | 'utilities';
|
||||
|
||||
interface SidebarProps {
|
||||
interface TopBarProps {
|
||||
currentPage: Page;
|
||||
onNavigate: (page: Page) => void;
|
||||
}
|
||||
|
||||
const navItems: { page: Page; label: string; icon: string }[] = [
|
||||
{ page: 'dashboard', label: 'Dashboard', icon: '📊' },
|
||||
{ page: 'dashboard', label: 'Home', icon: '🏠' },
|
||||
{ page: 'emulators', label: 'Emulators', icon: '🕹️' },
|
||||
{ page: 'library', label: 'Library', icon: '📚' },
|
||||
{ page: 'controller', label: 'Controller', icon: '🎮' },
|
||||
@@ -16,28 +16,23 @@ const navItems: { page: Page; label: string; icon: string }[] = [
|
||||
{ page: 'settings', label: 'Settings', icon: '⚙️' },
|
||||
];
|
||||
|
||||
export function Sidebar({ currentPage, onNavigate }: SidebarProps) {
|
||||
export function Sidebar({ currentPage, onNavigate }: TopBarProps) {
|
||||
return (
|
||||
<div className="sidebar">
|
||||
<div className="sidebar-header">
|
||||
<h1>OmniEmu</h1>
|
||||
<p>Cross-platform emulator manager</p>
|
||||
</div>
|
||||
<nav className="sidebar-nav">
|
||||
<div className="topbar-nav">
|
||||
<div className="topbar-brand">OmniEmu</div>
|
||||
<nav className="topbar-tabs">
|
||||
{navItems.map((item) => (
|
||||
<button
|
||||
key={item.page}
|
||||
className={`nav-item ${currentPage === item.page ? 'active' : ''}`}
|
||||
className={`topbar-tab ${currentPage === item.page ? 'active' : ''}`}
|
||||
onClick={() => onNavigate(item.page)}
|
||||
>
|
||||
<span className="nav-icon">{item.icon}</span>
|
||||
{item.label}
|
||||
<span className="topbar-tab-icon">{item.icon}</span>
|
||||
<span className="topbar-tab-label">{item.label}</span>
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
<div className="sidebar-footer">
|
||||
v0.1.3
|
||||
</div>
|
||||
<div className="topbar-version">v0.1.3</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+105
-105
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useRef, useState, useCallback } from 'react';
|
||||
|
||||
const DEBOUNCE_MS = 300;
|
||||
const DEBOUNCE_MS = 180;
|
||||
const LEGEND_TIMEOUT_MS = 4000;
|
||||
|
||||
type Page = 'dashboard' | 'emulators' | 'library' | 'settings' | 'controller' | 'utilities';
|
||||
@@ -12,6 +12,8 @@ export function useGamepadNav(onNavigate: (page: Page) => void, currentPage: Pag
|
||||
const [connected, setConnected] = useState(false);
|
||||
const [showLegend, setShowLegend] = useState(false);
|
||||
const legendTimer = useRef<ReturnType<typeof setTimeout>>(undefined);
|
||||
const currentPageRef = useRef(currentPage);
|
||||
currentPageRef.current = currentPage;
|
||||
|
||||
const showLegendTemporarily = useCallback(() => {
|
||||
setShowLegend(true);
|
||||
@@ -22,7 +24,6 @@ export function useGamepadNav(onNavigate: (page: Page) => void, currentPage: Pag
|
||||
useEffect(() => {
|
||||
let raf = 0;
|
||||
let lastConnected = false;
|
||||
let navigationPending = false;
|
||||
|
||||
const poll = () => {
|
||||
const gamepads = navigator.getGamepads();
|
||||
@@ -42,118 +43,103 @@ export function useGamepadNav(onNavigate: (page: Page) => void, currentPage: Pag
|
||||
const gp = activePad;
|
||||
if (!gp) { raf = requestAnimationFrame(poll); return; }
|
||||
|
||||
if (navigationPending) {
|
||||
navigationPending = false;
|
||||
focusFirstOnPage();
|
||||
}
|
||||
|
||||
const debounced = (key: string): boolean => {
|
||||
if (now - (lastTime.current[key] || 0) < DEBOUNCE_MS) return false;
|
||||
lastTime.current[key] = now;
|
||||
return true;
|
||||
};
|
||||
|
||||
// D-Pad (12-15) and left stick
|
||||
const dpadUp = gp.buttons[12]?.pressed || gp.axes[1] < -0.5;
|
||||
const dpadDown = gp.buttons[13]?.pressed || gp.axes[1] > 0.5;
|
||||
const dpadLeft = gp.buttons[14]?.pressed || gp.axes[0] < -0.5;
|
||||
const dpadRight = gp.buttons[15]?.pressed || gp.axes[0] > 0.5;
|
||||
|
||||
// --- Sidebar navigation with Left/Right (only when sidebar is focused) ---
|
||||
if (dpadLeft && debounced('left')) {
|
||||
const focused = document.activeElement;
|
||||
if (focused?.closest('.sidebar')) {
|
||||
cycleSidebar(-1);
|
||||
navigationPending = true;
|
||||
}
|
||||
}
|
||||
if (dpadRight && debounced('right')) {
|
||||
const focused = document.activeElement;
|
||||
if (focused?.closest('.sidebar')) {
|
||||
cycleSidebar(1);
|
||||
navigationPending = true;
|
||||
}
|
||||
}
|
||||
|
||||
// --- Page content navigation with Up/Down ---
|
||||
if (dpadUp && debounced('up')) {
|
||||
const focused = document.activeElement;
|
||||
if (focused?.closest('.sidebar')) {
|
||||
cycleSidebar(-1);
|
||||
navigationPending = true;
|
||||
} else {
|
||||
const focusable = getFocusableElements();
|
||||
const idx = focusable.indexOf(focused as HTMLElement);
|
||||
if (idx > 0) {
|
||||
focusable[idx - 1]?.focus();
|
||||
focusable[idx - 1]?.scrollIntoView({ block: 'nearest' });
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dpadDown && debounced('down')) {
|
||||
const focused = document.activeElement;
|
||||
if (focused?.closest('.sidebar')) {
|
||||
cycleSidebar(1);
|
||||
navigationPending = true;
|
||||
} else {
|
||||
const focusable = getFocusableElements();
|
||||
const idx = focusable.indexOf(focused as HTMLElement);
|
||||
if (idx < focusable.length - 1) {
|
||||
focusable[idx + 1]?.focus();
|
||||
focusable[idx + 1]?.scrollIntoView({ block: 'nearest' });
|
||||
} else {
|
||||
focusable[0]?.focus();
|
||||
focusable[0]?.scrollIntoView({ block: 'nearest' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A button (0) → confirm / click
|
||||
if (gp.buttons[0]?.pressed && debounced('a')) {
|
||||
const el = document.activeElement as HTMLElement;
|
||||
if (el) {
|
||||
const inSidebar = !!el.closest('.sidebar');
|
||||
el.click();
|
||||
if (inSidebar) navigationPending = true;
|
||||
}
|
||||
}
|
||||
|
||||
// B (1), X (2), Select (8) → blur / back
|
||||
const backPressed = (gp.buttons[1]?.pressed || gp.buttons[2]?.pressed || gp.buttons[8]?.pressed);
|
||||
if (backPressed && debounced('back')) {
|
||||
const focused = document.activeElement as HTMLElement;
|
||||
if (focused?.closest('.sidebar')) {
|
||||
// If in sidebar, blur and focus first page element
|
||||
focused.blur();
|
||||
focusFirstOnPage();
|
||||
} else if (focused) {
|
||||
focused.blur();
|
||||
}
|
||||
}
|
||||
|
||||
// Start (9) → focus first element on the page
|
||||
if (gp.buttons[9]?.pressed && debounced('start')) {
|
||||
focusFirstOnPage();
|
||||
}
|
||||
|
||||
// LB (4) → previous tab, RB (5) → next tab
|
||||
if (gp.buttons[4]?.pressed && debounced('lb')) {
|
||||
const idx = pageOrder.indexOf(currentPage);
|
||||
const idx = pageOrder.indexOf(currentPageRef.current);
|
||||
const prev = idx > 0 ? idx - 1 : pageOrder.length - 1;
|
||||
onNavigate(pageOrder[prev]);
|
||||
navigationPending = true;
|
||||
return;
|
||||
}
|
||||
if (gp.buttons[5]?.pressed && debounced('rb')) {
|
||||
const idx = pageOrder.indexOf(currentPage);
|
||||
const idx = pageOrder.indexOf(currentPageRef.current);
|
||||
const next = idx < pageOrder.length - 1 ? idx + 1 : 0;
|
||||
onNavigate(pageOrder[next]);
|
||||
navigationPending = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Home/Guide (16) → go to dashboard
|
||||
if (gp.buttons[16]?.pressed && debounced('guide')) {
|
||||
onNavigate('dashboard');
|
||||
navigationPending = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Start (9) → focus first element on the page
|
||||
if (gp.buttons[9]?.pressed && debounced('start')) {
|
||||
focusFirstOnPage();
|
||||
return;
|
||||
}
|
||||
|
||||
// D-Pad navigation within page content
|
||||
const focusable = getFocusableElements();
|
||||
|
||||
if (dpadDown && debounced('down')) {
|
||||
const focused = document.activeElement as HTMLElement;
|
||||
const idx = focusable.indexOf(focused);
|
||||
if (idx >= 0 && idx < focusable.length - 1) {
|
||||
focusable[idx + 1].focus();
|
||||
focusable[idx + 1].scrollIntoView({ block: 'nearest' });
|
||||
} else if (focusable.length > 0) {
|
||||
focusable[0].focus();
|
||||
focusable[0].scrollIntoView({ block: 'nearest' });
|
||||
}
|
||||
}
|
||||
|
||||
if (dpadUp && debounced('up')) {
|
||||
const focused = document.activeElement as HTMLElement;
|
||||
const idx = focusable.indexOf(focused);
|
||||
if (idx > 0) {
|
||||
focusable[idx - 1].focus();
|
||||
focusable[idx - 1].scrollIntoView({ block: 'nearest' });
|
||||
} else if (focusable.length > 0) {
|
||||
focusable[focusable.length - 1].focus();
|
||||
focusable[focusable.length - 1].scrollIntoView({ block: 'nearest' });
|
||||
}
|
||||
}
|
||||
|
||||
// Left/Right for horizontal grid navigation
|
||||
if (dpadRight && debounced('right')) {
|
||||
const focused = document.activeElement as HTMLElement;
|
||||
if (focused) {
|
||||
const next = findNextInRow(focused, 1);
|
||||
if (next) {
|
||||
next.focus();
|
||||
next.scrollIntoView({ block: 'nearest' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dpadLeft && debounced('left')) {
|
||||
const focused = document.activeElement as HTMLElement;
|
||||
if (focused) {
|
||||
const prev = findNextInRow(focused, -1);
|
||||
if (prev) {
|
||||
prev.focus();
|
||||
prev.scrollIntoView({ block: 'nearest' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A (0) → confirm / click
|
||||
if (gp.buttons[0]?.pressed && debounced('a')) {
|
||||
const el = document.activeElement as HTMLElement;
|
||||
if (el) el.click();
|
||||
}
|
||||
|
||||
// B (1) → back / deselect
|
||||
if (gp.buttons[1]?.pressed && debounced('back')) {
|
||||
const focused = document.activeElement as HTMLElement;
|
||||
if (focused) focused.blur();
|
||||
}
|
||||
|
||||
raf = requestAnimationFrame(poll);
|
||||
@@ -169,30 +155,44 @@ export function useGamepadNav(onNavigate: (page: Page) => void, currentPage: Pag
|
||||
function getFocusableElements(): HTMLElement[] {
|
||||
return Array.from(
|
||||
document.querySelectorAll<HTMLElement>(
|
||||
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"]), .game-card, .nav-item'
|
||||
'.topbar-tab, button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"]), .game-card'
|
||||
)
|
||||
).filter(el => el.offsetParent !== null);
|
||||
}
|
||||
|
||||
function focusFirstOnPage() {
|
||||
requestAnimationFrame(() => {
|
||||
const focusable = getFocusableElements().filter(el => !el.closest('.sidebar'));
|
||||
const focusable = getFocusableElements().filter(el => !el.closest('.topbar-nav'));
|
||||
if (focusable.length > 0) {
|
||||
focusable[0]?.focus();
|
||||
focusable[0]?.scrollIntoView({ block: 'nearest' });
|
||||
focusable[0].focus();
|
||||
focusable[0].scrollIntoView({ block: 'nearest' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cycleSidebar(dir: 1 | -1): void {
|
||||
const items = document.querySelectorAll<HTMLElement>('.nav-item');
|
||||
if (items.length === 0) return;
|
||||
const activeIdx = Array.from(items).findIndex(el =>
|
||||
el.classList.contains('active') || el === document.activeElement
|
||||
);
|
||||
let next = activeIdx + dir;
|
||||
if (next < 0) next = items.length - 1;
|
||||
if (next >= items.length) next = 0;
|
||||
items[next]?.click();
|
||||
items[next]?.focus();
|
||||
function findNextInRow(current: HTMLElement, direction: 1 | -1): HTMLElement | null {
|
||||
const focusable = getFocusableElements();
|
||||
const idx = focusable.indexOf(current);
|
||||
if (idx < 0) return null;
|
||||
|
||||
const currentRect = current.getBoundingClientRect();
|
||||
const currentCenterY = currentRect.top + currentRect.height / 2;
|
||||
|
||||
// Find elements on roughly the same row (within 50px vertically)
|
||||
const sameRow = focusable.filter(el => {
|
||||
if (el === current) return false;
|
||||
const rect = el.getBoundingClientRect();
|
||||
const centerY = rect.top + rect.height / 2;
|
||||
return Math.abs(centerY - currentCenterY) < 50;
|
||||
});
|
||||
|
||||
if (sameRow.length === 0) return null;
|
||||
|
||||
if (direction === 1) {
|
||||
const right = sameRow.filter(el => el.getBoundingClientRect().left > currentRect.right - 10);
|
||||
return right.length > 0 ? right[0] : null;
|
||||
} else {
|
||||
const left = sameRow.filter(el => el.getBoundingClientRect().right < currentRect.left + 10);
|
||||
return left.length > 0 ? left[left.length - 1] : null;
|
||||
}
|
||||
}
|
||||
@@ -220,6 +220,10 @@ export function SettingsPage() {
|
||||
<option value="dark">Dark</option>
|
||||
<option value="light">Light</option>
|
||||
<option value="system">System</option>
|
||||
<option value="midnight">Midnight</option>
|
||||
<option value="ember">Ember</option>
|
||||
<option value="lavender">Lavender</option>
|
||||
<option value="jade">Jade</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,12 +7,15 @@ export function UtilitiesPage() {
|
||||
const [raApiKey, setRaApiKey] = useState('');
|
||||
const [raResults, setRaResults] = useState<Record<string, boolean> | null>(null);
|
||||
const [saving, setSaving] = useState(false);
|
||||
const [sgdbKey, setSgdbKey] = useState('');
|
||||
const [sgdbSaved, setSgdbSaved] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
window.omni.settings.get().then((s) => {
|
||||
setRaUsername(s.retroAchievementsUsername || '');
|
||||
setRaPassword(s.retroAchievementsPassword || '');
|
||||
setRaApiKey(s.retroAchievementsApiKey || '');
|
||||
setSgdbKey(s.steamGridDbApiKey || '');
|
||||
});
|
||||
}, []);
|
||||
|
||||
@@ -157,6 +160,43 @@ export function UtilitiesPage() {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="settings-section">
|
||||
<h3>SteamGridDB Cover Art</h3>
|
||||
<p className="text-sm text-muted" style={{ marginBottom: 12 }}>
|
||||
Search and pick cover art from SteamGridDB. Get a free API key at{' '}
|
||||
<a href="https://www.steamgriddb.com/profile/preferences" target="_blank" rel="noreferrer">
|
||||
steamgriddb.com/profile/preferences
|
||||
</a>.
|
||||
</p>
|
||||
|
||||
<div className="setting-row">
|
||||
<div>
|
||||
<div className="setting-label">API Key</div>
|
||||
</div>
|
||||
<input
|
||||
type="password"
|
||||
className="input"
|
||||
value={sgdbKey}
|
||||
onChange={(e) => { setSgdbKey(e.target.value); setSgdbSaved(false); }}
|
||||
placeholder="your SteamGridDB API key"
|
||||
style={{ width: 240 }}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="setting-row">
|
||||
<div />
|
||||
<button
|
||||
className="btn btn-primary btn-sm"
|
||||
onClick={async () => {
|
||||
await window.omni.settings.save({ steamGridDbApiKey: sgdbKey });
|
||||
setSgdbSaved(true);
|
||||
}}
|
||||
>
|
||||
{sgdbSaved ? 'Saved!' : 'Save'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+211
-50
@@ -60,6 +60,86 @@
|
||||
--shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
/* Midnight — deep navy with teal/cyan accents */
|
||||
[data-theme="midnight"] {
|
||||
--bg-primary: #0a0e1a;
|
||||
--bg-secondary: #111827;
|
||||
--bg-tertiary: #0f1b2d;
|
||||
--bg-card: #151d2e;
|
||||
--bg-hover: #1c2740;
|
||||
--text-primary: #d1e3f8;
|
||||
--text-secondary: #6b8bb5;
|
||||
--text-muted: #3d5a80;
|
||||
--accent: #06d6a0;
|
||||
--accent-hover: #2ae8b5;
|
||||
--accent-dim: rgba(6, 214, 160, 0.12);
|
||||
--success: #06d6a0;
|
||||
--warning: #fbbf24;
|
||||
--error: #ef476f;
|
||||
--border: #1e2d45;
|
||||
--shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
/* Ember — warm dark with orange/amber accents */
|
||||
[data-theme="ember"] {
|
||||
--bg-primary: #141010;
|
||||
--bg-secondary: #1e1614;
|
||||
--bg-tertiary: #221815;
|
||||
--bg-card: #261c18;
|
||||
--bg-hover: #312320;
|
||||
--text-primary: #f5e6e0;
|
||||
--text-secondary: #b8908a;
|
||||
--text-muted: #7a5550;
|
||||
--accent: #ff6b35;
|
||||
--accent-hover: #ff8555;
|
||||
--accent-dim: rgba(255, 107, 53, 0.12);
|
||||
--success: #4ade80;
|
||||
--warning: #fbbf24;
|
||||
--error: #ef4444;
|
||||
--border: #302220;
|
||||
--shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
|
||||
}
|
||||
|
||||
/* Lavender — soft purple-tinted dark */
|
||||
[data-theme="lavender"] {
|
||||
--bg-primary: #12101e;
|
||||
--bg-secondary: #1c1830;
|
||||
--bg-tertiary: #1a1530;
|
||||
--bg-card: #211c38;
|
||||
--bg-hover: #2a2345;
|
||||
--text-primary: #e4dff5;
|
||||
--text-secondary: #9a8ec0;
|
||||
--text-muted: #5e5280;
|
||||
--accent: #a78bfa;
|
||||
--accent-hover: #b8a0ff;
|
||||
--accent-dim: rgba(167, 139, 250, 0.12);
|
||||
--success: #4ade80;
|
||||
--warning: #fbbf24;
|
||||
--error: #f87171;
|
||||
--border: #2c2548;
|
||||
--shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
/* Jade — dark with emerald green accents */
|
||||
[data-theme="jade"] {
|
||||
--bg-primary: #0d1510;
|
||||
--bg-secondary: #142018;
|
||||
--bg-tertiary: #13221a;
|
||||
--bg-card: #182a1e;
|
||||
--bg-hover: #203628;
|
||||
--text-primary: #d4f0e0;
|
||||
--text-secondary: #7eb898;
|
||||
--text-muted: #4a7a60;
|
||||
--accent: #34d399;
|
||||
--accent-hover: #5ae8b5;
|
||||
--accent-dim: rgba(52, 211, 153, 0.12);
|
||||
--success: #34d399;
|
||||
--warning: #fbbf24;
|
||||
--error: #f87171;
|
||||
--border: #1e3528;
|
||||
--shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
|
||||
}
|
||||
|
||||
html, body, #root {
|
||||
height: 100%;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||
@@ -68,87 +148,79 @@ html, body, #root {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
/* Layout — top bar + content */
|
||||
.app-layout {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 240px;
|
||||
background: var(--bg-secondary);
|
||||
border-right: 1px solid var(--border);
|
||||
/* Top navigation bar */
|
||||
.topbar-nav {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.sidebar-header {
|
||||
padding: 20px 16px;
|
||||
align-items: center;
|
||||
height: 52px;
|
||||
background: var(--bg-secondary);
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding: 0 16px;
|
||||
flex-shrink: 0;
|
||||
gap: 8px;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.sidebar-header h1 {
|
||||
font-size: 20px;
|
||||
.topbar-brand {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
background: linear-gradient(135deg, var(--accent), #a78bfa);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
margin-right: 16px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.sidebar-header p {
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.sidebar-nav {
|
||||
flex: 1;
|
||||
padding: 12px 8px;
|
||||
.topbar-tabs {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
.topbar-tab {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 10px 12px;
|
||||
gap: 6px;
|
||||
padding: 8px 14px;
|
||||
border-radius: var(--radius);
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--text-secondary);
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all var(--transition);
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.nav-item:hover {
|
||||
.topbar-tab:hover {
|
||||
background: var(--bg-hover);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.nav-item.active {
|
||||
.topbar-tab.active {
|
||||
background: var(--accent-dim);
|
||||
color: var(--accent-hover);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.nav-icon {
|
||||
font-size: 18px;
|
||||
width: 24px;
|
||||
text-align: center;
|
||||
.topbar-tab-icon {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.sidebar-footer {
|
||||
padding: 12px 16px;
|
||||
border-top: 1px solid var(--border);
|
||||
font-size: 12px;
|
||||
.topbar-version {
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
white-space: nowrap;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
/* Main content */
|
||||
@@ -160,17 +232,7 @@ html, body, #root {
|
||||
}
|
||||
|
||||
.topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16px 24px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
background: var(--bg-secondary);
|
||||
}
|
||||
|
||||
.topbar h2 {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.page-content {
|
||||
@@ -1084,3 +1146,102 @@ select:focus, input[type="text"]:focus {
|
||||
from { opacity: 0; transform: translateX(-50%) translateY(8px); }
|
||||
to { opacity: 1; transform: translateX(-50%) translateY(0); }
|
||||
}
|
||||
|
||||
/* Cover picker modal */
|
||||
.cover-picker-modal {
|
||||
background: var(--bg-secondary);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 12px;
|
||||
width: min(700px, 90vw);
|
||||
max-height: 80vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.cover-picker-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 16px 20px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.cover-picker-header h3 {
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.cover-picker-subtitle {
|
||||
font-size: 13px;
|
||||
color: var(--text-muted);
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.cover-picker-body {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 16px 20px;
|
||||
min-height: 200px;
|
||||
}
|
||||
|
||||
.cover-picker-loading,
|
||||
.cover-picker-error {
|
||||
text-align: center;
|
||||
padding: 40px 20px;
|
||||
color: var(--text-secondary);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.cover-picker-error {
|
||||
color: var(--warning);
|
||||
}
|
||||
|
||||
.cover-picker-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.cover-picker-item {
|
||||
position: relative;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
border: 2px solid var(--border);
|
||||
cursor: pointer;
|
||||
transition: all var(--transition);
|
||||
background: var(--bg-card);
|
||||
}
|
||||
|
||||
.cover-picker-item:hover {
|
||||
border-color: var(--accent);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.cover-picker-item.selected {
|
||||
border-color: var(--accent);
|
||||
box-shadow: 0 0 0 2px var(--accent-dim);
|
||||
}
|
||||
|
||||
.cover-picker-item img {
|
||||
width: 100%;
|
||||
aspect-ratio: 2/3;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.cover-picker-item-info {
|
||||
padding: 6px 8px;
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.cover-picker-footer {
|
||||
padding: 12px 20px;
|
||||
border-top: 1px solid var(--border);
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
@@ -42,6 +42,7 @@ declare global {
|
||||
clearRecent: () => Promise<boolean>;
|
||||
scrapeArt: (title: string, platform: string) => Promise<string | undefined>;
|
||||
cacheCovers: (entries: { romPath: string; coverUrl: string }[]) => Promise<boolean>;
|
||||
searchCoverSGDB: (title: string, platform: string) => Promise<any[]>;
|
||||
scrapeMetadata: (romPath: string, title: string, platform: string) => Promise<GameMetadata>;
|
||||
achievements: (romPath: string, title: string, platform: string) => Promise<AchievementInfo | null>;
|
||||
};
|
||||
|
||||
+3
-1
@@ -99,7 +99,7 @@ export interface ScanResult {
|
||||
export interface AppSettings {
|
||||
romsDirectory: string;
|
||||
emulatorsDirectory: string;
|
||||
theme: 'light' | 'dark' | 'system';
|
||||
theme: 'light' | 'dark' | 'system' | 'midnight' | 'ember' | 'lavender' | 'jade';
|
||||
minimiseToTray: boolean;
|
||||
launchInFullscreen: boolean;
|
||||
closeToTray: boolean;
|
||||
@@ -119,6 +119,8 @@ export interface AppSettings {
|
||||
retroAchievementsApiKey?: string;
|
||||
/** Enable experimental/beta features (ES-DE, NeoStation, etc.) */
|
||||
betaFeatures?: boolean;
|
||||
/** SteamGridDB API key (free account at steamgriddb.com) */
|
||||
steamGridDbApiKey?: string;
|
||||
}
|
||||
|
||||
export interface RetroAchievement {
|
||||
|
||||
Reference in new issue
Block a user