Merge pull request #4023 from rommapp/fix/v2-infogrid-pivot-to-search

fix(v2): pivot to a filtered search from the overview info grid
This commit is contained in:
Georges-Antoine Assi
2026-07-30 21:29:38 -04:00
committed by GitHub
2 changed files with 39 additions and 11 deletions

View File

@@ -7,7 +7,15 @@
// hover affordance so they read as candidates for click-to-filter.
// Sections with no items are omitted so the grid doesn't show empty
// columns.
//
// A section carrying a `filter` renders its chips as links into the
// global search scoped to that value (`/search?genres=Adventure`), the
// pivot-to-search v1 offered from the same rows. Links (not click
// handlers) so middle-click / open-in-new-tab work and the chips join
// keyboard + spatial navigation as `a[href]`.
import { RIcon } from "@v2/lib";
import { ROUTES } from "@/plugins/router";
import type { FilterType } from "@/stores/galleryFilter";
defineOptions({ inheritAttrs: false });
@@ -17,11 +25,19 @@ export type InfoGridSection = {
/** Leading icon for the section header — gives each category a
* semantic cue (e.g. tags for genres, building for companies). */
icon?: string;
/** Gallery filter these items map to. Set it to make the chips
* clickable pivots into a filtered search. */
filter?: FilterType;
};
const props = defineProps<{ sections: InfoGridSection[] }>();
const visible = () => props.sections.filter((s) => s.items.length > 0);
const searchLocation = (filter: FilterType, item: string) => ({
name: ROUTES.SEARCH,
query: { [filter]: item },
});
</script>
<template>
@@ -41,13 +57,16 @@ const visible = () => props.sections.filter((s) => s.items.length > 0);
<span>{{ section.label }}</span>
</div>
<div class="r-v2-det-infogrid__chips">
<span
v-for="item in section.items"
:key="item"
class="r-v2-det-infogrid__chip"
>
{{ item }}
</span>
<template v-for="item in section.items" :key="item">
<router-link
v-if="section.filter"
:to="searchLocation(section.filter, item)"
class="r-v2-det-infogrid__chip r-v2-det-infogrid__chip--link"
>
{{ item }}
</router-link>
<span v-else class="r-v2-det-infogrid__chip">{{ item }}</span>
</template>
</div>
</div>
</div>
@@ -106,4 +125,9 @@ const visible = () => props.sections.filter((s) => s.items.length > 0);
border-color: var(--r-color-brand-primary);
background: var(--r-color-surface-hover);
}
.r-v2-det-infogrid__chip--link {
cursor: pointer;
text-decoration: none;
}
</style>

View File

@@ -167,10 +167,14 @@ const lastPlayed = computed(() => {
// would be a lie. "Franchises" mirrors the singular→plural consistency
// of the surrounding rows.
const overviewSections = computed<InfoGridSection[]>(() => [
{ label: t("rom.genres"), items: genres.value },
{ label: t("rom.companies"), items: companies.value },
{ label: t("rom.franchises"), items: franchises.value },
{ label: t("rom.collections"), items: collections.value },
{ label: t("rom.genres"), items: genres.value, filter: "genres" },
{ label: t("rom.companies"), items: companies.value, filter: "companies" },
{ label: t("rom.franchises"), items: franchises.value, filter: "franchises" },
{
label: t("rom.collections"),
items: collections.value,
filter: "collections",
},
]);
const playerCount = computed<string | null>(() => {