From 0c03c833c2d7ebb9dfd935afb38f03f5b9ca19d7 Mon Sep 17 00:00:00 2001 From: zurdi Date: Wed, 16 Sep 2026 11:53:57 +0200 Subject: [PATCH] fix(player): hover feedback on the launch screen only, no save restore State tiles now lift and highlight on hover like the save rows, and neither does so in the Save data tab: the entrance animation released its transform so the lift shows, and static tiles keep a flat hover. Clearing a picked state leaves nothing picked again; the save it displaced no longer comes back. The Save data tab's four copies of the per-item buttons collapse into one AssetActions composite. Co-Authored-By: Claude Fable 5.1 --- .../components/GameDetails/AssetActions.vue | 60 +++++++++ .../v2/components/GameDetails/SaveDataTab.vue | 115 ++++-------------- .../src/v2/components/shared/AssetStrip.vue | 10 +- frontend/src/v2/views/Player/EmulatorJS.vue | 5 +- .../v2/views/Player/resumeSelection.test.ts | 47 +------ .../src/v2/views/Player/resumeSelection.ts | 16 +-- 6 files changed, 103 insertions(+), 150 deletions(-) create mode 100644 frontend/src/v2/components/GameDetails/AssetActions.vue diff --git a/frontend/src/v2/components/GameDetails/AssetActions.vue b/frontend/src/v2/components/GameDetails/AssetActions.vue new file mode 100644 index 000000000..0fcbdaa1f --- /dev/null +++ b/frontend/src/v2/components/GameDetails/AssetActions.vue @@ -0,0 +1,60 @@ + + + diff --git a/frontend/src/v2/components/GameDetails/SaveDataTab.vue b/frontend/src/v2/components/GameDetails/SaveDataTab.vue index 45a5d2afa..a5ef3939d 100644 --- a/frontend/src/v2/components/GameDetails/SaveDataTab.vue +++ b/frontend/src/v2/components/GameDetails/SaveDataTab.vue @@ -32,6 +32,7 @@ import stateApi from "@/services/api/state"; import storeAuth from "@/stores/auth"; import storeConfig from "@/stores/config"; import { getSupportedEJSCores } from "@/utils"; +import AssetActions from "@/v2/components/GameDetails/AssetActions.vue"; import UploadAssetDialog, { type UploadAssetPayload, } from "@/v2/components/GameDetails/UploadAssetDialog.vue"; @@ -425,44 +426,14 @@ async function toggleStateVisibility(state: StateSchema) { :scrollable="false" > @@ -486,13 +457,10 @@ async function toggleStateVisibility(state: StateSchema) { show-owner > @@ -550,44 +518,14 @@ async function toggleStateVisibility(state: StateSchema) { group-by="emulator" > @@ -612,13 +550,10 @@ async function toggleStateVisibility(state: StateSchema) { show-owner > diff --git a/frontend/src/v2/components/shared/AssetStrip.vue b/frontend/src/v2/components/shared/AssetStrip.vue index 7c1a305d8..e8a4a9cfe 100644 --- a/frontend/src/v2/components/shared/AssetStrip.vue +++ b/frontend/src/v2/components/shared/AssetStrip.vue @@ -496,9 +496,15 @@ const fadeIndex = computed(() => background var(--r-motion-fast) var(--r-motion-ease-out), border-color var(--r-motion-fast) var(--r-motion-ease-out); } +/* The entrance animation sits on the tile itself, so its final frame would + pin the transform; releasing the fill lets the hover lift through. */ +.r-asset-strip__tile.r-v2-asset-fade { + animation-fill-mode: backwards; +} .r-asset-strip__tile:hover { - transform: translateY(-2px); + transform: translateY(-1px); border-color: var(--r-color-border-strong); + background: var(--r-color-surface); } .r-asset-strip__tile--active { border-color: var(--r-color-brand-primary); @@ -514,6 +520,7 @@ const fadeIndex = computed(() => .r-asset-strip__tile--static:hover { transform: none; border-color: var(--r-color-border); + background: transparent; } /* Kept visible so the count adds up; the tooltip carries the reason. */ .r-asset-strip__tile--disabled { @@ -524,6 +531,7 @@ const fadeIndex = computed(() => .r-asset-strip__tile--disabled:hover { transform: none; border-color: var(--r-color-border); + background: transparent; } /* One card: the screenshot fills the top, the tinted body sits flush below. */ diff --git a/frontend/src/v2/views/Player/EmulatorJS.vue b/frontend/src/v2/views/Player/EmulatorJS.vue index 84fc32f48..1cf499f04 100644 --- a/frontend/src/v2/views/Player/EmulatorJS.vue +++ b/frontend/src/v2/views/Player/EmulatorJS.vue @@ -99,7 +99,6 @@ import { import { isJsResource, loadScript } from "@/v2/utils/scriptLoader"; import { rememberCore, resolveRememberedCore } from "./coreStorage"; import { - clearState, defaultResumeSelection, newerThanPick, pickSave, @@ -306,12 +305,12 @@ function unselectSave() { } function selectState(state: StateSchema) { - resume.value = pickState(resume.value, state); + resume.value = pickState(state); isSavesTabSelected.value = false; } function unselectState() { - resume.value = clearState(resume.value); + resume.value = { ...resume.value, state: null }; } watch(selectedCore, (newSelectedCore) => { diff --git a/frontend/src/v2/views/Player/resumeSelection.test.ts b/frontend/src/v2/views/Player/resumeSelection.test.ts index 496e609d0..b9681243d 100644 --- a/frontend/src/v2/views/Player/resumeSelection.test.ts +++ b/frontend/src/v2/views/Player/resumeSelection.test.ts @@ -1,7 +1,6 @@ import { describe, expect, it } from "vitest"; import type { SaveSchema, StateSchema } from "@/__generated__"; import { - clearState, defaultResumeSelection, newerThanPick, pickSave, @@ -41,34 +40,8 @@ describe("pickSave", () => { }); describe("pickState", () => { - it("boots from the state and sets the picked save aside", () => { - expect(pickState(pickSave(save(2)), state(9))).toEqual({ - save: null, - state: state(9), - aside: save(2), - }); - }); - - it("keeps the aside save across a second state pick", () => { - const first = pickState(pickSave(save(2)), state(9)); - - expect(pickState(first, state(8)).aside).toEqual(save(2)); - }); -}); - -describe("clearState", () => { - it("restores the save the state displaced", () => { - expect(clearState(pickState(pickSave(save(2)), state(9)))).toEqual({ - save: save(2), - state: null, - }); - }); - - it("leaves nothing picked when the state was the default", () => { - expect(clearState(defaultResumeSelection([save(1)], [state(9)]))).toEqual({ - save: null, - state: null, - }); + it("boots from the state and drops any picked save", () => { + expect(pickState(state(9))).toEqual({ save: null, state: state(9) }); }); }); @@ -85,23 +58,11 @@ describe("newerThanPick", () => { stateAt(8, "2026-09-05T10:00:00Z"), ]; - expect( - newerThanPick( - saves, - states, - pickState({ save: null, state: null }, states[0]), - ), - ).toEqual({ + expect(newerThanPick(saves, states, pickState(states[0]))).toEqual({ kind: "state", asset: states[1], }); - expect( - newerThanPick( - saves, - [states[0]], - pickState({ save: null, state: null }, states[0]), - ), - ).toEqual({ + expect(newerThanPick(saves, [states[0]], pickState(states[0]))).toEqual({ kind: "save", asset: saves[0], }); diff --git a/frontend/src/v2/views/Player/resumeSelection.ts b/frontend/src/v2/views/Player/resumeSelection.ts index 547bbb491..23425abb3 100644 --- a/frontend/src/v2/views/Player/resumeSelection.ts +++ b/frontend/src/v2/views/Player/resumeSelection.ts @@ -6,8 +6,6 @@ import { newest } from "@/v2/utils/assets"; export interface ResumeSelection { save: SaveSchema | null; state: StateSchema | null; - /** The save a picked state displaced, restored when the state is cleared. */ - aside?: SaveSchema | null; } /** The newest compatible state, else the newest save; never both. */ @@ -24,17 +22,9 @@ export function pickSave(save: SaveSchema): ResumeSelection { return { save, state: null }; } -/** A picked state carries its own SRAM, so the picked save steps aside. */ -export function pickState( - selection: ResumeSelection, - state: StateSchema, -): ResumeSelection { - return { save: null, state, aside: selection.save ?? selection.aside }; -} - -/** Clearing the state hands the boot back to the save it displaced. */ -export function clearState(selection: ResumeSelection): ResumeSelection { - return { save: selection.aside ?? null, state: null }; +/** A picked state carries its own SRAM, so no save stays picked. */ +export function pickState(state: StateSchema): ResumeSelection { + return { save: null, state }; } export type NewerAsset =