diff --git a/frontend/src/pages/GameDetail.svelte b/frontend/src/pages/GameDetail.svelte index 8984e07..e82b8af 100644 --- a/frontend/src/pages/GameDetail.svelte +++ b/frontend/src/pages/GameDetail.svelte @@ -156,13 +156,24 @@ ← Back to Library
{:else}
by {game.developer}{game.publisher ? ` · ${game.publisher}` : ""}
+ {/if} + {/if}by {game.developer}{game.publisher ? ` · ${game.publisher}` : ""}
- {/if} {#if game.description}{game.description}
{/if} @@ -333,6 +335,8 @@ .detail-layout > * { min-width: 0; } /* prevent grid overflow from wide content */ @media (max-width: 640px) { .detail-layout { grid-template-columns: 1fr; } } .cover-section { border-radius: var(--radius); overflow: hidden; } + .cover-section .meta { margin-top: 12px; } + .cover-section .dev { margin-top: 8px; } .cover-img { width: 100%; border-radius: var(--radius); } .cover-placeholder { aspect-ratio: 3/4; background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 4rem; border-radius: var(--radius); } .info-section h1 { color: var(--phosphor); font-family: var(--font-mono); margin-bottom: 8px; word-break: break-word; } diff --git a/frontend/src/pages/Library.svelte b/frontend/src/pages/Library.svelte index 7d25eb0..0d1ce6f 100644 --- a/frontend/src/pages/Library.svelte +++ b/frontend/src/pages/Library.svelte @@ -7,7 +7,12 @@ let search = $state(""); let uploading = $state(false); let uploadError = $state(""); - let uploadTitle = $state(""); + + // Post-selection upload dialog + let pendingFile = $state(null); + let pendingFileName = $state(""); + let pendingTitle = $state(""); + let fileInput; async function loadGames() { @@ -21,16 +26,31 @@ loading = false; } - async function handleUpload(e) { + function handleFileSelected(e) { const file = e.target.files?.[0]; if (!file) return; + const name = file.name.replace(/\.zip$/i, ""); + pendingFile = file; + pendingFileName = name; + pendingTitle = ""; + // Reset input so the same file can be re-selected + fileInput.value = ""; + } + + function cancelUpload() { + pendingFile = null; + pendingFileName = ""; + pendingTitle = ""; + } + + async function doUpload(title) { + if (!pendingFile) return; uploading = true; uploadError = ""; try { - await uploadGame(file, uploadTitle.trim() || undefined); - uploadTitle = ""; + await uploadGame(pendingFile, title || undefined); + cancelUpload(); await loadGames(); - fileInput.value = ""; } catch (err) { uploadError = err.message; } @@ -53,13 +73,6 @@ oninput={() => loadGames()} />