From 76ddf4f69903eef70c7b8a0acc202e65685b860e Mon Sep 17 00:00:00 2001 From: zurdi Date: Thu, 17 Sep 2026 19:19:24 +0200 Subject: [PATCH] refactor(v2): apply simplify findings - Route tab and subtab writes through patchQuery. - Keep the CRT/reduced-motion rule inside useCrtMode: reduced motion hides CRT without erasing the saved choice, and turning CRT on turns it off. - Reuse the global asset fade on Home's empty library. - useLoadingPhase: refAutoReset for the skeleton hold, drop the unused delay parameter. - One computed per empty state in Streaming and platform stats; drop RTable's unused empty slot. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01XAReUPhZXnp7LyiP1W4GGQ --- .../GameDetails/FilesTab/FilesTab.test.ts | 6 ++- .../Settings/PlatformsStatsSection.vue | 16 ++++--- .../components/Settings/StreamingSection.vue | 42 +++++++++---------- .../v2/composables/useCrtMode/index.test.ts | 21 ++++++++++ .../src/v2/composables/useCrtMode/index.ts | 16 ++++++- .../v2/composables/useLoadingPhase/index.ts | 18 ++------ .../v2/composables/useSubtabQuery/index.ts | 7 +--- frontend/src/v2/layouts/AppLayout.vue | 11 +---- frontend/src/v2/lib/data/RTable/RTable.vue | 16 ++++--- frontend/src/v2/views/GameDetails.vue | 7 +--- frontend/src/v2/views/Home.vue | 20 +-------- 11 files changed, 87 insertions(+), 93 deletions(-) diff --git a/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.test.ts b/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.test.ts index e99f4eee9..b3763e74f 100644 --- a/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.test.ts +++ b/frontend/src/v2/components/GameDetails/FilesTab/FilesTab.test.ts @@ -25,7 +25,11 @@ vi.mock("vue-i18n", () => ({ vi.mock("vue-router", async (importOriginal) => ({ ...(await importOriginal()), useRoute: () => ({ query: routeQuery, path: "/rom/1", params: {} }), - useRouter: () => ({ replace: vi.fn(), push: vi.fn() }), + useRouter: () => ({ + replace: vi.fn(), + push: vi.fn(), + currentRoute: { value: { query: routeQuery } }, + }), })); vi.mock("@/services/api/rom", () => ({ default: { uploadRoms, deleteRomFile: vi.fn() }, diff --git a/frontend/src/v2/components/Settings/PlatformsStatsSection.vue b/frontend/src/v2/components/Settings/PlatformsStatsSection.vue index de43e0c4a..727006e16 100644 --- a/frontend/src/v2/components/Settings/PlatformsStatsSection.vue +++ b/frontend/src/v2/components/Settings/PlatformsStatsSection.vue @@ -76,6 +76,12 @@ const orderItems = computed[]>(() => [ }, ]); +const emptyState = computed(() => + searchQuery.value.trim() + ? { icon: "mdi-magnify-close", title: t("settings.no-matching-platforms") } + : { icon: "mdi-folder-question", title: t("settings.no-platforms") }, +); + const sortedPlatforms = computed(() => { const q = searchQuery.value.trim().toLowerCase(); let list = [...filledPlatforms.value]; @@ -331,15 +337,7 @@ function onRowClick(e: MouseEvent, platformId: number): void { class="r-v2-plat-stats__bar" /> - + diff --git a/frontend/src/v2/components/Settings/StreamingSection.vue b/frontend/src/v2/components/Settings/StreamingSection.vue index f22c3a056..6a426ee28 100644 --- a/frontend/src/v2/components/Settings/StreamingSection.vue +++ b/frontend/src/v2/components/Settings/StreamingSection.vue @@ -8,7 +8,7 @@ // an admin needs: open its desktop to configure the emulator inside it, and // end whatever session is holding it. import { RBtn, REmptyState, RIcon, RSpinner } from "@v2/lib"; -import { onMounted, ref } from "vue"; +import { computed, onMounted, ref } from "vue"; import { useI18n } from "vue-i18n"; import { useRouter } from "vue-router"; import { ROUTES } from "@/plugins/router"; @@ -35,6 +35,25 @@ const loadFailed = ref(false); const containers = ref([]); const releasing = ref(null); +const emptyState = computed<{ icon: string; title: string } | null>(() => { + if (loadFailed.value) { + return { + icon: "mdi-alert-circle-outline", + title: t("settings.streaming-load-failed"), + }; + } + if (!enabled.value) { + return { icon: "mdi-monitor-off", title: t("settings.streaming-disabled") }; + } + if (containers.value.length === 0) { + return { + icon: "mdi-monitor-dashboard", + title: t("settings.streaming-none"), + }; + } + return null; +}); + async function load(): Promise { loading.value = true; loadFailed.value = false; @@ -120,26 +139,7 @@ onMounted(load); - - - - - +