From 6ed332bce3da8dac93537be29bb779ec588a68c9 Mon Sep 17 00:00:00 2001 From: zurdi Date: Thu, 21 May 2026 13:31:43 +0000 Subject: [PATCH] feat: integrate playability checks and tooltips for platforms in PlatformListRow and PlatformTile components --- .vscode/tasks.json | 7 +- .../components/Platforms/PlatformListRow.vue | 30 ++++---- .../v2/components/Platforms/PlatformTile.vue | 21 ++++-- .../composables/usePlatformPlayable/index.ts | 71 +++++++++++++++++-- frontend/src/v2/views/PlatformsIndex.vue | 1 - 5 files changed, 101 insertions(+), 29 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 99802c576..997b84315 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -3,15 +3,14 @@ "tasks": [ { "label": "Launch frontend", - "type": "npm", - "path": "frontend", - "script": "dev", + "type": "shell", + "command": "cd frontend && npm i && npm run dev", "problemMatcher": [] }, { "label": "Launch backend", "type": "shell", - "command": "cd backend && uv run python3 main.py", + "command": "cd backend && uv sync --dev && uv run python3 main.py", "problemMatcher": [] }, { diff --git a/frontend/src/v2/components/Platforms/PlatformListRow.vue b/frontend/src/v2/components/Platforms/PlatformListRow.vue index 54055c693..fe9902112 100644 --- a/frontend/src/v2/components/Platforms/PlatformListRow.vue +++ b/frontend/src/v2/components/Platforms/PlatformListRow.vue @@ -9,6 +9,10 @@ import { RPlatformIcon } from "@v2/lib"; import { computed, ref } from "vue"; import { useRouter } from "vue-router"; +import { + playableTooltip, + usePlatformPlayable, +} from "@/v2/composables/usePlatformPlayable"; import { pendingMorphName, useViewTransition, @@ -33,10 +37,6 @@ interface Props { familyName?: string | null; category?: string | null; generation?: number | null; - /** Whether any ROM on this platform can run in-browser. Pre-computed - * by the parent (PlatformsIndex) so the sort comparator and the row - * read the same value. */ - playable?: boolean; } const props = withDefaults(defineProps(), { @@ -45,7 +45,6 @@ const props = withDefaults(defineProps(), { familyName: null, category: null, generation: null, - playable: false, }); const router = useRouter(); @@ -71,6 +70,9 @@ const generationLabel = computed(() => : null, ); +const { playable, emulator } = usePlatformPlayable(() => props.slug); +const playableLabel = computed(() => playableTooltip(emulator.value)); + function onRowClick(e: MouseEvent) { if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || e.button !== 0) { return; @@ -121,15 +123,13 @@ function onRowClick(e: MouseEvent) {
- - - + + + - —
@@ -225,6 +225,10 @@ function onRowClick(e: MouseEvent) { color: var(--r-color-success); } +.plat-list-row__playable--off { + color: var(--r-color-fg-faint); +} + .plat-list-row__meta { min-width: 0; display: flex; diff --git a/frontend/src/v2/components/Platforms/PlatformTile.vue b/frontend/src/v2/components/Platforms/PlatformTile.vue index 35e40b8a7..8d7799be7 100644 --- a/frontend/src/v2/components/Platforms/PlatformTile.vue +++ b/frontend/src/v2/components/Platforms/PlatformTile.vue @@ -5,7 +5,10 @@ import { RPlatformIcon } from "@v2/lib"; import { computed, ref } from "vue"; import { useRouter } from "vue-router"; -import { usePlatformPlayable } from "@/v2/composables/usePlatformPlayable"; +import { + playableTooltip, + usePlatformPlayable, +} from "@/v2/composables/usePlatformPlayable"; import { pendingMorphName, useViewTransition, @@ -69,7 +72,8 @@ const morphStyle = computed(() => : undefined, ); -const { playable } = usePlatformPlayable(() => props.slug); +const { playable, emulator } = usePlatformPlayable(() => props.slug); +const playableLabel = computed(() => playableTooltip(emulator.value));