feat(scan): enhance ROM scanning interface with virtual scrolling and improved metadata selection

- Refactor ScanPlatform.vue to always use RVirtualScroller for listing ROMs, improving performance and layout consistency.
- Introduce a maximum viewport height for the virtual scroller to prevent excessive DOM growth.
- Update ScanPlatformRow.vue to make each ROM row a clickable router link, enhancing navigation to ROM details.
- Add a synthetic "All" option in RSelect for metadata sources, allowing users to toggle all items in multi-select mode.
- Split metadata providers into general and specific categories for clearer organization in the Scan view.
- Improve styling and layout of the scan configuration card for better user experience.
This commit is contained in:
zurdi
2026-05-25 12:32:12 +00:00
parent 902b7042b3
commit 123a397c8a
10 changed files with 962 additions and 318 deletions

View File

@@ -150,6 +150,8 @@ def with_details(func):
selectinload(Rom.notes),
undefer(Rom.multi_file),
undefer(Rom.top_level_file_count),
undefer(Rom.has_manual_files),
undefer(Rom.has_soundtrack),
)
return func(*args, **kwargs)
@@ -575,6 +577,8 @@ class DBRomsHandler(DBBaseHandler):
query = query.options(
undefer(Rom.multi_file),
undefer(Rom.top_level_file_count),
undefer(Rom.has_manual_files),
undefer(Rom.has_soundtrack),
)
# Handle platform filtering - platform filtering always uses OR logic since ROMs belong to only one platform

View File

@@ -21,7 +21,13 @@ from sqlalchemy import (
or_,
select,
)
from sqlalchemy.orm import Mapped, column_property, mapped_column, relationship
from sqlalchemy.orm import (
Mapped,
column_property,
declared_attr,
mapped_column,
relationship,
)
from config import FRONTEND_RESOURCES_PATH
from models.base import (
@@ -316,13 +322,46 @@ class Rom(BaseModel):
def has_manual(self) -> bool:
return bool(self.path_manual)
@cached_property
def has_manual_files(self) -> bool:
return any(f.category == RomFileCategory.MANUAL for f in self.files)
# `has_manual_files` and `has_soundtrack` come from correlated
# `EXISTS` subqueries against rom_files filtered by category.
# `@declared_attr` lets us define the column_property inside the
# class while still referencing `cls.id` (resolved after the
# mapping is built). Deferred + opt-in via `undefer` from the
# gallery query so we don't force a `Rom.files` load (the
# relationship is `lazy="raise"` for that endpoint).
@declared_attr
def has_manual_files(cls) -> Mapped[bool]:
return column_property(
select(RomFile.id)
.where(
and_(
RomFile.rom_id == cls.id,
RomFile.category == RomFileCategory.MANUAL,
)
)
.correlate_except(RomFile)
.exists()
.select()
.scalar_subquery(),
deferred=True,
)
@cached_property
def has_soundtrack(self) -> bool:
return any(f.category == RomFileCategory.SOUNDTRACK for f in self.files)
@declared_attr
def has_soundtrack(cls) -> Mapped[bool]:
return column_property(
select(RomFile.id)
.where(
and_(
RomFile.rom_id == cls.id,
RomFile.category == RomFileCategory.SOUNDTRACK,
)
)
.correlate_except(RomFile)
.exists()
.select()
.scalar_subquery(),
deferred=True,
)
@cached_property
def merged_screenshots(self) -> list[str]:

View File

@@ -42,5 +42,12 @@
"unmatched-games": "Unmatched games",
"unmatched-games-desc": "Scan games with missing metadata matches",
"update-metadata": "Update metadata",
"update-metadata-desc": "Update metadata for matched games"
"update-metadata-desc": "Update metadata for matched games",
"section-platforms": "Platforms",
"section-metadata": "Metadata",
"section-providers": "Providers",
"section-providers-general": "General",
"section-providers-specific": "Specific",
"section-proxies": "Proxies",
"section-scan-type": "Scan type"
}

View File

@@ -69,13 +69,30 @@
"metadata-proxies": "Match proxies",
"metadata-proxies-hint": "Community-hosted matchers that improve hits using file hashes.",
"provider-igdb-desc": "Titles, descriptions, cover art, screenshots, and related-game data.",
"provider-moby-desc": "Catalogue, alternate cover art, and screenshots. The API is a paid feature.",
"provider-igdb-setup": "Requires a Twitch account with phone 2FA. Set IGDB_CLIENT_ID and IGDB_CLIENT_SECRET.",
"provider-moby-desc": "Catalogue, alternate cover art, and screenshots.",
"provider-moby-setup": "Requires a MobyGames account. Set MOBYGAMES_API_KEY.",
"provider-moby-caveat": "The API is a paid feature.",
"provider-ss-desc": "Cover art across regions, manuals, 3D boxes, and CD/cartridge art.",
"provider-ra-desc": "Achievement progress and unlock data per user. Requires file hashes.",
"provider-launchbox-desc": "Community metadata, cover art, and screenshots. Matches by exact filename.",
"provider-ss-setup": "Requires a ScreenScraper account. Set SCREENSCRAPER_USER and SCREENSCRAPER_PASSWORD.",
"provider-ra-desc": "Achievement progress and unlock data per user.",
"provider-ra-setup": "Requires a RetroAchievements account. Set RETROACHIEVEMENTS_API_KEY.",
"provider-ra-caveat": "Requires file hashes. Enable hash calculation in the scan.",
"provider-launchbox-desc": "Community metadata, cover art, and screenshots.",
"provider-launchbox-setup": "Set LAUNCHBOX_API_ENABLED=true and ENABLE_SCHEDULED_UPDATE_LAUNCHBOX_METADATA=true.",
"provider-launchbox-caveat": "Matches by exact filename; requires the local XML index.",
"provider-flashpoint-desc": "Metadata for 180,000+ Flash and browser-based games.",
"provider-flashpoint-setup": "Set FLASHPOINT_API_ENABLED=true.",
"provider-hltb-desc": "Completion-time estimates for 84,000+ games.",
"provider-hltb-setup": "Set HLTB_API_ENABLED=true.",
"provider-hltb-caveat": "Surfaces in the overview tab of the game details page.",
"provider-sgdb-desc": "Alternative cover art, banners, logos, and heroes for any game.",
"provider-sgdb-setup": "Requires a SteamGridDB account. Set STEAMGRIDDB_API_KEY.",
"provider-sgdb-caveat": "Also reachable via the manual \"search cover\" action in the edit-game menu.",
"proxy-hasheous-desc": "Hash-based matcher that proxies IGDB data and supplies RetroAchievements IDs.",
"proxy-playmatch-desc": "Hash-based matcher paired with IGDB. Community-hosted service."
"proxy-hasheous-setup": "Set HASHEOUS_API_ENABLED=true.",
"proxy-hasheous-caveat": "Community-hosted service. Requires file hashes. Enable hash calculation in the config (on by default).",
"proxy-playmatch-desc": "Hash-based matcher paired with IGDB.",
"proxy-playmatch-setup": "Set PLAYMATCH_API_ENABLED=true.",
"proxy-playmatch-caveat": "Community-hosted service."
}

View File

@@ -13,7 +13,7 @@
// whether the configured key actually works
// The combined status pill maps these to one of: disabled, missing /
// invalid key, checking, available.
import { RImg, RTag } from "@v2/lib";
import { RIcon, RImg, RTag } from "@v2/lib";
import { computed, onMounted, ref } from "vue";
import { useI18n } from "vue-i18n";
import storeHeartbeat from "@/stores/heartbeat";
@@ -32,6 +32,12 @@ interface Source {
name: string;
logoPath: string;
descKey: string;
/** Locale key for the env-var / config instructions. Shared with
* the Scan view's info dialog so both surfaces show the same
* setup hint per provider. */
setupKey: string;
/** Optional locale key for a warning / caveat pill. Shared too. */
caveatKey?: string;
disabled: boolean;
}
@@ -45,6 +51,7 @@ const catalogs = computed<Source[]>(() => {
name: "IGDB",
logoPath: "/assets/scrappers/igdb.png",
descKey: "setup.provider-igdb-desc",
setupKey: "setup.provider-igdb-setup",
disabled: !m.IGDB_API_ENABLED,
},
{
@@ -52,6 +59,7 @@ const catalogs = computed<Source[]>(() => {
name: "ScreenScraper",
logoPath: "/assets/scrappers/ss.png",
descKey: "setup.provider-ss-desc",
setupKey: "setup.provider-ss-setup",
disabled: !m.SS_API_ENABLED,
},
{
@@ -59,6 +67,8 @@ const catalogs = computed<Source[]>(() => {
name: "MobyGames",
logoPath: "/assets/scrappers/moby.png",
descKey: "setup.provider-moby-desc",
setupKey: "setup.provider-moby-setup",
caveatKey: "setup.provider-moby-caveat",
disabled: !m.MOBY_API_ENABLED,
},
{
@@ -66,6 +76,8 @@ const catalogs = computed<Source[]>(() => {
name: "LaunchBox",
logoPath: "/assets/scrappers/launchbox.png",
descKey: "setup.provider-launchbox-desc",
setupKey: "setup.provider-launchbox-setup",
caveatKey: "setup.provider-launchbox-caveat",
disabled: !m.LAUNCHBOX_API_ENABLED,
},
{
@@ -73,6 +85,7 @@ const catalogs = computed<Source[]>(() => {
name: "Flashpoint",
logoPath: "/assets/scrappers/flashpoint.png",
descKey: "setup.provider-flashpoint-desc",
setupKey: "setup.provider-flashpoint-setup",
disabled: !m.FLASHPOINT_API_ENABLED,
},
];
@@ -86,6 +99,8 @@ const specialised = computed<Source[]>(() => {
name: "RetroAchievements",
logoPath: "/assets/scrappers/ra.png",
descKey: "setup.provider-ra-desc",
setupKey: "setup.provider-ra-setup",
caveatKey: "setup.provider-ra-caveat",
disabled: !m.RA_API_ENABLED,
},
{
@@ -93,6 +108,8 @@ const specialised = computed<Source[]>(() => {
name: "SteamGridDB",
logoPath: "/assets/scrappers/sgdb.png",
descKey: "setup.provider-sgdb-desc",
setupKey: "setup.provider-sgdb-setup",
caveatKey: "setup.provider-sgdb-caveat",
disabled: !m.STEAMGRIDDB_API_ENABLED,
},
{
@@ -100,6 +117,8 @@ const specialised = computed<Source[]>(() => {
name: "HowLongToBeat",
logoPath: "/assets/scrappers/hltb.png",
descKey: "setup.provider-hltb-desc",
setupKey: "setup.provider-hltb-setup",
caveatKey: "setup.provider-hltb-caveat",
disabled: !m.HLTB_API_ENABLED,
},
];
@@ -113,6 +132,8 @@ const proxies = computed<Source[]>(() => {
name: "Hasheous",
logoPath: "/assets/scrappers/hasheous.png",
descKey: "setup.proxy-hasheous-desc",
setupKey: "setup.proxy-hasheous-setup",
caveatKey: "setup.proxy-hasheous-caveat",
disabled: !m.HASHEOUS_API_ENABLED,
},
{
@@ -120,6 +141,8 @@ const proxies = computed<Source[]>(() => {
name: "PlayMatch",
logoPath: "/assets/scrappers/playmatch.png",
descKey: "setup.proxy-playmatch-desc",
setupKey: "setup.proxy-playmatch-setup",
caveatKey: "setup.proxy-playmatch-caveat",
disabled: !m.PLAYMATCH_API_ENABLED,
},
];
@@ -224,6 +247,19 @@ onMounted(() => {
<span class="r-setup-metadata__item-desc">
{{ t(source.descKey) }}
</span>
<div class="r-setup-metadata__item-meta">
<span class="r-setup-metadata__pill">
<RIcon icon="mdi-cog-outline" size="11" />
{{ t(source.setupKey) }}
</span>
<span
v-if="source.caveatKey"
class="r-setup-metadata__pill r-setup-metadata__pill--warn"
>
<RIcon icon="mdi-alert-circle-outline" size="11" />
{{ t(source.caveatKey) }}
</span>
</div>
</div>
<RTag
size="small"
@@ -266,6 +302,19 @@ onMounted(() => {
<span class="r-setup-metadata__item-desc">
{{ t(source.descKey) }}
</span>
<div class="r-setup-metadata__item-meta">
<span class="r-setup-metadata__pill">
<RIcon icon="mdi-cog-outline" size="11" />
{{ t(source.setupKey) }}
</span>
<span
v-if="source.caveatKey"
class="r-setup-metadata__pill r-setup-metadata__pill--warn"
>
<RIcon icon="mdi-alert-circle-outline" size="11" />
{{ t(source.caveatKey) }}
</span>
</div>
</div>
<RTag
size="small"
@@ -308,6 +357,19 @@ onMounted(() => {
<span class="r-setup-metadata__item-desc">
{{ t(source.descKey) }}
</span>
<div class="r-setup-metadata__item-meta">
<span class="r-setup-metadata__pill">
<RIcon icon="mdi-cog-outline" size="11" />
{{ t(source.setupKey) }}
</span>
<span
v-if="source.caveatKey"
class="r-setup-metadata__pill r-setup-metadata__pill--warn"
>
<RIcon icon="mdi-alert-circle-outline" size="11" />
{{ t(source.caveatKey) }}
</span>
</div>
</div>
<RTag
size="small"
@@ -446,4 +508,42 @@ onMounted(() => {
color: var(--r-color-fg-muted);
line-height: var(--r-line-height-normal);
}
/* Setup / caveat pills — same vocabulary as the Scan view's info
dialog (the source-of-truth locale keys live in `setup.*`, used
by both surfaces). Wrap so dense env-var instructions can flow
onto a second line on narrow viewports. */
.r-setup-metadata__item-meta {
display: flex;
flex-wrap: wrap;
gap: var(--r-space-1);
margin-top: var(--r-space-1);
}
.r-setup-metadata__pill {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 3px 8px;
border-radius: var(--r-radius-sm);
background: var(--r-color-surface);
border: 1px solid var(--r-color-border);
font-size: var(--r-font-size-xs);
color: var(--r-color-fg-muted);
font-family:
var(--r-font-family-mono, ui-monospace), SFMono-Regular, monospace;
}
.r-setup-metadata__pill--warn {
background: color-mix(
in srgb,
var(--r-color-status-base-warning) 14%,
transparent
);
border-color: color-mix(
in srgb,
var(--r-color-status-base-warning) 36%,
transparent
);
color: var(--r-color-warning);
font-family: inherit;
}
</style>

View File

@@ -100,88 +100,89 @@ interface ProviderRow {
/** Logo path under /assets/scrappers/. Matches the same scheme the
* heartbeat store uses so consumers and reference share assets. */
logo: string;
desc: string;
setup: string;
caveat?: string;
/** Locale key for the description. Shared with the setup wizard's
* Step 3 so both views show the exact same text. */
descKey: string;
/** Locale key for the "how to configure" / env-var hint. */
setupKey: string;
/** Locale key for the optional warning / caveat pill. */
caveatKey?: string;
}
const LOGO_BASE = "/assets/scrappers";
// Static reference set — kept in sync with docs.romm.app's metadata
// providers page. Not derived from the heartbeat store because users
// often need to look up a provider *before* they've configured it
// (e.g., "what API key do I need?").
//
// Split into two groups to mirror the wizard's setup step:
// * providers — first-party services queried directly with your key.
// * proxies — community-hosted hash matchers that piggy-back on
// the providers to boost hit rates.
const providers: ProviderRow[] = [
// Static reference set — every text string lives under the wizard's
// `setup.*` locale namespace so the Setup Wizard's Step 3 and this
// dialog never drift. Split into three groups, also mirroring the
// wizard:
// * generalProviders — full-record catalogs (IGDB, MobyGames, …)
// * specificProviders — single-dimension sources (achievements,
// cover art, completion times)
// * proxies — community hash matchers
const generalProviders: ProviderRow[] = [
{
id: "igdb",
name: "IGDB",
logo: `${LOGO_BASE}/igdb.png`,
desc: "Titles, descriptions, cover art, screenshots, and related-game data.",
setup:
"Requires a Twitch account with phone 2FA. Set IGDB_CLIENT_ID and IGDB_CLIENT_SECRET.",
descKey: "setup.provider-igdb-desc",
setupKey: "setup.provider-igdb-setup",
},
{
id: "ss",
name: "ScreenScraper",
logo: `${LOGO_BASE}/ss.png`,
desc: "Cover art across regions, manuals, 3D boxes, and CD/cartridge art.",
setup:
"Requires a ScreenScraper account. Set SCREENSCRAPER_USER and SCREENSCRAPER_PASSWORD.",
descKey: "setup.provider-ss-desc",
setupKey: "setup.provider-ss-setup",
},
{
id: "moby",
name: "MobyGames",
logo: `${LOGO_BASE}/moby.png`,
desc: "Catalogue, alternate cover art, and screenshots.",
setup: "Requires a MobyGames account. Set MOBYGAMES_API_KEY.",
caveat: "The API is a paid feature.",
descKey: "setup.provider-moby-desc",
setupKey: "setup.provider-moby-setup",
caveatKey: "setup.provider-moby-caveat",
},
{
id: "launchbox",
name: "LaunchBox",
logo: `${LOGO_BASE}/launchbox.png`,
desc: "Community metadata, cover art, and screenshots.",
setup:
"Set LAUNCHBOX_API_ENABLED=true and ENABLE_SCHEDULED_UPDATE_LAUNCHBOX_METADATA=true.",
caveat: "Matches by exact filename; requires the local XML index.",
},
{
id: "ra",
name: "RetroAchievements",
logo: `${LOGO_BASE}/ra.png`,
desc: "Achievement progress and unlock data per user.",
setup:
"Requires a RetroAchievements account. Set RETROACHIEVEMENTS_API_KEY.",
caveat: "Requires file hashes — enable hash calculation in the scan.",
},
{
id: "sgdb",
name: "SteamGridDB",
logo: `${LOGO_BASE}/sgdb.png`,
desc: "Alternative cover art, banners, logos, and heroes for any game.",
setup: "Requires a SteamGridDB account. Set STEAMGRIDDB_API_KEY.",
caveat:
'Also reachable via the manual "search cover" action in the edit-game menu.',
descKey: "setup.provider-launchbox-desc",
setupKey: "setup.provider-launchbox-setup",
caveatKey: "setup.provider-launchbox-caveat",
},
{
id: "flashpoint",
name: "Flashpoint",
logo: `${LOGO_BASE}/flashpoint.png`,
desc: "Metadata for 180,000+ Flash and browser-based games.",
setup: "Set FLASHPOINT_API_ENABLED=true.",
descKey: "setup.provider-flashpoint-desc",
setupKey: "setup.provider-flashpoint-setup",
},
];
const specificProviders: ProviderRow[] = [
{
id: "ra",
name: "RetroAchievements",
logo: `${LOGO_BASE}/ra.png`,
descKey: "setup.provider-ra-desc",
setupKey: "setup.provider-ra-setup",
caveatKey: "setup.provider-ra-caveat",
},
{
id: "sgdb",
name: "SteamGridDB",
logo: `${LOGO_BASE}/sgdb.png`,
descKey: "setup.provider-sgdb-desc",
setupKey: "setup.provider-sgdb-setup",
caveatKey: "setup.provider-sgdb-caveat",
},
{
id: "hltb",
name: "How Long To Beat",
logo: `${LOGO_BASE}/hltb.png`,
desc: "Completion-time estimates for 84,000+ games.",
setup: "Set HLTB_API_ENABLED=true.",
caveat: "Surfaces in the overview tab of the game details page.",
descKey: "setup.provider-hltb-desc",
setupKey: "setup.provider-hltb-setup",
caveatKey: "setup.provider-hltb-caveat",
},
];
@@ -190,18 +191,17 @@ const proxies: ProviderRow[] = [
id: "hasheous",
name: "Hasheous",
logo: `${LOGO_BASE}/hasheous.png`,
desc: "Hash-based matcher that proxies IGDB data and supplies RetroAchievements IDs.",
setup: "Set HASHEOUS_API_ENABLED=true.",
caveat:
"Community-hosted service. Requires file hashes — enable hash calculation in the config (on by default).",
descKey: "setup.proxy-hasheous-desc",
setupKey: "setup.proxy-hasheous-setup",
caveatKey: "setup.proxy-hasheous-caveat",
},
{
id: "playmatch",
name: "PlayMatch",
logo: `${LOGO_BASE}/playmatch.png`,
desc: "Hash-based matcher paired with IGDB data.",
setup: "Set PLAYMATCH_API_ENABLED=true.",
caveat: "Community-hosted service.",
descKey: "setup.proxy-playmatch-desc",
setupKey: "setup.proxy-playmatch-setup",
caveatKey: "setup.proxy-playmatch-caveat",
},
];
@@ -258,21 +258,19 @@ function paragraphs(text: string): string[] {
</div>
<div v-else class="r-v2-scan-info__list">
<!-- General providers — full-record catalogs. Section labels
and per-provider strings come from the same `setup.*`
locale keys the Setup Wizard's Step 3 uses, so the two
views stay in sync. -->
<section class="r-v2-scan-info__section">
<header class="r-v2-scan-info__section-head">
<RIcon icon="mdi-database-search" size="14" />
<span>{{ t("scan.info-providers", "Providers") }}</span>
<span>{{ t("setup.metadata-catalogs") }}</span>
<p class="r-v2-scan-info__section-hint">
{{
t(
"scan.info-providers-hint",
"First-party services queried directly with your API key.",
)
}}
{{ t("setup.metadata-catalogs-hint") }}
</p>
</header>
<article
v-for="p in providers"
v-for="p in generalProviders"
:key="p.id"
class="r-v2-scan-info__row r-v2-scan-info__row--provider"
>
@@ -286,35 +284,71 @@ function paragraphs(text: string): string[] {
<h4 class="r-v2-scan-info__row-name">{{ p.name }}</h4>
</div>
<div class="r-v2-scan-info__row-desc">
<p class="r-v2-scan-info__para">{{ p.desc }}</p>
<p class="r-v2-scan-info__para">{{ t(p.descKey) }}</p>
<div class="r-v2-scan-info__meta">
<span class="r-v2-scan-info__pill">
<RIcon icon="mdi-cog-outline" size="11" />
{{ p.setup }}
{{ t(p.setupKey) }}
</span>
<span
v-if="p.caveat"
v-if="p.caveatKey"
class="r-v2-scan-info__pill r-v2-scan-info__pill--warn"
>
<RIcon icon="mdi-alert-circle-outline" size="11" />
{{ p.caveat }}
{{ t(p.caveatKey) }}
</span>
</div>
</div>
</article>
</section>
<!-- Specific providers — single-dimension sources. -->
<section class="r-v2-scan-info__section">
<header class="r-v2-scan-info__section-head">
<RIcon icon="mdi-shuffle-variant" size="14" />
<span>{{ t("scan.info-proxies", "Match proxies") }}</span>
<span>{{ t("setup.metadata-specialised") }}</span>
<p class="r-v2-scan-info__section-hint">
{{
t(
"scan.info-proxies-hint",
"Community-hosted hash matchers that improve hits using file hashes.",
)
}}
{{ t("setup.metadata-specialised-hint") }}
</p>
</header>
<article
v-for="p in specificProviders"
:key="p.id"
class="r-v2-scan-info__row r-v2-scan-info__row--provider"
>
<div class="r-v2-scan-info__row-head">
<RAvatar
:image="p.logo"
size="28"
rounded="sm"
class="r-v2-scan-info__logo"
/>
<h4 class="r-v2-scan-info__row-name">{{ p.name }}</h4>
</div>
<div class="r-v2-scan-info__row-desc">
<p class="r-v2-scan-info__para">{{ t(p.descKey) }}</p>
<div class="r-v2-scan-info__meta">
<span class="r-v2-scan-info__pill">
<RIcon icon="mdi-cog-outline" size="11" />
{{ t(p.setupKey) }}
</span>
<span
v-if="p.caveatKey"
class="r-v2-scan-info__pill r-v2-scan-info__pill--warn"
>
<RIcon icon="mdi-alert-circle-outline" size="11" />
{{ t(p.caveatKey) }}
</span>
</div>
</div>
</article>
</section>
<!-- Proxies — community hash matchers. -->
<section class="r-v2-scan-info__section">
<header class="r-v2-scan-info__section-head">
<span>{{ t("setup.metadata-proxies") }}</span>
<p class="r-v2-scan-info__section-hint">
{{ t("setup.metadata-proxies-hint") }}
</p>
</header>
<article
@@ -332,18 +366,18 @@ function paragraphs(text: string): string[] {
<h4 class="r-v2-scan-info__row-name">{{ p.name }}</h4>
</div>
<div class="r-v2-scan-info__row-desc">
<p class="r-v2-scan-info__para">{{ p.desc }}</p>
<p class="r-v2-scan-info__para">{{ t(p.descKey) }}</p>
<div class="r-v2-scan-info__meta">
<span class="r-v2-scan-info__pill">
<RIcon icon="mdi-cog-outline" size="11" />
{{ p.setup }}
{{ t(p.setupKey) }}
</span>
<span
v-if="p.caveat"
v-if="p.caveatKey"
class="r-v2-scan-info__pill r-v2-scan-info__pill--warn"
>
<RIcon icon="mdi-alert-circle-outline" size="11" />
{{ p.caveat }}
{{ t(p.caveatKey) }}
</span>
</div>
</div>

View File

@@ -3,13 +3,12 @@
// Scan view. Header shows the platform icon + name + per-platform
// chips (ROM count, firmware count, "not identified" badge).
//
// Body: lists every newly-scanned ROM via ScanPlatformRow. Switches to
// RVirtualScroller once the ROM count crosses VIRT_THRESHOLD so an
// initial scan with hundreds of games per platform keeps the DOM size
// bounded and scroll smooth. The threshold is high enough that small
// platforms keep the natural inline layout (no fixed-height scroll
// box), and low enough that big platforms get virtualised before the
// browser starts struggling.
// Body: lists every newly-scanned ROM via ScanPlatformRow, always
// inside an RVirtualScroller. Using the virtual scroller unconditionally
// keeps the body surface aligned with its content height regardless of
// the row count — an initial scan with hundreds of games per platform
// gets bounded DOM size, and small platforms still get the same flush
// surface (no late "growing into" the right shape as rows stream in).
import { RCollapsible, RPlatformIcon, RTag, RVirtualScroller } from "@v2/lib";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
@@ -31,22 +30,25 @@ defineEmits<{
const { t } = useI18n();
// Above this row count, the body switches to the virtual scroller with
// a bounded viewport. Below it, we keep the plain inline list so small
// platforms don't get a redundant scrollbar.
const VIRT_THRESHOLD = 50;
// Row height baked into ScanPlatformRow's scoped styles (8px padding +
// 48px cover + 8px padding + 1px border). Kept here as a constant so
// `getItemHeight` and the row style stay in sync.
const ROW_HEIGHT = 65;
// Bounded viewport for the virtualised list — tall enough to read a
// real chunk of the scan, short enough that the parent log can still
// show neighbour platforms above and below.
const VIRT_VIEWPORT_PX = 480;
// Cap the virtual scroller's viewport so it never overruns the right
// pane. Up to this many rows render at natural height; above the cap
// the container scrolls internally.
const MAX_VIEWPORT_ROWS = 8;
const shouldVirtualise = computed(
() => props.platform.roms.length >= VIRT_THRESHOLD,
);
// Use the natural cumulative height up to the cap so small / empty
// platforms don't show a tall empty box. Above the cap we lock to the
// max so streaming hundreds of rows can't push the panel off-screen.
const viewportHeight = computed(() => {
const rows = Math.min(props.platform.roms.length, MAX_VIEWPORT_ROWS);
// Always reserve at least one row's height so the body has visible
// surface even when there are no ROMs yet (the "no new roms" empty
// state still needs somewhere to sit).
return Math.max(rows, 1) * ROW_HEIGHT;
});
function getItemHeight() {
return ROW_HEIGHT;
@@ -89,15 +91,20 @@ function getItemHeight() {
/>
</template>
<!-- Virtualised path — only when the platform has crossed the
threshold. RVirtualScroller absolutely positions each row, so
we wrap it in our own surface (background, top border) instead
of leaning on the <ul> styling. -->
<!-- Always virtualised — keeps the body surface flush with its
content height regardless of how many rows have streamed in,
and bounds the DOM size on big platforms. -->
<div
v-if="platform.roms.length === 0 && platform.firmware_count === 0"
class="r-v2-scan-platform__empty"
>
{{ t("scan.no-new-roms") }}
</div>
<RVirtualScroller
v-if="shouldVirtualise"
v-else
:items="platform.roms"
:get-item-height="getItemHeight"
:height="VIRT_VIEWPORT_PX"
:height="viewportHeight"
:overscan="10"
class="r-v2-scan-platform__virtual"
>
@@ -105,33 +112,10 @@ function getItemHeight() {
<ScanPlatformRow :rom="item as SimpleRom" />
</template>
</RVirtualScroller>
<!-- Plain path — small platforms keep the natural inline list. -->
<ul v-else class="r-v2-scan-platform__rom-list">
<li v-for="rom in platform.roms" :key="rom.id">
<ScanPlatformRow :rom="rom" />
</li>
<li
v-if="platform.roms.length === 0 && platform.firmware_count === 0"
class="r-v2-scan-platform__empty"
>
{{ t("scan.no-new-roms") }}
</li>
</ul>
</RCollapsible>
</template>
<style scoped>
.r-v2-scan-platform__rom-list {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 4px;
background: var(--r-color-bg-elevated);
}
.r-v2-scan-platform__virtual {
background: var(--r-color-bg-elevated);
/* Top border so the first virtual row's border-top isn't the only

View File

@@ -7,6 +7,7 @@
// Provider chip logic and cover-fallback selection live here.
import { RImg, RTag } from "@v2/lib";
import { useI18n } from "vue-i18n";
import { ROUTES } from "@/plugins/router";
import type { SimpleRom } from "@/stores/roms";
import { getMissingCoverImage, getUnmatchedCoverImage } from "@/utils/covers";
import { useWebpSupport } from "@/v2/composables/useWebpSupport";
@@ -62,7 +63,10 @@ function coverFor(rom: SimpleRom): string {
</script>
<template>
<div class="r-v2-scan-platform__rom">
<router-link
:to="{ name: ROUTES.ROM, params: { rom: props.rom.id } }"
class="r-v2-scan-platform__rom"
>
<RImg
:src="coverFor(props.rom)"
:alt="props.rom.name || props.rom.fs_name"
@@ -112,7 +116,7 @@ function coverFor(rom: SimpleRom): string {
</span>
</template>
</div>
</div>
</router-link>
</template>
<style scoped>
@@ -127,6 +131,18 @@ function coverFor(rom: SimpleRom): string {
border = 65px. */
box-sizing: border-box;
height: 65px;
/* The row is a router-link to the ROM detail page. Strip the default
link chrome so it reads as a regular row, and give it a hover tint
to signal it's a click target. */
color: inherit;
text-decoration: none;
cursor: pointer;
transition: background var(--r-motion-fast) var(--r-motion-ease-out);
}
.r-v2-scan-platform__rom:hover,
.r-v2-scan-platform__rom:focus-visible {
background: var(--r-color-surface-hover);
outline: none;
}
.r-v2-scan-platform__cover {
flex-shrink: 0;

View File

@@ -34,6 +34,7 @@ import {
useSlots,
watch,
} from "vue";
import RDivider from "../../primitives/RDivider/RDivider.vue";
import RIcon from "../../primitives/RIcon/RIcon.vue";
import RProgressCircular from "../../primitives/RProgressCircular/RProgressCircular.vue";
import RTag from "../../primitives/RTag/RTag.vue";
@@ -70,6 +71,10 @@ interface Props {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
itemValue?: string | ((item: any) => unknown);
multiple?: boolean;
/** When true, the model holds the raw item objects instead of their
* `itemValue` keys. Read paths (selection comparisons, chip
* rendering, isSelected) are mode-agnostic — only emits change. */
returnObject?: boolean;
chips?: boolean;
closableChips?: boolean;
clearable?: boolean;
@@ -120,6 +125,15 @@ interface Props {
| "warning"
| "info"
| "plain";
/** Multi-select only: render a synthetic "All" row at the top of the
* menu (with a divider below) that toggles every item on / off. When
* no items are selected and this is on, the activator displays the
* `allOptionLabel` text instead of the placeholder — the empty
* selection reads as "every item" rather than "nothing picked". */
showAllOption?: boolean;
/** Label used by the "All" row in the menu and as the activator
* display when nothing is selected. Defaults to "All". */
allOptionLabel?: string;
}
const props = withDefaults(defineProps<Props>(), {
@@ -132,6 +146,7 @@ const props = withDefaults(defineProps<Props>(), {
itemTitle: "title",
itemValue: "value",
multiple: false,
returnObject: false,
chips: false,
closableChips: false,
clearable: false,
@@ -155,6 +170,8 @@ const props = withDefaults(defineProps<Props>(), {
menuOffset: 6,
maxVisibleChips: Number.POSITIVE_INFINITY,
chipTone: "brand",
showAllOption: false,
allOptionLabel: "All",
});
const emit = defineEmits<{
@@ -275,18 +292,24 @@ function isSelected(value: unknown): boolean {
}
const selectedItems = computed<NormalisedItem[]>(() => {
// Look up each model value against the items; preserve any value
// that has no matching item so the activator can still render
// "off-list" selections via the `#selection` slot.
return selectedValues.value.map((v) => {
const key = valueOf(v);
const match = normalisedItems.value.find((it) => it.value === key);
if (match) return match;
return { raw: v, title: String(v ?? ""), value: v };
});
// Only surface model values that are present in *this* select's
// items — keeps two subset selects sharing one model from each
// rendering the other's chips. Foreign values (no match) are
// dropped on the floor; if you genuinely need off-list rendering,
// include the value in your items list.
const byValue = new Map(normalisedItems.value.map((it) => [it.value, it]));
const out: NormalisedItem[] = [];
for (const v of selectedValues.value) {
const match = byValue.get(valueOf(v));
if (match) out.push(match);
}
return out;
});
const hasSelection = computed(() => selectedValues.value.length > 0);
// Scoped to *this* select's items via `selectedItems` so two subset
// selects sharing a model don't each think they have a selection just
// because the sibling added something.
const hasSelection = computed(() => selectedItems.value.length > 0);
// Chip overflow — keep the activator at a single line by collapsing
// chips that won't fit into a "+N" pill at the end of the row.
@@ -373,26 +396,135 @@ watch(
{ flush: "post" },
);
// What goes into the model when this select pushes an item — the raw
// object in returnObject mode, the primitive value otherwise. Read
// paths always re-extract the key via `valueOf` so the model can
// be mixed (e.g., consumer-seeded with one shape, user-toggled in
// the other).
function emitValueOf(item: NormalisedItem): unknown {
return props.returnObject ? item.raw : item.value;
}
function selectItem(item: NormalisedItem) {
if (item.disabled) return;
if (props.multiple) {
// Picking an individual while All-mode is active flips the mode
// off automatically — All and individuals are mutually exclusive,
// but the transition is one-click instead of "first deselect All,
// then pick". We preserve any model values that aren't part of
// *this* select's items so two RSelects can share a single model
// (e.g., general + specific provider selects on the Scan view)
// without clobbering each other.
if (props.showAllOption && isAllSelected.value) {
isAllSelected.value = false;
const ownSet = new Set(ownSelectableValues.value);
const preserved = Array.isArray(props.modelValue)
? (props.modelValue as unknown[]).filter((v) => !ownSet.has(valueOf(v)))
: [];
emit("update:modelValue", [...preserved, emitValueOf(item)]);
return;
}
const cur = Array.isArray(props.modelValue)
? [...(props.modelValue as unknown[])]
: [];
const idx = cur.findIndex((v) => v === item.value);
if (idx === -1) cur.push(item.value);
const idx = cur.findIndex((v) => valueOf(v) === item.value);
if (idx === -1) cur.push(emitValueOf(item));
else cur.splice(idx, 1);
emit("update:modelValue", cur);
} else {
emit("update:modelValue", item.value);
emit("update:modelValue", emitValueOf(item));
closeMenu();
}
}
// ── "All" pseudo-row (multi-select only) ───────────────────────
//
// When `showAllOption` is on, the menu prepends a synthetic "All" row
// that is **mutually exclusive** with picking individual items. The
// exclusion is enforced via auto-transitions, not disabled clicks, so
// the user never has to "first uncheck X to pick Y":
//
// * Pick an individual while All-mode is on → All flips off and the
// individual becomes the only selection.
// * Pick All while individuals are selected → All flips on and the
// individual list is cleared.
//
// Defaulting `isAllSelected = true` when the parent boots with an
// empty modelValue means the natural "no selection = all" semantics
// of the consumer (e.g. scan platforms) reads as All from the start.
// The parent doesn't need a separate v-model: empty modelValue keeps
// the same backend meaning either way; this state only governs the
// menu / chip UX.
//
// Hidden while the user is filtering — choosing "All" in a filtered
// menu would silently reach outside the visible rows.
const showAllRow = computed(
() => props.multiple && props.showAllOption && !internalSearch.value.trim(),
);
// All non-disabled item values exposed by *this* select. Used by the
// "All" toggle to scope its changes to its own items, so two selects
// sharing a model don't step on each other.
const ownSelectableValues = computed<unknown[]>(() =>
normalisedItems.value.filter((it) => !it.disabled).map((it) => it.value),
);
function hasOwnSelection(value: unknown): boolean {
if (!Array.isArray(value)) return false;
const ownSet = new Set(ownSelectableValues.value);
return (value as unknown[]).some((v) => ownSet.has(valueOf(v)));
}
function isInitialAllSelected(): boolean {
if (!props.multiple || !props.showAllOption) return false;
const v = props.modelValue;
if (v == null) return true;
if (Array.isArray(v)) return !hasOwnSelection(v);
return false;
}
const isAllSelected = ref(isInitialAllSelected());
// When the parent pushes a model that contains any of *this* select's
// items, leave All-mode automatically — those items are individual
// selections that can't coexist with All. Foreign items (from a
// sibling select sharing the model) don't trip this.
watch(
() => props.modelValue,
(next) => {
if (Array.isArray(next) && hasOwnSelection(next)) {
isAllSelected.value = false;
}
},
);
function toggleAllItems() {
if (!props.multiple || !props.showAllOption) return;
if (isAllSelected.value) {
// Drop All-mode without touching individuals (they're already
// empty since All was on). The user can now pick from the list.
isAllSelected.value = false;
} else {
// Switching INTO All-mode strips *this* select's items from the
// model so the mutual-exclusion invariant holds locally. Items
// owned by a sibling select stay put.
isAllSelected.value = true;
if (Array.isArray(props.modelValue)) {
const ownSet = new Set(ownSelectableValues.value);
const preserved = (props.modelValue as unknown[]).filter(
(v) => !ownSet.has(valueOf(v)),
);
emit("update:modelValue", preserved);
} else {
emit("update:modelValue", []);
}
}
}
function removeSelection(value: unknown) {
if (props.multiple) {
const cur = Array.isArray(props.modelValue)
? (props.modelValue as unknown[]).filter((v) => v !== value)
? (props.modelValue as unknown[]).filter((v) => valueOf(v) !== value)
: [];
emit("update:modelValue", cur);
} else {
@@ -401,7 +533,27 @@ function removeSelection(value: unknown) {
}
function clear() {
emit("update:modelValue", props.multiple ? [] : null);
if (props.multiple && props.showAllOption) {
// Clearing while All-mode is on drops back to the neutral
// "nothing picked, both choices available" state instead of
// re-arming All implicitly.
isAllSelected.value = false;
}
if (props.multiple) {
// Only strip *this* select's items from the model so a sibling
// select sharing the same v-model keeps its selection.
if (Array.isArray(props.modelValue)) {
const ownSet = new Set(ownSelectableValues.value);
const preserved = (props.modelValue as unknown[]).filter(
(v) => !ownSet.has(valueOf(v)),
);
emit("update:modelValue", preserved);
} else {
emit("update:modelValue", []);
}
} else {
emit("update:modelValue", null);
}
emit("clear");
}
@@ -804,8 +956,30 @@ const hasPrependInner = computed(
/>
</span>
<!-- Empty — show placeholder or label. -->
<span v-if="!hasSelection" class="r-select__placeholder">
<!-- All-mode active → render a single "All" chip in place of
the regular selection. Closable so the user can drop All
without opening the menu. -->
<RTag
v-if="isAllSelected && multiple && showAllOption"
class="r-select__chip r-select__chip--all"
:tone="chipTone"
size="small"
>
{{ allOptionLabel }}
<template v-if="closableChips" #append>
<button
type="button"
class="r-select__chip-close"
tabindex="-1"
aria-label="Remove"
@mousedown.prevent
@click.stop="isAllSelected = false"
>
<RIcon icon="mdi-close" size="x-small" />
</button>
</template>
</RTag>
<span v-else-if="!hasSelection" class="r-select__placeholder">
{{ effectivePlaceholder }}
</span>
<!-- Multi with chips — render the visible slice as removable
@@ -955,6 +1129,37 @@ const hasPrependInner = computed(
</div>
<ul class="r-select__list">
<!-- Synthetic "All" row — multi-select only, suppressed
while the user is filtering. Sits above the regular
items and is separated by a divider so it reads as a
meta action rather than a list item. -->
<template v-if="showAllRow">
<li
class="r-select__item r-select__item--all"
:class="{ 'r-select__item--selected': isAllSelected }"
role="option"
:aria-selected="isAllSelected"
tabindex="-1"
@click="toggleAllItems"
@mouseenter="activeIndex = -1"
>
<span class="r-select__item-title">{{ allOptionLabel }}</span>
<RIcon
v-if="isAllSelected"
icon="mdi-check"
class="r-select__item-check"
size="x-small"
/>
</li>
<li
v-if="filteredItems.length"
class="r-select__divider"
aria-hidden="true"
>
<RDivider />
</li>
</template>
<li v-if="!filteredItems.length" class="r-select__empty">
<slot name="no-data">No options</slot>
</li>
@@ -1164,6 +1369,26 @@ const hasPrependInner = computed(
color: var(--r-color-fg-faint);
}
/* Synthetic "All" row in the menu — slightly emphasised so it reads
as a meta action rather than just another item. The divider sits
on a non-interactive li with reset padding. */
.r-select__item--all {
font-weight: var(--r-font-weight-semibold);
}
/* The All row is hovered via CSS — `activeIndex` is reserved for the
filtered-items list (keyboard navigation), so we can't piggyback on
the `--active` class here. */
.r-select__item--all:hover {
background: var(--r-color-surface);
color: var(--r-color-fg);
}
.r-select__divider {
padding: 0;
margin: 4px 0;
pointer-events: none;
list-style: none;
}
/* When an adornment is present on either side, trim the inner gap so
the value text sits close to the adornment. */
.r-select__field:has(.r-select__adornment--prepend) .r-select__value {

View File

@@ -214,6 +214,31 @@ function isHashMatcherOn(matcher: HashMatcher): boolean {
: playmatchEnabled.value;
}
// Provider categorisation — mirrors the split used by the setup
// wizard's metadata step. General catalogs ship a full game record
// (title, artwork, descriptions); specific sources add a single
// domain dimension (achievements, completion times, custom art).
// Each group renders its own RSelect; both share `metadataSources`
// as the model. RSelect's `show-all-option` is subset-safe — toggling
// All in one group doesn't touch the other.
const GENERAL_PROVIDER_KEYS = new Set([
"igdb",
"ss",
"moby",
"launchbox",
"flashpoint",
"gamelist",
"libretro",
]);
const SPECIFIC_PROVIDER_KEYS = new Set(["ra", "sgdb", "hltb"]);
const generalProviders = computed<MetadataOption[]>(() =>
metadataOptions.value.filter((o) => GENERAL_PROVIDER_KEYS.has(o.value)),
);
const specificProviders = computed<MetadataOption[]>(() =>
metadataOptions.value.filter((o) => SPECIFIC_PROVIDER_KEYS.has(o.value)),
);
// Auto-expand a platform's panel the moment it starts reporting roms
// or firmware. We track by `id:hasContent` so the watch fires only on
// the 0 → 1 transition, not per-ROM.
@@ -425,155 +450,279 @@ function stopScan() {
</div>
<div class="r-v2-scan-card__fields">
<PlatformSelect
v-model="platformsToScan"
:items="sortedPlatforms"
:label="t('common.platforms')"
prepend-inner-icon="mdi-controller"
:icon-size="32"
multiple
clearable
hide-details
chips
show-meta
/>
<!-- 1. Platform controls -->
<section class="r-v2-scan-card__section">
<h3 class="r-v2-scan-card__section-title">
{{ t("scan.section-platforms") }}
</h3>
<PlatformSelect
v-model="platformsToScan"
:items="sortedPlatforms"
:label="t('common.platforms')"
prepend-inner-icon="mdi-controller"
:icon-size="32"
multiple
clearable
hide-details
chips
show-meta
show-all-option
/>
</section>
<RSelect
v-model="metadataSources"
:items="metadataOptions"
:label="t('scan.metadata-sources')"
item-title="name"
prepend-inner-icon="mdi-database-search"
variant="outlined"
multiple
return-object
clearable
hide-details
chips
chip-tone="plain"
>
<template #chip="{ item }">
<RTooltip :text="item.raw.name" location="bottom">
<template #activator="{ props: tipProps }">
<span
v-bind="tipProps"
class="r-v2-scan-card__provider-chip"
:aria-label="item.raw.name"
>
<RAvatar :image="item.raw.logo_path" size="18" rounded="sm" />
</span>
</template>
</RTooltip>
</template>
<template #item="{ props: itemProps, item }">
<li v-bind="itemProps">
<RAvatar :image="item.raw.logo_path" size="22" rounded="sm" />
<div class="r-select__item-stack">
<div class="r-select__item-title">
{{ item.raw.name }}
</div>
<div v-if="item.raw.disabled" class="r-select__item-subtitle">
{{ item.raw.disabled }}
</div>
</div>
<!-- 2. Metadata controls — providers (2.1) + proxies (2.2)
share one section so it reads as "data we pull from
external sources". -->
<section class="r-v2-scan-card__section">
<h3 class="r-v2-scan-card__section-title">
{{ t("scan.section-metadata") }}
</h3>
<div
v-if="item.raw.value === 'launchbox'"
class="r-v2-scan-card__lb-toggle"
<!-- 2.1 providers — two RSelects sharing the same
`metadataSources` model, one per category. The
primitive's `show-all-option` is subset-safe so the
"All" toggle in one group only affects that group's
items. -->
<div class="r-v2-scan-card__subsection">
<span class="r-v2-scan-card__subsection-label">
{{ t("scan.section-providers") }}
</span>
<div class="r-v2-scan-card__providers-group">
<span class="r-v2-scan-card__providers-group-label">
{{ t("scan.section-providers-general") }}
</span>
<RSelect
v-model="metadataSources"
:items="generalProviders"
:label="t('scan.section-providers-general')"
item-title="name"
prepend-inner-icon="mdi-database-search"
variant="outlined"
multiple
return-object
clearable
hide-details
chips
chip-tone="plain"
show-all-option
>
<span
class="text-caption"
:class="{
'r-v2-scan-card__lb-inactive': launchboxRemoteEnabled,
}"
>
Local
</span>
<RSwitch
v-model="launchboxRemoteEnabled"
:disabled="!isLaunchboxSelected"
@click.stop
@mousedown.stop
/>
<span
class="text-caption"
:class="{
'r-v2-scan-card__lb-inactive': !launchboxRemoteEnabled,
}"
>
Cloud
</span>
</div>
</li>
</template>
</RSelect>
<template #chip="{ item }">
<RTooltip :text="item.raw.name" location="bottom">
<template #activator="{ props: tipProps }">
<span
v-bind="tipProps"
class="r-v2-scan-card__provider-chip"
:aria-label="item.raw.name"
>
<RAvatar
:image="item.raw.logo_path"
size="18"
rounded="sm"
/>
</span>
</template>
</RTooltip>
</template>
<template #item="{ props: itemProps, item }">
<li v-bind="itemProps">
<RAvatar
:image="item.raw.logo_path"
size="22"
rounded="sm"
/>
<div class="r-select__item-stack">
<div class="r-select__item-title">
{{ item.raw.name }}
</div>
<div
v-if="item.raw.disabled"
class="r-select__item-subtitle"
>
{{ item.raw.disabled }}
</div>
</div>
<!-- Hash-matcher switch pills. See header comment for the
behaviour summary; the Info dialog covers what they do. -->
<div
class="r-v2-scan-card__matchers"
role="group"
aria-label="Hash matchers"
>
<RTooltip
v-for="matcher in hashMatchers"
:key="matcher.value"
:text="
matcher.blockedReason
? `${matcher.name} — ${matcher.blockedReason}`
: matcher.name
"
location="bottom"
<!-- LaunchBox: Local/Cloud inline toggle inside its
dropdown row. Disabled until LaunchBox itself
is selected. -->
<div
v-if="item.raw.value === 'launchbox'"
class="r-v2-scan-card__lb-toggle"
@click.stop
@mousedown.stop
>
<span
class="r-v2-scan-card__lb-label"
:class="{
'r-v2-scan-card__lb-inactive': launchboxRemoteEnabled,
}"
>
Local
</span>
<RSwitch
v-model="launchboxRemoteEnabled"
:disabled="!isLaunchboxSelected"
/>
<span
class="r-v2-scan-card__lb-label"
:class="{
'r-v2-scan-card__lb-inactive':
!launchboxRemoteEnabled,
}"
>
Cloud
</span>
</div>
</li>
</template>
</RSelect>
</div>
<div
v-if="specificProviders.length"
class="r-v2-scan-card__providers-group"
>
<span class="r-v2-scan-card__providers-group-label">
{{ t("scan.section-providers-specific") }}
</span>
<RSelect
v-model="metadataSources"
:items="specificProviders"
:label="t('scan.section-providers-specific')"
item-title="name"
prepend-inner-icon="mdi-trophy-outline"
variant="outlined"
multiple
return-object
clearable
hide-details
chips
chip-tone="plain"
show-all-option
>
<template #chip="{ item }">
<RTooltip :text="item.raw.name" location="bottom">
<template #activator="{ props: tipProps }">
<span
v-bind="tipProps"
class="r-v2-scan-card__provider-chip"
:aria-label="item.raw.name"
>
<RAvatar
:image="item.raw.logo_path"
size="18"
rounded="sm"
/>
</span>
</template>
</RTooltip>
</template>
<template #item="{ props: itemProps, item }">
<li v-bind="itemProps">
<RAvatar
:image="item.raw.logo_path"
size="22"
rounded="sm"
/>
<div class="r-select__item-stack">
<div class="r-select__item-title">
{{ item.raw.name }}
</div>
<div
v-if="item.raw.disabled"
class="r-select__item-subtitle"
>
{{ item.raw.disabled }}
</div>
</div>
</li>
</template>
</RSelect>
</div>
</div>
<!-- 2.2 proxies (hash matchers) -->
<div class="r-v2-scan-card__subsection">
<span class="r-v2-scan-card__subsection-label">
{{ t("scan.section-proxies") }}
</span>
<div
class="r-v2-scan-card__matchers"
role="group"
aria-label="Hash matchers"
>
<RTooltip
v-for="matcher in hashMatchers"
:key="matcher.value"
:text="
matcher.blockedReason
? `${matcher.name}: ${matcher.blockedReason}`
: matcher.name
"
location="bottom"
>
<template #activator="{ props: tipProps }">
<div
v-bind="tipProps"
class="r-v2-scan-card__matcher"
:class="{
'r-v2-scan-card__matcher--off': !matcher.switchEnabled,
}"
>
<RAvatar
:image="matcher.logo"
size="16"
rounded="sm"
class="r-v2-scan-card__matcher-logo"
/>
<RSwitch
:model-value="isHashMatcherOn(matcher)"
:disabled="!matcher.switchEnabled"
:aria-label="matcher.name"
@update:model-value="
(v) => setHashMatcher(matcher.value, v)
"
/>
</div>
</template>
</RTooltip>
</div>
</div>
</section>
<!-- 3. Scan type controls -->
<section class="r-v2-scan-card__section">
<h3 class="r-v2-scan-card__section-title">
{{ t("scan.section-scan-type") }}
</h3>
<RSelect
v-model="scanType"
:items="scanOptions"
:label="t('scan.scan-options')"
prepend-inner-icon="mdi-magnify-scan"
hide-details
variant="outlined"
>
<template #activator="{ props: tipProps }">
<div
v-bind="tipProps"
class="r-v2-scan-card__matcher"
:class="{
'r-v2-scan-card__matcher--off': !matcher.switchEnabled,
}"
>
<RAvatar
:image="matcher.logo"
size="16"
rounded="sm"
class="r-v2-scan-card__matcher-logo"
/>
<RSwitch
:model-value="isHashMatcherOn(matcher)"
:disabled="!matcher.switchEnabled"
:aria-label="matcher.name"
@update:model-value="(v) => setHashMatcher(matcher.value, v)"
/>
</div>
<template #item="{ props: itemProps, item }">
<li v-bind="itemProps">
<div class="r-select__item-stack">
<div class="r-select__item-title">
{{ item.title }}
</div>
<div v-if="item.raw.subtitle" class="r-select__item-subtitle">
{{ item.raw.subtitle }}
</div>
</div>
</li>
</template>
</RTooltip>
</div>
<RSelect
v-model="scanType"
:items="scanOptions"
:label="t('scan.scan-options')"
prepend-inner-icon="mdi-magnify-scan"
hide-details
variant="outlined"
>
<template #item="{ props: itemProps, item }">
<li v-bind="itemProps">
<div class="r-select__item-stack">
<div class="r-select__item-title">
{{ item.title }}
</div>
<div v-if="item.raw.subtitle" class="r-select__item-subtitle">
{{ item.raw.subtitle }}
</div>
</div>
</li>
</template>
</RSelect>
</RSelect>
</section>
</div>
<footer class="r-v2-scan-card__cta">
<!-- 4. Action buttons — untitled; the divider above marks the
boundary between "config" and "actions" without a label. -->
<footer class="r-v2-scan-card__section r-v2-scan-card__cta">
<div class="r-v2-scan-card__hints">
<RAlert
v-if="metadataSources.length === 0"
@@ -828,12 +977,55 @@ function stopScan() {
.r-v2-scan-card__fields {
display: flex;
flex-direction: column;
gap: 16px;
/* Matches the parent card's 18px gap so every divider — between
fields-internal sections AND between __fields/__cta — has the
same breathing room above and below. */
gap: 18px;
}
/* Each numbered section in the config card: small uppercase label
above its content, divided from the next section by a hairline
border-top. The first section inside `__fields` drops the border
so the head row doesn't sit under a stray line; the `__cta` footer
keeps its border because it sits below `__fields` and the divider
separates "configuration" from "actions". */
.r-v2-scan-card__section {
display: flex;
flex-direction: column;
gap: 10px;
padding-top: 14px;
border-top: 1px solid var(--r-color-border);
}
.r-v2-scan-card__section:first-child {
padding-top: 0;
border-top: 0;
}
.r-v2-scan-card__section-title {
margin: 0;
font-size: 11px;
font-weight: var(--r-font-weight-semibold);
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--r-color-fg-muted);
}
/* Sub-section inside Metadata (providers / proxies). Tightly spaced
so they read as siblings of the same section, separated by a small
muted label rather than a divider. */
.r-v2-scan-card__subsection {
display: flex;
flex-direction: column;
gap: 6px;
}
.r-v2-scan-card__subsection-label {
font-size: 10.5px;
font-weight: var(--r-font-weight-medium);
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--r-color-fg-faint);
}
.r-v2-scan-card__cta {
display: flex;
flex-direction: column;
align-items: stretch;
gap: 8px;
}
@@ -853,30 +1045,40 @@ function stopScan() {
display: none;
}
/* Provider chip — icon-only chip inside the RSelect chip slot. */
/* Providers split into General / Specific groups. Each group has a
tiny inline caption above its RSelect — same visual rhythm as the
subsection label, indented one level deeper. */
.r-v2-scan-card__providers-group {
display: flex;
flex-direction: column;
gap: 4px;
}
.r-v2-scan-card__providers-group + .r-v2-scan-card__providers-group {
margin-top: 8px;
}
.r-v2-scan-card__providers-group-label {
font-size: 10px;
font-weight: var(--r-font-weight-medium);
letter-spacing: 0.04em;
color: var(--r-color-fg-faint);
}
/* Provider chip in the activator — icon-only avatar so a multi-select
doesn't drown the field in coloured pills. The `#chip` slot renders
into RSelect's RTag. */
.r-v2-scan-card__provider-chip {
display: inline-flex;
align-items: center;
justify-content: center;
}
.r-v2-scan-card__lb-toggle {
display: inline-flex;
align-items: center;
gap: 8px;
}
.r-v2-scan-card__lb-inactive {
color: var(--r-color-fg-muted);
}
/* Hash matchers — compact pills sitting between provider + scan-type
selects. Each pill is logo + small switch + tooltip; the Info
dialog covers the meaning. In the stacked field layout they sit
as a small row inside the column. */
/* Hash-matcher proxies — compact icon + switch pills (kept as direct
pills since there are only two and a select would be overkill). */
.r-v2-scan-card__matchers {
display: flex;
flex-direction: row;
align-items: center;
flex-wrap: wrap;
gap: 6px;
align-self: flex-start;
}
@@ -897,6 +1099,22 @@ function stopScan() {
flex-shrink: 0;
}
/* LaunchBox Local/Cloud toggle inline inside its dropdown item. */
.r-v2-scan-card__lb-toggle {
display: inline-flex;
align-items: center;
gap: 6px;
margin-left: auto;
}
.r-v2-scan-card__lb-label {
font-size: 11px;
color: var(--r-color-fg);
white-space: nowrap;
}
.r-v2-scan-card__lb-inactive {
color: var(--r-color-fg-muted);
}
/* === Live area (right column) ================================
Same flat surface vocabulary as the config card (Profile-style).
Header doubles as the live status panel (pulse + label + counters