mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 10:32:57 +01:00
Merge pull request #2368 from rommapp/use-template-ref
Use modern useTemplateRef hook
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
import { ref, onMounted, computed } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useDisplay } from "vuetify";
|
||||
import type { EarnedAchievement } from "@/__generated__/models/EarnedAchievement";
|
||||
import type { RAGameRomAchievement } from "@/__generated__/models/RAGameRomAchievement";
|
||||
import type { RAUserGameProgression } from "@/__generated__/models/RAUserGameProgression";
|
||||
import storeAuth from "@/stores/auth";
|
||||
import type { DetailedRom } from "@/stores/roms";
|
||||
|
||||
@@ -10,10 +12,8 @@ const { smAndDown } = useDisplay();
|
||||
const props = defineProps<{ rom: DetailedRom }>();
|
||||
const { t } = useI18n();
|
||||
const auth = storeAuth();
|
||||
const targetRom = ref();
|
||||
const earnedAchievements = ref<
|
||||
{ id: string; date: string; hardcore: boolean }[]
|
||||
>([]);
|
||||
const raUserAchivement = ref<RAUserGameProgression | undefined>();
|
||||
const earnedAchievements = ref<EarnedAchievement[]>([]);
|
||||
const achievementsPercentage = ref(0);
|
||||
const achievementsPercentageHardcore = ref(0);
|
||||
const showEarned = ref(false);
|
||||
@@ -45,10 +45,11 @@ const isAchievementEarned = computed(
|
||||
|
||||
const isAchievementEarnedHarcore = computed(
|
||||
() => (achievement: RAGameRomAchievement) => {
|
||||
return (
|
||||
earnedAchievements.value.find(
|
||||
(earned) => earned.id === (achievement.badge_id ?? ""),
|
||||
)?.hardcore ?? false
|
||||
return earnedAchievements.value.some(
|
||||
(earned) =>
|
||||
achievement.badge_id &&
|
||||
earned.id === achievement.badge_id &&
|
||||
earned.date_hardcore,
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -66,29 +67,24 @@ onMounted(() => {
|
||||
props.rom.merged_ra_metadata?.achievements ?? []
|
||||
).sort((a, b) => (a.display_order ?? 0) - (b.display_order ?? 0));
|
||||
if (auth.user?.ra_progression?.results) {
|
||||
targetRom.value = auth.user.ra_progression.results.find(
|
||||
raUserAchivement.value = auth.user.ra_progression.results.find(
|
||||
(result) => result.rom_ra_id === props.rom.ra_id,
|
||||
);
|
||||
if (targetRom.value) {
|
||||
earnedAchievements.value = targetRom.value.earned_achievements.map(
|
||||
(achievement: {
|
||||
id: string;
|
||||
date: string;
|
||||
date_hardcore?: string | null;
|
||||
}) => ({
|
||||
id: achievement.id,
|
||||
if (raUserAchivement.value) {
|
||||
earnedAchievements.value = raUserAchivement.value.earned_achievements.map(
|
||||
(achievement) => ({
|
||||
...achievement,
|
||||
date: achievement.date_hardcore || achievement.date,
|
||||
hardcore: !!achievement.date_hardcore,
|
||||
}),
|
||||
);
|
||||
if (props.rom.merged_ra_metadata?.achievements) {
|
||||
achievementsPercentage.value = Math.round(
|
||||
(targetRom.value.earned_achievements.length /
|
||||
(raUserAchivement.value.earned_achievements.length /
|
||||
props.rom.merged_ra_metadata?.achievements.length) *
|
||||
100,
|
||||
);
|
||||
achievementsPercentageHardcore.value = Math.round(
|
||||
(targetRom.value.earned_achievements.filter(
|
||||
(raUserAchivement.value.earned_achievements.filter(
|
||||
(achievement: { date_hardcore?: string }) =>
|
||||
achievement.date_hardcore,
|
||||
).length /
|
||||
@@ -105,7 +101,7 @@ onMounted(() => {
|
||||
<template #prepend>
|
||||
<v-chip v-if="rom.merged_ra_metadata?.achievements" label rounded="0"
|
||||
><v-icon class="mr-2">mdi-trophy</v-icon
|
||||
>{{ targetRom?.earned_achievements.length ?? 0 }} /
|
||||
>{{ raUserAchivement?.earned_achievements.length ?? 0 }} /
|
||||
{{ rom.merged_ra_metadata?.achievements.length }}</v-chip
|
||||
>
|
||||
</template>
|
||||
|
||||
@@ -19,7 +19,7 @@ const gridCollections = useLocalStorage(`settings.${props.setting}`, false);
|
||||
const enable3DEffect = useLocalStorage("settings.enable3DEffect", false);
|
||||
const visibleCollections = ref(72);
|
||||
const isHovering = ref(false);
|
||||
const hoveringCollectionId = ref();
|
||||
const hoveringCollectionId = ref<number>();
|
||||
|
||||
function toggleGridCollections() {
|
||||
gridCollections.value = !gridCollections.value;
|
||||
|
||||
@@ -17,9 +17,9 @@ const gridContinuePlayingRoms = useLocalStorage(
|
||||
);
|
||||
const enable3DEffect = useLocalStorage("settings.enable3DEffect", false);
|
||||
const isHovering = ref(false);
|
||||
const hoveringRomId = ref();
|
||||
const hoveringRomId = ref<number>();
|
||||
const openedMenu = ref(false);
|
||||
const openedMenuRomId = ref();
|
||||
const openedMenuRomId = ref<number>();
|
||||
|
||||
function toggleGridContinuePlaying() {
|
||||
gridContinuePlayingRoms.value = !gridContinuePlayingRoms.value;
|
||||
@@ -37,7 +37,7 @@ function onOpenedMenu(emitData: { openedMenu: boolean; id: number }) {
|
||||
|
||||
function onClosedMenu() {
|
||||
openedMenu.value = false;
|
||||
openedMenuRomId.value = null;
|
||||
openedMenuRomId.value = undefined;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
||||
@@ -14,7 +14,7 @@ const { filledPlatforms } = storeToRefs(platformsStore);
|
||||
const gridPlatforms = useLocalStorage("settings.gridPlatforms", false);
|
||||
const enable3DEffect = useLocalStorage("settings.enable3DEffect", false);
|
||||
const isHovering = ref(false);
|
||||
const hoveringPlatformId = ref();
|
||||
const hoveringPlatformId = ref<number>();
|
||||
|
||||
function toggleGridPlatforms() {
|
||||
gridPlatforms.value = !gridPlatforms.value;
|
||||
|
||||
@@ -14,9 +14,9 @@ const { recentRoms } = storeToRefs(romsStore);
|
||||
const gridRecentRoms = useLocalStorage("settings.gridRecentRoms", false);
|
||||
const enable3DEffect = useLocalStorage("settings.enable3DEffect", false);
|
||||
const isHovering = ref(false);
|
||||
const hoveringRomId = ref();
|
||||
const hoveringRomId = ref<number>();
|
||||
const openedMenu = ref(false);
|
||||
const openedMenuRomId = ref();
|
||||
const openedMenuRomId = ref<number>();
|
||||
|
||||
function toggleGridRecentRoms() {
|
||||
gridRecentRoms.value = !gridRecentRoms.value;
|
||||
@@ -34,7 +34,7 @@ function onOpenedMenu(emitData: { openedMenu: boolean; id: number }) {
|
||||
|
||||
function onClosedMenu() {
|
||||
openedMenu.value = false;
|
||||
openedMenuRomId.value = null;
|
||||
openedMenuRomId.value = undefined;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
|
||||
@@ -12,8 +12,8 @@ const { lgAndUp } = useDisplay();
|
||||
const show = ref(false);
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
const configStore = storeConfig();
|
||||
const platformBindingFSSlugToDelete = ref();
|
||||
const platformBindingSlugToDelete = ref();
|
||||
const platformBindingFSSlugToDelete = ref("");
|
||||
const platformBindingSlugToDelete = ref("");
|
||||
emitter?.on("showDeletePlatformBindingDialog", ({ fsSlug, slug }) => {
|
||||
platformBindingFSSlugToDelete.value = fsSlug;
|
||||
platformBindingSlugToDelete.value = slug;
|
||||
|
||||
@@ -12,8 +12,8 @@ const { lgAndUp } = useDisplay();
|
||||
const show = ref(false);
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
const configStore = storeConfig();
|
||||
const fsSlugToDelete = ref();
|
||||
const slugToDelete = ref();
|
||||
const fsSlugToDelete = ref("");
|
||||
const slugToDelete = ref("");
|
||||
emitter?.on("showDeletePlatformVersionDialog", ({ fsSlug, slug }) => {
|
||||
fsSlugToDelete.value = fsSlug;
|
||||
slugToDelete.value = slug;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import PlatformIcon from "@/components/common/Platform/Icon.vue";
|
||||
|
||||
const emit = defineEmits(["clickEdit", "clickDelete"]);
|
||||
const emit = defineEmits(["click-edit", "click-delete"]);
|
||||
defineProps<{
|
||||
slug: string;
|
||||
fsSlug: string;
|
||||
@@ -26,7 +26,7 @@ defineProps<{
|
||||
size="x-small"
|
||||
icon="mdi-pencil"
|
||||
class="ml-0"
|
||||
@click="$emit('clickEdit')"
|
||||
@click="$emit('click-edit')"
|
||||
/>
|
||||
</v-slide-x-reverse-transition>
|
||||
<v-slide-x-reverse-transition>
|
||||
@@ -37,7 +37,7 @@ defineProps<{
|
||||
size="x-small"
|
||||
icon="mdi-delete"
|
||||
class="text-romm-red"
|
||||
@click="$emit('clickDelete')"
|
||||
@click="$emit('click-delete')"
|
||||
/>
|
||||
</v-slide-x-reverse-transition>
|
||||
</template>
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import VanillaTilt from "vanilla-tilt";
|
||||
import { computed, ref, watchEffect, onMounted, onBeforeUnmount } from "vue";
|
||||
import {
|
||||
computed,
|
||||
ref,
|
||||
watchEffect,
|
||||
onMounted,
|
||||
onBeforeUnmount,
|
||||
useTemplateRef,
|
||||
} from "vue";
|
||||
import { useDisplay } from "vuetify";
|
||||
import Skeleton from "@/components/common/Game/Card/Skeleton.vue";
|
||||
import { ROUTES } from "@/plugins/router";
|
||||
@@ -108,7 +115,7 @@ interface TiltHTMLElement extends HTMLElement {
|
||||
}
|
||||
const emit = defineEmits(["hover"]);
|
||||
|
||||
const tiltCard = ref<TiltHTMLElement | null>(null);
|
||||
const tiltCardRef = useTemplateRef<TiltHTMLElement>("tilt-card-ref");
|
||||
|
||||
// Determine the correct route for this collection type
|
||||
const collectionRoute = computed(() => {
|
||||
@@ -138,8 +145,8 @@ const collectionRoute = computed(() => {
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
if (tiltCard.value && !smAndDown.value && props.enable3DTilt) {
|
||||
VanillaTilt.init(tiltCard.value, {
|
||||
if (tiltCardRef.value && !smAndDown.value && props.enable3DTilt) {
|
||||
VanillaTilt.init(tiltCardRef.value, {
|
||||
max: 20,
|
||||
speed: 400,
|
||||
scale: 1.1,
|
||||
@@ -150,15 +157,15 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (tiltCard.value?.vanillaTilt && props.enable3DTilt) {
|
||||
tiltCard.value.vanillaTilt.destroy();
|
||||
if (tiltCardRef.value?.vanillaTilt && props.enable3DTilt) {
|
||||
tiltCardRef.value.vanillaTilt.destroy();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-hover v-slot="{ isHovering, props: hoverProps }">
|
||||
<div data-tilt ref="tiltCard">
|
||||
<div data-tilt ref="tilt-card-ref">
|
||||
<v-card
|
||||
v-bind="{
|
||||
...hoverProps,
|
||||
|
||||
@@ -2,7 +2,14 @@
|
||||
import { useLocalStorage } from "@vueuse/core";
|
||||
import type { Emitter } from "mitt";
|
||||
import VanillaTilt from "vanilla-tilt";
|
||||
import { computed, ref, onMounted, onBeforeUnmount, inject } from "vue";
|
||||
import {
|
||||
computed,
|
||||
ref,
|
||||
onMounted,
|
||||
onBeforeUnmount,
|
||||
inject,
|
||||
useTemplateRef,
|
||||
} from "vue";
|
||||
import { useDisplay } from "vuetify";
|
||||
import type { SearchRomSchema } from "@/__generated__";
|
||||
import ActionBar from "@/components/common/Game/Card/ActionBar.vue";
|
||||
@@ -128,7 +135,7 @@ interface TiltHTMLElement extends HTMLElement {
|
||||
};
|
||||
}
|
||||
|
||||
const tiltCard = ref<TiltHTMLElement | null>(null);
|
||||
const tiltCardRef = useTemplateRef<TiltHTMLElement>("tilt-card-ref");
|
||||
|
||||
const isWebpEnabled = computed(
|
||||
() => heartbeatStore.value.TASKS?.ENABLE_SCHEDULED_CONVERT_IMAGES_TO_WEBP,
|
||||
@@ -163,8 +170,8 @@ const showNoteDialog = (event: MouseEvent | KeyboardEvent) => {
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
if (tiltCard.value && !smAndDown.value && props.enable3DTilt) {
|
||||
VanillaTilt.init(tiltCard.value, {
|
||||
if (tiltCardRef.value && !smAndDown.value && props.enable3DTilt) {
|
||||
VanillaTilt.init(tiltCardRef.value, {
|
||||
max: 20,
|
||||
speed: 400,
|
||||
scale: 1.1,
|
||||
@@ -175,15 +182,15 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (tiltCard.value?.vanillaTilt && props.enable3DTilt) {
|
||||
tiltCard.value.vanillaTilt.destroy();
|
||||
if (tiltCardRef.value?.vanillaTilt && props.enable3DTilt) {
|
||||
tiltCardRef.value.vanillaTilt.destroy();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-hover v-slot="{ isHovering: isOuterHovering, props: hoverProps }">
|
||||
<div data-tilt ref="tiltCard">
|
||||
<div data-tilt ref="tilt-card-ref">
|
||||
<v-card
|
||||
:style="{
|
||||
...(disableViewTransition
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import VanillaTilt from "vanilla-tilt";
|
||||
import { ref, onMounted, onBeforeUnmount } from "vue";
|
||||
import { onMounted, onBeforeUnmount, useTemplateRef } from "vue";
|
||||
import { useDisplay } from "vuetify";
|
||||
import MissingFromFSIcon from "@/components/common/MissingFromFSIcon.vue";
|
||||
import PlatformIcon from "@/components/common/Platform/Icon.vue";
|
||||
@@ -20,11 +20,11 @@ interface TiltHTMLElement extends HTMLElement {
|
||||
}
|
||||
const emit = defineEmits(["hover"]);
|
||||
|
||||
const tiltCard = ref<TiltHTMLElement | null>(null);
|
||||
const tiltCardRef = useTemplateRef<TiltHTMLElement>("tilt-card-ref");
|
||||
|
||||
onMounted(() => {
|
||||
if (tiltCard.value && !smAndDown.value && props.enable3DTilt) {
|
||||
VanillaTilt.init(tiltCard.value, {
|
||||
if (tiltCardRef.value && !smAndDown.value && props.enable3DTilt) {
|
||||
VanillaTilt.init(tiltCardRef.value, {
|
||||
max: 20,
|
||||
speed: 400,
|
||||
scale: 1.1,
|
||||
@@ -35,15 +35,15 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
if (tiltCard.value?.vanillaTilt && props.enable3DTilt) {
|
||||
tiltCard.value.vanillaTilt.destroy();
|
||||
if (tiltCardRef.value?.vanillaTilt && props.enable3DTilt) {
|
||||
tiltCardRef.value.vanillaTilt.destroy();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-hover v-slot="{ isHovering, props }">
|
||||
<div data-tilt ref="tiltCard">
|
||||
<div data-tilt ref="tilt-card-ref">
|
||||
<v-card
|
||||
v-bind="props"
|
||||
class="bg-toplayer"
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
import {
|
||||
onUnmounted,
|
||||
watchEffect,
|
||||
nextTick,
|
||||
type Ref,
|
||||
type DefineComponent,
|
||||
} from "vue";
|
||||
import { onUnmounted, watchEffect, nextTick, type ShallowRef } from "vue";
|
||||
|
||||
export const useAutoScroll = (
|
||||
scrollContainer: Ref<DefineComponent | null>,
|
||||
observedElement: Ref<DefineComponent | null>,
|
||||
scrollContainer: ShallowRef,
|
||||
observedElement: ShallowRef,
|
||||
options = {},
|
||||
) => {
|
||||
const config = { always: false, smooth: false, deep: false, ...options };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watchEffect } from "vue";
|
||||
import { computed, onMounted, ref, watchEffect, useTemplateRef } from "vue";
|
||||
import type { CollectionSchema } from "@/__generated__/models/CollectionSchema";
|
||||
import { collectionElementRegistry } from "@/console/composables/useElementRegistry";
|
||||
import { getFavoriteCoverImage } from "@/utils/covers";
|
||||
@@ -11,7 +11,9 @@ const props = defineProps<{
|
||||
loaded?: boolean;
|
||||
}>();
|
||||
const emit = defineEmits(["click", "mouseenter", "focus", "loaded"]);
|
||||
const el = ref<HTMLElement>();
|
||||
const collectionCardRef = useTemplateRef<HTMLButtonElement>(
|
||||
"collection-card-ref",
|
||||
);
|
||||
|
||||
const isFavorite = computed(() => props.collection.is_favorite);
|
||||
const coverSrc = computed(
|
||||
@@ -52,15 +54,18 @@ watchEffect(() => {
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
if (!el.value) return;
|
||||
collectionElementRegistry.registerElement(props.index, el.value);
|
||||
if (!collectionCardRef.value) return;
|
||||
collectionElementRegistry.registerElement(
|
||||
props.index,
|
||||
collectionCardRef.value,
|
||||
);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex flex-col items-center w-[250px] shrink-0">
|
||||
<button
|
||||
ref="el"
|
||||
ref="collection-card-ref"
|
||||
class="relative block bg-[var(--console-collection-card-bg)] border-2 border-white/10 rounded-md p-0 cursor-pointer overflow-hidden shadow-[0_4px_20px_rgba(0,0,0,0.3),_inset_0_1px_0_rgba(255,255,255,0.1)] transition-all duration-200 w-full"
|
||||
:class="{
|
||||
'-translate-y-[2px] scale-[1.03] shadow-[0_8px_28px_rgba(0,0,0,0.35),_0_0_0_2px_var(--console-collection-card-focus-border),_0_0_16px_var(--console-collection-card-focus-border)]':
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { computed, onMounted, useTemplateRef } from "vue";
|
||||
import type { SimpleRomSchema } from "@/__generated__/models/SimpleRomSchema";
|
||||
import {
|
||||
recentElementRegistry,
|
||||
@@ -23,7 +23,7 @@ const coverSrc = computed(
|
||||
"",
|
||||
);
|
||||
const emit = defineEmits(["click", "mouseenter", "focus", "loaded"]);
|
||||
const el = ref<HTMLElement>();
|
||||
const gameCardRef = useTemplateRef<HTMLButtonElement>("game-card-ref");
|
||||
|
||||
// Check if this game is in the favorites collection
|
||||
const collectionsStore = storeCollections();
|
||||
@@ -32,19 +32,19 @@ const isFavorited = computed(() => {
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
if (!el.value) return;
|
||||
if (!gameCardRef.value) return;
|
||||
|
||||
if (props.registry === "gamesList") {
|
||||
gamesListElementRegistry.registerElement(props.index, el.value);
|
||||
gamesListElementRegistry.registerElement(props.index, gameCardRef.value);
|
||||
} else {
|
||||
recentElementRegistry.registerElement(props.index, el.value);
|
||||
recentElementRegistry.registerElement(props.index, gameCardRef.value);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<button
|
||||
ref="el"
|
||||
ref="game-card-ref"
|
||||
class="relative block border-2 border-white/10 rounded-md p-0 cursor-pointer overflow-hidden shadow-[0_4px_20px_rgba(0,0,0,0.3),_inset_0_1px_0_rgba(255,255,255,0.1)] transition-all duration-200"
|
||||
:class="{
|
||||
'-translate-y-[2px] scale-[1.03] shadow-[0_8px_28px_rgba(0,0,0,0.35),_0_0_0_2px_var(--console-game-card-focus-border),_0_0_16px_var(--console-game-card-focus-border)]':
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { computed, onMounted, useTemplateRef } from "vue";
|
||||
import { systemElementRegistry } from "@/console/composables/useElementRegistry";
|
||||
import { useThemeAssets } from "@/console/composables/useThemeAssets";
|
||||
import { getPlatformTheme } from "@/console/constants/platforms";
|
||||
@@ -11,12 +11,12 @@ const props = defineProps<{
|
||||
selected?: boolean;
|
||||
}>();
|
||||
const emit = defineEmits(["click", "mouseenter", "focus"]);
|
||||
const el = ref<HTMLElement>();
|
||||
const systemCardRef = useTemplateRef<HTMLButtonElement>("system-card-ref");
|
||||
const { getSystemImagePath } = useThemeAssets();
|
||||
|
||||
onMounted(() => {
|
||||
if (el.value) {
|
||||
systemElementRegistry.registerElement(props.index, el.value);
|
||||
if (systemCardRef.value) {
|
||||
systemElementRegistry.registerElement(props.index, systemCardRef.value);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -44,7 +44,7 @@ const theme = computed(() => {
|
||||
|
||||
<template>
|
||||
<button
|
||||
ref="el"
|
||||
ref="system-card-ref"
|
||||
class="relative w-[280px] h-[160px] rounded-xl border-2 border-white/10 cursor-pointer overflow-hidden shrink-0 shadow-[0_4px_20px_rgba(0,0,0,0.3),_inset_0_1px_0_rgba(255,255,255,0.1)] transition-all"
|
||||
:class="{
|
||||
'-translate-y-[2px] scale-[1.03] shadow-[0_8px_28px_rgba(0,0,0,0.35),_0_0_0_2px_var(--system-accent),_0_0_16px_var(--system-accent)]':
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import { formatDistanceToNow } from "date-fns";
|
||||
import { computed, onMounted, onUnmounted, ref, watch, nextTick } from "vue";
|
||||
import {
|
||||
computed,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
ref,
|
||||
watch,
|
||||
nextTick,
|
||||
useTemplateRef,
|
||||
} from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import type { DetailedRomSchema } from "@/__generated__/models/DetailedRomSchema";
|
||||
import BackButton from "@/console/components/BackButton.vue";
|
||||
@@ -40,12 +48,14 @@ const showDescription = ref(false);
|
||||
const showDetails = ref(false);
|
||||
const showLightbox = ref(false);
|
||||
const selectedShot = ref(0);
|
||||
const shotsRef = ref<HTMLDivElement | null>(null);
|
||||
const shotEls = ref<HTMLElement[]>([]);
|
||||
const statesRef = ref<HTMLDivElement | null>(null);
|
||||
const stateEls = ref<HTMLElement[]>([]);
|
||||
const descOverlayRef = ref<HTMLElement | null>(null);
|
||||
const detailsOverlayRef = ref<HTMLElement | null>(null);
|
||||
const screenshotsRef = useTemplateRef<HTMLDivElement>("screenshots-ref");
|
||||
const screenshotELs = ref<HTMLButtonElement[]>([]);
|
||||
const saveStatesRef = useTemplateRef<HTMLDivElement>("save-states-ref");
|
||||
const saveStatesELs = ref<HTMLButtonElement[]>([]);
|
||||
const descriptionOverlayRef = useTemplateRef<HTMLDivElement>(
|
||||
"description-overlay-ref",
|
||||
);
|
||||
const detailsOverlayRef = useTemplateRef<HTMLDivElement>("details-overlay-ref");
|
||||
|
||||
const releaseYear = computed(() => {
|
||||
const firstReleaseDate = rom.value?.metadatum?.first_release_date;
|
||||
@@ -362,19 +372,19 @@ async function deleteState(index: number) {
|
||||
}
|
||||
}
|
||||
|
||||
function registerShotEl(el: HTMLElement | null, idx: number) {
|
||||
function registerShotEl(el: HTMLButtonElement | null, idx: number) {
|
||||
if (!el) return;
|
||||
shotEls.value[idx] = el;
|
||||
screenshotELs.value[idx] = el;
|
||||
}
|
||||
|
||||
function registerStateEl(el: HTMLElement | null, idx: number) {
|
||||
function registerStateEl(el: HTMLButtonElement | null, idx: number) {
|
||||
if (!el) return;
|
||||
stateEls.value[idx] = el;
|
||||
saveStatesELs.value[idx] = el;
|
||||
}
|
||||
|
||||
function scrollShotsToSelected() {
|
||||
const container = shotsRef.value;
|
||||
const el = shotEls.value[selectedShot.value];
|
||||
const container = screenshotsRef.value;
|
||||
const el = screenshotELs.value[selectedShot.value];
|
||||
if (!container || !el) return;
|
||||
const cr = container.getBoundingClientRect();
|
||||
const er = el.getBoundingClientRect();
|
||||
@@ -383,8 +393,8 @@ function scrollShotsToSelected() {
|
||||
}
|
||||
|
||||
function scrollStatesToSelected() {
|
||||
const container = statesRef.value;
|
||||
const el = stateEls.value[selectedStateIndex.value];
|
||||
const container = saveStatesRef.value;
|
||||
const el = saveStatesELs.value[selectedStateIndex.value];
|
||||
if (!container || !el) return;
|
||||
const cr = container.getBoundingClientRect();
|
||||
const er = el.getBoundingClientRect();
|
||||
@@ -426,7 +436,7 @@ onMounted(async () => {
|
||||
|
||||
// Focus overlays when opened so Esc works even if window handlers exist
|
||||
watch(showDescription, (v) => {
|
||||
if (v) nextTick(() => descOverlayRef.value?.focus?.());
|
||||
if (v) nextTick(() => descriptionOverlayRef.value?.focus?.());
|
||||
});
|
||||
watch(showDetails, (v) => {
|
||||
if (v) nextTick(() => detailsOverlayRef.value?.focus?.());
|
||||
@@ -604,7 +614,7 @@ onUnmounted(() => {
|
||||
SAVE STATES
|
||||
</h3>
|
||||
<div
|
||||
ref="statesRef"
|
||||
ref="save-states-ref"
|
||||
class="w-full overflow-x-auto overflow-y-hidden no-scrollbar"
|
||||
>
|
||||
<div class="flex items-center gap-3 py-1 px-2 min-w-max">
|
||||
@@ -612,7 +622,8 @@ onUnmounted(() => {
|
||||
v-for="(st, i) in rom.user_states"
|
||||
:key="st.id"
|
||||
:ref="
|
||||
(el) => registerStateEl(el as HTMLElement | null, i)
|
||||
(el) =>
|
||||
registerStateEl(el as HTMLButtonElement | null, i)
|
||||
"
|
||||
:style="{
|
||||
borderColor: 'var(--console-game-state-card-border)',
|
||||
@@ -677,7 +688,7 @@ onUnmounted(() => {
|
||||
Screenshots
|
||||
</h3>
|
||||
<div
|
||||
ref="shotsRef"
|
||||
ref="screenshots-ref"
|
||||
class="w-full overflow-x-auto overflow-y-hidden no-scrollbar"
|
||||
>
|
||||
<div
|
||||
@@ -686,7 +697,10 @@ onUnmounted(() => {
|
||||
<button
|
||||
v-for="(src, idx) in screenshotUrls"
|
||||
:key="`${idx}-${src}`"
|
||||
:ref="(el) => registerShotEl(el as HTMLElement | null, idx)"
|
||||
:ref="
|
||||
(el) =>
|
||||
registerShotEl(el as HTMLButtonElement | null, idx)
|
||||
"
|
||||
class="relative h-32 md:h-40 aspect-[16/9] rounded-md flex-none overflow-hidden cursor-pointer transition-all duration-200 border-2"
|
||||
:class="{
|
||||
'scale-[1.03] shadow-[0_8px_28px_rgba(0,0,0,0.35),_0_0_0_2px_var(--console-game-screenshot-thumbnail-focus-border),_0_0_16px_var(--console-game-screenshot-thumbnail-focus-border)]':
|
||||
@@ -736,6 +750,7 @@ onUnmounted(() => {
|
||||
|
||||
<!-- Description Modal -->
|
||||
<v-dialog
|
||||
ref="description-overlay-ref"
|
||||
:model-value="showDescription"
|
||||
:width="1000"
|
||||
scroll-strategy="block"
|
||||
@@ -775,6 +790,7 @@ onUnmounted(() => {
|
||||
|
||||
<!-- Details Modal -->
|
||||
<v-dialog
|
||||
ref="details-overlay-ref"
|
||||
:model-value="showDetails"
|
||||
:width="1000"
|
||||
scroll-strategy="block"
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, onUnmounted, ref, nextTick } from "vue";
|
||||
import {
|
||||
computed,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
ref,
|
||||
nextTick,
|
||||
useTemplateRef,
|
||||
} from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import type { CollectionSchema } from "@/__generated__/models/CollectionSchema";
|
||||
import type { SimpleRomSchema } from "@/__generated__/models/SimpleRomSchema";
|
||||
@@ -34,7 +41,7 @@ const selectedIndex = ref(0);
|
||||
const loadedMap = ref<Record<number, boolean>>({});
|
||||
const inAlphabet = ref(false);
|
||||
const alphaIndex = ref(0);
|
||||
const gridRef = ref<HTMLDivElement>();
|
||||
const gridRef = useTemplateRef<HTMLDivElement>("game-grid-ref");
|
||||
|
||||
// Initialize selection from store
|
||||
if (platformId != null) {
|
||||
@@ -344,7 +351,7 @@ function markLoaded(id: number) {
|
||||
No games found.
|
||||
</div>
|
||||
<div
|
||||
ref="gridRef"
|
||||
ref="game-grid-ref"
|
||||
class="grid grid-cols-[repeat(auto-fill,minmax(250px,250px))] justify-center my-12 gap-5 px-13 md:px-16 lg:px-20 xl:px-28 py-8 relative z-10 w-full box-border overflow-x-hidden"
|
||||
@wheel.prevent
|
||||
>
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from "pinia";
|
||||
import { onMounted, onUnmounted, ref, nextTick, watch } from "vue";
|
||||
import {
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
ref,
|
||||
nextTick,
|
||||
watch,
|
||||
useTemplateRef,
|
||||
} from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import type { CollectionSchema } from "@/__generated__/models/CollectionSchema";
|
||||
import type { PlatformSchema } from "@/__generated__/models/PlatformSchema";
|
||||
@@ -37,10 +44,10 @@ const { toggleFavorite: toggleFavoriteComposable } = useFavoriteToggle();
|
||||
const { subscribe } = useInputScope();
|
||||
|
||||
const platforms = ref<PlatformSchema[]>([]);
|
||||
const recent = ref<SimpleRomSchema[]>([]);
|
||||
const recentRoms = ref<SimpleRomSchema[]>([]);
|
||||
const collections = ref<CollectionSchema[]>([]);
|
||||
const loading = ref(true);
|
||||
const error = ref("");
|
||||
const loadingPlatforms = ref(true);
|
||||
const errorMessage = ref("");
|
||||
const showSettings = ref(false);
|
||||
|
||||
// Navigation indices
|
||||
@@ -48,13 +55,16 @@ const selectedIndex = ref(storeConsole.platformIndex);
|
||||
const recentIndex = ref(storeConsole.recentIndex);
|
||||
const collectionsIndex = ref(storeConsole.collectionsIndex);
|
||||
const controlIndex = ref(storeConsole.controlIndex);
|
||||
const scrollContainerRef = ref<HTMLDivElement>();
|
||||
const systemsRef = ref<HTMLDivElement>();
|
||||
const recentRef = ref<HTMLDivElement>();
|
||||
const collectionsRef = ref<HTMLDivElement>();
|
||||
const platformsSectionRef = ref<HTMLElement>();
|
||||
const recentSectionRef = ref<HTMLElement>();
|
||||
const collectionsSectionRef = ref<HTMLElement>();
|
||||
const scrollContainerRef = useTemplateRef<HTMLDivElement>(
|
||||
"scroll-container-ref",
|
||||
);
|
||||
const platformsRef = useTemplateRef<HTMLDivElement>("platforms-ref");
|
||||
const recentRef = useTemplateRef<HTMLDivElement>("recent-ref");
|
||||
const collectionsRef = useTemplateRef<HTMLDivElement>("collections-ref");
|
||||
const recentSectionRef = useTemplateRef<HTMLElement>("recent-section-ref");
|
||||
const collectionsSectionRef = useTemplateRef<HTMLElement>(
|
||||
"collections-section-ref",
|
||||
);
|
||||
|
||||
const systemElementAt = (i: number) => systemElementRegistry.getElement(i);
|
||||
const recentElementAt = (i: number) => recentElementRegistry.getElement(i);
|
||||
@@ -69,8 +79,8 @@ const { moveLeft: moveSystemLeft, moveRight: moveSystemRight } = useSpatialNav(
|
||||
);
|
||||
const { moveLeft: moveRecentLeft, moveRight: moveRecentRight } = useSpatialNav(
|
||||
recentIndex,
|
||||
() => recent.value.length || 1,
|
||||
() => recent.value.length,
|
||||
() => recentRoms.value.length || 1,
|
||||
() => recentRoms.value.length,
|
||||
);
|
||||
const { moveLeft: moveCollectionLeft, moveRight: moveCollectionRight } =
|
||||
useSpatialNav(
|
||||
@@ -102,8 +112,8 @@ useRovingDom(collectionsIndex, collectionElementAt, {
|
||||
watch(selectedIndex, (newIdx) => {
|
||||
if (!isVerticalScrolling) {
|
||||
const el = systemElementAt(newIdx);
|
||||
if (el && systemsRef.value) {
|
||||
centerInCarousel(systemsRef.value, el, "smooth");
|
||||
if (el && platformsRef.value) {
|
||||
centerInCarousel(platformsRef.value, el, "smooth");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -157,7 +167,7 @@ const navigationFunctions = {
|
||||
const before = recentIndex.value;
|
||||
moveRecentLeft();
|
||||
if (recentIndex.value === before) {
|
||||
recentIndex.value = Math.max(0, recent.value.length - 1);
|
||||
recentIndex.value = Math.max(0, recentRoms.value.length - 1);
|
||||
}
|
||||
},
|
||||
next: () => {
|
||||
@@ -168,11 +178,11 @@ const navigationFunctions = {
|
||||
}
|
||||
},
|
||||
confirm: () => {
|
||||
if (!recent.value[recentIndex.value]) return false;
|
||||
if (!recentRoms.value[recentIndex.value]) return false;
|
||||
router.push({
|
||||
name: ROUTES.CONSOLE_ROM,
|
||||
params: { rom: recent.value[recentIndex.value].id },
|
||||
query: { id: recent.value[recentIndex.value].platform_id },
|
||||
params: { rom: recentRoms.value[recentIndex.value].id },
|
||||
query: { id: recentRoms.value[recentIndex.value].platform_id },
|
||||
});
|
||||
return true;
|
||||
},
|
||||
@@ -347,7 +357,8 @@ function handleAction(action: InputAction): boolean {
|
||||
return true;
|
||||
}
|
||||
if (currentMode === "collections") {
|
||||
navigationMode.value = recent.value.length > 0 ? "recent" : "systems";
|
||||
navigationMode.value =
|
||||
recentRoms.value.length > 0 ? "recent" : "systems";
|
||||
scrollToCurrentRow();
|
||||
return true;
|
||||
}
|
||||
@@ -356,7 +367,7 @@ function handleAction(action: InputAction): boolean {
|
||||
case "moveDown":
|
||||
if (currentMode === "systems") {
|
||||
navigationMode.value =
|
||||
recent.value.length > 0
|
||||
recentRoms.value.length > 0
|
||||
? "recent"
|
||||
: collections.value.length > 0
|
||||
? "collections"
|
||||
@@ -386,8 +397,8 @@ function handleAction(action: InputAction): boolean {
|
||||
return true;
|
||||
|
||||
case "toggleFavorite":
|
||||
if (currentMode === "recent" && recent.value[recentIndex.value]) {
|
||||
toggleFavoriteComposable(recent.value[recentIndex.value]);
|
||||
if (currentMode === "recent" && recentRoms.value[recentIndex.value]) {
|
||||
toggleFavoriteComposable(recentRoms.value[recentIndex.value]);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -409,7 +420,7 @@ onMounted(async () => {
|
||||
platforms.value = plats.filter(
|
||||
(p) => p.rom_count > 0 && isSupportedPlatform(p.slug),
|
||||
);
|
||||
recent.value = recents.items ?? [];
|
||||
recentRoms.value = recents.items ?? [];
|
||||
collections.value = cols ?? [];
|
||||
|
||||
collectionsStore.setCollections(cols ?? []);
|
||||
@@ -419,14 +430,14 @@ onMounted(async () => {
|
||||
),
|
||||
);
|
||||
} catch (err: unknown) {
|
||||
error.value = err instanceof Error ? err.message : "Failed to load";
|
||||
errorMessage.value = err instanceof Error ? err.message : "Failed to load";
|
||||
} finally {
|
||||
loading.value = false;
|
||||
loadingPlatforms.value = false;
|
||||
}
|
||||
|
||||
// Restore indices within bounds
|
||||
if (selectedIndex.value >= platforms.value.length) selectedIndex.value = 0;
|
||||
if (recentIndex.value >= recent.value.length) recentIndex.value = 0;
|
||||
if (recentIndex.value >= recentRoms.value.length) recentIndex.value = 0;
|
||||
if (collectionsIndex.value >= collections.value.length)
|
||||
collectionsIndex.value = 0;
|
||||
|
||||
@@ -434,7 +445,7 @@ onMounted(async () => {
|
||||
scrollToCurrentRow();
|
||||
|
||||
// Center carousels
|
||||
centerInCarousel(systemsRef.value, systemElementAt(selectedIndex.value));
|
||||
centerInCarousel(platformsRef.value, systemElementAt(selectedIndex.value));
|
||||
centerInCarousel(recentRef.value, recentElementAt(recentIndex.value));
|
||||
centerInCarousel(
|
||||
collectionsRef.value,
|
||||
@@ -461,7 +472,7 @@ onUnmounted(() => {
|
||||
|
||||
<template>
|
||||
<div
|
||||
ref="scrollContainerRef"
|
||||
ref="scroll-container-ref"
|
||||
class="relative h-screen overflow-y-auto overflow-x-hidden"
|
||||
@wheel.prevent
|
||||
>
|
||||
@@ -477,21 +488,21 @@ onUnmounted(() => {
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="loading"
|
||||
v-if="loadingPlatforms"
|
||||
class="text-center mt-16"
|
||||
:style="{ color: 'var(--console-loading-text)' }"
|
||||
>
|
||||
Loading platforms…
|
||||
</div>
|
||||
<div
|
||||
v-else-if="error"
|
||||
v-else-if="errorMessage"
|
||||
class="text-center mt-16"
|
||||
:style="{ color: 'var(--console-error-text)' }"
|
||||
:style="{ color: 'var(--console-errorMessage-text)' }"
|
||||
>
|
||||
{{ error }}
|
||||
{{ errorMessage }}
|
||||
</div>
|
||||
<div v-else>
|
||||
<section ref="platformsSectionRef" class="pb-2">
|
||||
<section class="pb-2">
|
||||
<h2
|
||||
class="text-xl font-bold text-fg0 mb-3 drop-shadow pl-8 pr-8"
|
||||
:style="{ color: 'var(--console-home-category-text)' }"
|
||||
@@ -522,7 +533,7 @@ onUnmounted(() => {
|
||||
▶
|
||||
</button>
|
||||
<div
|
||||
ref="systemsRef"
|
||||
ref="platforms-ref"
|
||||
class="w-full h-full overflow-x-auto overflow-y-hidden no-scrollbar [scrollbar-width:none] [-ms-overflow-style:none]"
|
||||
@wheel.prevent
|
||||
>
|
||||
@@ -543,7 +554,11 @@ onUnmounted(() => {
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="recent.length > 0" ref="recentSectionRef" class="pb-8">
|
||||
<section
|
||||
v-if="recentRoms.length > 0"
|
||||
ref="recent-section-ref"
|
||||
class="pb-8"
|
||||
>
|
||||
<h2
|
||||
class="text-xl font-bold text-fg0 mb-3 drop-shadow pl-8 pr-8"
|
||||
:style="{ color: 'var(--console-home-category-text)' }"
|
||||
@@ -574,13 +589,13 @@ onUnmounted(() => {
|
||||
▶
|
||||
</button>
|
||||
<div
|
||||
ref="recentRef"
|
||||
ref="recent-ref"
|
||||
class="w-full h-full overflow-x-auto overflow-y-hidden no-scrollbar [scrollbar-width:none] [-ms-overflow-style:none]"
|
||||
@wheel.prevent
|
||||
>
|
||||
<div class="flex items-center gap-4 h-full px-12 min-w-max">
|
||||
<GameCard
|
||||
v-for="(g, i) in recent"
|
||||
v-for="(g, i) in recentRoms"
|
||||
:key="`${g.platform_id}-${g.id}`"
|
||||
:rom="g"
|
||||
:index="i"
|
||||
@@ -597,7 +612,7 @@ onUnmounted(() => {
|
||||
|
||||
<section
|
||||
v-if="collections.length > 0"
|
||||
ref="collectionsSectionRef"
|
||||
ref="collections-section-ref"
|
||||
class="pb-8"
|
||||
>
|
||||
<h2
|
||||
@@ -630,7 +645,7 @@ onUnmounted(() => {
|
||||
▶
|
||||
</button>
|
||||
<div
|
||||
ref="collectionsRef"
|
||||
ref="collections-ref"
|
||||
class="w-full h-full overflow-x-auto overflow-y-hidden no-scrollbar [scrollbar-width:none] [-ms-overflow-style:none]"
|
||||
@wheel.prevent
|
||||
>
|
||||
|
||||
@@ -40,9 +40,9 @@ const {
|
||||
const noCollectionError = ref(false);
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
const isHovering = ref(false);
|
||||
const hoveringRomId = ref();
|
||||
const hoveringRomId = ref<number>();
|
||||
const openedMenu = ref(false);
|
||||
const openedMenuRomId = ref();
|
||||
const openedMenuRomId = ref<number>();
|
||||
const enable3DEffect = useLocalStorage("settings.enable3DEffect", false);
|
||||
let timeout: ReturnType<typeof setTimeout>;
|
||||
|
||||
@@ -88,7 +88,7 @@ function onOpenedMenu(emitData: { openedMenu: boolean; id: number }) {
|
||||
|
||||
function onClosedMenu() {
|
||||
openedMenu.value = false;
|
||||
openedMenuRomId.value = null;
|
||||
openedMenuRomId.value = undefined;
|
||||
}
|
||||
|
||||
function onGameClick(emitData: { rom: SimpleRom; event: MouseEvent }) {
|
||||
|
||||
@@ -38,9 +38,9 @@ const {
|
||||
const noPlatformError = ref(false);
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
const isHovering = ref(false);
|
||||
const hoveringRomId = ref();
|
||||
const hoveringRomId = ref<number>();
|
||||
const openedMenu = ref(false);
|
||||
const openedMenuRomId = ref();
|
||||
const openedMenuRomId = ref<number>();
|
||||
const enable3DEffect = useLocalStorage("settings.enable3DEffect", false);
|
||||
let timeout: ReturnType<typeof setTimeout>;
|
||||
|
||||
@@ -87,7 +87,7 @@ function onOpenedMenu(emitData: { openedMenu: boolean; id: number }) {
|
||||
|
||||
function onClosedMenu() {
|
||||
openedMenu.value = false;
|
||||
openedMenuRomId.value = null;
|
||||
openedMenuRomId.value = undefined;
|
||||
}
|
||||
|
||||
function onGameClick(emitData: { rom: SimpleRom; event: MouseEvent }) {
|
||||
|
||||
@@ -31,9 +31,9 @@ const {
|
||||
} = storeToRefs(romsStore);
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
const isHovering = ref(false);
|
||||
const hoveringRomId = ref();
|
||||
const hoveringRomId = ref<number>();
|
||||
const openedMenu = ref(false);
|
||||
const openedMenuRomId = ref();
|
||||
const openedMenuRomId = ref<number>();
|
||||
const enable3DEffect = useLocalStorage("settings.enable3DEffect", false);
|
||||
let timeout: ReturnType<typeof setTimeout>;
|
||||
|
||||
@@ -49,7 +49,7 @@ function onOpenedMenu(emitData: { openedMenu: boolean; id: number }) {
|
||||
|
||||
function onClosedMenu() {
|
||||
openedMenu.value = false;
|
||||
openedMenuRomId.value = null;
|
||||
openedMenuRomId.value = undefined;
|
||||
}
|
||||
|
||||
function onGameClick(emitData: { rom: SimpleRom; event: MouseEvent }) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { useLocalStorage } from "@vueuse/core";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { computed, ref, watch, type DefineComponent } from "vue";
|
||||
import { computed, ref, useTemplateRef, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useDisplay } from "vuetify";
|
||||
import RomListItem from "@/components/common/Game/ListItem.vue";
|
||||
@@ -24,8 +24,8 @@ const platforms = storePlatforms();
|
||||
const heartbeat = storeHeartbeat();
|
||||
const platformsToScan = ref<number[]>([]);
|
||||
const panels = ref<number[]>([]);
|
||||
const scanLog = ref<DefineComponent | null>(null);
|
||||
const expansionPanels = ref<DefineComponent | null>(null);
|
||||
const scanLog = useTemplateRef<HTMLDivElement>("scan-log-ref");
|
||||
const expansionPanels = useTemplateRef<HTMLDivElement>("expansion-panels-ref");
|
||||
|
||||
useAutoScroll(scanLog, expansionPanels);
|
||||
|
||||
@@ -316,7 +316,7 @@ async function stopScan() {
|
||||
</div>
|
||||
|
||||
<!-- Scan log -->
|
||||
<v-row no-gutters class="scan-log overflow-y-scroll" ref="scanLog">
|
||||
<v-row no-gutters class="scan-log overflow-y-scroll" ref="scan-log-ref">
|
||||
<v-col>
|
||||
<v-card
|
||||
elevation="0"
|
||||
@@ -325,7 +325,7 @@ async function stopScan() {
|
||||
>
|
||||
<v-card-text class="pa-0">
|
||||
<v-expansion-panels
|
||||
ref="expansionPanels"
|
||||
ref="expansion-panels-ref"
|
||||
v-model="panels"
|
||||
multiple
|
||||
flat
|
||||
|
||||
Reference in New Issue
Block a user