From 68d0974009621bc4a98f007ebe6fc1650a345246 Mon Sep 17 00:00:00 2001 From: zurdi Date: Fri, 19 Dec 2025 12:28:21 +0000 Subject: [PATCH] feat: refactor asset display components and improve styling --- frontend/src/components/Details/Saves.vue | 76 +----- frontend/src/components/Details/States.vue | 95 +------ .../src/components/common/Game/AssetCard.vue | 175 +++++++++++++ frontend/src/styles/common.css | 4 +- frontend/src/views/Player/EmulatorJS/Base.vue | 243 +++--------------- 5 files changed, 237 insertions(+), 356 deletions(-) create mode 100644 frontend/src/components/common/Game/AssetCard.vue diff --git a/frontend/src/components/Details/Saves.vue b/frontend/src/components/Details/Saves.vue index 21128e81a..581504d24 100644 --- a/frontend/src/components/Details/Saves.vue +++ b/frontend/src/components/Details/Saves.vue @@ -2,15 +2,13 @@ import type { Emitter } from "mitt"; import { storeToRefs } from "pinia"; import { inject, ref } from "vue"; -import { useI18n } from "vue-i18n"; import type { SaveSchema } from "@/__generated__"; import EmptySaves from "@/components/common/EmptyStates/EmptySaves.vue"; +import AssetCard from "@/components/common/Game/AssetCard.vue"; import storeAuth from "@/stores/auth"; import { type DetailedRom } from "@/stores/roms"; import type { Events } from "@/types/emitter"; -import { formatBytes, formatTimestamp, formatRelativeDate } from "@/utils"; -const { t, locale } = useI18n(); const auth = storeAuth(); const { scopes } = storeToRefs(auth); const props = defineProps<{ rom: DetailedRom }>(); @@ -112,70 +110,16 @@ function onCardClick(save: SaveSchema, event: MouseEvent) { :key="save.id" cols="6" sm="4" - class="pa-1" + class="pa-1 align-self-end" > - - - - - - - mdi-download - - - mdi-delete - - - - - {{ save.file_name }} - - - - - {{ save.emulator }} - - - - - {{ formatBytes(save.file_size_bytes) }} - - - -
- {{ t("rom.updated") }}: - {{ formatTimestamp(save.updated_at, locale) }} - ({{ formatRelativeDate(save.updated_at) }}) -
-
-
-
-
-
+ diff --git a/frontend/src/components/Details/States.vue b/frontend/src/components/Details/States.vue index 2aba18ff9..146b81012 100644 --- a/frontend/src/components/Details/States.vue +++ b/frontend/src/components/Details/States.vue @@ -2,16 +2,13 @@ import type { Emitter } from "mitt"; import { storeToRefs } from "pinia"; import { inject, ref } from "vue"; -import { useI18n } from "vue-i18n"; import type { StateSchema } from "@/__generated__"; import EmptySates from "@/components/common/EmptyStates/EmptyStates.vue"; +import AssetCard from "@/components/common/Game/AssetCard.vue"; import storeAuth from "@/stores/auth"; import { type DetailedRom } from "@/stores/roms"; import type { Events } from "@/types/emitter"; -import { formatBytes, formatTimestamp, formatRelativeDate } from "@/utils"; -import { getEmptyCoverImage } from "@/utils/covers"; -const { t, locale } = useI18n(); const auth = storeAuth(); const { scopes } = storeToRefs(auth); const props = defineProps<{ rom: DetailedRom }>(); @@ -115,88 +112,16 @@ function onCardClick(state: StateSchema, event: MouseEvent) { :key="state.id" cols="6" sm="4" - class="pa-1" + class="pa-1 align-self-end" > - - - - - - - - - - mdi-download - - - mdi-delete - - - - - - - - {{ state.file_name }} - - - - - {{ state.emulator }} - - - - - {{ formatBytes(state.file_size_bytes) }} - - - -
- {{ t("rom.updated") }}: - {{ formatTimestamp(state.updated_at, locale) }} - ({{ formatRelativeDate(state.updated_at) }}) -
-
-
-
-
-
+ diff --git a/frontend/src/components/common/Game/AssetCard.vue b/frontend/src/components/common/Game/AssetCard.vue new file mode 100644 index 000000000..f77032f8c --- /dev/null +++ b/frontend/src/components/common/Game/AssetCard.vue @@ -0,0 +1,175 @@ + + + diff --git a/frontend/src/styles/common.css b/frontend/src/styles/common.css index 8a8a7314a..025e0a9f5 100644 --- a/frontend/src/styles/common.css +++ b/frontend/src/styles/common.css @@ -47,14 +47,14 @@ body { } .transform-scale:hover, .transform-scale:focus { - transform: scale(1.05) !important; + transform: scale(1.07) !important; } .pointer { cursor: pointer !important; } .border-selected { border: 1px solid rgba(var(--v-theme-primary)) !important; - transform: scale(1.1); + transform: scale(1.04); } .greyscale { filter: grayscale(100%); diff --git a/frontend/src/views/Player/EmulatorJS/Base.vue b/frontend/src/views/Player/EmulatorJS/Base.vue index 3d9f74e94..924cb574f 100644 --- a/frontend/src/views/Player/EmulatorJS/Base.vue +++ b/frontend/src/views/Player/EmulatorJS/Base.vue @@ -8,6 +8,7 @@ import { useDisplay } from "vuetify"; import type { FirmwareSchema, SaveSchema, StateSchema } from "@/__generated__"; import EmptySaves from "@/components/common/EmptyStates/EmptySaves.vue"; import EmptyStates from "@/components/common/EmptyStates/EmptyStates.vue"; +import AssetCard from "@/components/common/Game/AssetCard.vue"; import RomListItem from "@/components/common/Game/ListItem.vue"; import { ROUTES } from "@/plugins/router"; import firmwareApi from "@/services/api/firmware"; @@ -287,7 +288,7 @@ onBeforeUnmount(async () => { 'mt-2': smAndDown, 'pr-1': !smAndDown, }" - :cols="smAndDown ? 12 : 6" + :cols="smAndDown ? 6 : 4" > { }} - - - - - - - - - {{ selectedState.file_name }} - - - - - {{ t("rom.updated") }}: - {{ - formatTimestamp( - selectedState.updated_at, - locale, - ) - }} - ({{ - formatRelativeDate( - selectedState.updated_at, - ) - }}) - - - - - {{ selectedState.emulator }} - - - - - - - mdi-close-circle-outline - - - - - - - + @close="unselectState" + /> @@ -390,7 +335,7 @@ onBeforeUnmount(async () => { 'mt-2': smAndDown, 'pl-1': !smAndDown, }" - :cols="smAndDown ? 12 : 6" + :cols="smAndDown ? 6 : 4" > { }} - - - - - - {{ selectedSave.file_name }} - - - - - {{ t("rom.updated") }}: - {{ - formatTimestamp( - selectedSave.updated_at, - locale, - ) - }} - ({{ - formatRelativeDate(selectedSave.updated_at) - }}) - - - - - {{ selectedSave.emulator }} - - - - - - - mdi-close-circle-outline - - - - - - - + @close="unselectSave" + /> @@ -480,57 +384,18 @@ onBeforeUnmount(async () => { :key="state.id" cols="6" sm="4" - class="pa-1" + class="pa-1 align-self-end" > - - - - - - - - - {{ state.file_name }} - - - - - {{ t("rom.updated") }}: - {{ formatTimestamp(state.updated_at, locale) }} - ({{ - formatRelativeDate(state.updated_at) - }}) - - - - - {{ state.emulator }} - - - - - + /> @@ -553,43 +418,15 @@ onBeforeUnmount(async () => { :key="save.id" cols="6" sm="4" - class="pa-1" + class="pa-1 align-self-end" > - - - - {{ save.file_name }} - - - - - {{ t("rom.updated") }}: - {{ formatTimestamp(save.updated_at, locale) }} - ({{ formatRelativeDate(save.updated_at) }}) - - - - - {{ save.emulator }} - - - - - + />