diff --git a/frontend/e2e/game-media-files.spec.ts b/frontend/e2e/game-media-files.spec.ts index 789ca6c53..ac91d0832 100644 --- a/frontend/e2e/game-media-files.spec.ts +++ b/frontend/e2e/game-media-files.spec.ts @@ -23,7 +23,7 @@ async function openTab(page: Page, tab: string) { // Media subtabs are a sidebar list of role=tab buttons, distinct from the // top-level RTabNav tabs. async function openSubtab(page: Page, subtab: string) { - await page.locator(".r-v2-media__subtab-btn", { hasText: subtab }).click(); + await page.locator(".r-v2-subtab-nav__btn", { hasText: subtab }).click(); } /** The one Media panel currently on screen. */ @@ -132,9 +132,7 @@ test.describe("Files tab write affordances", () => { await gotoFirstRom(page); await openTab(page, "Files"); - await expect( - page.locator(".r-v2-files__subtab-btn").first(), - ).toBeVisible(); + await expect(page.locator(".r-v2-subtab-nav__btn").first()).toBeVisible(); await expect(uploadButton(page)).toHaveCount(0); await expect(uploadToFolderButton(page)).toHaveCount(0); }); @@ -157,7 +155,7 @@ test.describe("Files tab write affordances", () => { await gotoFirstRom(page); await openTab(page, "Files"); await page - .locator(".r-v2-files__subtab-btn:not(.r-v2-files__subtab-btn--active)") + .locator(".r-v2-subtab-nav__btn:not(.r-v2-subtab-nav__btn--active)") .first() .click(); diff --git a/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.vue b/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.vue index 91b651a2a..9d54d4ee7 100644 --- a/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.vue +++ b/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.vue @@ -5,7 +5,8 @@ // 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 that hosts -// the Upload button plus a Patch button (multi-file ROMs only). Bulk +// the Upload button plus a Patch button (multi-file ROMs only). On phones +// the list collapses into a folder picker in that same header row. Bulk // download / copy-link affordances live in the selection toolbar // instead — pair them with select-all. // @@ -36,7 +37,7 @@ // Selected files in the Files tab can be deleted by users with the // `rom.delete` permission. Each file is removed from disk and the DB // row is dropped via `DELETE /roms/{rom_id}/files/{file_id}`. -import { RBtn, RCheckbox, REmptyState, RIcon } from "@v2/lib"; +import { RBtn, RCheckbox, REmptyState } from "@v2/lib"; import { computed, ref, watch } from "vue"; import { useI18n } from "vue-i18n"; import { useRoute, useRouter } from "vue-router"; @@ -48,6 +49,10 @@ import type { import romApi from "@/services/api/rom"; import storeRoms from "@/stores/roms"; import { getDownloadLink } from "@/utils"; +import SubtabNav, { + type SubtabNavItem, +} from "@/v2/components/GameDetails/SubtabNav.vue"; +import { useBreakpoint } from "@/v2/composables/useBreakpoint"; import { useCan } from "@/v2/composables/useCan"; import { useConfirm } from "@/v2/composables/useConfirm"; import { useIsAlive } from "@/v2/composables/useIsAlive"; @@ -72,6 +77,7 @@ const route = useRoute(); const router = useRouter(); const romsStore = storeRoms(); const { refetchRom } = useRomSync(); +const { smAndDown } = useBreakpoint(); const canUpload = useCan("rom.upload"); const hasDeleteGrant = useCan("rom.delete"); @@ -252,20 +258,13 @@ function folderIcon(folder: string): string { return folderMeta(folder)?.icon ?? "mdi-folder-outline"; } -interface SubtabDef { - id: Subtab; - label: string; - icon: string; - count: number; -} - -const subtabDefs = computed(() => { - const out: SubtabDef[] = [ +const subtabDefs = computed[]>(() => { + const out: SubtabNavItem[] = [ { id: "all", label: t("rom.all-files"), icon: "mdi-folder-multiple-outline", - count: files.value.length, + badge: files.value.length, }, ]; // Root always sits right after "All files" so the user's eye lands @@ -277,7 +276,7 @@ const subtabDefs = computed(() => { id: ROOT, label: t("rom.folder-root"), icon: folderIcon(ROOT), - count: rootList.length, + badge: rootList.length, }); } const folders = [...filesByFolder.value.keys()] @@ -288,7 +287,7 @@ const subtabDefs = computed(() => { id: folder, label: folderLabel(folder), icon: folderIcon(folder), - count: filesByFolder.value.get(folder)?.length ?? 0, + badge: filesByFolder.value.get(folder)?.length ?? 0, }); } return out; @@ -555,7 +554,7 @@ const uploadFolders = computed(() => [ { value: "", label: folderLabel(ROOT), icon: folderIcon(ROOT) }, ...subtabDefs.value .filter((s) => s.id !== "all" && s.id !== ROOT) - .map((s) => ({ value: s.id, label: s.label, icon: s.icon })), + .map((s) => ({ value: s.id, label: s.label, icon: folderIcon(s.id) })), ]); // Destination implied by the active subtab: "" for the ROM root, null @@ -613,47 +612,36 @@ async function refreshRom() { />
-