simplify elevation and centralize video playing

This commit is contained in:
Georges-Antoine Assi
2025-10-30 14:18:19 -04:00
parent b74808cf25
commit 7f02b16904
15 changed files with 696 additions and 865 deletions

View File

@@ -118,10 +118,8 @@ function onCardClick(save: SaveSchema, event: MouseEvent) {
v-bind="saveProps"
class="bg-toplayer transform-scale"
:class="{
'on-hover': isHovering,
'border-selected': selectedSaves.some((s) => s.id === save.id),
}"
:elevation="isHovering ? 20 : 3"
@click="(e: MouseEvent) => onCardClick(save, e)"
>
<v-card-text class="pa-2">

View File

@@ -120,10 +120,8 @@ function onCardClick(state: StateSchema, event: MouseEvent) {
v-bind="stateProps"
class="bg-toplayer transform-scale"
:class="{
'on-hover': isHovering,
'border-selected': selectedStates.some((s) => s.id === state.id),
}"
:elevation="isHovering ? 20 : 3"
@click="(e: MouseEvent) => onCardClick(state, e)"
>
<v-card-text class="pa-2">

View File

@@ -53,13 +53,13 @@ const enableExperimentalCacheRef = useLocalStorage(
// Boxart
export type BoxartStyleOption =
| "cover"
| "cover_path"
| "box3d_path"
| "physical_path"
| "miximage_path";
const boxartStyleRef = useLocalStorage<BoxartStyleOption>(
"settings.boxartStyle",
"cover",
"cover_path",
);
const homeOptions = computed(() => [
@@ -193,7 +193,7 @@ const galleryOptions = computed(() => [
]);
const boxartStyleOptions = computed(() => [
{ title: t("settings.boxart-cover"), value: "cover" },
{ title: t("settings.boxart-cover"), value: "cover_path" },
{ title: t("settings.boxart-box3d"), value: "box3d_path" },
{ title: t("settings.boxart-physical"), value: "physical_path" },
{ title: t("settings.boxart-miximage"), value: "miximage_path" },

View File

@@ -176,124 +176,53 @@ onBeforeUnmount(() => {
</script>
<template>
<v-hover v-slot="{ isHovering, props: hoverProps }">
<div ref="tilt-card-ref" data-tilt>
<v-card
v-bind="{
...hoverProps,
to: collectionRoute,
}"
:class="{
'on-hover': isHovering,
'transform-scale': transformScale && !enable3DTilt,
}"
:elevation="isHovering && transformScale ? 20 : 3"
:aria-label="`${collection.name} game card`"
@mouseenter="
() => {
emit('hover', { isHovering: true, id: collection.id });
}
"
@mouseleave="
() => {
emit('hover', { isHovering: false, id: collection.id });
}
"
@blur="
() => {
emit('hover', { isHovering: false, id: collection.id });
}
"
>
<v-row v-if="showTitle" class="pa-1 justify-center bg-surface">
<div
:title="collection.name?.toString()"
class="py-4 px-6 text-truncate text-caption"
>
<span>{{ collection.name }}</span>
</div>
</v-row>
<div ref="tilt-card-ref" data-tilt>
<v-card
v-bind="{
to: collectionRoute,
}"
:class="{
'transform-scale': transformScale && !enable3DTilt,
}"
:aria-label="`${collection.name} game card`"
@mouseenter="
() => {
emit('hover', { isHovering: true, id: collection.id });
}
"
@mouseleave="
() => {
emit('hover', { isHovering: false, id: collection.id });
}
"
@blur="
() => {
emit('hover', { isHovering: false, id: collection.id });
}
"
>
<v-row v-if="showTitle" class="pa-1 justify-center bg-surface">
<div
class="image-container"
:style="{
aspectRatio: galleryViewStore.defaultAspectRatioCollection,
}"
:title="collection.name?.toString()"
class="py-4 px-6 text-truncate text-caption"
>
<template
v-if="
collection.is_virtual ||
!collection.path_cover_large ||
!collection.path_cover_small
"
>
<div class="split-image first-image">
<v-img
cover
:src="firstLargeCover"
:aspect-ratio="galleryViewStore.defaultAspectRatioCollection"
>
<template #placeholder>
<v-img
:src="firstSmallCover"
:aspect-ratio="
galleryViewStore.defaultAspectRatioCollection
"
>
<template #placeholder>
<Skeleton
:aspect-ratio="
galleryViewStore.defaultAspectRatioCollection
"
type="image"
/>
</template>
</v-img>
</template>
<template #error>
<v-img
:src="collectionCoverImage"
:aspect-ratio="
galleryViewStore.defaultAspectRatioCollection
"
/>
</template>
</v-img>
</div>
<div class="split-image second-image">
<v-img
cover
:src="secondLargeCover"
:aspect-ratio="galleryViewStore.defaultAspectRatioCollection"
>
<template #placeholder>
<v-img
:src="secondSmallCover"
:aspect-ratio="
galleryViewStore.defaultAspectRatioCollection
"
>
<template #placeholder>
<Skeleton
:aspect-ratio="
galleryViewStore.defaultAspectRatioCollection
"
type="image"
/>
</template>
</v-img>
</template>
<template #error>
<v-img
:src="collectionCoverImage"
:aspect-ratio="
galleryViewStore.defaultAspectRatioCollection
"
/>
</template>
</v-img>
</div>
</template>
<template v-else>
<span>{{ collection.name }}</span>
</div>
</v-row>
<div
class="image-container"
:style="{
aspectRatio: galleryViewStore.defaultAspectRatioCollection,
}"
>
<template
v-if="
collection.is_virtual ||
!collection.path_cover_large ||
!collection.path_cover_small
"
>
<div class="split-image first-image">
<v-img
cover
:src="firstLargeCover"
@@ -321,23 +250,81 @@ onBeforeUnmount(() => {
/>
</template>
</v-img>
</template>
<div class="position-absolute append-inner">
<slot name="append-inner" />
</div>
<div class="split-image second-image">
<v-img
cover
:src="secondLargeCover"
:aspect-ratio="galleryViewStore.defaultAspectRatioCollection"
>
<template #placeholder>
<v-img
:src="secondSmallCover"
:aspect-ratio="galleryViewStore.defaultAspectRatioCollection"
>
<template #placeholder>
<Skeleton
:aspect-ratio="
galleryViewStore.defaultAspectRatioCollection
"
type="image"
/>
</template>
</v-img>
</template>
<template #error>
<v-img
:src="collectionCoverImage"
:aspect-ratio="galleryViewStore.defaultAspectRatioCollection"
/>
</template>
</v-img>
</div>
</template>
<template v-else>
<v-img
cover
:src="firstLargeCover"
:aspect-ratio="galleryViewStore.defaultAspectRatioCollection"
>
<template #placeholder>
<v-img
:src="firstSmallCover"
:aspect-ratio="galleryViewStore.defaultAspectRatioCollection"
>
<template #placeholder>
<Skeleton
:aspect-ratio="
galleryViewStore.defaultAspectRatioCollection
"
type="image"
/>
</template>
</v-img>
</template>
<template #error>
<v-img
:src="collectionCoverImage"
:aspect-ratio="galleryViewStore.defaultAspectRatioCollection"
/>
</template>
</v-img>
</template>
<div class="position-absolute append-inner">
<slot name="append-inner" />
</div>
<v-chip
v-if="showRomCount"
class="bg-background position-absolute"
size="x-small"
style="bottom: 0.5rem; right: 0.5rem"
label
>
{{ collection.rom_count }}
</v-chip>
</v-card>
</div>
</v-hover>
</div>
<v-chip
v-if="showRomCount"
class="bg-background position-absolute"
size="x-small"
style="bottom: 0.5rem; right: 0.5rem"
label
>
{{ collection.rom_count }}
</v-chip>
</v-card>
</div>
</template>
<style scoped>

View File

@@ -191,30 +191,24 @@ onBeforeUnmount(() => {
sm="3"
md="2"
>
<v-hover v-slot="{ isHovering, props: hoverProps }">
<!-- TODO: fix aspect ratio -->
<v-img
v-bind="hoverProps"
:class="{ 'on-hover': isHovering }"
class="transform-scale pointer"
:aspect-ratio="coverAspectRatio"
:src="resource.thumb"
cover
@click="selectCover(resource.url)"
>
<template #error>
<!-- TODO: fix aspect ratio -->
<v-img
:src="resource.url"
cover
:aspect-ratio="galleryViewStore.defaultAspectRatioCover"
/>
</template>
<template #placeholder>
<Skeleton :aspect-ratio="coverAspectRatio" type="image" />
</template>
</v-img>
</v-hover>
<v-img
class="transform-scale pointer"
:aspect-ratio="coverAspectRatio"
:src="resource.thumb"
cover
@click="selectCover(resource.url)"
>
<template #error>
<v-img
:src="resource.url"
cover
:aspect-ratio="galleryViewStore.defaultAspectRatioCover"
/>
</template>
<template #placeholder>
<Skeleton :aspect-ratio="coverAspectRatio" type="image" />
</template>
</v-img>
</v-col>
</v-row>
</v-expansion-panel-text>

View File

@@ -9,7 +9,6 @@ import {
onBeforeUnmount,
inject,
useTemplateRef,
nextTick,
} from "vue";
import { useDisplay } from "vuetify";
import type { BoxartStyleOption } from "@/components/Settings/UserInterface/Interface.vue";
@@ -76,6 +75,7 @@ const props = withDefaults(
const { smAndDown } = useDisplay();
const platformsStore = storePlatforms();
const romsStore = storeRoms();
const activeMenu = ref(false);
const emitter = inject<Emitter<Events>>("emitter");
const emit = defineEmits([
"hover",
@@ -85,6 +85,7 @@ const emit = defineEmits([
"touchstart",
"touchend",
]);
const handleClick = (event: MouseEvent) => {
if (event.button === 0) {
// Only handle left-click
@@ -105,6 +106,14 @@ const handleCloseMenu = () => {
activeMenu.value = false;
emit("closedmenu");
};
const handleMouseEnter = () => {
emit("hover", { isHovering: true, id: props.rom.id });
gameIsHovering.value = true;
};
const handleMouseLeave = () => {
emit("hover", { isHovering: false, id: props.rom.id });
gameIsHovering.value = false;
};
const galleryViewStore = storeGalleryView();
const collectionsStore = storeCollections();
@@ -122,7 +131,6 @@ const fallbackCoverImage = computed(() =>
? getMissingCoverImage(props.rom.name || props.rom.slug || "")
: getUnmatchedCoverImage(props.rom.name || props.rom.slug || ""),
);
const activeMenu = ref(false);
const showActionBarAlways = useLocalStorage("settings.showActionBar", false);
const showGameTitleAlways = useLocalStorage("settings.showGameTitle", false);
@@ -144,42 +152,34 @@ interface TiltHTMLElement extends HTMLElement {
}
const tiltCardRef = useTemplateRef<TiltHTMLElement>("tilt-card-ref");
const vImgRef = useTemplateRef("game-image-ref");
const coverRef = useTemplateRef("game-image-ref");
const videoRef = useTemplateRef<HTMLVideoElement>("hover-video-ref");
const gameIsHovering = ref(false);
const {
boxartStyleCover,
animateCD,
animateCartridge,
localVideoPath,
isVideoPlaying,
animateCDSpin,
animateCDLoad,
stopCDAnimation,
animateLoadCart,
stopVideo,
} = useGameAnimation({
rom: props.rom,
accelerate: gameIsHovering,
isHovering: gameIsHovering,
coverSrc: props.coverSrc,
vImgRef: vImgRef,
coverRef: coverRef,
videoRef: videoRef,
});
const boxartStyle = useLocalStorage<BoxartStyleOption>(
"settings.boxartStyle",
"cover",
"cover_path",
);
const localVideoPath = computed(() => {
if (!romsStore.isSimpleRom(props.rom)) return null;
// Only play video if boxart style is miximage
if (boxartStyle.value !== "miximage_path") return null;
const ssVideo = props.rom.ss_metadata?.video_path;
const gamelistVideo = props.rom.gamelist_metadata?.video_path;
return ssVideo || gamelistVideo || null;
});
const hoverTimeout = ref<ReturnType<typeof setTimeout> | null>(null);
const isVideoPlaying = ref(false);
const videoRef = useTemplateRef<HTMLVideoElement>("hover-video-ref");
const isWebpEnabled = computed(
() => heartbeatStore.value.TASKS?.ENABLE_SCHEDULED_CONVERT_IMAGES_TO_WEBP,
);
@@ -221,50 +221,6 @@ const showNoteDialog = (event: MouseEvent | KeyboardEvent) => {
}
};
const onMouseEnter = () => {
gameIsHovering.value = true;
animateCDSpin();
};
const onCardMouseEnter = () => {
if (isVideoPlaying.value) return;
// Start video after 3 seconds if video path exists
if (localVideoPath.value) {
hoverTimeout.value = setTimeout(async () => {
isVideoPlaying.value = true;
// Wait for next tick to ensure video element is rendered
await nextTick();
if (videoRef.value) {
videoRef.value.load();
videoRef.value.play().catch(() => {
// Handle play() promise rejection (e.g., autoplay disabled)
isVideoPlaying.value = false;
});
}
}, 2000);
}
};
const onMouseLeave = () => {
gameIsHovering.value = false;
};
const onCardMouseLeave = () => {
// Clear the hover timeout if it exists
if (hoverTimeout.value) {
clearTimeout(hoverTimeout.value);
hoverTimeout.value = null;
}
// Pause and reset video
if (videoRef.value) {
videoRef.value.pause();
videoRef.value.currentTime = 0;
}
isVideoPlaying.value = false;
};
const handlePlayGame = (romId: number) => {
if (romId !== props.rom.id) return;
if (animateCD.value) {
@@ -295,18 +251,7 @@ onBeforeUnmount(() => {
}
emitter?.off("playGame", handlePlayGame);
stopCDAnimation();
// Clean up hover timeout
if (hoverTimeout.value) {
clearTimeout(hoverTimeout.value);
hoverTimeout.value = null;
}
// Clean up video
if (videoRef.value) {
videoRef.value.pause();
videoRef.value.src = "";
}
stopVideo();
});
</script>
@@ -331,237 +276,207 @@ onBeforeUnmount(() => {
}
: {}),
}"
class="bg-transparent"
class="game-card bg-transparent"
:class="{
'on-hover': isOuterHovering || activeMenu,
'transform-scale':
transformScale && !enable3DTilt && boxartStyle === 'cover_path',
'border-selected': withBorderPrimary,
'transform-scale': transformScale && !enable3DTilt,
}"
:elevation="
isOuterHovering && transformScale ? 20 : boxartStyleCover ? 0 : 3
"
:aria-label="`${rom.name} game card`"
@mouseenter="
() => {
emit('hover', { isHovering: true, id: rom.id });
}
"
@mouseleave="
() => {
emit('hover', { isHovering: false, id: rom.id });
}
"
@blur="
() => {
emit('hover', { isHovering: false, id: rom.id });
}
"
@mouseenter="handleMouseEnter"
@mouseleave="handleMouseLeave"
@focus="handleMouseEnter"
@blur="handleMouseLeave"
>
<v-card-text
class="pa-0 position-relative"
@mouseenter="onCardMouseEnter"
@mouseleave="onCardMouseLeave"
>
<v-hover v-slot="{ isHovering, props: imgProps }" open-delay="800">
<v-img
ref="game-image-ref"
v-bind="imgProps"
:key="romsStore.isSimpleRom(rom) ? rom.id : rom.name"
:cover="!boxartStyleCover"
:contain="boxartStyleCover"
content-class="d-flex flex-column justify-space-between"
:class="{
pointer: pointerOnHover,
'opacity-0': isVideoPlaying && localVideoPath,
transitioning: !isVideoPlaying && localVideoPath,
}"
:src="largeCover || fallbackCoverImage"
:aspect-ratio="computedAspectRatio"
@click="handleClick"
@touchstart="handleTouchStart"
@touchend="handleTouchEnd"
@mouseenter="onMouseEnter"
@mouseleave="onMouseLeave"
>
<template v-if="titleOnHover">
<v-expand-transition>
<div
v-if="
isHovering ||
showGameTitleAlways ||
(romsStore.isSimpleRom(rom) && !rom.path_cover_large) ||
(!romsStore.isSimpleRom(rom) &&
!rom.igdb_url_cover &&
!rom.moby_url_cover &&
!rom.ss_url_cover &&
!rom.sgdb_url_cover &&
!rom.launchbox_url_cover &&
!rom.flashpoint_url_cover)
"
class="translucent text-white"
:class="
sizeActionBar === 1 ? 'text-subtitle-1' : 'text-caption'
"
:title="
<v-card-text class="pa-0 position-relative">
<v-img
ref="game-image-ref"
:key="romsStore.isSimpleRom(rom) ? rom.id : rom.name"
:cover="!boxartStyleCover"
:contain="boxartStyleCover"
content-class="d-flex flex-column justify-space-between"
:class="{
pointer: pointerOnHover,
'opacity-0': isVideoPlaying && localVideoPath,
transitioning: !isVideoPlaying && localVideoPath,
}"
:src="largeCover || fallbackCoverImage"
:aspect-ratio="computedAspectRatio"
@click="handleClick"
@touchstart="handleTouchStart"
@touchend="handleTouchEnd"
>
<template v-if="titleOnHover">
<v-expand-transition>
<div
v-if="
isOuterHovering ||
showGameTitleAlways ||
(romsStore.isSimpleRom(rom) && !rom.path_cover_large) ||
(!romsStore.isSimpleRom(rom) &&
!rom.igdb_url_cover &&
!rom.moby_url_cover &&
!rom.ss_url_cover &&
!rom.sgdb_url_cover &&
!rom.launchbox_url_cover &&
!rom.flashpoint_url_cover)
"
class="translucent text-white"
:class="
sizeActionBar === 1 ? 'text-subtitle-1' : 'text-caption'
"
:title="
romsStore.isSimpleRom(rom) && rom.name === rom.fs_name
? rom.fs_name_no_tags
: rom.name || ''
"
>
<div class="pa-2 text-truncate">
{{
romsStore.isSimpleRom(rom) && rom.name === rom.fs_name
? rom.fs_name_no_tags
: rom.name || ''
"
>
<div class="pa-2 text-truncate">
{{
romsStore.isSimpleRom(rom) && rom.name === rom.fs_name
? rom.fs_name_no_tags
: rom.name
}}
</div>
: rom.name
}}
</div>
</v-expand-transition>
</template>
<v-row no-gutters class="text-white px-1">
<v-col>
<Sources v-if="!romsStore.isSimpleRom(rom)" :rom="rom" />
<Flags
v-if="romsStore.isSimpleRom(rom) && showChips"
:rom="rom"
</div>
</v-expand-transition>
</template>
<v-row no-gutters class="text-white px-1">
<v-col>
<Sources v-if="!romsStore.isSimpleRom(rom)" :rom="rom" />
<Flags
v-if="romsStore.isSimpleRom(rom) && showChips"
:rom="rom"
/>
</v-col>
</v-row>
<div>
<v-row v-if="romsStore.isSimpleRom(rom) && showChips" no-gutters>
<v-col cols="auto" class="px-0">
<PlatformIcon
v-if="showPlatformIcon"
:key="rom.platform_slug"
:size="25"
:slug="rom.platform_slug"
:name="rom.platform_display_name"
:fs-slug="rom.platform_fs_slug"
class="ml-1"
/>
</v-col>
</v-row>
<div>
<v-row
v-if="romsStore.isSimpleRom(rom) && showChips"
no-gutters
>
<v-col cols="auto" class="px-0">
<PlatformIcon
v-if="showPlatformIcon"
:key="rom.platform_slug"
:size="25"
:slug="rom.platform_slug"
:name="rom.platform_display_name"
:fs-slug="rom.platform_fs_slug"
class="ml-1"
/>
</v-col>
<v-col class="px-1 d-flex justify-end">
<MissingFromFSIcon
v-if="rom.missing_from_fs"
:text="`Missing from filesystem: ${rom.fs_path}/${rom.fs_name}`"
class="mr-1 mb-1 px-1"
chip
chip-density="compact"
/>
<v-chip
v-if="rom.hasheous_id"
class="translucent text-white mr-1 mb-1 px-1"
density="compact"
title="Verified with Hasheous"
>
<v-icon>mdi-check-decagram-outline</v-icon>
</v-chip>
<v-chip
v-if="rom.siblings.length > 0 && showSiblings"
class="translucent text-white mr-1 mb-1 px-1"
density="compact"
:title="`${rom.siblings.length} sibling(s)`"
>
<v-icon>mdi-card-multiple-outline</v-icon>
</v-chip>
<v-chip
v-if="collectionsStore.isFavorite(rom)"
text="Favorite"
color="secondary"
density="compact"
class="translucent text-white mr-1 mb-1 px-1"
>
<v-icon>mdi-star</v-icon>
</v-chip>
<v-chip
v-if="hasNotes && showChips"
class="translucent text-white mr-1 mb-1 px-1"
density="compact"
title="View notes"
@click.stop="showNoteDialog"
>
<v-icon>mdi-notebook</v-icon>
</v-chip>
</v-col>
</v-row>
<div class="position-absolute append-inner-right">
<slot name="append-inner-right" />
</div>
<v-expand-transition>
<ActionBar
v-if="
romsStore.isSimpleRom(rom) &&
showActionBar &&
(isOuterHovering ||
showActionBarAlways ||
activeMenu ||
smAndDown)
"
class="translucent"
:rom="rom"
:size-action-bar="sizeActionBar"
@menu-open="handleOpenMenu"
@menu-close="handleCloseMenu"
<v-col class="px-1 d-flex justify-end">
<MissingFromFSIcon
v-if="rom.missing_from_fs"
:text="`Missing from filesystem: ${rom.fs_path}/${rom.fs_name}`"
class="mr-1 mb-1 px-1"
chip
chip-density="compact"
/>
</v-expand-transition>
<v-chip
v-if="rom.hasheous_id"
class="translucent text-white mr-1 mb-1 px-1"
density="compact"
title="Verified with Hasheous"
>
<v-icon>mdi-check-decagram-outline</v-icon>
</v-chip>
<v-chip
v-if="rom.siblings.length > 0 && showSiblings"
class="translucent text-white mr-1 mb-1 px-1"
density="compact"
:title="`${rom.siblings.length} sibling(s)`"
>
<v-icon>mdi-card-multiple-outline</v-icon>
</v-chip>
<v-chip
v-if="collectionsStore.isFavorite(rom)"
text="Favorite"
color="secondary"
density="compact"
class="translucent text-white mr-1 mb-1 px-1"
>
<v-icon>mdi-star</v-icon>
</v-chip>
<v-chip
v-if="hasNotes && showChips"
class="translucent text-white mr-1 mb-1 px-1"
density="compact"
title="View notes"
@click.stop="showNoteDialog"
>
<v-icon>mdi-notebook</v-icon>
</v-chip>
</v-col>
</v-row>
<div class="position-absolute append-inner-right">
<slot name="append-inner-right" />
</div>
<template #placeholder>
<v-img
:cover="!boxartStyleCover"
:contain="boxartStyleCover"
eager
:src="smallCover || fallbackCoverImage"
:aspect-ratio="computedAspectRatio"
>
<template #placeholder>
<Skeleton
:platform-id="rom.platform_id"
:aspect-ratio="computedAspectRatio"
type="image"
/>
</template>
</v-img>
</template>
<template #error>
<v-img
:cover="!boxartStyleCover"
:contain="boxartStyleCover"
eager
:src="fallbackCoverImage"
:aspect-ratio="computedAspectRatio"
<v-expand-transition>
<ActionBar
v-if="
romsStore.isSimpleRom(rom) &&
showActionBar &&
(isOuterHovering ||
showActionBarAlways ||
activeMenu ||
smAndDown)
"
class="translucent"
:rom="rom"
:size-action-bar="sizeActionBar"
@menu-open="handleOpenMenu"
@menu-close="handleCloseMenu"
/>
</template>
</v-img>
<div
class="hover-video-container position-absolute top-0 opacity-0 h-full d-flex align-center justify-center"
:class="{
'opacity-100 transitioning': isVideoPlaying && localVideoPath,
}"
>
<div
class="position-relative max-h-full"
style="margin-top: -40px"
>
<video
ref="hover-video-ref"
:src="`${FRONTEND_RESOURCES_PATH}/${localVideoPath}`"
class="hover-video"
loop
:autoplay="isVideoPlaying"
playsinline
preload="none"
/>
<img
src="/assets/default/miximage.png"
style="z-index: 1"
class="position-relative"
/>
</div>
</v-expand-transition>
</div>
</v-hover>
<template #placeholder>
<v-img
:cover="!boxartStyleCover"
:contain="boxartStyleCover"
eager
:src="smallCover || fallbackCoverImage"
:aspect-ratio="computedAspectRatio"
>
<template #placeholder>
<Skeleton
:platform-id="rom.platform_id"
:aspect-ratio="computedAspectRatio"
type="image"
/>
</template>
</v-img>
</template>
<template #error>
<v-img
:cover="!boxartStyleCover"
:contain="boxartStyleCover"
eager
:src="fallbackCoverImage"
:aspect-ratio="computedAspectRatio"
/>
</template>
</v-img>
<div
class="hover-video-container position-absolute top-0 opacity-0 h-full d-flex align-center justify-center"
:class="{
'opacity-100 transitioning': isVideoPlaying && localVideoPath,
}"
>
<div class="position-relative max-h-full" style="margin-top: -40px">
<video
ref="hover-video-ref"
:src="`${FRONTEND_RESOURCES_PATH}/${localVideoPath}`"
class="hover-video"
loop
playsinline
preload="none"
/>
<img
src="/assets/default/miximage.png"
style="z-index: 1"
class="position-relative"
/>
</div>
</div>
</v-card-text>
</v-card>
</div>
@@ -609,6 +524,7 @@ onBeforeUnmount(() => {
.hover-video-container {
transition: opacity 0.25s ease;
transition-delay: 0.1s;
pointer-events: none;
}
.v-img.transitioning,

View File

@@ -48,62 +48,48 @@ function closeDialog() {
</template>
<template #content>
<div v-if="rom" class="d-flex justify-center ga-4 flex-md-wrap py-6 px-2">
<v-hover
<v-card
v-for="save in rom.user_saves"
v-if="rom.user_saves.length > 0"
:key="save.id"
v-slot="{ isHovering, props }"
class="bg-toplayer transform-scale"
width="200px"
@click="onCardClick(save)"
>
<v-card
v-bind="props"
class="bg-toplayer transform-scale"
:class="{
'on-hover': isHovering,
}"
:elevation="isHovering ? 20 : 3"
width="200px"
@click="onCardClick(save)"
<v-card-text
class="d-flex flex-column justify-end h-100"
style="padding: 1.5rem"
>
<v-card-text
class="d-flex flex-column justify-end h-100"
style="padding: 1.5rem"
<v-row>
<v-img
cover
height="100%"
min-height="75px"
:src="
save.screenshot?.download_path ??
getEmptyCoverImage(save.file_name)
"
/>
</v-row>
<v-row class="mt-6 flex-grow-0">
{{ save.file_name }}
</v-row>
<v-row
class="mt-6 d-flex flex-md-wrap ga-2 flex-grow-0"
style="min-height: 20px"
>
<v-row>
<v-img
cover
height="100%"
min-height="75px"
:src="
save.screenshot?.download_path ??
getEmptyCoverImage(save.file_name)
"
/>
</v-row>
<v-row class="mt-6 flex-grow-0">
{{ save.file_name }}
</v-row>
<v-row
class="mt-6 d-flex flex-md-wrap ga-2 flex-grow-0"
style="min-height: 20px"
>
<v-chip
v-if="save.emulator"
size="x-small"
color="orange"
label
>
{{ save.emulator }}
</v-chip>
<v-chip size="x-small" label>
{{ formatBytes(save.file_size_bytes) }}
</v-chip>
<v-chip size="x-small" label>
Updated: {{ formatTimestamp(save.updated_at) }}
</v-chip>
</v-row>
</v-card-text>
</v-card>
</v-hover>
<v-chip v-if="save.emulator" size="x-small" color="orange" label>
{{ save.emulator }}
</v-chip>
<v-chip size="x-small" label>
{{ formatBytes(save.file_size_bytes) }}
</v-chip>
<v-chip size="x-small" label>
Updated: {{ formatTimestamp(save.updated_at) }}
</v-chip>
</v-row>
</v-card-text>
</v-card>
<div v-else>
<v-col class="text-center mt-6">
<v-icon size="x-large"> mdi-help-rhombus-outline </v-icon>

View File

@@ -48,62 +48,48 @@ function closeDialog() {
</template>
<template #content>
<div v-if="rom" class="d-flex justify-center ga-4 flex-md-wrap py-6 px-2">
<v-hover
<v-card
v-for="state in rom.user_states"
v-if="rom.user_states.length > 0"
:key="state.id"
v-slot="{ isHovering, props }"
class="bg-toplayer transform-scale"
width="200px"
@click="onCardClick(state)"
>
<v-card
v-bind="props"
class="bg-toplayer transform-scale"
:class="{
'on-hover': isHovering,
}"
:elevation="isHovering ? 20 : 3"
width="200px"
@click="onCardClick(state)"
<v-card-text
class="d-flex flex-column justify-end h-100"
style="padding: 1.5rem"
>
<v-card-text
class="d-flex flex-column justify-end h-100"
style="padding: 1.5rem"
<v-row>
<v-img
cover
height="100%"
min-height="75px"
:src="
state.screenshot?.download_path ??
getEmptyCoverImage(state.file_name)
"
/>
</v-row>
<v-row class="mt-6 flex-grow-0">
{{ state.file_name }}
</v-row>
<v-row
class="mt-6 d-flex flex-md-wrap ga-2 flex-grow-0"
style="min-height: 20px"
>
<v-row>
<v-img
cover
height="100%"
min-height="75px"
:src="
state.screenshot?.download_path ??
getEmptyCoverImage(state.file_name)
"
/>
</v-row>
<v-row class="mt-6 flex-grow-0">
{{ state.file_name }}
</v-row>
<v-row
class="mt-6 d-flex flex-md-wrap ga-2 flex-grow-0"
style="min-height: 20px"
>
<v-chip
v-if="state.emulator"
size="x-small"
color="orange"
label
>
{{ state.emulator }}
</v-chip>
<v-chip size="x-small" label>
{{ formatBytes(state.file_size_bytes) }}
</v-chip>
<v-chip size="x-small" label>
Updated: {{ formatTimestamp(state.updated_at) }}
</v-chip>
</v-row>
</v-card-text>
</v-card>
</v-hover>
<v-chip v-if="state.emulator" size="x-small" color="orange" label>
{{ state.emulator }}
</v-chip>
<v-chip size="x-small" label>
{{ formatBytes(state.file_size_bytes) }}
</v-chip>
<v-chip size="x-small" label>
Updated: {{ formatTimestamp(state.updated_at) }}
</v-chip>
</v-row>
</v-card-text>
</v-card>
<div v-else>
<v-col class="text-center mt-6">
<v-icon size="x-large"> mdi-help-rhombus-outline </v-icon>

View File

@@ -578,41 +578,36 @@ onBeforeUnmount(() => {
class="pa-1"
cols="auto"
>
<v-hover v-slot="{ isHovering, props }">
<v-card
:width="xs ? 150 : 220"
v-bind="props"
class="transform-scale mx-2"
:class="{
'on-hover': isHovering,
'border-selected border-lg':
selectedCover?.name == source.name,
}"
:elevation="isHovering ? 20 : 3"
@click="selectCover(source)"
<v-card
:width="xs ? 150 : 220"
class="transform-scale mx-2"
:class="{
'border-selected border-lg':
selectedCover?.name == source.name,
}"
@click="selectCover(source)"
>
<v-img
:src="source.url_cover || missingCoverImage"
:aspect-ratio="computedAspectRatio"
cover
>
<v-img
:src="source.url_cover || missingCoverImage"
:aspect-ratio="computedAspectRatio"
cover
>
<template #placeholder>
<Skeleton
:aspect-ratio="computedAspectRatio"
type="image"
/>
</template>
<v-row no-gutters class="text-white pa-1">
<v-avatar class="mr-1" size="30" rounded="1">
<v-img :src="source.logo_path" />
</v-avatar>
</v-row>
<template #error>
<v-img :src="missingCoverImage" />
</template>
</v-img>
</v-card>
</v-hover>
<template #placeholder>
<Skeleton
:aspect-ratio="computedAspectRatio"
type="image"
/>
</template>
<v-row no-gutters class="text-white pa-1">
<v-avatar class="mr-1" size="30" rounded="1">
<v-img :src="source.logo_path" />
</v-avatar>
</v-row>
<template #error>
<v-img :src="missingCoverImage" />
</template>
</v-img>
</v-card>
</v-col>
</v-row>
</v-col>

View File

@@ -42,65 +42,61 @@ onBeforeUnmount(() => {
</script>
<template>
<v-hover v-slot="{ isHovering, props: cardProps }">
<div ref="tilt-card-ref" data-tilt>
<v-card
v-bind="cardProps"
class="bg-toplayer"
:class="{ 'on-hover': isHovering, 'transform-scale': !enable3DTilt }"
:elevation="isHovering ? 20 : 3"
:aria-label="`${platform.name} platform card`"
:to="{ name: ROUTES.PLATFORM, params: { platform: platform.id } }"
@mouseenter="
() => {
emit('hover', { isHovering: true, id: platform.id });
}
"
@mouseleave="
() => {
emit('hover', { isHovering: false, id: platform.id });
}
"
@blur="
() => {
emit('hover', { isHovering: false, id: platform.id });
}
"
>
<v-card-text>
<v-row class="pa-1 justify-center align-center bg-background">
<MissingFromFSIcon
v-if="platform.missing_from_fs"
text="Missing platform from filesystem"
:size="15"
/>
<div
:title="platform.display_name"
class="px-2 text-truncate text-caption"
>
<span>{{ platform.display_name }}</span>
</div>
</v-row>
<v-row class="pa-1 justify-center">
<PlatformIcon
:key="platform.slug"
:slug="platform.slug"
:name="platform.name"
:fs-slug="platform.fs_slug"
:size="105"
class="mt-2"
/>
<v-chip
class="bg-background position-absolute"
size="x-small"
style="bottom: 1rem; right: 1rem"
label
>
{{ platform.rom_count }}
</v-chip>
</v-row>
</v-card-text>
</v-card>
</div>
</v-hover>
<div ref="tilt-card-ref" data-tilt>
<v-card
class="bg-toplayer"
:class="{ 'transform-scale': !enable3DTilt }"
:aria-label="`${platform.name} platform card`"
:to="{ name: ROUTES.PLATFORM, params: { platform: platform.id } }"
@mouseenter="
() => {
emit('hover', { isHovering: true, id: platform.id });
}
"
@mouseleave="
() => {
emit('hover', { isHovering: false, id: platform.id });
}
"
@blur="
() => {
emit('hover', { isHovering: false, id: platform.id });
}
"
>
<v-card-text>
<v-row class="pa-1 justify-center align-center bg-background">
<MissingFromFSIcon
v-if="platform.missing_from_fs"
text="Missing platform from filesystem"
:size="15"
/>
<div
:title="platform.display_name"
class="px-2 text-truncate text-caption"
>
<span>{{ platform.display_name }}</span>
</div>
</v-row>
<v-row class="pa-1 justify-center">
<PlatformIcon
:key="platform.slug"
:slug="platform.slug"
:name="platform.name"
:fs-slug="platform.fs_slug"
:size="105"
class="mt-2"
/>
<v-chip
class="bg-background position-absolute"
size="x-small"
style="bottom: 1rem; right: 1rem"
label
>
{{ platform.rom_count }}
</v-chip>
</v-row>
</v-card-text>
</v-card>
</div>
</template>

View File

@@ -3,7 +3,7 @@
* It will spin CD based games on hover and load cartridge based games on play.
*/
import { useLocalStorage } from "@vueuse/core";
import { computed, ref, type Ref, type ShallowRef } from "vue";
import { computed, nextTick, ref, watch, type Ref, type ShallowRef } from "vue";
import type { VImg } from "vuetify/lib/components/VImg/VImg.js";
import type { BoxartStyleOption } from "@/components/Settings/UserInterface/Interface.vue";
import storeRoms from "@/stores/roms";
@@ -37,18 +37,20 @@ function getTranslateY(el: HTMLElement) {
export function useGameAnimation({
rom,
coverSrc,
vImgRef,
accelerate = ref(false),
coverRef,
videoRef,
isHovering = ref(false),
}: {
rom: SimpleRom | SearchRom;
accelerate?: Ref<boolean>;
coverSrc?: string;
vImgRef?: Readonly<ShallowRef<VImg | null>>;
coverRef?: Readonly<ShallowRef<VImg | null>>;
videoRef?: Readonly<ShallowRef<HTMLVideoElement | null>>;
isHovering?: Ref<boolean>;
}) {
const romsStore = storeRoms();
const boxartStyle = useLocalStorage<BoxartStyleOption>(
"settings.boxartStyle",
"cover",
"cover_path",
);
// User selected alternative cover image
@@ -56,7 +58,7 @@ export function useGameAnimation({
if (
coverSrc ||
!romsStore.isSimpleRom(rom) ||
boxartStyle.value === "cover"
boxartStyle.value === "cover_path"
)
return null;
const ssMedia = rom.ss_metadata?.[boxartStyle.value];
@@ -90,8 +92,8 @@ export function useGameAnimation({
let animateLoad = false;
const spinCD = (timestamp: number) => {
const container = vImgRef?.value?.$el;
const imageElement = vImgRef?.value?.image;
const container = coverRef?.value?.$el;
const imageElement = coverRef?.value?.image;
if (!container || !imageElement) return;
if (lastTimestamp === null) lastTimestamp = timestamp;
@@ -103,7 +105,7 @@ export function useGameAnimation({
// Update velocity and angle with acceleration
velocity +=
(accelerate.value ? accelerationRate : decelerationRate) * deltaTime;
(isHovering.value ? accelerationRate : decelerationRate) * deltaTime;
// Clamp the velocity
velocity = Math.min(maxRotationSpeed, Math.max(0, velocity));
angle = (angle + velocity * deltaTime) % 360;
@@ -122,7 +124,7 @@ export function useGameAnimation({
// Animate rotation of the CD
imageElement.style.transform = ANIMATION_CONFIG.transformCSS(angle);
if (velocity > 0 || accelerate.value) {
if (velocity > 0 || isHovering.value) {
animationID = requestAnimationFrame(spinCD);
} else {
// Stop the animation if the CD is no longer moving
@@ -131,7 +133,7 @@ export function useGameAnimation({
};
const setTransitionCSS = () => {
const imageElement = vImgRef?.value?.image;
const imageElement = coverRef?.value?.image;
if (!imageElement) return;
imageElement.style.transition = ANIMATION_CONFIG.transitionCSS;
};
@@ -163,8 +165,8 @@ export function useGameAnimation({
const animateLoadCart = () => {
if (!animateCartridge.value) return;
const container = vImgRef?.value?.$el;
const imageElement = vImgRef?.value?.image;
const container = coverRef?.value?.$el;
const imageElement = coverRef?.value?.image;
if (!container || !imageElement) return;
// Apply snap-down animation
@@ -173,13 +175,80 @@ export function useGameAnimation({
imageElement.style.marginTop = `${container.offsetHeight / 3}px`;
};
/* Video player */
let hoverTimeout: number | null = null;
const isVideoPlaying = ref(false);
const localVideoPath = computed(() => {
if (!romsStore.isSimpleRom(rom)) return null;
// Only play video if boxart style is miximage
if (boxartStyle.value !== "miximage_path") return null;
const ssVideo = rom.ss_metadata?.video_path;
const gamelistVideo = rom.gamelist_metadata?.video_path;
return ssVideo || gamelistVideo || null;
});
const playVideoEnabled = computed(() => {
return (
boxartStyle.value === "miximage_path" && Boolean(localVideoPath.value)
);
});
const playVideo = () => {
if (isVideoPlaying.value) return;
if (!playVideoEnabled.value) return;
// Start video after 1.5 seconds if video path exists
hoverTimeout = window.setTimeout(async () => {
isVideoPlaying.value = true;
// Wait for next tick to ensure video element is rendered
await nextTick();
if (videoRef?.value) {
videoRef.value.load();
videoRef.value.play().catch(() => {
// Handle play() promise rejection
isVideoPlaying.value = false;
});
}
}, 1500);
};
const stopVideo = () => {
isVideoPlaying.value = false;
if (hoverTimeout) {
clearTimeout(hoverTimeout);
hoverTimeout = null;
}
if (videoRef?.value) {
videoRef.value.pause();
videoRef.value.currentTime = 0;
}
};
watch(
isHovering,
(hovering) => {
if (hovering) {
animateCDSpin();
playVideo();
} else {
stopVideo();
}
},
{ immediate: true },
);
return {
boxartStyleCover,
animateCD,
animateCartridge,
localVideoPath,
isVideoPlaying,
animateCDSpin,
animateCDLoad,
stopCDAnimation,
animateLoadCart,
playVideo,
stopVideo,
};
}

View File

@@ -1,15 +1,11 @@
<script setup lang="ts">
import { useLocalStorage } from "@vueuse/core";
import {
computed,
onMounted,
onBeforeUnmount,
ref,
useTemplateRef,
watch,
nextTick,
} from "vue";
import type { BoxartStyleOption } from "@/components/Settings/UserInterface/Interface.vue";
import Skeleton from "@/components/common/Game/Card/Skeleton.vue";
import { useGameAnimation } from "@/composables/useGameAnimation";
import {
@@ -39,17 +35,24 @@ const props = defineProps<{
const heartbeatStore = storeHeartbeat();
const romsStore = storeRoms();
const gameCardRef = useTemplateRef<HTMLButtonElement>("game-card-ref");
const vImgRef = useTemplateRef("game-image-ref");
const coverRef = useTemplateRef("game-image-ref");
const videoRef = useTemplateRef<HTMLVideoElement>("hover-video-ref");
const isWebpEnabled = computed(
() => heartbeatStore.value.TASKS?.ENABLE_SCHEDULED_CONVERT_IMAGES_TO_WEBP,
);
const { boxartStyleCover, animateCDSpin, stopCDAnimation } = useGameAnimation({
const {
boxartStyleCover,
localVideoPath,
isVideoPlaying,
stopCDAnimation,
stopVideo,
} = useGameAnimation({
rom: props.rom,
accelerate: computed(() => props.selected),
vImgRef: vImgRef,
isHovering: computed(() => props.selected),
coverRef: coverRef,
videoRef: videoRef,
});
const largeCover = computed(() => {
@@ -76,23 +79,6 @@ const fallbackCoverImage = computed(() =>
: getUnmatchedCoverImage(props.rom.name || props.rom.slug || ""),
);
const boxartStyle = useLocalStorage<BoxartStyleOption>(
"settings.boxartStyle",
"cover",
);
const localVideoPath = computed(() => {
if (!romsStore.isSimpleRom(props.rom)) return null;
// Only play video if boxart style is miximage
if (boxartStyle.value !== "miximage_path") return null;
const ssVideo = props.rom.ss_metadata?.video_path;
const gamelistVideo = props.rom.gamelist_metadata?.video_path;
return ssVideo || gamelistVideo || null;
});
const selectionTimeout = ref<ReturnType<typeof setTimeout> | null>(null);
const isVideoPlaying = ref(false);
const emit = defineEmits([
"click",
"mouseenter",
@@ -116,37 +102,8 @@ watch(
if (largeCover.value) {
emit("select", largeCover.value);
}
animateCDSpin();
// Start video after 3 seconds if video path exists
if (localVideoPath.value) {
selectionTimeout.value = setTimeout(async () => {
isVideoPlaying.value = true;
// Wait for next tick to ensure video element is rendered
await nextTick();
if (videoRef.value) {
videoRef.value.load();
videoRef.value.play().catch(() => {
// Handle play() promise rejection (e.g., autoplay disabled)
isVideoPlaying.value = false;
});
}
}, 2000);
}
} else {
// Game deselected - stop video and clear timeout
emit("deselect");
isVideoPlaying.value = false;
if (selectionTimeout.value) {
clearTimeout(selectionTimeout.value);
selectionTimeout.value = null;
}
if (videoRef.value) {
videoRef.value.pause();
videoRef.value.currentTime = 0;
}
}
},
{ immediate: true },
@@ -167,18 +124,7 @@ onMounted(() => {
onBeforeUnmount(() => {
stopCDAnimation();
// Clean up selection timeout
if (selectionTimeout.value) {
clearTimeout(selectionTimeout.value);
selectionTimeout.value = null;
}
// Clean up video
if (videoRef.value) {
videoRef.value.pause();
videoRef.value.src = "";
}
stopVideo();
});
</script>
@@ -321,6 +267,7 @@ onBeforeUnmount(() => {
.hover-video-container {
top: 15%;
transition: opacity 0.25s ease;
pointer-events: none;
}
.v-img.transitioning,

View File

@@ -45,8 +45,9 @@ body {
transition-property: all !important;
transition-duration: 0.1s !important;
}
.transform-scale.on-hover {
transform: scale(1.1) !important;
.transform-scale:hover,
.transform-scale:focus {
transform: scale(1.05) !important;
}
.pointer {
cursor: pointer !important;

View File

@@ -36,10 +36,6 @@ const {
} = storeToRefs(romsStore);
const noPlatformError = ref(false);
const emitter = inject<Emitter<Events>>("emitter");
const isHovering = ref(false);
const hoveringRomId = ref<number>();
const openedMenu = ref(false);
const openedMenuRomId = ref<number>();
const enable3DEffect = useLocalStorage("settings.enable3DEffect", false);
let timeout: ReturnType<typeof setTimeout>;
@@ -74,21 +70,6 @@ async function fetchRoms() {
});
}
function onHover(emitData: { isHovering: boolean; id: number }) {
isHovering.value = emitData.isHovering;
hoveringRomId.value = emitData.id;
}
function onOpenedMenu(emitData: { openedMenu: boolean; id: number }) {
openedMenu.value = emitData.openedMenu;
openedMenuRomId.value = emitData.id;
}
function onClosedMenu() {
openedMenu.value = false;
openedMenuRomId.value = undefined;
}
function onGameClick(emitData: { rom: SimpleRom; event: MouseEvent }) {
let index = filteredRoms.value.indexOf(emitData.rom);
if (
@@ -252,13 +233,6 @@ onBeforeRouteUpdate(async (to, from) => {
:md="views[currentView]['size-md']"
:lg="views[currentView]['size-lg']"
:xl="views[currentView]['size-xl']"
:style="{
zIndex:
(isHovering && hoveringRomId === rom.id) ||
(openedMenu && openedMenuRomId === rom.id)
? 1000
: 1,
}"
>
<GameCard
:key="rom.id"
@@ -278,10 +252,6 @@ onBeforeRouteUpdate(async (to, from) => {
@click="onGameClick"
@touchstart="onGameTouchStart"
@touchend="onGameTouchEnd"
@hover="onHover"
@focus="onHover"
@openedmenu="onOpenedMenu"
@closedmenu="onClosedMenu"
/>
</v-col>
</v-row>

View File

@@ -472,58 +472,53 @@ onBeforeUnmount(async () => {
sm="4"
class="pa-1"
>
<v-hover v-slot="{ isHovering, props }">
<v-card
:style="{
zIndex: selectedState?.id === state.id ? 11 : undefined,
}"
v-bind="props"
class="bg-toplayer transform-scale"
:class="{
'on-hover': isHovering,
'border-selected': selectedState?.id === state.id,
}"
:elevation="isHovering ? 20 : 3"
@click="selectState(state)"
>
<v-card-text class="pa-2">
<v-row no-gutters>
<v-col cols="12">
<v-img
rounded
:src="
state.screenshot?.download_path ??
getEmptyCoverImage(state.file_name)
"
/>
</v-col>
</v-row>
<v-row
class="py-2 px-1 text-caption text-primary"
no-gutters
>
{{ state.file_name }}
</v-row>
<v-row class="ga-1" no-gutters>
<v-col cols="12">
<v-list-item rounded class="pa-1 text-caption">
Updated: {{ formatTimestamp(state.updated_at) }}
<span class="ml-1 text-grey text-caption"
>({{
formatRelativeDate(state.updated_at)
}})</span
>
</v-list-item>
</v-col>
<v-col v-if="state.emulator" cols="12" class="mt-1">
<v-chip size="x-small" color="orange" label>
{{ state.emulator }}
</v-chip>
</v-col>
</v-row>
</v-card-text>
</v-card>
</v-hover>
<v-card
:style="{
zIndex: selectedState?.id === state.id ? 11 : undefined,
}"
class="bg-toplayer transform-scale"
:class="{
'border-selected': selectedState?.id === state.id,
}"
@click="selectState(state)"
>
<v-card-text class="pa-2">
<v-row no-gutters>
<v-col cols="12">
<v-img
rounded
:src="
state.screenshot?.download_path ??
getEmptyCoverImage(state.file_name)
"
/>
</v-col>
</v-row>
<v-row
class="py-2 px-1 text-caption text-primary"
no-gutters
>
{{ state.file_name }}
</v-row>
<v-row class="ga-1" no-gutters>
<v-col cols="12">
<v-list-item rounded class="pa-1 text-caption">
Updated: {{ formatTimestamp(state.updated_at) }}
<span class="ml-1 text-grey text-caption"
>({{
formatRelativeDate(state.updated_at)
}})</span
>
</v-list-item>
</v-col>
<v-col v-if="state.emulator" cols="12" class="mt-1">
<v-chip size="x-small" color="orange" label>
{{ state.emulator }}
</v-chip>
</v-col>
</v-row>
</v-card-text>
</v-card>
</v-col>
</template>
<v-col v-else class="pa-1 mt-1">
@@ -548,58 +543,51 @@ onBeforeUnmount(async () => {
sm="4"
class="pa-1"
>
<v-hover v-slot="{ isHovering, props }">
<v-card
:style="{
zIndex: selectedSave?.id === save.id ? 11 : undefined,
}"
v-bind="props"
class="bg-toplayer transform-scale"
:class="{
'on-hover': isHovering,
'border-selected': selectedSave?.id === save.id,
}"
:elevation="isHovering ? 20 : 3"
@click="selectSave(save)"
>
<v-card-text class="pa-2">
<v-row no-gutters>
<v-col cols="12">
<v-img
rounded
:src="
save.screenshot?.download_path ??
getEmptyCoverImage(save.file_name)
"
/>
</v-col>
</v-row>
<v-row
class="py-2 px-1 text-caption text-primary"
no-gutters
>
{{ save.file_name }}
</v-row>
<v-row class="ga-1" no-gutters>
<v-col cols="12">
<v-list-item rounded class="pa-1 text-caption">
Updated: {{ formatTimestamp(save.updated_at) }}
<span class="ml-1 text-grey text-caption"
>({{
formatRelativeDate(save.updated_at)
}})</span
>
</v-list-item>
</v-col>
<v-col v-if="save.emulator" cols="12" class="mt-1">
<v-chip size="x-small" color="orange" label>
{{ save.emulator }}
</v-chip>
</v-col>
</v-row>
</v-card-text>
</v-card>
</v-hover>
<v-card
:style="{
zIndex: selectedSave?.id === save.id ? 11 : undefined,
}"
class="bg-toplayer transform-scale"
:class="{
'border-selected': selectedSave?.id === save.id,
}"
@click="selectSave(save)"
>
<v-card-text class="pa-2">
<v-row no-gutters>
<v-col cols="12">
<v-img
rounded
:src="
save.screenshot?.download_path ??
getEmptyCoverImage(save.file_name)
"
/>
</v-col>
</v-row>
<v-row
class="py-2 px-1 text-caption text-primary"
no-gutters
>
{{ save.file_name }}
</v-row>
<v-row class="ga-1" no-gutters>
<v-col cols="12">
<v-list-item rounded class="pa-1 text-caption">
Updated: {{ formatTimestamp(save.updated_at) }}
<span class="ml-1 text-grey text-caption"
>({{ formatRelativeDate(save.updated_at) }})</span
>
</v-list-item>
</v-col>
<v-col v-if="save.emulator" cols="12" class="mt-1">
<v-chip size="x-small" color="orange" label>
{{ save.emulator }}
</v-chip>
</v-col>
</v-row>
</v-card-text>
</v-card>
</v-col>
</template>
<v-col v-else class="pa-1 mt-1">