refactor: unify upload UX across GameDetails subtabs

Move every upload affordance out of the sidebar's collapsible action
panel into a section header at the top of each panel, matching
ScreenshotsSubtab. Sidebars become navigation-only.

Touched subtabs:
- SaveDataTab (Saves + States) — Upload per Mine section header.
- MediaTab Manual — header hosts the entry selector + Upload only;
  Delete + Redownload move into the PDF viewer's toolbar via new
  PdfViewer `deletable` / `redownloadable` props.
- MediaTab Soundtrack — header with just Upload.
- MediaTab — reorder subtabs so Screenshots sits above Soundtrack.
- FilesTab — header with Upload only (Download all / Copy link
  dropped; equivalent via select-all + selection toolbar).
- ScreenshotsSubtab + SaveDataTab — drop the redundant "Private to
  you until you make them public" subtitle and i18n keys.

Add a distinct entrance animation for dense, data-row content:
`r-v2-asset-fade` (fade + 14px rise, no scale, no overshoot, 320ms,
24ms stagger). Applied to AssetList / AssetStrip rows, FileRow,
screenshot thumbnails and soundtrack track rows so they cascade in
on first paint, separate from the bouncier `r-v2-card-fade` reserved
for hero cards.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
zurdi
2026-06-21 17:23:40 +00:00
parent 91640c36ec
commit d3bc224900
28 changed files with 379 additions and 378 deletions

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "Екранни снимки на ROM",
"screenshots-section-rom-desc": "Споделени с всички, които виждат тази игра",
"screenshots-section-mine": "Моите екранни снимки",
"screenshots-section-mine-desc": "Лични за теб, докато не ги направиш публични",
"screenshots-section-community": "Общност",
"screenshot-make-public": "Направи публична",
"screenshot-make-private": "Направи лична",

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "Screenshoty ROM",
"screenshots-section-rom-desc": "Sdíleno se všemi, kdo vidí tuto hru",
"screenshots-section-mine": "Moje screenshoty",
"screenshots-section-mine-desc": "Soukromé, dokud je nezveřejníš",
"screenshots-section-community": "Komunita",
"screenshot-make-public": "Zveřejnit",
"screenshot-make-private": "Nastavit jako soukromé",

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "ROM-Screenshots",
"screenshots-section-rom-desc": "Mit allen geteilt, die dieses Spiel sehen können",
"screenshots-section-mine": "Meine Screenshots",
"screenshots-section-mine-desc": "Privat, bis du sie veröffentlichst",
"screenshots-section-community": "Community",
"screenshot-make-public": "Veröffentlichen",
"screenshot-make-private": "Privat machen",

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "ROM screenshots",
"screenshots-section-rom-desc": "Shared with everyone who can see this game",
"screenshots-section-mine": "My screenshots",
"screenshots-section-mine-desc": "Private to you until you make them public",
"screenshots-section-community": "Community",
"screenshot-make-public": "Make public",
"screenshot-make-private": "Make private",

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "ROM screenshots",
"screenshots-section-rom-desc": "Shared with everyone who can see this game",
"screenshots-section-mine": "My screenshots",
"screenshots-section-mine-desc": "Private to you until you make them public",
"screenshots-section-community": "Community",
"screenshot-make-public": "Make public",
"screenshot-make-private": "Make private",

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "Capturas de la ROM",
"screenshots-section-rom-desc": "Compartidas con todos los que pueden ver este juego",
"screenshots-section-mine": "Mis capturas",
"screenshots-section-mine-desc": "Privadas hasta que las hagas públicas",
"screenshots-section-community": "Comunidad",
"screenshot-make-public": "Hacer pública",
"screenshot-make-private": "Hacer privada",

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "Captures de la ROM",
"screenshots-section-rom-desc": "Partagées avec tous ceux qui voient ce jeu",
"screenshots-section-mine": "Mes captures",
"screenshots-section-mine-desc": "Privées jusqu'à ce que vous les rendiez publiques",
"screenshots-section-community": "Communauté",
"screenshot-make-public": "Rendre publique",
"screenshot-make-private": "Rendre privée",

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "ROM képernyőképei",
"screenshots-section-rom-desc": "Megosztva mindenkivel, aki látja ezt a játékot",
"screenshots-section-mine": "Saját képernyőképeim",
"screenshots-section-mine-desc": "Csak a tiéd, amíg nyilvánossá nem teszed",
"screenshots-section-community": "Közösség",
"screenshot-make-public": "Közzététel",
"screenshot-make-private": "Priváttá tétel",

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "Screenshot della ROM",
"screenshots-section-rom-desc": "Condivise con tutti coloro che vedono questo gioco",
"screenshots-section-mine": "I miei screenshot",
"screenshots-section-mine-desc": "Private finché non le rendi pubbliche",
"screenshots-section-community": "Comunità",
"screenshot-make-public": "Rendi pubblico",
"screenshot-make-private": "Rendi privato",

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "ROMのスクリーンショット",
"screenshots-section-rom-desc": "このゲームを見られる全員と共有されます",
"screenshots-section-mine": "自分のスクリーンショット",
"screenshots-section-mine-desc": "公開するまであなただけが見られます",
"screenshots-section-community": "コミュニティ",
"screenshot-make-public": "公開する",
"screenshot-make-private": "非公開にする",

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "ROM 스크린샷",
"screenshots-section-rom-desc": "이 게임을 볼 수 있는 모든 사용자와 공유됩니다",
"screenshots-section-mine": "내 스크린샷",
"screenshots-section-mine-desc": "공개하기 전까지 나만 볼 수 있습니다",
"screenshots-section-community": "커뮤니티",
"screenshot-make-public": "공개로 전환",
"screenshot-make-private": "비공개로 전환",

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "Zrzuty ekranu ROM-u",
"screenshots-section-rom-desc": "Udostępnione wszystkim, którzy widzą tę grę",
"screenshots-section-mine": "Moje zrzuty ekranu",
"screenshots-section-mine-desc": "Prywatne, dopóki ich nie upublicznisz",
"screenshots-section-community": "Społeczność",
"screenshot-make-public": "Upublicznij",
"screenshot-make-private": "Ustaw jako prywatne",

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "Capturas da ROM",
"screenshots-section-rom-desc": "Compartilhadas com todos que veem este jogo",
"screenshots-section-mine": "Minhas capturas",
"screenshots-section-mine-desc": "Privadas até você torná-las públicas",
"screenshots-section-community": "Comunidade",
"screenshot-make-public": "Tornar pública",
"screenshot-make-private": "Tornar privada",

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "Capturi ale ROM-ului",
"screenshots-section-rom-desc": "Partajate cu toți cei care văd acest joc",
"screenshots-section-mine": "Capturile mele",
"screenshots-section-mine-desc": "Private până le faci publice",
"screenshots-section-community": "Comunitate",
"screenshot-make-public": "Fă publică",
"screenshot-make-private": "Fă privată",

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "Скриншоты ROM",
"screenshots-section-rom-desc": "Доступны всем, кто видит эту игру",
"screenshots-section-mine": "Мои скриншоты",
"screenshots-section-mine-desc": "Видны только вам, пока вы не сделаете их публичными",
"screenshots-section-community": "Сообщество",
"screenshot-make-public": "Сделать публичной",
"screenshot-make-private": "Сделать приватной",

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "ROM 截图",
"screenshots-section-rom-desc": "与所有能看到此游戏的人共享",
"screenshots-section-mine": "我的截图",
"screenshots-section-mine-desc": "在你公开之前仅自己可见",
"screenshots-section-community": "社区",
"screenshot-make-public": "设为公开",
"screenshot-make-private": "设为私密",

View File

@@ -400,7 +400,6 @@
"screenshots-section-rom": "ROM 螢幕截圖",
"screenshots-section-rom-desc": "與所有能看到此遊戲的人共享",
"screenshots-section-mine": "我的螢幕截圖",
"screenshots-section-mine-desc": "在你公開之前僅自己可見",
"screenshots-section-community": "社群",
"screenshot-make-public": "設為公開",
"screenshot-make-private": "設為私密",

View File

@@ -104,7 +104,11 @@ const hasAnyHash = computed(
</script>
<template>
<li class="r-v2-file-row" :class="{ 'r-v2-file-row--selected': selected }">
<li
class="r-v2-file-row"
:class="{ 'r-v2-file-row--selected': selected }"
v-bind="$attrs"
>
<!-- The wrapper matches the filename's first-line box height
(font-size × line-height) so `align-items: center` inside it
lands the checkbox box on the filename's vertical centre,

View File

@@ -2,9 +2,10 @@
// FilesTab — browse + interact with the individual files that make up
// a (potentially multi-file) ROM.
//
// Layout mirrors MediaTab / SaveDataTab: a vertical subtab list on the
// left with an attached RCollapsible action panel under the active
// subtab, and a content column on the right.
// Layout mirrors ScreenshotsSubtab / SaveDataTab / MediaTab: a vertical
// subtab list on the left (navigation only — no inline action panel),
// and a content column on the right with a section header hosting the
// subtab-level actions (Download all / Copy link / Upload) on the right.
//
// Grouping is **folder-based**: every direct subfolder of the ROM
// becomes its own subtab, plus a "Root" subtab for files sitting
@@ -15,15 +16,16 @@
// folder name. Per-file `category` metadata is still shown as a chip
// inside each row.
//
// Sidebar action panel (per active subtab):
// * Download all / Copy link — always wired for any subtab.
// * Upload — only wired for the "manual" and "soundtrack" folders
// Section header (per active subtab):
// * Download all / Copy link — wired for any subtab with files.
// * Upload — only enabled for the "manual" and "soundtrack" folders
// (the only places the backend supports adding files to an
// existing ROM today). Other subtabs render a disabled Upload
// button with a "coming soon" tooltip so the affordance is
// visible but truthful about its current reach.
// button with a tooltip so the affordance is visible but truthful
// about its current reach.
//
// Content column:
// * Section header (Download all / Copy link / Upload)
// * ROM-info card (size, revision, ROM-level hashes — click to copy)
// * Selection toolbar (select-all + per-selection actions)
// * One row per file with checkbox, relative path, category chip,
@@ -33,14 +35,7 @@
// All destructive ops live elsewhere (MediaTab handles manual /
// soundtrack deletion, EditRom dialog handles whole-ROM deletion).
// This tab is browse + download + (limited) upload only.
import {
RBtn,
RCheckbox,
RCollapsible,
REmptyState,
RIcon,
RTooltip,
} from "@v2/lib";
import { RBtn, RCheckbox, REmptyState, RIcon, RTooltip } from "@v2/lib";
import { computed, ref, watch } from "vue";
import { useI18n } from "vue-i18n";
import { useRoute, useRouter } from "vue-router";
@@ -451,13 +446,6 @@ async function downloadFile(file: RomFileSchema) {
await romApi.downloadRom({ rom: props.rom, fileIDs: [file.id] });
}
async function downloadSubtab() {
// "all" → download whole ROM (empty fileIDs == full content)
const ids =
subTab.value === "all" ? [] : filteredFiles.value.map((f) => f.id);
await romApi.downloadRom({ rom: props.rom, fileIDs: ids });
}
async function downloadSelected() {
if (selectedCount.value === 0) return;
await romApi.downloadRom({
@@ -466,12 +454,6 @@ async function downloadSelected() {
});
}
async function copySubtabLink() {
const ids =
subTab.value === "all" ? [] : filteredFiles.value.map((f) => f.id);
await copyDownloadLink(getDownloadLink({ rom: props.rom, fileIDs: ids }));
}
async function copyFileLink(file: RomFileSchema) {
await copyDownloadLink(
getDownloadLink({ rom: props.rom, fileIDs: [file.id] }),
@@ -595,7 +577,9 @@ async function onSoundtrackUpload(event: Event) {
}
}
// Per-subtab upload affordance computed for the inline action panel.
// Upload affordance for the active subtab — drives the header's
// Upload button (enabled / loading) plus the tooltip surfaced when the
// folder isn't a backend-supported upload target.
interface SubtabUploadState {
/** Whether the button should be clickable. */
enabled: boolean;
@@ -605,8 +589,8 @@ interface SubtabUploadState {
loading: boolean;
}
function uploadStateForSubtab(id: Subtab): SubtabUploadState {
const target = uploadSupportsSubtab(id);
const currentUploadState = computed<SubtabUploadState>(() => {
const target = uploadSupportsSubtab(subTab.value);
if (!target) {
return {
enabled: false,
@@ -627,7 +611,7 @@ function uploadStateForSubtab(id: Subtab): SubtabUploadState {
loading:
target === "manual" ? uploadingManual.value : uploadingSoundtrack.value,
};
}
});
</script>
<template>
@@ -667,8 +651,6 @@ function uploadStateForSubtab(id: Subtab): SubtabUploadState {
class="r-v2-files__subtab-btn"
:class="{
'r-v2-files__subtab-btn--active': subTab === tab.id,
'r-v2-files__subtab-btn--joined':
subTab === tab.id && tab.count > 0,
}"
:aria-selected="subTab === tab.id"
@click="subTab = tab.id"
@@ -679,58 +661,38 @@ function uploadStateForSubtab(id: Subtab): SubtabUploadState {
{{ tab.count }}
</span>
</button>
<RCollapsible
:model-value="subTab === tab.id && tab.count > 0"
attached
class="r-v2-files__subtab-panel"
>
<div class="r-v2-files__subtab-panel-inner">
<RBtn
variant="outlined"
prepend-icon="mdi-cloud-download-outline"
block
@click="downloadSubtab"
>
{{ t("rom.download-all") }}
</RBtn>
<RBtn
variant="outlined"
prepend-icon="mdi-link-variant"
block
@click="copySubtabLink"
>
{{ t("rom.copy-link-action") }}
</RBtn>
<!-- Upload — wired only for Manual / Soundtrack folders;
other subtabs render disabled with a tooltip
explaining the pending backend work. -->
<div class="r-v2-files__upload-slot">
<RBtn
variant="outlined"
prepend-icon="mdi-cloud-upload-outline"
block
:disabled="!uploadStateForSubtab(tab.id).enabled"
:loading="uploadStateForSubtab(tab.id).loading"
@click="triggerUpload"
>
{{ t("common.upload") }}
</RBtn>
<RTooltip
v-if="uploadStateForSubtab(tab.id).reason"
:text="uploadStateForSubtab(tab.id).reason ?? ''"
location="bottom"
activator="parent"
/>
</div>
</div>
</RCollapsible>
</li>
</ul>
</aside>
<div class="r-v2-files__content">
<!-- Section header — the sidebar's subtab label already names the
section, so the header skips a redundant title and just hosts
the Upload button on the right. Download-all / Copy-link are
covered by the selection toolbar below (select-all then act). -->
<header v-if="filteredFiles.length > 0" class="r-v2-files__section-head">
<div class="r-v2-files__section-actions">
<div class="r-v2-files__upload-slot">
<RBtn
variant="outlined"
size="small"
prepend-icon="mdi-cloud-upload-outline"
:disabled="!currentUploadState.enabled"
:loading="currentUploadState.loading"
@click="triggerUpload"
>
{{ t("common.upload") }}
</RBtn>
<RTooltip
v-if="currentUploadState.reason"
:text="currentUploadState.reason ?? ''"
location="bottom"
activator="parent"
/>
</div>
</div>
</header>
<FilesSummary :rom="rom" />
<!-- Selection toolbar — pinned above the list. Always visible
@@ -803,8 +765,10 @@ function uploadStateForSubtab(id: Subtab): SubtabUploadState {
<ul v-else class="r-v2-files__list">
<FileRow
v-for="file in filteredFiles"
v-for="(file, i) in filteredFiles"
:key="file.id"
class="r-v2-asset-fade"
:style="{ '--asset-fade-i': i }"
:file="file"
:display-path="displayPath(file)"
:relative-path="relativePath(file)"
@@ -905,10 +869,6 @@ function uploadStateForSubtab(id: Subtab): SubtabUploadState {
background: color-mix(in srgb, var(--r-color-brand-primary) 18%, transparent);
color: var(--r-color-brand-primary);
}
.r-v2-files__subtab-btn--joined {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.r-v2-files__subtab-label {
flex: 1;
}
@@ -920,16 +880,6 @@ function uploadStateForSubtab(id: Subtab): SubtabUploadState {
background: color-mix(in srgb, currentColor 18%, transparent);
}
.r-v2-files__subtab-panel {
margin-bottom: var(--r-space-1);
}
.r-v2-files__subtab-panel-inner {
display: flex;
flex-direction: column;
gap: var(--r-space-2);
padding: var(--r-space-3);
}
/* Hidden file inputs sit at the template root so the visible buttons
can `.click()` them — display:none works fine since we never need
them to be tabbable directly. */
@@ -937,6 +887,25 @@ function uploadStateForSubtab(id: Subtab): SubtabUploadState {
display: none;
}
/* Section header — toolbar row at the top of the content column,
mirroring ScreenshotsSubtab / MediaTab. The sidebar's subtab label
names the section, so the header has no title — only the action
cluster pushed to the right. */
.r-v2-files__section-head {
display: flex;
align-items: center;
gap: 12px;
flex-shrink: 0;
}
.r-v2-files__section-actions {
margin-left: auto;
display: flex;
align-items: center;
gap: 6px;
flex-wrap: wrap;
justify-content: flex-end;
}
/* Wrapper around the Upload button so RTooltip can attach to a
non-disabled positioned ancestor; pointer-events on the disabled
button itself swallow the tooltip's hover detection. */
@@ -947,13 +916,14 @@ function uploadStateForSubtab(id: Subtab): SubtabUploadState {
.r-v2-files__content {
flex: 1;
min-width: 0;
/* Grid (auto / auto / 1fr) instead of flex column: the `1fr` row
forces the list to clip + scroll internally even with many files.
Flex `min-height: 0` + `overflow-y: auto` on the list was unreliable
here — the list's intrinsic min-content kept leaking through and
pushed `.r-v2-det__panel` into showing its outer scrollbar. */
/* Grid (auto / auto / auto / 1fr) instead of flex column: the `1fr`
row forces the list to clip + scroll internally even with many
files. Flex `min-height: 0` + `overflow-y: auto` on the list was
unreliable here — the list's intrinsic min-content kept leaking
through and pushed `.r-v2-det__panel` into showing its outer
scrollbar. Rows: section header, summary, selection toolbar, list. */
display: grid;
grid-template-rows: auto auto 1fr;
grid-template-rows: auto auto auto 1fr;
gap: var(--r-space-3);
min-height: 0;
overflow: hidden;

View File

@@ -14,14 +14,7 @@
// ROM / Mine / Community sections with per-user public/private
//
// The PDF viewer + soundtrack player are reused from v1 for now.
import {
RBtn,
RCollapsible,
RDropzone,
REmptyState,
RIcon,
RSelect,
} from "@v2/lib";
import { RBtn, RDropzone, REmptyState, RIcon, RSelect } from "@v2/lib";
import axios from "axios";
import type { Emitter } from "mitt";
import { computed, defineAsyncComponent, inject, ref, watch } from "vue";
@@ -65,7 +58,7 @@ const { t } = useI18n();
// ---------- Subtab state ----------
// Mirrored to `?subtab=` so the SoundtrackMiniPlayer can detect when the full
// player is visible here and hide itself to avoid duplication.
const validSubtabs = ["manual", "soundtrack", "screenshots"] as const;
const validSubtabs = ["manual", "screenshots", "soundtrack"] as const;
type Subtab = (typeof validSubtabs)[number];
const route = useRoute();
@@ -179,10 +172,10 @@ const manualItems = computed(() =>
const soundtrackSupported = computed(() => !props.rom.has_simple_single_file);
// ---------- Subtab nav ----------
// We render the subtab list manually (not via RTabNav) so we can inline
// each subtab's contextual controls right under the active item — the
// list reads as "tab + its expanded panel", not "tabs above + a separate
// actions block". RTabNav stays a navigation-only primitive.
// We render the subtab list manually (not via RTabNav) because each
// subtab's content panel owns its own section header with title +
// contextual actions — the sidebar stays navigation-only, mirroring
// ScreenshotsSubtab.
type SubtabDef = { id: Subtab; label: string; icon: string };
const subtabDefs = computed<SubtabDef[]>(() => [
{
@@ -190,31 +183,21 @@ const subtabDefs = computed<SubtabDef[]>(() => [
label: t("rom.manual"),
icon: "mdi-book-open-page-variant-outline",
},
{
id: "soundtrack",
label: t("rom.soundtrack"),
icon: "mdi-music-note-outline",
},
{
id: "screenshots",
label: t("rom.screenshots"),
icon: "mdi-image-multiple-outline",
},
{
id: "soundtrack",
label: t("rom.soundtrack"),
icon: "mdi-music-note-outline",
},
]);
// Whether the active subtab has any inline actions worth rendering.
// Drives the empty-panel skip so we don't paint a stray padding block.
function hasSubtabActions(id: Subtab): boolean {
if (id === "manual") return manualEntries.value.length > 0;
if (id === "soundtrack")
return soundtrackSupported.value && Boolean(props.rom.has_soundtrack);
// The screenshots subtab owns its own controls (ScreenshotsSubtab).
return false;
}
// ---------- Upload / refresh plumbing ----------
// The manual / soundtrack panels each use an RDropzone (CTA when empty,
// overlay over the viewer / player when filled). The sidebar's explicit
// overlay over the viewer / player when filled). The section header's
// "upload" button opens the filled dropzone's picker via these refs.
const manualDz = ref<InstanceType<typeof RDropzone> | null>(null);
const soundtrackDz = ref<InstanceType<typeof RDropzone> | null>(null);
@@ -354,8 +337,6 @@ async function deleteSoundtrack(fileId: number) {
class="r-v2-media__subtab-btn"
:class="{
'r-v2-media__subtab-btn--active': subTab === tab.id,
'r-v2-media__subtab-btn--joined':
subTab === tab.id && hasSubtabActions(tab.id),
}"
:aria-selected="subTab === tab.id"
@click="subTab = tab.id"
@@ -363,74 +344,6 @@ async function deleteSoundtrack(fileId: number) {
<RIcon :icon="tab.icon" size="16" />
<span class="r-v2-media__subtab-label">{{ tab.label }}</span>
</button>
<!-- Inline controls panel — RCollapsible drives the open/close
animation; `attached` removes its top radius/border so it
sits flush with the active subtab button above. -->
<RCollapsible
:model-value="subTab === tab.id && hasSubtabActions(tab.id)"
attached
class="r-v2-media__subtab-panel"
>
<div class="r-v2-media__subtab-panel-inner">
<template v-if="tab.id === 'manual' && manualEntries.length > 0">
<RSelect
v-if="manualEntries.length > 1"
v-model="selectedManualId"
:items="manualItems"
density="compact"
variant="outlined"
hide-details
/>
<RBtn
variant="outlined"
prepend-icon="mdi-cloud-upload-outline"
block
@click="manualDz?.open()"
>
{{ t("common.upload") }}
</RBtn>
<RBtn
v-if="rom.url_manual"
variant="outlined"
prepend-icon="mdi-cloud-download-outline"
block
:loading="redownloadingManual"
:disabled="redownloadingManual"
@click="redownloadManual"
>
{{ t("rom.redownload") }}
</RBtn>
<RBtn
v-if="selectedManual"
variant="outlined"
color="romm-red"
prepend-icon="mdi-delete"
block
@click="requestDeleteManual"
>
{{ t("common.delete") }}
</RBtn>
</template>
<template
v-else-if="
tab.id === 'soundtrack' &&
soundtrackSupported &&
rom.has_soundtrack
"
>
<RBtn
variant="outlined"
prepend-icon="mdi-cloud-upload-outline"
block
@click="soundtrackDz?.open()"
>
{{ t("common.upload") }}
</RBtn>
</template>
</div>
</RCollapsible>
</li>
</ul>
</aside>
@@ -444,6 +357,37 @@ async function deleteSoundtrack(fileId: number) {
once on Media tab entry and switching is a CSS toggle. -->
<!-- Manual subtab -->
<section v-show="subTab === 'manual'" class="r-v2-media__panel">
<!-- The subtab label in the sidebar already names the section,
so the header skips a redundant title and just hosts the
entry selector (when multiple) + the Upload button. Delete
and Redownload live inside the PDF viewer's toolbar — they
act on the currently displayed entry, so colocating them
with Download reads as one action cluster. -->
<header
v-if="manualEntries.length > 0"
class="r-v2-media__section-head"
>
<RSelect
v-if="manualEntries.length > 1"
v-model="selectedManualId"
:items="manualItems"
density="compact"
variant="outlined"
hide-details
class="r-v2-media__manual-select"
/>
<div class="r-v2-media__section-actions">
<RBtn
variant="outlined"
size="small"
prepend-icon="mdi-cloud-upload-outline"
@click="manualDz?.open()"
>
{{ t("common.upload") }}
</RBtn>
</div>
</header>
<RDropzone
v-if="manualEntries.length === 0"
:title="t('rom.manual-empty')"
@@ -483,11 +427,22 @@ async function deleteSoundtrack(fileId: number) {
v-if="selectedManual"
:key="`${selectedManual.id}-${rom.updated_at}`"
:pdf-url="selectedManual.url"
deletable
:redownloadable="!!rom.url_manual"
:redownloading="redownloadingManual"
@delete="requestDeleteManual"
@redownload="redownloadManual"
/>
</div>
</RDropzone>
</section>
<!-- Screenshots subtab — its own component (ROM / Mine / Community
sections, per-user public/private). -->
<section v-show="subTab === 'screenshots'" class="r-v2-media__panel">
<ScreenshotsSubtab :rom="rom" />
</section>
<!-- Soundtrack subtab -->
<section v-show="subTab === 'soundtrack'" class="r-v2-media__panel">
<REmptyState
@@ -497,40 +452,50 @@ async function deleteSoundtrack(fileId: number) {
:hint="t('rom.soundtrack-folder-hint')"
/>
<RDropzone
v-else-if="!rom.has_soundtrack"
:title="t('rom.soundtrack-empty')"
:hint="t('common.dropzone-hint')"
:active-title="t('common.dropzone-drag-over')"
:input-label="t('rom.upload-soundtrack')"
accept="audio/*,.flac,.opus"
multiple
@files="handleSoundtrackFiles"
/>
<template v-else>
<header v-if="rom.has_soundtrack" class="r-v2-media__section-head">
<div class="r-v2-media__section-actions">
<RBtn
variant="outlined"
size="small"
prepend-icon="mdi-cloud-upload-outline"
@click="soundtrackDz?.open()"
>
{{ t("common.upload") }}
</RBtn>
</div>
</header>
<RDropzone
v-else
ref="soundtrackDz"
overlay
:release-label="t('common.dropzone-drag-over')"
:input-label="t('rom.upload-soundtrack')"
accept="audio/*,.flac,.opus"
multiple
@files="handleSoundtrackFiles"
>
<SoundtrackPanel
:rom="rom"
class="r-v2-media__soundtrack"
@upload-tracks="soundtrackDz?.open()"
@delete-track="deleteSoundtrack"
<RDropzone
v-if="!rom.has_soundtrack"
:title="t('rom.soundtrack-empty')"
:hint="t('common.dropzone-hint')"
:active-title="t('common.dropzone-drag-over')"
:input-label="t('rom.upload-soundtrack')"
accept="audio/*,.flac,.opus"
multiple
@files="handleSoundtrackFiles"
/>
</RDropzone>
</section>
<!-- Screenshots subtab — its own component (ROM / Mine / Community
sections, per-user public/private). -->
<section v-show="subTab === 'screenshots'" class="r-v2-media__panel">
<ScreenshotsSubtab :rom="rom" />
<RDropzone
v-else
ref="soundtrackDz"
overlay
class="r-v2-media__fill"
:release-label="t('common.dropzone-drag-over')"
:input-label="t('rom.upload-soundtrack')"
accept="audio/*,.flac,.opus"
multiple
@files="handleSoundtrackFiles"
>
<SoundtrackPanel
:rom="rom"
class="r-v2-media__soundtrack"
@upload-tracks="soundtrackDz?.open()"
@delete-track="deleteSoundtrack"
/>
</RDropzone>
</template>
</section>
</div>
</div>
@@ -553,10 +518,9 @@ async function deleteSoundtrack(fileId: number) {
flex-shrink: 0;
}
/* Subtab list — inline-expansion pattern: each tab can host a panel of
contextual actions right under its button. Visual mirrors RTabNav's
`pill` + `vertical` + `sm` size so the navigation reads identically
to the rest of v2. */
/* Subtab list — navigation only. Per-section actions (Upload, etc.)
live in the content column's section headers, mirroring
ScreenshotsSubtab. */
.r-v2-media__subtabs {
list-style: none;
margin: 0;
@@ -597,32 +561,10 @@ async function deleteSoundtrack(fileId: number) {
background: color-mix(in srgb, var(--r-color-brand-primary) 18%, transparent);
color: var(--r-color-brand-primary);
}
/* When the active subtab has an attached panel below, drop its bottom
radius so the button visually merges with the RCollapsible surface. */
.r-v2-media__subtab-btn--joined {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.r-v2-media__subtab-label {
flex: 1;
}
/* Inline panel — RCollapsible (attached, headless) provides the
surface (bg-elevated + border + bottom radius) and the open/close
animation. We only add a small bottom margin so the next subtab
doesn't crowd the panel. */
.r-v2-media__subtab-panel {
margin-bottom: var(--r-space-1);
}
/* Headless mode: consumer drives the inner padding so the controls
breathe inside the panel surface. */
.r-v2-media__subtab-panel-inner {
display: flex;
flex-direction: column;
gap: var(--r-space-2);
padding: var(--r-space-3);
}
.r-v2-media__content {
flex: 1;
min-width: 0;
@@ -644,6 +586,33 @@ async function deleteSoundtrack(fileId: number) {
min-height: 0;
}
/* Section header — toolbar row. The sidebar's subtab label already
names the section, so the header skips the title and hosts the
contextual controls only: the manual entry selector on the left
(when relevant) and the action cluster pushed to the right. */
.r-v2-media__section-head {
display: flex;
align-items: center;
gap: 12px;
flex-shrink: 0;
}
.r-v2-media__section-actions {
margin-left: auto;
display: flex;
align-items: center;
gap: 6px;
flex-wrap: wrap;
justify-content: flex-end;
}
/* Manual entry selector — capped width so it doesn't stretch to
fill the row when the action cluster is light. */
.r-v2-media__manual-select {
max-width: 360px;
min-width: 200px;
flex-shrink: 1;
}
/* Overlay-mode RDropzone wrapping the PDF viewer must fill the panel
height so the inner viewer can stretch to 100%. */
.r-v2-media__fill {

View File

@@ -14,7 +14,21 @@ import { useI18n } from "vue-i18n";
import { useBreakpoint } from "@/v2/composables/useBreakpoint";
import { useThemeMode } from "@/v2/composables/useThemeMode";
defineProps<{ pdfUrl: string }>();
defineProps<{
pdfUrl: string;
/** Show a danger-tinted delete button at the end of the toolbar. */
deletable?: boolean;
/** Show a re-download button (next to Download) when a scraped source
* URL exists for this manual. */
redownloadable?: boolean;
/** Drive the re-download button's loading/disabled state. */
redownloading?: boolean;
}>();
const emit = defineEmits<{
delete: [];
redownload: [];
}>();
const { t } = useI18n();
const { xs } = useBreakpoint();
@@ -159,6 +173,34 @@ const ids = {
</button>
</template>
</RTooltip>
<RTooltip v-if="redownloadable" :text="t('rom.redownload')">
<template #activator="{ props: activator }">
<button
v-bind="activator"
type="button"
class="r-v2-pdfv__btn"
:class="{ 'r-v2-pdfv__btn--loading': redownloading }"
:disabled="redownloading"
@click="emit('redownload')"
>
<RIcon icon="mdi-cloud-download-outline" size="18" />
</button>
</template>
</RTooltip>
<RTooltip v-if="deletable" :text="t('common.delete')">
<template #activator="{ props: activator }">
<button
v-bind="activator"
type="button"
class="r-v2-pdfv__btn r-v2-pdfv__btn--danger"
@click="emit('delete')"
>
<RIcon icon="mdi-delete-outline" size="18" />
</button>
</template>
</RTooltip>
</div>
<div class="r-v2-pdfv__viewer">
@@ -223,6 +265,24 @@ const ids = {
background: var(--r-color-surface-hover);
color: var(--r-color-fg);
}
/* Danger variant — Delete sits at the end of the toolbar, so it takes
a danger-tinted foreground + hover so the destructive action reads
different from the navigation/zoom siblings. */
.r-v2-pdfv__btn--danger {
color: var(--r-color-danger);
}
.r-v2-pdfv__btn--danger:hover {
background: color-mix(in srgb, var(--r-color-danger) 14%, transparent);
color: var(--r-color-danger);
}
.r-v2-pdfv__btn--loading {
opacity: 0.6;
cursor: not-allowed;
}
.r-v2-pdfv__btn--loading:hover {
background: transparent;
color: var(--r-color-fg-secondary);
}
.r-v2-pdfv__page-input {
width: 48px;

View File

@@ -1,10 +1,11 @@
<script setup lang="ts">
// SaveDataTab — Saves + States, each its own subtab with badge counts
// and per-tab Upload affordance. Layout mirrors MediaTab: a vertical
// subtab list on the left with an attached RCollapsible action panel
// underneath the active tab, and the file list filling the content
// column on the right. Per-row Download + Delete actions are
// always-visible icon buttons; empty states promote the Upload CTA.
// and per-tab Upload affordance. Layout mirrors ScreenshotsSubtab: a
// vertical subtab list on the left (navigation only — no inline action
// panel), and per-section headers in the content column with the
// Upload button on the right when the section already has items. Empty
// sections promote the dropzone CTA (the dropzone owns the upload
// affordance there).
//
// Each list is split into a "Mine" section (own saves/states, with a
// per-item public/private toggle + delete) and a read-only "Community"
@@ -14,7 +15,7 @@
// URL-persistent subtab selection via `?subtab=` so deep-linking
// into a specific list works and stale state doesn't leak when the
// user navigates to a sibling tab.
import { RBtn, RCollapsible, RDropzone, RIcon } from "@v2/lib";
import { RBtn, RDropzone, RIcon } from "@v2/lib";
import axios from "axios";
import { storeToRefs } from "pinia";
import { computed, ref, watch } from "vue";
@@ -125,17 +126,10 @@ const subtabDefs = computed<SubtabDef[]>(() => [
{ id: "states", label: t("rom.states-tab"), icon: "mdi-camera-outline" },
]);
// Inline action panel under the active subtab only renders when the user
// already owns at least one item — the empty "Mine" state owns the Upload
// CTA so there's no redundant panel.
function hasSubtabActions(id: Subtab): boolean {
return id === "saves" ? mySaves.value.length > 0 : myStates.value.length > 0;
}
// ---------- Upload / refresh plumbing ----------
// Overlay-mode dropzone refs so the action-panel "Upload" buttons can open
// the native picker via `.open()`; the empty-state CTA dropzones are
// self-contained (click-to-browse + drag-and-drop).
// Overlay-mode dropzone refs so the section-header "Upload" buttons can
// open the native picker via `.open()`; the empty-state CTA dropzones
// are self-contained (click-to-browse + drag-and-drop).
const saveDz = ref<InstanceType<typeof RDropzone> | null>(null);
const stateDz = ref<InstanceType<typeof RDropzone> | null>(null);
const uploadingSaves = ref(false);
@@ -338,8 +332,6 @@ async function toggleStateVisibility(state: StateSchema) {
class="r-v2-saves__subtab-btn"
:class="{
'r-v2-saves__subtab-btn--active': subTab === tab.id,
'r-v2-saves__subtab-btn--joined':
subTab === tab.id && hasSubtabActions(tab.id),
}"
:aria-selected="subTab === tab.id"
@click="subTab = tab.id"
@@ -356,39 +348,6 @@ async function toggleStateVisibility(state: StateSchema) {
{{ tab.id === "saves" ? savesCount : statesCount }}
</span>
</button>
<RCollapsible
:model-value="subTab === tab.id && hasSubtabActions(tab.id)"
attached
class="r-v2-saves__subtab-panel"
>
<div class="r-v2-saves__subtab-panel-inner">
<template v-if="tab.id === 'saves' && mySaves.length > 0">
<RBtn
variant="outlined"
prepend-icon="mdi-cloud-upload-outline"
block
:loading="uploadingSaves"
:disabled="uploadingSaves"
@click="saveDz?.open()"
>
{{ t("common.upload") }}
</RBtn>
</template>
<template v-else-if="tab.id === 'states' && myStates.length > 0">
<RBtn
variant="outlined"
prepend-icon="mdi-cloud-upload-outline"
block
:loading="uploadingStates"
:disabled="uploadingStates"
@click="stateDz?.open()"
>
{{ t("common.upload") }}
</RBtn>
</template>
</div>
</RCollapsible>
</li>
</ul>
</aside>
@@ -398,11 +357,23 @@ async function toggleStateVisibility(state: StateSchema) {
<section v-show="subTab === 'saves'" class="r-v2-saves__panel">
<!-- Mine -->
<div class="r-v2-saves__section">
<header
v-if="communitySaves.length > 0"
class="r-v2-saves__section-head"
>
{{ t("rom.saves-section-mine") }}
<header class="r-v2-saves__section-head">
<div class="r-v2-saves__section-head-text">
<h3 class="r-v2-saves__section-title">
{{ t("rom.saves-section-mine") }}
</h3>
</div>
<RBtn
v-if="mySaves.length > 0"
variant="outlined"
size="small"
prepend-icon="mdi-cloud-upload-outline"
:loading="uploadingSaves"
:disabled="uploadingSaves"
@click="saveDz?.open()"
>
{{ t("common.upload") }}
</RBtn>
</header>
<RDropzone
@@ -480,7 +451,11 @@ async function toggleStateVisibility(state: StateSchema) {
<!-- Community -->
<div v-if="communitySaves.length > 0" class="r-v2-saves__section">
<header class="r-v2-saves__section-head">
{{ t("rom.saves-section-community") }}
<div class="r-v2-saves__section-head-text">
<h3 class="r-v2-saves__section-title">
{{ t("rom.saves-section-community") }}
</h3>
</div>
</header>
<AssetList
:assets="communitySaves"
@@ -507,11 +482,23 @@ async function toggleStateVisibility(state: StateSchema) {
<section v-show="subTab === 'states'" class="r-v2-saves__panel">
<!-- Mine -->
<div class="r-v2-saves__section">
<header
v-if="communityStates.length > 0"
class="r-v2-saves__section-head"
>
{{ t("rom.states-section-mine") }}
<header class="r-v2-saves__section-head">
<div class="r-v2-saves__section-head-text">
<h3 class="r-v2-saves__section-title">
{{ t("rom.states-section-mine") }}
</h3>
</div>
<RBtn
v-if="myStates.length > 0"
variant="outlined"
size="small"
prepend-icon="mdi-cloud-upload-outline"
:loading="uploadingStates"
:disabled="uploadingStates"
@click="stateDz?.open()"
>
{{ t("common.upload") }}
</RBtn>
</header>
<RDropzone
@@ -589,7 +576,11 @@ async function toggleStateVisibility(state: StateSchema) {
<!-- Community -->
<div v-if="communityStates.length > 0" class="r-v2-saves__section">
<header class="r-v2-saves__section-head">
{{ t("rom.states-section-community") }}
<div class="r-v2-saves__section-head-text">
<h3 class="r-v2-saves__section-title">
{{ t("rom.states-section-community") }}
</h3>
</div>
</header>
<AssetStrip
:assets="communityStates"
@@ -629,9 +620,8 @@ async function toggleStateVisibility(state: StateSchema) {
flex-shrink: 0;
}
/* Subtab list — inline-expansion pattern: each tab can host a panel
of contextual actions right under its button. Visually identical
to MediaTab so the two GameDetails tabs share the same vocabulary. */
/* Subtab list — navigation only. Per-section actions (Upload) live
in the content column's section headers, not under the sidebar. */
.r-v2-saves__subtabs {
list-style: none;
margin: 0;
@@ -672,10 +662,6 @@ async function toggleStateVisibility(state: StateSchema) {
background: color-mix(in srgb, var(--r-color-brand-primary) 18%, transparent);
color: var(--r-color-brand-primary);
}
.r-v2-saves__subtab-btn--joined {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.r-v2-saves__subtab-label {
flex: 1;
}
@@ -687,20 +673,6 @@ async function toggleStateVisibility(state: StateSchema) {
background: color-mix(in srgb, currentColor 18%, transparent);
}
/* Inline action panel — RCollapsible (attached, headless) provides
the surface (bg-elevated + border + bottom radius) and the open /
close animation. We add inner padding here so the controls breathe
inside the panel. */
.r-v2-saves__subtab-panel {
margin-bottom: var(--r-space-1);
}
.r-v2-saves__subtab-panel-inner {
display: flex;
flex-direction: column;
gap: var(--r-space-2);
padding: var(--r-space-3);
}
.r-v2-saves__content {
flex: 1;
min-width: 0;
@@ -717,18 +689,25 @@ async function toggleStateVisibility(state: StateSchema) {
min-height: 0;
}
/* Mine / Community subsections within a subtab panel. */
/* Mine / Community subsections within a subtab panel. Header layout
mirrors ScreenshotsSubtab: title + subtitle on the left, Upload
button on the right when the section already has items. */
.r-v2-saves__section {
display: flex;
flex-direction: column;
gap: var(--r-space-3);
gap: 10px;
}
.r-v2-saves__section-head {
font-size: 12px;
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
}
.r-v2-saves__section-title {
margin: 0;
font-size: 14px;
font-weight: var(--r-font-weight-semibold);
color: var(--r-color-fg-muted);
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--r-color-fg);
}
html[data-bp~="xs"] .r-v2-saves {

View File

@@ -298,9 +298,6 @@ async function toggleVisibility(id: number, isPublic: boolean) {
<h3 class="r-v2-shots__title">
{{ t("rom.screenshots-section-mine") }}
</h3>
<p class="r-v2-shots__subtitle">
{{ t("rom.screenshots-section-mine-desc") }}
</p>
</div>
<RBtn
v-if="myScreenshots.length > 0"

View File

@@ -69,7 +69,8 @@ function canToggle(shot: ScreenshotItem): boolean {
<div
v-for="(shot, i) in screenshots"
:key="shot.id ?? shot.url"
class="r-v2-det-shots__cell"
class="r-v2-det-shots__cell r-v2-asset-fade"
:style="{ '--asset-fade-i': i }"
>
<button
type="button"

View File

@@ -463,15 +463,16 @@ function seekValueText(v: number): string {
<!-- Track list -->
<ul class="r-v2-stp__list">
<li
v-for="track in tracks"
v-for="(track, trackIdx) in tracks"
:key="track.id"
class="r-v2-stp__row"
class="r-v2-stp__row r-v2-asset-fade"
:class="{
'r-v2-stp__row--active': activeTrackId === track.id,
'r-v2-stp__row--playing':
activeTrackId === track.id && isPlaying && !isBuffering,
'r-v2-stp__row--buffering': activeTrackId === track.id && isBuffering,
}"
:style="{ '--asset-fade-i': trackIdx }"
>
<button
type="button"

View File

@@ -78,12 +78,13 @@ function ownerOf(asset: Asset): UserSaveSchema | UserStateSchema | null {
<div class="r-asset-list" :class="{ 'r-asset-list--scroll': scrollable }">
<ul v-if="assets.length > 0" class="r-asset-list__items">
<li
v-for="asset in assets"
v-for="(asset, i) in assets"
:key="asset.id"
class="r-asset-list__item"
class="r-asset-list__item r-v2-asset-fade"
:class="{
'r-asset-list__item--active': selectable && asset.id === selectedId,
}"
:style="{ '--asset-fade-i': i }"
>
<component
:is="selectable ? 'button' : 'div'"

View File

@@ -86,14 +86,15 @@ function ownerOf(asset: Asset): UserSaveSchema | UserStateSchema | null {
<div v-if="assets.length > 0" class="r-asset-strip__track">
<component
:is="selectable ? 'button' : 'div'"
v-for="asset in assets"
v-for="(asset, i) in assets"
:key="asset.id"
:type="selectable ? 'button' : undefined"
class="r-asset-strip__tile"
class="r-asset-strip__tile r-v2-asset-fade"
:class="{
'r-asset-strip__tile--active': selectable && asset.id === selectedId,
'r-asset-strip__tile--static': !selectable,
}"
:style="{ '--asset-fade-i': i }"
:aria-pressed="selectable ? asset.id === selectedId : undefined"
@click="selectable && $emit('select', asset)"
>

View File

@@ -280,6 +280,41 @@ html[data-input="pad"] .r-v2 * {
}
}
/* Asset reveal — the list/strip variant of the card pop. Saves and
states are dense info rows, so the pop+overshoot of `.r-v2-card-fade`
reads as too "showy"; this variant keeps the same direction (rise
from below + fade) but drops the scale, swaps the bouncy easing for
a plain ease-out, and uses a tighter 24ms stagger. Shared by
AssetList and AssetStrip via --asset-fade-i. */
.r-v2-asset-fade {
animation: r-v2-asset-fade 320ms var(--r-motion-ease-out) both;
animation-delay: calc(var(--asset-fade-i, 0) * 24ms);
}
@keyframes r-v2-asset-fade {
from {
opacity: 0;
transform: translateY(14px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@media (prefers-reduced-motion: reduce) {
.r-v2-asset-fade {
animation: r-v2-asset-fade-reduced 180ms ease-out both;
animation-delay: 0ms;
}
@keyframes r-v2-asset-fade-reduced {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
}
/* Shimmer loading — matches the mockup's card skeleton. */
.r-v2-shimmer {
animation: r-v2-shimmer 1.4s ease-in-out infinite;