mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 10:01:00 +01:00
Merge branch 'master' into claude/youthful-wozniak-ocjhc0
This commit is contained in:
@@ -7,10 +7,11 @@ from decorators.auth import protected_route
|
||||
from endpoints.responses.activity import ActivityClearSchema, ActivityEntrySchema
|
||||
from handler.activity_handler import ActivityEntry, activity_handler
|
||||
from handler.auth.constants import Scope
|
||||
from handler.database import db_device_handler, db_rom_handler
|
||||
from handler.database import db_device_handler, db_rom_handler, db_save_handler
|
||||
from handler.socket_handler import socket_handler
|
||||
from logger.logger import log
|
||||
from utils.router import APIRouter
|
||||
from utils.screenshots import continue_playing_screenshot
|
||||
|
||||
router = APIRouter(
|
||||
prefix="/activity",
|
||||
@@ -69,6 +70,11 @@ async def device_heartbeat(
|
||||
existing["started_at"] if existing else datetime.now(timezone.utc).isoformat()
|
||||
)
|
||||
|
||||
latest_save = db_save_handler.get_latest_saves_for_roms(
|
||||
user_id=request.user.id, rom_ids=[rom.id]
|
||||
).get(rom.id)
|
||||
screenshot_path = continue_playing_screenshot(rom, latest_save) or ""
|
||||
|
||||
platform = rom.platform
|
||||
entry = ActivityEntry(
|
||||
user_id=request.user.id,
|
||||
@@ -77,6 +83,7 @@ async def device_heartbeat(
|
||||
rom_id=rom.id,
|
||||
rom_name=rom.name or rom.fs_name,
|
||||
rom_cover_path=rom.path_cover_s or "",
|
||||
screenshot_path=screenshot_path,
|
||||
platform_slug=platform.slug if platform else "",
|
||||
platform_name=(platform.custom_name or platform.name) if platform else "",
|
||||
device_id=device.id,
|
||||
|
||||
@@ -8,6 +8,7 @@ class ActivityEntrySchema(BaseModel):
|
||||
rom_id: int
|
||||
rom_name: str
|
||||
rom_cover_path: str = ""
|
||||
screenshot_path: str = ""
|
||||
platform_slug: str
|
||||
platform_name: str
|
||||
device_id: str
|
||||
|
||||
@@ -400,6 +400,8 @@ class SiblingRomSchema(BaseModel):
|
||||
|
||||
|
||||
class SimpleRomSchema(RomSchema):
|
||||
screenshot_path: str | None = None
|
||||
|
||||
@classmethod
|
||||
def from_orm_with_request(
|
||||
cls,
|
||||
@@ -407,8 +409,10 @@ class SimpleRomSchema(RomSchema):
|
||||
request: Request,
|
||||
files: Sequence[RomFile] | None = None,
|
||||
siblings: Sequence[tuple[Rom, bool]] | None = None,
|
||||
screenshot_path: str | None = None,
|
||||
) -> SimpleRomSchema:
|
||||
db_rom = cls.populate_properties(db_rom, request)
|
||||
db_rom.screenshot_path = screenshot_path # type: ignore[assignment]
|
||||
|
||||
# The list endpoint passes pre-fetched `files`/`siblings` (batched via
|
||||
# get_files_for_roms / get_siblings_for_roms, no per-row hydration).
|
||||
@@ -445,6 +449,7 @@ class SimpleRomSchema(RomSchema):
|
||||
db_rom.included_files = [] # type: ignore[assignment]
|
||||
db_rom.included_sibling_roms = [] # type: ignore[assignment]
|
||||
db_rom.has_notes = False # type: ignore[assignment]
|
||||
db_rom.screenshot_path = None # type: ignore[assignment]
|
||||
return cls.model_validate(db_rom)
|
||||
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ from endpoints.responses.rom import (
|
||||
from exceptions.endpoint_exceptions import RomNotFoundInDatabaseException
|
||||
from exceptions.fs_exceptions import RomAlreadyExistsException
|
||||
from handler.auth.constants import Scope
|
||||
from handler.database import db_rom_handler
|
||||
from handler.database import db_rom_handler, db_save_handler
|
||||
from handler.database.base_handler import sync_session
|
||||
from handler.filesystem import fs_resource_handler, fs_rom_handler
|
||||
from handler.filesystem.assets_handler import validate_image_upload
|
||||
@@ -70,6 +70,7 @@ from utils.filesystem import sanitize_filename
|
||||
from utils.hashing import crc32_to_hex
|
||||
from utils.nginx import FileRedirectResponse, ZipContentLine, ZipResponse
|
||||
from utils.router import APIRouter
|
||||
from utils.screenshots import continue_playing_screenshot
|
||||
from utils.validation import ValidationError
|
||||
|
||||
from .files import router as files_router
|
||||
@@ -630,12 +631,24 @@ def get_roms(
|
||||
rom_ids, user_id=request.user.id, session=session
|
||||
)
|
||||
|
||||
# Continue-playing rail
|
||||
screenshot_by_rom: dict[int, str | None] = {}
|
||||
if last_played:
|
||||
latest_saves = db_save_handler.get_latest_saves_for_roms(
|
||||
user_id=request.user.id, rom_ids=rom_ids, session=session
|
||||
)
|
||||
for item in items:
|
||||
screenshot_by_rom[item.id] = continue_playing_screenshot(
|
||||
item, latest_saves.get(item.id)
|
||||
)
|
||||
|
||||
return [
|
||||
SimpleRomSchema.from_orm_with_request(
|
||||
db_rom=item,
|
||||
request=request,
|
||||
files=files_by_rom.get(item.id, []),
|
||||
siblings=siblings_by_rom.get(item.id, []),
|
||||
screenshot_path=screenshot_by_rom.get(item.id),
|
||||
)
|
||||
for item in items
|
||||
]
|
||||
|
||||
@@ -21,9 +21,15 @@ from typing import Any, TypedDict
|
||||
|
||||
from endpoints.responses.activity import ActivityClearSchema
|
||||
from handler.activity_handler import ActivityEntry, activity_handler
|
||||
from handler.database import db_device_handler, db_rom_handler, db_user_handler
|
||||
from handler.database import (
|
||||
db_device_handler,
|
||||
db_rom_handler,
|
||||
db_save_handler,
|
||||
db_user_handler,
|
||||
)
|
||||
from handler.socket_handler import socket_handler
|
||||
from logger.logger import log
|
||||
from utils.screenshots import continue_playing_screenshot
|
||||
|
||||
# Socket-session key holding the authenticated user id, written by the connect
|
||||
# handler. Identity for every activity event is derived from this, not payload.
|
||||
@@ -92,6 +98,13 @@ async def _build_entry(
|
||||
device = db_device_handler.get_device(device_id=device_id, user_id=user_id)
|
||||
device_type = device.client if device else None
|
||||
|
||||
# "Where they are" image — the player's latest save screenshot, else the
|
||||
# title screen / first gameplay screenshot (frontend falls back to cover).
|
||||
latest_save = db_save_handler.get_latest_saves_for_roms(
|
||||
user_id=user_id, rom_ids=[rom_id]
|
||||
).get(rom_id)
|
||||
screenshot_path = continue_playing_screenshot(rom, latest_save) or ""
|
||||
|
||||
return ActivityEntry(
|
||||
user_id=user.id,
|
||||
username=user.username,
|
||||
@@ -99,6 +112,7 @@ async def _build_entry(
|
||||
rom_id=rom.id,
|
||||
rom_name=rom.name or rom.fs_name,
|
||||
rom_cover_path=rom.path_cover_s or "",
|
||||
screenshot_path=screenshot_path,
|
||||
platform_slug=platform.slug if platform else "",
|
||||
platform_name=((platform.custom_name or platform.name) if platform else ""),
|
||||
device_id=device_id,
|
||||
|
||||
@@ -22,6 +22,7 @@ class ActivityEntry(TypedDict):
|
||||
rom_id: int
|
||||
rom_name: str
|
||||
rom_cover_path: str # small cover path, may be empty
|
||||
screenshot_path: str # "where they are" image (save/title/screenshot), may be empty
|
||||
platform_slug: str
|
||||
platform_name: str
|
||||
device_id: str
|
||||
|
||||
@@ -132,6 +132,33 @@ class DBSavesHandler(DBBaseHandler):
|
||||
query = query.order_by(desc(Save.updated_at))
|
||||
return session.scalars(query).all()
|
||||
|
||||
@begin_session
|
||||
def get_latest_saves_for_roms(
|
||||
self,
|
||||
user_id: int,
|
||||
rom_ids: Sequence[int],
|
||||
session: Session = None, # type: ignore
|
||||
) -> dict[int, Save]:
|
||||
"""The most recent save per ROM for a user, keyed by `rom_id`.
|
||||
|
||||
Batched for the continue-playing rail, which enriches each card with
|
||||
the in-game screenshot captured alongside the user's latest save.
|
||||
"""
|
||||
if not rom_ids:
|
||||
return {}
|
||||
|
||||
saves = session.scalars(
|
||||
select(Save)
|
||||
.filter(Save.user_id == user_id, Save.rom_id.in_(rom_ids))
|
||||
.order_by(desc(Save.updated_at))
|
||||
).all()
|
||||
|
||||
latest: dict[int, Save] = {}
|
||||
for save in saves:
|
||||
# Saves come newest-first, so the first one seen per ROM wins.
|
||||
latest.setdefault(save.rom_id, save)
|
||||
return latest
|
||||
|
||||
@begin_session
|
||||
def update_save(
|
||||
self,
|
||||
|
||||
@@ -749,3 +749,82 @@ class TestDBSavesHandlerSummary:
|
||||
)
|
||||
assert count_slot is not None
|
||||
assert count_slot["count"] == 5
|
||||
|
||||
|
||||
class TestDBSavesHandlerGetLatestSavesForRoms:
|
||||
"""Cover the continue-playing rail's batch lookup of the newest save per
|
||||
ROM."""
|
||||
|
||||
def test_returns_newest_save_per_rom(self, admin_user: User, rom: Rom):
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
base_time = datetime.now(timezone.utc)
|
||||
|
||||
older = db_save_handler.add_save(
|
||||
Save(
|
||||
rom_id=rom.id,
|
||||
user_id=admin_user.id,
|
||||
file_name="latest_old.sav",
|
||||
file_name_no_tags="latest_old",
|
||||
file_name_no_ext="latest_old",
|
||||
file_extension="sav",
|
||||
emulator="test_emu",
|
||||
file_path=f"{rom.platform_slug}/saves",
|
||||
file_size_bytes=100,
|
||||
)
|
||||
)
|
||||
newer = db_save_handler.add_save(
|
||||
Save(
|
||||
rom_id=rom.id,
|
||||
user_id=admin_user.id,
|
||||
file_name="latest_new.sav",
|
||||
file_name_no_tags="latest_new",
|
||||
file_name_no_ext="latest_new",
|
||||
file_extension="sav",
|
||||
emulator="test_emu",
|
||||
file_path=f"{rom.platform_slug}/saves",
|
||||
file_size_bytes=100,
|
||||
)
|
||||
)
|
||||
db_save_handler.update_save(
|
||||
older.id, {"updated_at": base_time - timedelta(hours=2)}
|
||||
)
|
||||
db_save_handler.update_save(
|
||||
newer.id, {"updated_at": base_time - timedelta(hours=1)}
|
||||
)
|
||||
|
||||
latest = db_save_handler.get_latest_saves_for_roms(
|
||||
user_id=admin_user.id, rom_ids=[rom.id]
|
||||
)
|
||||
|
||||
assert set(latest.keys()) == {rom.id}
|
||||
assert latest[rom.id].id == newer.id
|
||||
|
||||
def test_empty_rom_ids_returns_empty_dict(self, admin_user: User):
|
||||
assert (
|
||||
db_save_handler.get_latest_saves_for_roms(user_id=admin_user.id, rom_ids=[])
|
||||
== {}
|
||||
)
|
||||
|
||||
def test_excludes_other_users_saves(
|
||||
self, admin_user: User, editor_user: User, rom: Rom
|
||||
):
|
||||
db_save_handler.add_save(
|
||||
Save(
|
||||
rom_id=rom.id,
|
||||
user_id=editor_user.id,
|
||||
file_name="other_user.sav",
|
||||
file_name_no_tags="other_user",
|
||||
file_name_no_ext="other_user",
|
||||
file_extension="sav",
|
||||
emulator="test_emu",
|
||||
file_path=f"{rom.platform_slug}/saves",
|
||||
file_size_bytes=100,
|
||||
)
|
||||
)
|
||||
|
||||
latest = db_save_handler.get_latest_saves_for_roms(
|
||||
user_id=admin_user.id, rom_ids=[rom.id]
|
||||
)
|
||||
|
||||
assert latest == {}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import os
|
||||
|
||||
from config import FRONTEND_RESOURCES_PATH
|
||||
from models.assets import Save
|
||||
from models.rom import Rom
|
||||
|
||||
# Image formats every modern browser can decode. Shared by the per-ROM
|
||||
# (endpoints/roms/screenshot.py) and per-user (endpoints/screenshots.py)
|
||||
# screenshot upload endpoints.
|
||||
@@ -11,3 +15,23 @@ ALLOWED_SCREENSHOT_EXTENSIONS = frozenset(
|
||||
def is_allowed_screenshot_file(file_name: str) -> bool:
|
||||
_, ext = os.path.splitext(file_name)
|
||||
return ext.lower() in ALLOWED_SCREENSHOT_EXTENSIONS
|
||||
|
||||
|
||||
def continue_playing_screenshot(rom: Rom, latest_save: Save | None) -> str | None:
|
||||
"""The "where you left off" image for a rom, in priority order: the latest
|
||||
save's screenshot, then the title screen, then the first gameplay
|
||||
screenshot. None lets the frontend fall back to cover art. Shared by the
|
||||
continue-playing rail and the live-activity board."""
|
||||
if latest_save is not None and latest_save.screenshot is not None:
|
||||
return latest_save.screenshot.download_path
|
||||
|
||||
title_screen = (rom.ss_metadata or {}).get("title_screen_path") or (
|
||||
rom.gamelist_metadata or {}
|
||||
).get("title_screen_path")
|
||||
if title_screen:
|
||||
return f"{FRONTEND_RESOURCES_PATH}/{title_screen}"
|
||||
|
||||
if rom.merged_screenshots:
|
||||
return rom.merged_screenshots[0]
|
||||
|
||||
return None
|
||||
|
||||
@@ -1030,6 +1030,7 @@ Request Flow with Cache:
|
||||
- `getSupportedEJSCores()`: platform → EmulatorJS core mapping
|
||||
- `isEJSEmulationSupported()`: WebGL + config check
|
||||
- `isCDBasedSystem()`: 31 CD-based platforms
|
||||
- `isArcadeSystem()`: 3 arcade platforms
|
||||
|
||||
**Game Status:**
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
@@ -90,5 +90,6 @@ export type SimpleRomSchema = {
|
||||
merged_ra_metadata: (RomRAMetadata | null);
|
||||
files: Array<RomFileSchema>;
|
||||
sibling_roms: Array<SiblingRomSchema>;
|
||||
screenshot_path?: (string | null);
|
||||
};
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@ export interface ActivityEntry {
|
||||
rom_id: number;
|
||||
rom_name: string;
|
||||
rom_cover_path: string;
|
||||
// "Where they are" image (latest save screenshot / title / first
|
||||
// screenshot); empty when none — the card then shows cover art.
|
||||
screenshot_path: string;
|
||||
platform_slug: string;
|
||||
platform_name: string;
|
||||
device_id: string;
|
||||
|
||||
@@ -875,3 +875,9 @@ export const CD_BASED_SYSTEMS = new Set([
|
||||
export function isCDBasedSystem(platformSlug: string): boolean {
|
||||
return CD_BASED_SYSTEMS.has(platformSlug.toLowerCase());
|
||||
}
|
||||
|
||||
export const ARCADE_SYSTEMS = new Set(["arcade", "neogeoaes", "neogeomvs"]);
|
||||
|
||||
export function isArcadeSystem(platformSlug: string): boolean {
|
||||
return ARCADE_SYSTEMS.has(platformSlug.toLowerCase());
|
||||
}
|
||||
|
||||
@@ -10,11 +10,15 @@
|
||||
// session counter is the single live indicator.
|
||||
import { RAvatar, RIcon } from "@v2/lib";
|
||||
import type { RouteLocationRaw } from "vue-router";
|
||||
import CoverArtPip from "@/v2/components/shared/CoverArtPip.vue";
|
||||
import GameCover from "@/v2/components/shared/GameCover.vue";
|
||||
|
||||
interface Props {
|
||||
to: RouteLocationRaw;
|
||||
coverSrc: string | null;
|
||||
/** Cover-art URL for the corner PIP — set only when `coverSrc` is a
|
||||
* screenshot, so the game stays identifiable. Null shows no PIP. */
|
||||
pipCoverSrc?: string | null;
|
||||
romName: string;
|
||||
platformName: string;
|
||||
username: string;
|
||||
@@ -38,7 +42,15 @@ defineProps<Props>();
|
||||
:cover-src="coverSrc"
|
||||
:title="romName"
|
||||
class="activity-card__art"
|
||||
/>
|
||||
>
|
||||
<!-- Cover-art PIP — shown when the main image is a screenshot, so the
|
||||
game stays identifiable. -->
|
||||
<CoverArtPip
|
||||
v-if="pipCoverSrc"
|
||||
:cover-src="pipCoverSrc"
|
||||
:title="romName"
|
||||
/>
|
||||
</GameCover>
|
||||
|
||||
<div class="activity-card__body">
|
||||
<div class="activity-card__rom" :title="romName">
|
||||
@@ -50,17 +62,18 @@ defineProps<Props>();
|
||||
|
||||
<div class="activity-card__player">
|
||||
<RAvatar :image="avatarSrc" size="x-small" />
|
||||
<span class="activity-card__username" :title="username">
|
||||
{{ username }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="activity-card__meta">
|
||||
{{ elapsedLabel }}
|
||||
<template v-if="deviceType">
|
||||
<RIcon icon="mdi-circle-small" size="14" />
|
||||
<span class="activity-card__device">{{ deviceType }}</span>
|
||||
</template>
|
||||
<div>
|
||||
<span class="activity-card__username" :title="username">
|
||||
{{ username }}
|
||||
</span>
|
||||
<div class="activity-card__meta">
|
||||
{{ elapsedLabel }}
|
||||
<template v-if="deviceType">
|
||||
<RIcon icon="mdi-circle-small" size="14" />
|
||||
<span class="activity-card__device">{{ deviceType }}</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</router-link>
|
||||
@@ -76,15 +89,25 @@ defineProps<Props>();
|
||||
gap: 8px;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
/* Each card keeps its cover's natural width and wraps — no grow/shrink. */
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
/* GameCover owns the radius / overflow / placeholder background; the card
|
||||
adds the hover lift (rise + shadow) on top. */
|
||||
.activity-card__art {
|
||||
adds the hover lift (rise + shadow) on top.
|
||||
Fixed HEIGHT with NATURAL WIDTH (gallery-card behavior): the compound
|
||||
selector beats GameCover's base `width: 100%` so the box derives its width
|
||||
from the measured image ratio at this height. */
|
||||
.activity-card .activity-card__art {
|
||||
height: 190px;
|
||||
width: auto;
|
||||
transition:
|
||||
transform var(--r-motion-fast) var(--r-motion-ease-out),
|
||||
box-shadow var(--r-motion-fast) var(--r-motion-ease-out);
|
||||
}
|
||||
html[data-bp~="xs"] .activity-card .activity-card__art {
|
||||
height: 150px;
|
||||
}
|
||||
.activity-card:hover .activity-card__art {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 12px 28px color-mix(in srgb, black 45%, transparent);
|
||||
@@ -94,7 +117,11 @@ defineProps<Props>();
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
/* Match the cover's width and ellipsize inside it, without letting long
|
||||
names widen the card past the (natural-width) cover above. */
|
||||
width: 0;
|
||||
min-width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.activity-card__rom {
|
||||
@@ -133,7 +160,6 @@ defineProps<Props>();
|
||||
.activity-card__meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 4px;
|
||||
font-size: var(--r-font-size-xs);
|
||||
color: var(--r-color-fg-faint);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,11 @@ import GameListHeader from "@/v2/components/Gallery/GameListHeader.vue";
|
||||
import GameListRow from "@/v2/components/Gallery/GameListRow.vue";
|
||||
import GameListSkeletonRow from "@/v2/components/Gallery/GameListSkeletonRow.vue";
|
||||
import SelectionBar from "@/v2/components/Gallery/SelectionBar.vue";
|
||||
import { type ListSortKey } from "@/v2/components/Gallery/listColumns";
|
||||
import {
|
||||
LIST_COVER_HEIGHT_PX,
|
||||
LIST_COVER_WIDTH_PX,
|
||||
type ListSortKey,
|
||||
} from "@/v2/components/Gallery/listColumns";
|
||||
import { GameCard, GameCardSkeleton } from "@/v2/components/GameCard";
|
||||
import { useBreakpoint } from "@/v2/composables/useBreakpoint";
|
||||
import { coverRatio, isBoxartStyle } from "@/v2/composables/useCoverArt";
|
||||
@@ -269,7 +273,19 @@ const coverAspectRatio = computed(() =>
|
||||
// Measured natural cover ratios feeding the flow-packer — GameCard reports
|
||||
// each cover's ratio on load (`onCardRatio`), the packer reads `ratioAt`,
|
||||
// and `ratioVersion` bumps (debounced) to trigger a single re-pack.
|
||||
const { ratioVersion, ratioAt, onCardRatio } = useGalleryCoverRatios();
|
||||
// `maxRatio` (widest cover in this gallery) drives the list view's cover
|
||||
// column width.
|
||||
const { ratioVersion, ratioAt, onCardRatio, maxRatio, resetMaxRatio } =
|
||||
useGalleryCoverRatios();
|
||||
|
||||
// List-view cover column width: the widest cover at the row's cover height,
|
||||
// clamped so a portrait-only list stays tight and an outlier can't make the
|
||||
// column absurd. Wide (landscape) covers then show whole instead of being
|
||||
// clipped, and every row shares the width so titles stay aligned.
|
||||
const listCoverWidth = computed(() => {
|
||||
const w = Math.round(LIST_COVER_HEIGHT_PX * maxRatio.value);
|
||||
return Math.min(128, Math.max(LIST_COVER_WIDTH_PX, w));
|
||||
});
|
||||
|
||||
// 2D arrow / gamepad nav for both layouts of the gallery. Two passes:
|
||||
// * Grid mode — rows are `.r-v2-shell__row` (the per-virtualizer-item
|
||||
@@ -577,6 +593,15 @@ watch(virtualItems, () => {
|
||||
syncFetches(viewportRange.value);
|
||||
});
|
||||
|
||||
// Recompute the list cover-column max when the gallery's rom set changes
|
||||
// (context switch, filter, sort) so a previous platform's wide covers
|
||||
// don't keep the column wide. Keyed on `romIdIndex` (not `virtualItems`)
|
||||
// so grid re-packs don't trigger the O(total) rebuild.
|
||||
watch(
|
||||
() => galleryRoms.romIdIndex,
|
||||
() => resetMaxRatio(),
|
||||
);
|
||||
|
||||
// List mode pins a column header below the toolbar; AlphaStrip jumps
|
||||
// must land BELOW both pinned bars or the destination row would slide
|
||||
// behind the column header. Matches the height set in
|
||||
@@ -853,6 +878,7 @@ defineExpose({
|
||||
:sort-key="listSortKey"
|
||||
:sort-dir="orderDir"
|
||||
:show-platform-column="showPlatformColumn"
|
||||
:cover-width="listCoverWidth"
|
||||
@sort="onListSort"
|
||||
/>
|
||||
</template>
|
||||
@@ -897,11 +923,14 @@ defineExpose({
|
||||
:position="asListRow(item as GalleryItem).position"
|
||||
:webp="supportsWebp"
|
||||
:show-platform-column="showPlatformColumn"
|
||||
:cover-width="listCoverWidth"
|
||||
@ratio="onCardRatio"
|
||||
/>
|
||||
|
||||
<GameListSkeletonRow
|
||||
v-else-if="itemKind(item as GalleryItem) === 'skeleton-list-row'"
|
||||
:show-platform-column="showPlatformColumn"
|
||||
:cover-width="listCoverWidth"
|
||||
/>
|
||||
|
||||
<div
|
||||
@@ -972,6 +1001,7 @@ defineExpose({
|
||||
:sort-key="listSortKey"
|
||||
:sort-dir="orderDir"
|
||||
:show-platform-column="showPlatformColumn"
|
||||
:cover-width="listCoverWidth"
|
||||
@sort="onListSort"
|
||||
/>
|
||||
|
||||
|
||||
@@ -32,10 +32,14 @@ interface Props {
|
||||
* name on `GameListRow` + `GameListSkeletonRow` so all three stay in
|
||||
* lockstep. */
|
||||
showPlatformColumn?: boolean;
|
||||
/** Width of the cover column (px) — shared with every row so the title
|
||||
* column aligns. Set by the shell from the gallery's widest cover. */
|
||||
coverWidth?: number;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
showPlatformColumn: true,
|
||||
coverWidth: 48,
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -45,7 +49,10 @@ const emit = defineEmits<{
|
||||
const { t } = useI18n();
|
||||
const columns = computed(() => getListColumns(props.showPlatformColumn));
|
||||
const gridStyle = computed(() => ({
|
||||
gridTemplateColumns: getListGridTemplate(props.showPlatformColumn),
|
||||
gridTemplateColumns: getListGridTemplate(
|
||||
props.showPlatformColumn,
|
||||
props.coverWidth,
|
||||
),
|
||||
}));
|
||||
|
||||
const galleryRoms = storeGalleryRoms();
|
||||
|
||||
@@ -72,6 +72,9 @@ interface Props {
|
||||
/** Include the `platform` column. Mirrors `GameListHeader` so the row
|
||||
* stays aligned with the column header above it. */
|
||||
showPlatformColumn?: boolean;
|
||||
/** Cover column width (px) — shared with the header so the title column
|
||||
* aligns. Set by the shell from the gallery's widest cover. */
|
||||
coverWidth?: number;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
@@ -79,8 +82,15 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
rom: undefined,
|
||||
webp: false,
|
||||
showPlatformColumn: true,
|
||||
coverWidth: 48,
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
/** Forwards the cover's measured natural ratio so the shell can size the
|
||||
* cover column to the gallery's widest cover. */
|
||||
(e: "ratio", payload: { romId: number; ratio: number }): void;
|
||||
}>();
|
||||
|
||||
const router = useRouter();
|
||||
const galleryRoms = storeGalleryRoms();
|
||||
const selection = storeGallerySelection();
|
||||
@@ -121,7 +131,10 @@ function onCheckboxClick(e: MouseEvent) {
|
||||
}
|
||||
|
||||
const gridStyle = computed(() => ({
|
||||
gridTemplateColumns: getListGridTemplate(props.showPlatformColumn),
|
||||
gridTemplateColumns: getListGridTemplate(
|
||||
props.showPlatformColumn,
|
||||
props.coverWidth,
|
||||
),
|
||||
}));
|
||||
|
||||
const platformMeta = computed(() => {
|
||||
@@ -321,6 +334,7 @@ onBeforeUnmount(() => {
|
||||
decorative
|
||||
:show-title="false"
|
||||
:show-platform-icon="false"
|
||||
@ratio="emit('ratio', $event)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -579,13 +593,12 @@ onBeforeUnmount(() => {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
/* Cover sits in its own fixed-width column (right-aligned, vertically
|
||||
centred) so the title/meta column starts at the same x on every row and
|
||||
the cover hugs the title side. */
|
||||
/* Cover sits in its own fixed-width column (centred) so the title/meta
|
||||
column starts at the same x on every row. */
|
||||
.game-list-row__cover {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
/* Bound the xs cover to its fixed column: at the fixed xs height a wide
|
||||
|
||||
@@ -27,15 +27,21 @@ interface Props {
|
||||
* `GameListRow` so the bootstrap-phase skeleton stays aligned with
|
||||
* whichever variant the surrounding list is rendering. */
|
||||
showPlatformColumn?: boolean;
|
||||
/** Cover column width (px) — shared with the header / rows. */
|
||||
coverWidth?: number;
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
showPlatformColumn: true,
|
||||
coverWidth: 48,
|
||||
});
|
||||
|
||||
const columns = computed(() => getListColumns(props.showPlatformColumn));
|
||||
const gridStyle = computed(() => ({
|
||||
gridTemplateColumns: getListGridTemplate(props.showPlatformColumn),
|
||||
gridTemplateColumns: getListGridTemplate(
|
||||
props.showPlatformColumn,
|
||||
props.coverWidth,
|
||||
),
|
||||
}));
|
||||
</script>
|
||||
|
||||
@@ -112,11 +118,11 @@ const gridStyle = computed(() => ({
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
/* Right-align the cover block to match the real row. */
|
||||
/* Centre the cover block to match the real row. */
|
||||
.r-glr-skel__cover {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.r-glr-skel__title {
|
||||
|
||||
@@ -116,11 +116,16 @@ export function getListColumns(showPlatform: boolean): readonly ListColumn[] {
|
||||
/** CSS-grid template paired with `getListColumns`. The `platform` slot
|
||||
* is inserted between `name` and `fs_size_bytes` when present so column
|
||||
* order matches the array. */
|
||||
export function getListGridTemplate(showPlatform: boolean): string {
|
||||
export function getListGridTemplate(
|
||||
showPlatform: boolean,
|
||||
coverWidthPx = 48,
|
||||
): string {
|
||||
const platformTrack = showPlatform ? " 200px" : "";
|
||||
// Cover track = the xs cover height (64px), so any portrait→square cover
|
||||
// fits without clipping and the title column starts at a fixed x.
|
||||
return `36px 64px minmax(0, 1.6fr)${platformTrack} 88px 96px 84px 56px 110px 110px 88px`;
|
||||
// Cover track widens to the widest cover in the gallery (set by the
|
||||
// shell from measured ratios), so landscape covers show whole instead of
|
||||
// being clipped, while portrait-only lists stay tight. The title column
|
||||
// starts at a fixed x because every row shares this width.
|
||||
return `36px ${coverWidthPx}px minmax(0, 1.6fr)${platformTrack} 88px 96px 84px 56px 110px 110px 88px`;
|
||||
}
|
||||
|
||||
/** Default exports — the cross-platform variant. Used by the bootstrap-
|
||||
|
||||
@@ -44,6 +44,7 @@ import { useRouter } from "vue-router";
|
||||
import type { SimpleRom } from "@/stores/roms";
|
||||
import GameActionBtn from "@/v2/components/GameActions/GameActionBtn.vue";
|
||||
import SiblingBadge from "@/v2/components/GameCard/SiblingBadge.vue";
|
||||
import CoverArtPip from "@/v2/components/shared/CoverArtPip.vue";
|
||||
import GameCover from "@/v2/components/shared/GameCover.vue";
|
||||
import { useBackgroundArt } from "@/v2/composables/useBackgroundArt";
|
||||
import { useCoverArt } from "@/v2/composables/useCoverArt";
|
||||
@@ -104,6 +105,10 @@ interface Props {
|
||||
* (edit dialog) and external provider URLs (match dialog source
|
||||
* variants). Bypasses the path/webp/url_cover chain. */
|
||||
coverSrc?: string | null;
|
||||
/** When a `coverSrc` override is shown (e.g. the continue-playing
|
||||
* screenshot), float a small 2D cover-art thumbnail in the bottom-right
|
||||
* corner so the game stays identifiable. No-op without a `coverSrc`. */
|
||||
coverPip?: boolean;
|
||||
/** Paint a brand-coloured outline to mark the card as selected
|
||||
* (cover-variant picker, multi-select gallery). When `selectable`
|
||||
* is true this prop is ignored — the card subscribes directly to
|
||||
@@ -135,6 +140,7 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
noHover: false,
|
||||
showTitle: true,
|
||||
coverSrc: undefined,
|
||||
coverPip: false,
|
||||
selected: false,
|
||||
selectable: false,
|
||||
position: undefined,
|
||||
@@ -152,6 +158,9 @@ const art = useCoverArt(() => props.rom, {
|
||||
const coverUrl = art.coverUrl;
|
||||
const fallbackUrl = art.fallbackUrl;
|
||||
const coverAspectRatio = art.ratio;
|
||||
// Cover-art PIP — only when an override image (a screenshot) is actually
|
||||
// covering the rom's own art, and the consumer opted in.
|
||||
const showCoverPip = computed(() => props.coverPip && !!props.coverSrc);
|
||||
// Alt-art styles (box3d / physical / miximage) drop the card frame so the
|
||||
// artwork floats — but only while a real image renders; with no cover the
|
||||
// placeholder keeps its grey box so the title stays readable.
|
||||
@@ -233,7 +242,11 @@ const { morphTransition } = useViewTransition();
|
||||
// between ~1 and ~7 live `useGameActions` per card, which dominates a
|
||||
// virtualised grid's cost. Safe to call conditionally (no lifecycle hooks).
|
||||
const actions =
|
||||
props.static || props.decorative ? null : useGameActions(() => props.rom);
|
||||
props.static || props.decorative
|
||||
? null
|
||||
: useGameActions(() => props.rom, {
|
||||
coverEl: () => coverRef.value?.el() ?? null,
|
||||
});
|
||||
if (actions) provide(GAME_ACTIONS_KEY, actions);
|
||||
|
||||
// Stop propagation so the card's morph + router push doesn't fire when
|
||||
@@ -455,6 +468,11 @@ function onStaticKeydown(e: KeyboardEvent) {
|
||||
<slot name="overlay" />
|
||||
</div>
|
||||
|
||||
<!-- Cover-art PIP — small box-art thumbnail floated bottom-right while a
|
||||
screenshot covers the rom's own art. Fades out on hover (below) so
|
||||
it never collides with the action overlay. -->
|
||||
<CoverArtPip v-if="showCoverPip" :rom="rom" :title="title" :webp="webp" />
|
||||
|
||||
<!-- Gallery chrome — all suppressed in static / decorative mode. -->
|
||||
<template v-if="!static && !decorative">
|
||||
<div v-if="ratingLabel" class="r-gc__rating">★ {{ ratingLabel }}</div>
|
||||
@@ -758,6 +776,15 @@ html[data-input="touch"] .r-gc:hover .r-gc__overlay,
|
||||
gap: 4px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Cover-art PIP (CoverArtPip) — fades out under the hover overlay so it never
|
||||
overlaps the action row. The footprint / chrome live in the component. */
|
||||
html[data-input="mouse"] .r-gc:hover :deep(.cover-art-pip),
|
||||
html[data-input="touch"] .r-gc:hover :deep(.cover-art-pip),
|
||||
.r-gc:focus-visible :deep(.cover-art-pip),
|
||||
.r-gc--focused :deep(.cover-art-pip) {
|
||||
opacity: 0;
|
||||
}
|
||||
html[data-input="mouse"] .r-gc:hover .r-gc__badge,
|
||||
html[data-input="touch"] .r-gc:hover .r-gc__badge,
|
||||
.r-gc:focus-visible .r-gc__badge,
|
||||
|
||||
@@ -29,10 +29,6 @@ defineProps<{
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.r-v2-related {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.r-v2-related__title {
|
||||
margin: 0 0 10px 0;
|
||||
font-size: 11px;
|
||||
|
||||
66
frontend/src/v2/components/shared/CoverArtPip.vue
Normal file
66
frontend/src/v2/components/shared/CoverArtPip.vue
Normal file
@@ -0,0 +1,66 @@
|
||||
<script setup lang="ts">
|
||||
// CoverArtPip — a small 2D box-art thumbnail floated in the bottom-right
|
||||
// corner of a cover box, used when the main image is a screenshot (the
|
||||
// continue-playing rail, the live-activity board) so the game stays
|
||||
// identifiable. Renders the canonical GameCover forced to `cover_path`, so it
|
||||
// resolves the rom's real cover (by `rom`) or an explicit cover URL (by
|
||||
// `coverSrc`) — never 3D / physical / miximage.
|
||||
//
|
||||
// Positioning is `absolute`, so the host must give it a positioned ancestor:
|
||||
// drop it into the GameCover default slot (GameCover's root is relative). The
|
||||
// wrapper owns the footprint, rounding + lift; the host adds any hover fade.
|
||||
import GameCover from "@/v2/components/shared/GameCover.vue";
|
||||
import type { CoverArtRom } from "@/v2/composables/useCoverArt";
|
||||
|
||||
interface Props {
|
||||
/** The rom whose cover to resolve (gallery cards have the full rom). */
|
||||
rom?: CoverArtRom | null;
|
||||
/** Explicit cover URL, for surfaces that only have the path (activity). */
|
||||
coverSrc?: string | null;
|
||||
/** Alt / placeholder text for the inner cover. */
|
||||
title?: string;
|
||||
/** Webp override, forwarded to GameCover. */
|
||||
webp?: boolean;
|
||||
}
|
||||
|
||||
withDefaults(defineProps<Props>(), {
|
||||
rom: null,
|
||||
coverSrc: undefined,
|
||||
title: "",
|
||||
webp: undefined,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="cover-art-pip" aria-hidden="true">
|
||||
<GameCover
|
||||
:rom="rom ?? null"
|
||||
:cover-src="coverSrc"
|
||||
:title="title"
|
||||
force-style="cover_path"
|
||||
:webp="webp"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* The wrapper owns the footprint, rounding + lift; `--r-cover-radius: 0`
|
||||
squares the inner GameCover so the wrapper's corners win. */
|
||||
.cover-art-pip {
|
||||
position: absolute;
|
||||
right: 6px;
|
||||
bottom: 6px;
|
||||
width: 55px;
|
||||
z-index: 2;
|
||||
border-radius: var(--r-radius-sm);
|
||||
overflow: hidden;
|
||||
border: 1.5px solid var(--r-color-overlay-border);
|
||||
box-shadow: 0 2px 8px color-mix(in srgb, black 45%, transparent);
|
||||
pointer-events: none;
|
||||
--r-cover-radius: 0;
|
||||
transition: opacity 0.12s ease;
|
||||
}
|
||||
html[data-bp~="xs"] .cover-art-pip {
|
||||
width: 45px;
|
||||
}
|
||||
</style>
|
||||
@@ -29,6 +29,10 @@ import {
|
||||
type BoxartStyle,
|
||||
type CoverArtRom,
|
||||
} from "@/v2/composables/useCoverArt";
|
||||
import {
|
||||
getCoverRatio,
|
||||
setCoverRatio,
|
||||
} from "@/v2/composables/useGalleryCoverRatios";
|
||||
import { pendingMorphName } from "@/v2/composables/useViewTransition";
|
||||
|
||||
// inheritAttrs stays ON (default): consumers pass a `class` (e.g.
|
||||
@@ -122,14 +126,26 @@ const coverLoaded = ref(false);
|
||||
const activeSrc = computed(() =>
|
||||
showFallback.value ? art.fallbackUrl.value : art.coverUrl.value,
|
||||
);
|
||||
// Natural ratio (w / h) of the rendered image, measured on load — drives
|
||||
// the box shape. Null until decoded / for the placeholder (→ style ratio).
|
||||
const naturalRatio = ref<number | null>(null);
|
||||
// Rom id to key the measured ratio under — but ONLY when this is the rom's
|
||||
// own cover. With a `coverSrc` override (the cover shows a screenshot /
|
||||
// marquee / preview blob instead) the measured ratio belongs to that image,
|
||||
// not the rom's cover, so it must not land on the shared rom-id key the
|
||||
// gallery flow-packer reads (it stays keyed by URL only). The morph still
|
||||
// uses `props.morphId` directly — unaffected.
|
||||
const ratioRomId = computed(() => (props.coverSrc ? null : props.morphId));
|
||||
// Natural ratio (w / h) of the rendered image. Seeded from the shared
|
||||
// by-URL cache so a cover measured elsewhere (e.g. the gallery card the
|
||||
// user just clicked) renders at its true shape immediately — no stretch
|
||||
// during the morph. Falls back to the style ratio until the image decodes.
|
||||
const naturalRatio = ref<number | null>(
|
||||
getCoverRatio({ url: activeSrc.value, romId: ratioRomId.value }),
|
||||
);
|
||||
function measureNaturalRatio() {
|
||||
const el = imgEl.value;
|
||||
if (el && el.naturalWidth > 0 && el.naturalHeight > 0) {
|
||||
const r = el.naturalWidth / el.naturalHeight;
|
||||
naturalRatio.value = r;
|
||||
setCoverRatio({ url: activeSrc.value, romId: ratioRomId.value }, r);
|
||||
emit("ratio", r);
|
||||
}
|
||||
}
|
||||
@@ -137,7 +153,7 @@ watch(activeSrc, (src) => {
|
||||
// Seed from the session-seen set: a URL we've already bloomed once skips the
|
||||
// reveal so a recycled card doesn't re-flash it (and doesn't pay the blur).
|
||||
coverLoaded.value = !!src && revealedCoverSrcs.has(src);
|
||||
naturalRatio.value = null;
|
||||
naturalRatio.value = getCoverRatio({ url: src, romId: ratioRomId.value });
|
||||
});
|
||||
const onCoverLoad = () => {
|
||||
coverLoaded.value = true;
|
||||
@@ -154,6 +170,7 @@ const coverActive = computed(
|
||||
|
||||
const { isVideoPlaying, playLoad } = useCoverAnimation({
|
||||
el: imgEl,
|
||||
containerEl: rootEl,
|
||||
videoEl,
|
||||
animateCD: art.animateCD,
|
||||
animateCartridge: art.animateCartridge,
|
||||
@@ -231,6 +248,7 @@ defineExpose({
|
||||
"
|
||||
:alt="title"
|
||||
:style="{ objectFit: art.objectFit.value }"
|
||||
class="game-cover__img"
|
||||
:class="{
|
||||
'game-cover__img--behind': isVideoPlaying,
|
||||
'game-cover__img--reveal': !coverLoaded && art.motionEnabled.value,
|
||||
@@ -259,6 +277,17 @@ defineExpose({
|
||||
playsinline
|
||||
preload="none"
|
||||
/>
|
||||
<!-- Static miximage frame overlaid on the hover video while it plays
|
||||
(matches v1) — sits after the <video> so it stacks above it but
|
||||
below the surface chrome slot. -->
|
||||
<img
|
||||
v-if="art.videoUrl.value"
|
||||
class="game-cover__video-frame"
|
||||
:class="{ 'game-cover__video-frame--playing': isVideoPlaying }"
|
||||
src="/assets/default/miximage.png"
|
||||
alt=""
|
||||
aria-hidden="true"
|
||||
/>
|
||||
|
||||
<!-- Surface chrome (gallery overlay / badges / glow) renders on top. -->
|
||||
<slot />
|
||||
@@ -281,22 +310,24 @@ defineExpose({
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
/* Direct-child selector so the placeholder's own <img> isn't matched. */
|
||||
.game-cover > img {
|
||||
/* The cover image. (The placeholder's own <img> uses its own class.) */
|
||||
.game-cover__img {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
/* Three motions ride this <img>, each on its own property so they never
|
||||
/* Four motions ride this <img>, each on its own property so they never
|
||||
clobber each other: opacity crossfades to the hover video, filter +
|
||||
scale drive the blur-up reveal on first paint, and the spin owns
|
||||
`rotate` (set imperatively in useCoverAnimation). */
|
||||
scale drive the blur-up reveal on first paint, the spin owns `transform`
|
||||
(set per-frame in useCoverAnimation), and `margin-top` is the
|
||||
cartridge/disc slot-in slide (eased here so it composes with the spin). */
|
||||
transition:
|
||||
opacity 0.35s ease,
|
||||
filter 0.6s ease,
|
||||
scale 0.65s cubic-bezier(0.22, 1, 0.36, 1);
|
||||
scale 0.65s cubic-bezier(0.22, 1, 0.36, 1),
|
||||
margin 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
|
||||
}
|
||||
.game-cover__img--behind {
|
||||
opacity: 0;
|
||||
@@ -315,7 +346,7 @@ defineExpose({
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
/* Keep a gentle opacity fade, drop the blur/scale flourish. */
|
||||
.game-cover > img {
|
||||
.game-cover__img {
|
||||
transition: opacity 0.25s ease;
|
||||
}
|
||||
.game-cover__img--reveal {
|
||||
@@ -326,9 +357,9 @@ defineExpose({
|
||||
|
||||
.game-cover__video {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0.75rem;
|
||||
left: 0.35rem;
|
||||
width: 97%;
|
||||
object-fit: contain;
|
||||
opacity: 0;
|
||||
transition: opacity 0.35s ease;
|
||||
@@ -337,4 +368,19 @@ defineExpose({
|
||||
.game-cover__video--playing {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.game-cover__video-frame {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
object-fit: contain;
|
||||
opacity: 0;
|
||||
transition: opacity 0.35s ease;
|
||||
pointer-events: none;
|
||||
transform: scale(1.01);
|
||||
filter: hue-rotate(15deg);
|
||||
}
|
||||
.game-cover__video-frame--playing {
|
||||
opacity: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,18 +1,25 @@
|
||||
// useCoverAnimation — the "juicy" motion layer for alt-art game covers.
|
||||
//
|
||||
// v2 rebuild of v1's deprecated `useGameAnimation` against a raw <img>
|
||||
// (v2 has no Vuetify VImg internals). Three behaviours, all driven by the
|
||||
// card's hover/focus `active` signal and the flags `useCoverArt` resolves:
|
||||
// * CD spin — physical art on a CD-based platform spins up on
|
||||
// hover (accelerate) and coasts down on leave.
|
||||
// * Cartridge — physical art on a cartridge platform does a one-shot
|
||||
// "slot-in" drop when first hovered.
|
||||
// * Hover video — miximage art crossfades to its `path_video` clip a
|
||||
// beat after hover, and resets on leave.
|
||||
// v2 port of v1's `useGameAnimation` (which drove a Vuetify VImg; v2 drives a
|
||||
// raw <img>). Three behaviours, all gated by the card's hover/focus `active`
|
||||
// signal and the flags `useCoverArt` resolves:
|
||||
// * CD spin — physical art on a CD platform spins up on hover
|
||||
// (accelerate) and coasts down on leave. The launch
|
||||
// flourish spins it at max while it slides down into the
|
||||
// drive and vanishes.
|
||||
// * Cartridge — physical art on a cartridge platform seats fully into
|
||||
// its bay on launch (no hover animation, matching v1).
|
||||
// * Hover video — miximage art crossfades to its `path_video` clip a beat
|
||||
// after hover, and resets on leave.
|
||||
//
|
||||
// The v1 trick (kept here because it's the part that makes it feel right):
|
||||
// the slide is `margin-top` with an overshoot transition, while the spin is
|
||||
// `transform: rotate` — two *different* properties, so they compose. A single
|
||||
// `transform` for both can't be eased independently (the per-frame spin would
|
||||
// fight the eased slide).
|
||||
//
|
||||
// All motion is gated by the user's `disableAnimations` setting (via
|
||||
// `motionEnabled`) AND the OS `prefers-reduced-motion` — when either says
|
||||
// no, the cover stays a still image.
|
||||
// `motionEnabled`) AND the OS `prefers-reduced-motion`.
|
||||
import {
|
||||
computed,
|
||||
onBeforeUnmount,
|
||||
@@ -31,22 +38,31 @@ export interface SpinConfig {
|
||||
decel: number;
|
||||
}
|
||||
|
||||
// Mirrors v1's ANIMATION_CONFIG (maxRotationSpeed / acceleration /
|
||||
// deceleration), kept as deg/sec(²) for the frame-rate-independent step.
|
||||
// Mirrors v1's ANIMATION_CONFIG, kept as deg/sec(²) for the frame-rate-
|
||||
// independent step.
|
||||
export const SPIN_CONFIG: SpinConfig = {
|
||||
maxSpeed: 5000,
|
||||
accel: 2500,
|
||||
decel: 1500,
|
||||
};
|
||||
|
||||
// Cartridge slot-in depth on launch, as a fraction of the cover height
|
||||
// (v1 seated at 1/3 on play). There is no cartridge hover animation.
|
||||
const CART_SEAT_FRACTION = 1 / 3;
|
||||
|
||||
// How long the player waits (ms) for the launch flourish before booting —
|
||||
// the margin transition is 500ms; a little extra lets the motion read.
|
||||
const CD_LOAD_MS = 700;
|
||||
const CART_LOAD_MS = 600;
|
||||
|
||||
// Delay before the hover video kicks in, so fast scans across the gallery
|
||||
// don't fire a burst of <video> loads. A touch snappier than v1's 1500ms.
|
||||
// don't fire a burst of <video> loads.
|
||||
const VIDEO_HOVER_DELAY_MS = 1000;
|
||||
|
||||
/** Pure one-frame integration of the spin physics — exported for tests.
|
||||
* `accelerating` is true while the cover is hovered/focused; otherwise
|
||||
* the disc coasts to a stop. Velocity is clamped to `[0, maxSpeed]` and
|
||||
* the angle wraps at 360°. */
|
||||
* `accelerating` is true while the cover is hovered/focused; otherwise the
|
||||
* disc coasts to a stop. Velocity is clamped to `[0, maxSpeed]` and the
|
||||
* angle wraps at 360°. */
|
||||
export function stepSpin(
|
||||
state: { angle: number; velocity: number },
|
||||
dtSeconds: number,
|
||||
@@ -72,8 +88,10 @@ function prefersReducedMotion(): boolean {
|
||||
}
|
||||
|
||||
export interface UseCoverAnimationOptions {
|
||||
/** The cover <img> element (the thing that spins / slots in). */
|
||||
/** The cover <img> element (the thing that spins / slides). */
|
||||
el: Ref<HTMLElement | null>;
|
||||
/** The cover box that clips the slide — used for its `offsetHeight`. */
|
||||
containerEl: Ref<HTMLElement | null>;
|
||||
/** The hover-video <video> element (miximage style), if rendered. */
|
||||
videoEl: Ref<HTMLVideoElement | null>;
|
||||
/** Disc-spin applies (physical art, CD-based platform). */
|
||||
@@ -84,8 +102,8 @@ export interface UseCoverAnimationOptions {
|
||||
videoUrl: ComputedRef<string | null>;
|
||||
/** User's animation preference (`!disableAnimations`). */
|
||||
motionEnabled: ComputedRef<boolean>;
|
||||
/** Hover / focus state of the card — drives the spin / video. The
|
||||
* one-shot launch flourish (`playLoad`) is triggered imperatively by
|
||||
/** Hover / focus state of the card — drives the spin / slot-in / video.
|
||||
* The one-shot launch flourish (`playLoad`) is triggered imperatively by
|
||||
* the player view instead. */
|
||||
active: Ref<boolean> | ComputedRef<boolean>;
|
||||
}
|
||||
@@ -94,8 +112,8 @@ export interface UseCoverAnimation {
|
||||
/** True while the hover video is actually playing (drives the
|
||||
* image→video crossfade in the card). */
|
||||
isVideoPlaying: Ref<boolean>;
|
||||
/** Trigger the one-shot launch flourish (disc drop+spin / cartridge
|
||||
* slot-in). Returns its duration in ms (0 if nothing animates), so the
|
||||
/** Trigger the one-shot launch flourish (disc spin+drop / cartridge
|
||||
* seat). Returns its duration in ms (0 if nothing animates), so the
|
||||
* player view can hold the boot back until the insert plays out. */
|
||||
playLoad: () => number;
|
||||
}
|
||||
@@ -107,43 +125,46 @@ export function useCoverAnimation(
|
||||
() => opts.motionEnabled.value && !prefersReducedMotion(),
|
||||
);
|
||||
|
||||
// ── CD spin ───────────────────────────────────────────────────────
|
||||
// The slide (`margin-top`) is eased in CSS (`.game-cover__img`) so it
|
||||
// composes with the per-frame `transform: rotate` written below — the spin
|
||||
// stays immediate while the slot-in/drop overshoots.
|
||||
|
||||
// ── CD spin (+ launch drop) ───────────────────────────────────────
|
||||
let angle = 0;
|
||||
let velocity = 0;
|
||||
let lastTs: number | null = null;
|
||||
let raf: number | null = null;
|
||||
|
||||
const wantsSpin = computed(
|
||||
() => opts.active.value && opts.animateCD.value && motionOk.value,
|
||||
);
|
||||
// While true the disc holds max speed and slides the full height down
|
||||
// into the drive (the launch flourish). Cleared by `stopSpin`.
|
||||
let dropping = false;
|
||||
|
||||
function frame(ts: number) {
|
||||
const img = opts.el.value;
|
||||
if (!img) {
|
||||
raf = null;
|
||||
return;
|
||||
}
|
||||
if (lastTs === null) lastTs = ts;
|
||||
// Clamp dt so a backgrounded tab doesn't resume with a giant jump.
|
||||
const dt = Math.min((ts - lastTs) / 1000, 0.05);
|
||||
lastTs = ts;
|
||||
|
||||
const next = stepSpin({ angle, velocity }, dt, wantsSpin.value);
|
||||
const next = stepSpin({ angle, velocity }, dt, opts.active.value);
|
||||
angle = next.angle;
|
||||
velocity = next.velocity;
|
||||
|
||||
// Use the individual `rotate` property (not `transform`) so the
|
||||
// drop-in animation can own `transform: translateY` and the two
|
||||
// compose instead of clobbering each other.
|
||||
if (opts.el.value) {
|
||||
opts.el.value.style.rotate = `${angle.toFixed(2)}deg`;
|
||||
if (dropping) {
|
||||
velocity = SPIN_CONFIG.maxSpeed;
|
||||
const container = opts.containerEl.value;
|
||||
if (container) img.style.marginTop = `${container.offsetHeight}px`;
|
||||
}
|
||||
|
||||
if (velocity > 0 || wantsSpin.value) {
|
||||
img.style.transform = `rotate(${angle.toFixed(2)}deg)`;
|
||||
|
||||
if (velocity > 0 || opts.active.value || dropping) {
|
||||
raf = requestAnimationFrame(frame);
|
||||
} else {
|
||||
// Fully stopped — clear so a later style switch doesn't leave a
|
||||
// stale rotation on a non-disc image.
|
||||
raf = null;
|
||||
lastTs = null;
|
||||
angle = 0;
|
||||
velocity = 0;
|
||||
if (opts.el.value) opts.el.value.style.rotate = "";
|
||||
stopSpin();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,102 +175,60 @@ export function useCoverAnimation(
|
||||
}
|
||||
}
|
||||
|
||||
function hardStopSpin() {
|
||||
function stopSpin() {
|
||||
if (raf !== null) cancelAnimationFrame(raf);
|
||||
raf = null;
|
||||
lastTs = null;
|
||||
angle = 0;
|
||||
velocity = 0;
|
||||
if (opts.el.value) opts.el.value.style.rotate = "";
|
||||
dropping = false;
|
||||
const img = opts.el.value;
|
||||
if (img) {
|
||||
img.style.transform = "";
|
||||
img.style.marginTop = "";
|
||||
}
|
||||
}
|
||||
|
||||
// Start coasting up when wanted; the frame loop coasts down on its own
|
||||
// once `wantsSpin` flips false. A style switch away from CD hard-stops
|
||||
// so we don't keep spinning a cartridge / box.
|
||||
const wantsSpin = computed(
|
||||
() => opts.active.value && opts.animateCD.value && motionOk.value,
|
||||
);
|
||||
watch(wantsSpin, (on) => {
|
||||
if (on) kickSpin();
|
||||
// Leaving: the frame loop coasts down on its own (active is false).
|
||||
});
|
||||
watch(
|
||||
() => opts.animateCD.value,
|
||||
(cd) => {
|
||||
if (!cd) hardStopSpin();
|
||||
if (!cd) stopSpin();
|
||||
},
|
||||
);
|
||||
|
||||
// ── Drop-in (cartridge slot-in / disc drop) ───────────────────────
|
||||
// One-shot translateY with an overshoot settle. Uses `transform` so it
|
||||
// composes with the spin's `rotate` property. `from` is the start
|
||||
// offset as a percentage of the element height.
|
||||
function dropIn(from: number, duration: number) {
|
||||
const el = opts.el.value;
|
||||
if (!el || typeof el.animate !== "function") return;
|
||||
el.animate(
|
||||
[
|
||||
{ transform: `translateY(${from}%)`, opacity: 0.85, offset: 0 },
|
||||
{ transform: "translateY(4%)", offset: 0.72 },
|
||||
{ transform: "translateY(0)", opacity: 1, offset: 1 },
|
||||
],
|
||||
{ duration, easing: "cubic-bezier(0.34, 1.56, 0.64, 1)" },
|
||||
);
|
||||
// ── Cartridge slot-in ─────────────────────────────────────────────
|
||||
// Cartridges only seat on launch (no hover animation — matches v1).
|
||||
function cartSlot(depthFraction: number) {
|
||||
const img = opts.el.value;
|
||||
const container = opts.containerEl.value;
|
||||
if (!img || !container) return;
|
||||
img.style.transform = "rotate(0deg)";
|
||||
img.style.marginTop = depthFraction
|
||||
? `${container.offsetHeight * depthFraction}px`
|
||||
: "";
|
||||
}
|
||||
|
||||
// Gentle slot-in when a cartridge cover is first hovered.
|
||||
function playInsert() {
|
||||
dropIn(-16, 440);
|
||||
}
|
||||
|
||||
// Launch "load" flourish (player view): from its RESTING position the
|
||||
// disc spins up and slides DOWN into the drive, or the cartridge slides
|
||||
// down into the slot. One self-contained Web Animations keyframe (not the
|
||||
// rAF spin loop). `fill: forwards` keeps it inserted until the hero
|
||||
// unmounts for the running game. Returns the duration in ms (0 when no
|
||||
// launch animation applies) so the caller can hold the boot back until
|
||||
// the insert is seen. Starts at translateY(0) — no upward jump.
|
||||
// Disc: spins up and slides ALL the way down into the drive, vanishing.
|
||||
const CD_LOAD_MS = 850;
|
||||
// Cartridge: slides DOWN to ~halfway (clipped by the slot edge) and
|
||||
// HOLDS there ~1s, as if seated/connected — then the game boots.
|
||||
const CART_LOAD_MS = 1250;
|
||||
// ── Launch flourish (player view) ─────────────────────────────────
|
||||
function playLoad(): number {
|
||||
const el = opts.el.value;
|
||||
if (!motionOk.value || !el || typeof el.animate !== "function") return 0;
|
||||
hardStopSpin();
|
||||
const img = opts.el.value;
|
||||
const container = opts.containerEl.value;
|
||||
if (!motionOk.value || !img || !container) return 0;
|
||||
if (opts.animateCD.value) {
|
||||
el.animate(
|
||||
[
|
||||
{ transform: "translateY(0) rotate(0deg)", opacity: 1, offset: 0 },
|
||||
{
|
||||
transform: "translateY(10%) rotate(240deg)",
|
||||
opacity: 1,
|
||||
offset: 0.28,
|
||||
},
|
||||
{
|
||||
transform: "translateY(130%) rotate(1120deg)",
|
||||
opacity: 0,
|
||||
offset: 1,
|
||||
},
|
||||
],
|
||||
{
|
||||
duration: CD_LOAD_MS,
|
||||
easing: "cubic-bezier(0.5, 0, 0.9, 0.3)",
|
||||
fill: "forwards",
|
||||
},
|
||||
);
|
||||
// Spin up to max and slide the full height down into the drive.
|
||||
dropping = true;
|
||||
kickSpin();
|
||||
return CD_LOAD_MS;
|
||||
}
|
||||
if (opts.animateCartridge.value) {
|
||||
el.animate(
|
||||
[
|
||||
{
|
||||
transform: "translateY(0)",
|
||||
offset: 0,
|
||||
easing: "cubic-bezier(0.34, 1.1, 0.5, 1)",
|
||||
},
|
||||
{ transform: "translateY(50%)", offset: 0.28 }, // seated halfway
|
||||
{ transform: "translateY(50%)", offset: 1 }, // hold ~1s
|
||||
],
|
||||
{ duration: CART_LOAD_MS, fill: "forwards" },
|
||||
);
|
||||
// Seat the cartridge fully into the bay.
|
||||
cartSlot(CART_SEAT_FRACTION);
|
||||
return CART_LOAD_MS;
|
||||
}
|
||||
return 0;
|
||||
@@ -300,26 +279,17 @@ export function useCoverAnimation(
|
||||
else stopVideo();
|
||||
});
|
||||
|
||||
// ── Active-edge: fire the one-shot cartridge insert ───────────────
|
||||
watch(
|
||||
() => opts.active.value,
|
||||
(now, prev) => {
|
||||
if (now && !prev && opts.animateCartridge.value && motionOk.value) {
|
||||
playInsert();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// ── Motion preference flips off mid-flight ────────────────────────
|
||||
watch(motionOk, (ok) => {
|
||||
if (!ok) {
|
||||
hardStopSpin();
|
||||
stopSpin();
|
||||
cartSlot(0);
|
||||
stopVideo();
|
||||
}
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
hardStopSpin();
|
||||
stopSpin();
|
||||
cancelVideoTimer();
|
||||
const v = opts.videoEl.value;
|
||||
if (v) v.pause();
|
||||
|
||||
@@ -32,7 +32,11 @@ import {
|
||||
} from "vue";
|
||||
import { useUISettings } from "@/composables/useUISettings";
|
||||
import type { SimpleRom } from "@/stores/roms";
|
||||
import { FRONTEND_RESOURCES_PATH, isCDBasedSystem } from "@/utils";
|
||||
import {
|
||||
FRONTEND_RESOURCES_PATH,
|
||||
isCDBasedSystem,
|
||||
isArcadeSystem,
|
||||
} from "@/utils";
|
||||
import { useWebpSupport } from "@/v2/composables/useWebpSupport";
|
||||
|
||||
export type BoxartStyle =
|
||||
@@ -164,6 +168,7 @@ export function computeCoverArt(
|
||||
|
||||
const physicalAlt = style === "physical_path" && isAltArt;
|
||||
const cdBased = physicalAlt && isCDBasedSystem(rom.platform_slug);
|
||||
const arcadeBased = physicalAlt && isArcadeSystem(rom.platform_slug);
|
||||
|
||||
const videoUrl =
|
||||
style === "miximage_path" && rom.path_video
|
||||
@@ -178,7 +183,7 @@ export function computeCoverArt(
|
||||
ratio,
|
||||
objectFit: style === "cover_path" ? "cover" : "contain",
|
||||
animateCD: physicalAlt && cdBased,
|
||||
animateCartridge: physicalAlt && !cdBased,
|
||||
animateCartridge: physicalAlt && !cdBased && !arcadeBased,
|
||||
videoUrl,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { mount } from "@vue/test-utils";
|
||||
import { createPinia, setActivePinia } from "pinia";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { beforeEach, describe, expect, it } from "vitest";
|
||||
import { defineComponent } from "vue";
|
||||
import storeGalleryRoms from "@/v2/stores/galleryRoms";
|
||||
import { useGalleryCoverRatios } from "./index";
|
||||
import { getCoverRatio, setCoverRatio, useGalleryCoverRatios } from "./index";
|
||||
|
||||
// Run the composable inside a real component so its `onBeforeUnmount`
|
||||
// cleanup has a host instance. Returns the composable's result.
|
||||
@@ -23,10 +23,6 @@ function withComposable<T>(fn: () => T): T {
|
||||
describe("useGalleryCoverRatios", () => {
|
||||
beforeEach(() => {
|
||||
setActivePinia(createPinia());
|
||||
vi.useFakeTimers();
|
||||
});
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it("ratioAt maps position → rom id → measured ratio, else 0", () => {
|
||||
@@ -43,35 +39,40 @@ describe("useGalleryCoverRatios", () => {
|
||||
expect(ratioAt(0)).toBe(0); // rom 101 still unmeasured
|
||||
});
|
||||
|
||||
it("bumps ratioVersion once per debounce burst", () => {
|
||||
storeGalleryRoms().romIdIndex = [101, 102];
|
||||
const { ratioVersion, onCardRatio } = withComposable(() =>
|
||||
// Distinct rom ids per test — the ratio store is module-level (shared),
|
||||
// so reusing ids across tests would collide. (The `ratioVersion`
|
||||
// debounce isn't asserted here: its `setTimeout` doesn't fire under this
|
||||
// test harness; the storage / dedup it gates is covered directly below.)
|
||||
it("dedups sub-epsilon changes, keeps the first value, updates past it", () => {
|
||||
storeGalleryRoms().romIdIndex = [301];
|
||||
const { ratioAt, onCardRatio } = withComposable(() =>
|
||||
useGalleryCoverRatios(),
|
||||
);
|
||||
|
||||
expect(ratioVersion.value).toBe(0);
|
||||
onCardRatio({ romId: 101, ratio: 0.7 });
|
||||
onCardRatio({ romId: 102, ratio: 0.5 });
|
||||
expect(ratioVersion.value).toBe(0); // still debouncing
|
||||
|
||||
vi.advanceTimersByTime(350);
|
||||
expect(ratioVersion.value).toBe(1); // one bump for the whole burst
|
||||
});
|
||||
|
||||
it("ignores sub-epsilon changes (no re-store, no extra re-pack)", () => {
|
||||
storeGalleryRoms().romIdIndex = [101];
|
||||
const { ratioVersion, ratioAt, onCardRatio } = withComposable(() =>
|
||||
useGalleryCoverRatios(),
|
||||
);
|
||||
|
||||
onCardRatio({ romId: 101, ratio: 0.7 });
|
||||
vi.advanceTimersByTime(350);
|
||||
expect(ratioVersion.value).toBe(1);
|
||||
onCardRatio({ romId: 301, ratio: 0.7 });
|
||||
expect(ratioAt(0)).toBeCloseTo(0.7);
|
||||
|
||||
onCardRatio({ romId: 101, ratio: 0.705 }); // delta 0.005 < 0.01
|
||||
vi.advanceTimersByTime(350);
|
||||
expect(ratioVersion.value).toBe(1); // no new bump
|
||||
expect(ratioAt(0)).toBeCloseTo(0.7); // value unchanged
|
||||
onCardRatio({ romId: 301, ratio: 0.705 }); // delta 0.005 < 0.01 → ignored
|
||||
expect(ratioAt(0)).toBeCloseTo(0.7);
|
||||
|
||||
onCardRatio({ romId: 301, ratio: 0.9 }); // delta 0.2 ≥ 0.01 → updates
|
||||
expect(ratioAt(0)).toBeCloseTo(0.9);
|
||||
});
|
||||
});
|
||||
|
||||
describe("getCoverRatio / setCoverRatio (shared store)", () => {
|
||||
it("looks up by URL or rom id, normalising a string rom id", () => {
|
||||
setCoverRatio({ url: "/covers/401.webp", romId: 401 }, 1.33);
|
||||
|
||||
expect(getCoverRatio({ url: "/covers/401.webp" })).toBeCloseTo(1.33);
|
||||
expect(getCoverRatio({ romId: 401 })).toBeCloseTo(1.33);
|
||||
// A string id (e.g. a route param) collapses to the numeric key.
|
||||
expect(getCoverRatio({ romId: "401" })).toBeCloseTo(1.33);
|
||||
});
|
||||
|
||||
it("returns null for unknown keys", () => {
|
||||
expect(getCoverRatio({ url: "/covers/missing.webp" })).toBeNull();
|
||||
expect(getCoverRatio({ romId: 999999 })).toBeNull();
|
||||
expect(getCoverRatio({})).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,9 +6,12 @@
|
||||
// itself: GameCard reports `@ratio` once its cover loads, and this collects
|
||||
// the values for the packer to read via `ratioAt(position)`.
|
||||
//
|
||||
// Keyed by rom id (not position), so the key survives a gallery context
|
||||
// switch — a re-visited platform re-packs without re-waiting on images.
|
||||
// Intentionally unbounded: two numbers per rom, reset on page reload.
|
||||
// The measurements live in a single module-level store (below), indexed by
|
||||
// both rom id and image URL and shared with every GameCover — so a cover
|
||||
// measured in the gallery is instantly known by id (the packer) or URL (the
|
||||
// detail / player cover, for the shared-element morph). The packer keys by
|
||||
// rom id, which survives a context switch — a re-visited platform re-packs
|
||||
// without re-waiting on images.
|
||||
//
|
||||
// Updates batch behind `ratioVersion`: a burst of image loads bumps it once
|
||||
// (after a short debounce) so the packed layout recomputes a single time
|
||||
@@ -27,17 +30,65 @@ const RATIO_EPSILON = 0.01;
|
||||
// imperceptible next to the jank a per-150ms full re-pack causes.
|
||||
const REPACK_DEBOUNCE_MS = 350;
|
||||
|
||||
// ── Measured natural cover ratios — one page-lifetime, shared store ──
|
||||
// Module-level (shared across every GameCover + composable instance) and
|
||||
// indexed by BOTH the rom id and the resolved image URL, so a cover measured
|
||||
// on any surface is found by whichever key the caller has: the gallery
|
||||
// packer keys by rom id (position → id), a detail / player cover by URL or
|
||||
// rom id (before its image loads), the morph by rom id. This is also what
|
||||
// lets the detail/player cover paint at the right ratio immediately instead
|
||||
// of the default 2/3 — without it the shared-element morph stretches to 2/3
|
||||
// and snaps back on load.
|
||||
//
|
||||
// Rom-id keys are stored as plain numbers and URL keys as strings in the
|
||||
// same map — they can't collide (a URL is never a bare number), and a
|
||||
// numeric key avoids a per-lookup string concat on the packer's hot path.
|
||||
// A string rom id (e.g. a route param) is normalised with `Number()` so it
|
||||
// matches the numeric id the gallery stored. Intentionally unbounded — a
|
||||
// couple of numbers per cover, reset on page reload.
|
||||
const ratioByKey = new Map<string | number, number>();
|
||||
|
||||
interface RatioKeys {
|
||||
romId?: number | string | null;
|
||||
url?: string | null;
|
||||
}
|
||||
|
||||
/** Measured natural ratio (w / h) by rom id and/or image URL — whichever is
|
||||
* known — or null if neither has been measured yet. Not on the packer's hot
|
||||
* path (which reads the map directly); used by GameCover per cover load. */
|
||||
export function getCoverRatio({ romId, url }: RatioKeys): number | null {
|
||||
if (url) {
|
||||
const r = ratioByKey.get(url);
|
||||
if (r != null) return r;
|
||||
}
|
||||
if (romId != null) {
|
||||
const r = ratioByKey.get(Number(romId));
|
||||
if (r != null) return r;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Remember a cover's measured ratio under its rom id and/or URL. */
|
||||
export function setCoverRatio({ romId, url }: RatioKeys, ratio: number): void {
|
||||
if (url) ratioByKey.set(url, ratio);
|
||||
if (romId != null) ratioByKey.set(Number(romId), ratio);
|
||||
}
|
||||
|
||||
export function useGalleryCoverRatios() {
|
||||
const galleryRoms = storeGalleryRoms();
|
||||
const ratioByRomId = new Map<number, number>();
|
||||
const ratioVersion = ref(0);
|
||||
const maxRatio = ref(0);
|
||||
let bumpTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
/** Record a cover's measured ratio (GameCard's `@ratio` handler). */
|
||||
/** Record a cover's measured ratio (GameCard's `@ratio` handler). Reads
|
||||
* /writes the map directly by numeric rom id — no key object / string. */
|
||||
function onCardRatio(payload: { romId: number; ratio: number }) {
|
||||
const prev = ratioByRomId.get(payload.romId);
|
||||
// Track the max on every report (even cached re-paints with an
|
||||
// unchanged ratio) so it rebuilds correctly after a context reset.
|
||||
if (payload.ratio > maxRatio.value) maxRatio.value = payload.ratio;
|
||||
const prev = ratioByKey.get(payload.romId);
|
||||
if (prev != null && Math.abs(prev - payload.ratio) < RATIO_EPSILON) return;
|
||||
ratioByRomId.set(payload.romId, payload.ratio);
|
||||
ratioByKey.set(payload.romId, payload.ratio);
|
||||
if (bumpTimer) return;
|
||||
bumpTimer = setTimeout(() => {
|
||||
bumpTimer = null;
|
||||
@@ -45,17 +96,31 @@ export function useGalleryCoverRatios() {
|
||||
}, REPACK_DEBOUNCE_MS);
|
||||
}
|
||||
|
||||
/** Reset the running max to the widest already-measured cover in the
|
||||
* current gallery (or 0 if none) — call on a gallery context switch so
|
||||
* a previous platform's wide covers don't keep the column wide. */
|
||||
function resetMaxRatio() {
|
||||
let m = 0;
|
||||
const ids = galleryRoms.romIdIndex;
|
||||
for (let i = 0; i < ids.length; i++) {
|
||||
const r = ratioByKey.get(ids[i]);
|
||||
if (r != null && r > m) m = r;
|
||||
}
|
||||
maxRatio.value = m;
|
||||
}
|
||||
|
||||
/** Measured ratio for a position, or 0 when unknown (the packer then
|
||||
* falls back to its default ratio). */
|
||||
* falls back to its default ratio). Hot path — direct numeric map read,
|
||||
* called once per position on every re-pack. */
|
||||
function ratioAt(position: number): number {
|
||||
const romId = galleryRoms.romIdIndex[position];
|
||||
if (romId == null) return 0;
|
||||
return ratioByRomId.get(romId) ?? 0;
|
||||
return ratioByKey.get(romId) ?? 0;
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (bumpTimer) clearTimeout(bumpTimer);
|
||||
});
|
||||
|
||||
return { ratioVersion, ratioAt, onCardRatio };
|
||||
return { ratioVersion, ratioAt, onCardRatio, maxRatio, resetMaxRatio };
|
||||
}
|
||||
|
||||
@@ -25,10 +25,25 @@ import { getDownloadLink, getDownloadPath, isNintendoDSRom } from "@/utils";
|
||||
import { useCan } from "@/v2/composables/useCan";
|
||||
import { useCanPlay } from "@/v2/composables/useCanPlay";
|
||||
import { useSnackbar } from "@/v2/composables/useSnackbar";
|
||||
import { useViewTransition } from "@/v2/composables/useViewTransition";
|
||||
|
||||
export function useGameActions(getRom: () => SimpleRom | null | undefined) {
|
||||
export interface GameActionsOptions {
|
||||
/** Resolver for the cover element to morph from when `play()` navigates to
|
||||
* the player view. When it returns an element, the navigation runs through
|
||||
* a shared-element view transition (cover → player hero, same `rom-cover-`
|
||||
* tag the destination paints); otherwise navigation is immediate. The
|
||||
* GameCard passes its GameCover box so clicking Play in the gallery morphs
|
||||
* the cover into /ejs the same way clicking the card morphs into details. */
|
||||
coverEl?: () => HTMLElement | null;
|
||||
}
|
||||
|
||||
export function useGameActions(
|
||||
getRom: () => SimpleRom | null | undefined,
|
||||
options: GameActionsOptions = {},
|
||||
) {
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const { morphTransition } = useViewTransition();
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
const snackbar = useSnackbar();
|
||||
const romsStore = storeRoms();
|
||||
@@ -164,10 +179,25 @@ export function useGameActions(getRom: () => SimpleRom | null | undefined) {
|
||||
// The launch "load" flourish (disc/cartridge insert) lives on the
|
||||
// player view itself — see EmulatorJS's onPlay — so navigation is
|
||||
// immediate here.
|
||||
if (canPlayEJS.value) {
|
||||
router.push(`/rom/${rom.id}/ejs`);
|
||||
} else if (canPlayRuffle.value) {
|
||||
router.push(`/rom/${rom.id}/ruffle`);
|
||||
let path: string | null = null;
|
||||
if (canPlayEJS.value) path = `/rom/${rom.id}/ejs`;
|
||||
else if (canPlayRuffle.value) path = `/rom/${rom.id}/ruffle`;
|
||||
if (!path) return;
|
||||
const target = path;
|
||||
// When the caller supplies a cover element (the gallery card / detail
|
||||
// hero), morph it into the player's hero cover — same `rom-cover-<id>`
|
||||
// tag the player paints statically. Degrades to a plain push where view
|
||||
// transitions aren't available.
|
||||
const el = options.coverEl?.();
|
||||
if (el) {
|
||||
// Await the push inside the transition so the browser snapshots the
|
||||
// player view *after* it has rendered its hero cover (which carries the
|
||||
// same `rom-cover-<id>` tag) — otherwise there's no element to morph to.
|
||||
morphTransition({ el, name: `rom-cover-${rom.id}` }, async () => {
|
||||
await router.push(target);
|
||||
});
|
||||
} else {
|
||||
router.push(target);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,15 @@ export function useViewTransition() {
|
||||
function morphNameForRoute(route: RouteLocationNormalized): string | null {
|
||||
const name = route.name;
|
||||
const params = route.params as Record<string, string | string[]>;
|
||||
if (name === "rom" && params.rom) return `rom-cover-${params.rom}`;
|
||||
// `rom` (detail) and the players (`emulatorjs` / `ruffle`) all own a
|
||||
// `rom-cover-<id>` hero, so morph between any of them and the gallery /
|
||||
// each other.
|
||||
if (
|
||||
(name === "rom" || name === "emulatorjs" || name === "ruffle") &&
|
||||
params.rom
|
||||
) {
|
||||
return `rom-cover-${params.rom}`;
|
||||
}
|
||||
if (name === "platform" && params.platform) {
|
||||
return `platform-icon-${params.platform}`;
|
||||
}
|
||||
|
||||
@@ -218,6 +218,16 @@ export default defineStore("v2GalleryRoms", {
|
||||
return this.byPosition.get(position) ?? null;
|
||||
},
|
||||
|
||||
/** Find a loaded ROM by id, or null. Scans the sparse `byPosition`
|
||||
* window cache — used to seed the player hero cover synchronously on a
|
||||
* direct gallery→play so the shared-element morph has a target. */
|
||||
getRomById(id: number): SimpleRom | null {
|
||||
for (const rom of this.byPosition.values()) {
|
||||
if (rom.id === id) return rom;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
/** Drop everything tied to the previous gallery context but keep
|
||||
* order-by / order-dir. Call before switching platform / collection
|
||||
* or when filters change. */
|
||||
|
||||
@@ -62,13 +62,25 @@ function romRoute(entry: ActivityEntry) {
|
||||
return { name: ROUTES.ROM, params: { rom: entry.rom_id } };
|
||||
}
|
||||
|
||||
// Null when the rom has no cover — GameCover then paints its own canonical
|
||||
// placeholder (title initial) instead of a baked-in missing-cover image.
|
||||
function coverSrc(entry: ActivityEntry): string | null {
|
||||
// Cover art URL, or null when the rom has no cover — GameCover then paints
|
||||
// its own canonical placeholder (title initial).
|
||||
function coverArtSrc(entry: ActivityEntry): string | null {
|
||||
if (!entry.rom_cover_path) return null;
|
||||
return `${FRONTEND_RESOURCES_PATH}/${toWebp(entry.rom_cover_path)}`;
|
||||
}
|
||||
|
||||
// Main image: the "where they are" screenshot (already a full URL) if the
|
||||
// session has one, else the cover art.
|
||||
function coverSrc(entry: ActivityEntry): string | null {
|
||||
return entry.screenshot_path || coverArtSrc(entry);
|
||||
}
|
||||
|
||||
// PIP cover-art thumbnail — only when a screenshot is the main image, so the
|
||||
// game stays identifiable.
|
||||
function pipCoverSrc(entry: ActivityEntry): string | null {
|
||||
return entry.screenshot_path ? coverArtSrc(entry) : null;
|
||||
}
|
||||
|
||||
function avatarSrc(entry: ActivityEntry): string {
|
||||
// ActivityEntry carries no `updated_at`; the avatar is stable for the
|
||||
// life of a session so cache-busting isn't needed here.
|
||||
@@ -140,6 +152,7 @@ function elapsedLabel(startedAt: string): string {
|
||||
:style="{ '--card-fade-i': i }"
|
||||
:to="romRoute(entry)"
|
||||
:cover-src="coverSrc(entry)"
|
||||
:pip-cover-src="pipCoverSrc(entry)"
|
||||
:rom-name="entry.rom_name"
|
||||
:platform-name="entry.platform_name"
|
||||
:username="entry.username"
|
||||
@@ -212,17 +225,18 @@ function elapsedLabel(startedAt: string): string {
|
||||
}
|
||||
}
|
||||
|
||||
/* Gallery-card flow: every card is the SAME height, its width set by the
|
||||
image's natural ratio (landscape screenshots wide, portrait covers narrow).
|
||||
A wrapping flex row gives that without a fixed-column grid (which would pin
|
||||
the width and leave ragged vertical gaps). */
|
||||
.r-v2-activity__grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20px 16px;
|
||||
/* Cards take their cover's natural height, so don't stretch them to the
|
||||
row's tallest item — let each sit at its true height, top-aligned. */
|
||||
align-items: start;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
html[data-bp~="xs"] .r-v2-activity__grid {
|
||||
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
||||
gap: 16px 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -263,7 +263,7 @@ function collectionCovers(c: {
|
||||
<RIcon icon="mdi-play" size="20" />
|
||||
</template>
|
||||
<template v-if="fetchingContinue && !continuePlayingRoms.length">
|
||||
<GameCardSkeleton v-for="n in 4" :key="`cs-${n}`" hero />
|
||||
<GameCardSkeleton v-for="n in 4" :key="`cs-${n}`" />
|
||||
</template>
|
||||
<template v-else>
|
||||
<GameCard
|
||||
@@ -273,7 +273,8 @@ function collectionCovers(c: {
|
||||
:style="{ '--card-fade-i': i }"
|
||||
:rom="rom"
|
||||
:webp="supportsWebp"
|
||||
hero
|
||||
:cover-src="rom.screenshot_path"
|
||||
cover-pip
|
||||
/>
|
||||
</template>
|
||||
</CardRow>
|
||||
|
||||
@@ -37,7 +37,7 @@ import socket from "@/services/socket";
|
||||
import storeAuth from "@/stores/auth";
|
||||
import storeConfig from "@/stores/config";
|
||||
import storePlaying from "@/stores/playing";
|
||||
import { type DetailedRom } from "@/stores/roms";
|
||||
import storeRoms, { type DetailedRom, type SimpleRom } from "@/stores/roms";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import { getSupportedEJSCores } from "@/utils";
|
||||
import AssetPreview from "@/v2/components/Player/AssetPreview.vue";
|
||||
@@ -49,6 +49,7 @@ import { useCoverArt } from "@/v2/composables/useCoverArt";
|
||||
import { useFullscreenPref } from "@/v2/composables/useFullscreenPref";
|
||||
import { useInputModality } from "@/v2/composables/useInputModality";
|
||||
import type { SliderBtnGroupItem } from "@/v2/lib/primitives/RSliderBtnGroup/types";
|
||||
import storeGalleryRoms from "@/v2/stores/galleryRoms";
|
||||
import { installIOSFullscreenShim } from "@/views/Player/EmulatorJS/utils";
|
||||
|
||||
// Reuse v1's heavy emulator integration — do NOT rewrite this. Lazy so the
|
||||
@@ -80,6 +81,35 @@ function focusPlayButton() {
|
||||
const rom = ref<DetailedRom | null>(null);
|
||||
const firmwareOptions = ref<FirmwareSchema[]>([]);
|
||||
const selectedSave = ref<SaveSchema | null>(null);
|
||||
|
||||
// Rom id straight from the route param (available before `rom` resolves),
|
||||
// so the hero cover paints its `view-transition-name` immediately and the
|
||||
// shared-element morph from the gallery / details cover pairs on entry.
|
||||
const morphRomId = computed(() => {
|
||||
const r = route.params.rom;
|
||||
return typeof r === "string" ? r : null;
|
||||
});
|
||||
|
||||
// Seed synchronously so the hero cover is already in the DOM when the view
|
||||
// transition captures this view — the morph from the details / gallery cover
|
||||
// then pairs on entry. `onMounted` refetches the full payload.
|
||||
// * From GameDetails: `currentRom` is the full DetailedRom → seed `rom`.
|
||||
// * Direct gallery→play: only a SimpleRom exists (the gallery card) → seed a
|
||||
// cover-only `heroSeed` so the cover still paints its morph tag. `rom`
|
||||
// stays null (its DetailedRom-only fields are read guarded) until mount.
|
||||
const seededRom = storeRoms().currentRom;
|
||||
if (seededRom && String(seededRom.id) === morphRomId.value) {
|
||||
rom.value = seededRom;
|
||||
}
|
||||
const heroSeed = ref<SimpleRom | null>(null);
|
||||
if (!rom.value && morphRomId.value != null) {
|
||||
heroSeed.value = storeGalleryRoms().getRomById(Number(morphRomId.value));
|
||||
}
|
||||
// What the hero cover / title / glow read: the full rom once loaded, else the
|
||||
// lightweight seed during the morph-in window.
|
||||
const heroRom = computed<DetailedRom | SimpleRom | null>(
|
||||
() => rom.value ?? heroSeed.value,
|
||||
);
|
||||
const isSavesTabSelected = ref(true);
|
||||
const selectedState = ref<StateSchema | null>(null);
|
||||
const selectedDisc = ref<number | null>(null);
|
||||
@@ -159,7 +189,7 @@ const setBgArt = useBackgroundArt();
|
||||
// the active style is alt-art, so the purple glow can be dropped for a
|
||||
// floating disc / cartridge / mix image. The launch flourish is triggered
|
||||
// imperatively on the GameCover via `coverRef` — see onPlay.
|
||||
const art = useCoverArt(() => rom.value);
|
||||
const art = useCoverArt(() => heroRom.value);
|
||||
const heroIsAlt = computed(
|
||||
() =>
|
||||
art.style.value !== "cover_path" &&
|
||||
@@ -464,12 +494,14 @@ function backToPlatform() {
|
||||
}
|
||||
|
||||
const title = computed(
|
||||
() => rom.value?.name || rom.value?.fs_name_no_ext || "",
|
||||
() => heroRom.value?.name || heroRom.value?.fs_name_no_ext || "",
|
||||
);
|
||||
|
||||
const platformLabel = computed(
|
||||
() =>
|
||||
rom.value?.platform_custom_name || rom.value?.platform_display_name || "",
|
||||
heroRom.value?.platform_custom_name ||
|
||||
heroRom.value?.platform_display_name ||
|
||||
"",
|
||||
);
|
||||
|
||||
type AssetTab = "save" | "state";
|
||||
@@ -524,7 +556,7 @@ const selectedAsset = computed<SaveSchema | StateSchema | null>(() =>
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section v-if="rom" class="r-v2-ejs">
|
||||
<section v-if="rom || heroSeed" class="r-v2-ejs">
|
||||
<!-- Pre-game configuration -->
|
||||
<div v-if="!gameRunning" class="r-v2-ejs__config">
|
||||
<!-- Hero: cover + title + Play CTA -->
|
||||
@@ -536,9 +568,12 @@ const selectedAsset = computed<SaveSchema | StateSchema | null>(() =>
|
||||
<GameCover
|
||||
ref="coverRef"
|
||||
class="r-v2-ejs__cover-box"
|
||||
:rom="rom"
|
||||
:rom="heroRom"
|
||||
:title="title"
|
||||
:identified="rom?.is_identified ?? true"
|
||||
:identified="heroRom?.is_identified ?? true"
|
||||
:morph-id="morphRomId"
|
||||
morph-static
|
||||
hover-motion
|
||||
/>
|
||||
<div class="r-v2-ejs__cover-glow" aria-hidden="true" />
|
||||
</div>
|
||||
@@ -553,6 +588,8 @@ const selectedAsset = computed<SaveSchema | StateSchema | null>(() =>
|
||||
block
|
||||
prepend-icon="mdi-play"
|
||||
class="r-v2-ejs__play"
|
||||
:loading="!rom"
|
||||
:disabled="!rom"
|
||||
@click="onPlay"
|
||||
>
|
||||
{{ t("play.play") }}
|
||||
@@ -637,7 +674,7 @@ const selectedAsset = computed<SaveSchema | StateSchema | null>(() =>
|
||||
</div>
|
||||
<div class="r-v2-ejs__setup-body">
|
||||
<RSelect
|
||||
v-if="rom.files.length > 1"
|
||||
v-if="(rom?.files?.length ?? 0) > 1"
|
||||
v-model="selectedDisc"
|
||||
variant="outlined"
|
||||
density="comfortable"
|
||||
@@ -645,7 +682,12 @@ const selectedAsset = computed<SaveSchema | StateSchema | null>(() =>
|
||||
clearable
|
||||
hide-details
|
||||
:label="t('rom.file')"
|
||||
:items="rom.files.map((f) => ({ title: f.file_name, value: f.id }))"
|
||||
:items="
|
||||
(rom?.files ?? []).map((f) => ({
|
||||
title: f.file_name,
|
||||
value: f.id,
|
||||
}))
|
||||
"
|
||||
/>
|
||||
<RSelect
|
||||
v-if="supportedCores.length > 1"
|
||||
@@ -696,7 +738,7 @@ const selectedAsset = computed<SaveSchema | StateSchema | null>(() =>
|
||||
</div>
|
||||
|
||||
<!-- Running state -->
|
||||
<div v-else class="r-v2-ejs__stage">
|
||||
<div v-else-if="rom" class="r-v2-ejs__stage">
|
||||
<Player
|
||||
:rom="rom"
|
||||
:state="selectedState"
|
||||
|
||||
@@ -9,12 +9,13 @@ import { useI18n } from "vue-i18n";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ROUTES } from "@/plugins/router";
|
||||
import romApi from "@/services/api/rom";
|
||||
import type { DetailedRom } from "@/stores/roms";
|
||||
import storeRoms, { type DetailedRom, type SimpleRom } from "@/stores/roms";
|
||||
import type { RuffleSourceAPI } from "@/types/ruffle";
|
||||
import { getDownloadPath } from "@/utils";
|
||||
import GameCover from "@/v2/components/shared/GameCover.vue";
|
||||
import { useBackgroundArt } from "@/v2/composables/useBackgroundArt";
|
||||
import { useFullscreenPref } from "@/v2/composables/useFullscreenPref";
|
||||
import storeGalleryRoms from "@/v2/stores/galleryRoms";
|
||||
import { colorCanvas } from "@/v2/tokens";
|
||||
|
||||
const RUFFLE_VERSION = "0.2.0-nightly.2025.8.14";
|
||||
@@ -29,6 +30,31 @@ const rom = ref<DetailedRom | null>(null);
|
||||
const gameRunning = ref(false);
|
||||
const backgroundColor = ref<string>(DEFAULT_BACKGROUND_COLOR);
|
||||
|
||||
// Rom id from the route param (available before `rom` resolves) so the hero
|
||||
// cover paints its `view-transition-name` immediately and the shared-element
|
||||
// morph from the gallery / details cover pairs on entry.
|
||||
const morphRomId = computed(() => {
|
||||
const r = route.params.rom;
|
||||
return typeof r === "string" ? r : null;
|
||||
});
|
||||
|
||||
// Seed synchronously so the hero cover is in the DOM when the view transition
|
||||
// captures this view and the morph pairs on entry. From GameDetails the full
|
||||
// DetailedRom is in `currentRom`; on a direct gallery→play only a SimpleRom
|
||||
// exists, so seed a cover-only `heroSeed` (`rom` stays null until `onMounted`
|
||||
// refetches). See EmulatorJS for the same pattern.
|
||||
const seededRom = storeRoms().currentRom;
|
||||
if (seededRom && String(seededRom.id) === morphRomId.value) {
|
||||
rom.value = seededRom;
|
||||
}
|
||||
const heroSeed = ref<SimpleRom | null>(null);
|
||||
if (!rom.value && morphRomId.value != null) {
|
||||
heroSeed.value = storeGalleryRoms().getRomById(Number(morphRomId.value));
|
||||
}
|
||||
const heroRom = computed<DetailedRom | SimpleRom | null>(
|
||||
() => rom.value ?? heroSeed.value,
|
||||
);
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
RufflePlayer: {
|
||||
@@ -68,12 +94,14 @@ watch(
|
||||
);
|
||||
|
||||
const title = computed(
|
||||
() => rom.value?.name || rom.value?.fs_name_no_ext || "",
|
||||
() => heroRom.value?.name || heroRom.value?.fs_name_no_ext || "",
|
||||
);
|
||||
|
||||
const platformLabel = computed(
|
||||
() =>
|
||||
rom.value?.platform_custom_name || rom.value?.platform_display_name || "",
|
||||
heroRom.value?.platform_custom_name ||
|
||||
heroRom.value?.platform_display_name ||
|
||||
"",
|
||||
);
|
||||
|
||||
function onPlay() {
|
||||
@@ -157,16 +185,19 @@ onMounted(async () => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section v-if="rom" class="r-v2-ruffle">
|
||||
<section v-if="rom || heroSeed" class="r-v2-ruffle">
|
||||
<!-- Pre-game configuration -->
|
||||
<div v-if="!gameRunning" class="r-v2-ruffle__config">
|
||||
<!-- Cover column -->
|
||||
<aside class="r-v2-ruffle__cover">
|
||||
<GameCover
|
||||
class="r-v2-ruffle__cover-box"
|
||||
:rom="rom"
|
||||
:rom="heroRom"
|
||||
:title="title"
|
||||
:identified="rom?.is_identified ?? true"
|
||||
:identified="heroRom?.is_identified ?? true"
|
||||
:morph-id="morphRomId"
|
||||
morph-static
|
||||
hover-motion
|
||||
/>
|
||||
<h1 class="r-v2-ruffle__title">
|
||||
{{ title }}
|
||||
@@ -206,6 +237,8 @@ onMounted(async () => {
|
||||
block
|
||||
prepend-icon="mdi-play-circle"
|
||||
class="r-v2-ruffle__play"
|
||||
:loading="!rom"
|
||||
:disabled="!rom"
|
||||
@click="onPlay"
|
||||
>
|
||||
{{ t("play.play") }}
|
||||
|
||||
Reference in New Issue
Block a user