mirror of
https://github.com/rommapp/romm.git
synced 2026-12-03 02:24:09 +01:00
Merge pull request #612 from zurdi15/romm-547
[Romm-547] Global roms search
This commit is contained in:
@@ -13,6 +13,8 @@ class RomSchema(BaseModel):
|
||||
sgdb_id: Optional[int]
|
||||
|
||||
platform_id: int
|
||||
platform_slug: str
|
||||
platform_name: str
|
||||
|
||||
file_name: str
|
||||
file_name_no_tags: str
|
||||
|
||||
@@ -13,6 +13,8 @@ export type EnhancedRomSchema = {
|
||||
igdb_id: (number | null);
|
||||
sgdb_id: (number | null);
|
||||
platform_id: number;
|
||||
platform_slug: string;
|
||||
platform_name: string;
|
||||
file_name: string;
|
||||
file_name_no_tags: string;
|
||||
file_extension: string;
|
||||
|
||||
2
frontend/src/__generated__/models/RomSchema.ts
generated
2
frontend/src/__generated__/models/RomSchema.ts
generated
@@ -12,6 +12,8 @@ export type RomSchema = {
|
||||
igdb_id: (number | null);
|
||||
sgdb_id: (number | null);
|
||||
platform_id: number;
|
||||
platform_slug: string;
|
||||
platform_name: string;
|
||||
file_name: string;
|
||||
file_name_no_tags: string;
|
||||
file_extension: string;
|
||||
|
||||
@@ -7,6 +7,7 @@ defineProps<{ rom: Rom }>();
|
||||
</script>
|
||||
<template>
|
||||
<v-card
|
||||
:key="rom.path_cover_s"
|
||||
elevation="2"
|
||||
:loading="downloadStore.value.includes(rom.id) ? 'romm-accent-1' : false"
|
||||
>
|
||||
|
||||
@@ -17,7 +17,7 @@ defineProps<{ rom: RomSchema, platform: PlatformSchema }>();
|
||||
>
|
||||
{{ platform.name }}
|
||||
<v-avatar :rounded="0" size="40" class="ml-2 pa-2">
|
||||
<platform-icon :slug="platform.slug"></platform-icon>
|
||||
<platform-icon :key="platform.slug" :slug="platform.slug" />
|
||||
</v-avatar>
|
||||
</v-chip>
|
||||
<v-chip
|
||||
|
||||
@@ -19,7 +19,7 @@ function formatItem(rom: Rom) {
|
||||
function updateVersion() {
|
||||
router.push({
|
||||
name: "rom",
|
||||
params: { platform: props.platform.slug, rom: version.value },
|
||||
params: { rom: version.value },
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -51,7 +51,7 @@ async function deleteAssets() {
|
||||
if (romRef.value) {
|
||||
romRef.value[assetType.value] = data;
|
||||
romsStore.update(romRef.value);
|
||||
emitter?.emit("romUpdated", romRef.value)
|
||||
emitter?.emit("romUpdated", romRef.value);
|
||||
}
|
||||
})
|
||||
.catch(({ response, message }) => {
|
||||
@@ -83,6 +83,7 @@ function closeDialog() {
|
||||
@keydown.esc="closeDialog"
|
||||
no-click-animation
|
||||
persistent
|
||||
:scrim="true"
|
||||
>
|
||||
<v-card
|
||||
rounded="0"
|
||||
|
||||
@@ -31,7 +31,7 @@ function closeDialog() {
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<v-dialog v-model="show" max-width="500px" :scrim="false">
|
||||
<v-dialog v-model="show" max-width="500px" :scrim="true">
|
||||
<v-card>
|
||||
<v-toolbar density="compact" class="bg-terciary">
|
||||
<v-row class="align-center" no-gutters>
|
||||
|
||||
@@ -43,7 +43,7 @@ function closeDialog() {
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<v-dialog v-model="show" max-width="500px" :scrim="false">
|
||||
<v-dialog v-model="show" max-width="500px" :scrim="true">
|
||||
<v-card>
|
||||
<v-toolbar density="compact" class="bg-terciary">
|
||||
<v-row class="align-center" no-gutters>
|
||||
|
||||
@@ -47,6 +47,7 @@ function closeDialog() {
|
||||
@keydown.esc="closeDialog"
|
||||
no-click-animation
|
||||
persistent
|
||||
:scrim="true"
|
||||
>
|
||||
<v-card>
|
||||
<v-toolbar density="compact" class="bg-terciary">
|
||||
|
||||
@@ -51,11 +51,16 @@ function closeDialog() {
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<v-dialog v-if="platform" v-model="show" width="auto"
|
||||
<v-dialog
|
||||
v-if="platform"
|
||||
v-model="show"
|
||||
width="auto"
|
||||
@click:outside="closeDialog"
|
||||
@keydown.esc="closeDialog"
|
||||
no-click-animation
|
||||
persistent>
|
||||
:scrim="true"
|
||||
persistent
|
||||
>
|
||||
<v-card>
|
||||
<v-toolbar density="compact" class="bg-terciary">
|
||||
<v-row class="align-center" no-gutters>
|
||||
|
||||
@@ -66,6 +66,7 @@ function closeDialog() {
|
||||
@keydown.esc="closeDialog"
|
||||
no-click-animation
|
||||
persistent
|
||||
:scrim="true"
|
||||
>
|
||||
<v-card
|
||||
rounded="0"
|
||||
|
||||
@@ -77,7 +77,7 @@ function closeDialog() {
|
||||
:modelValue="show"
|
||||
scroll-strategy="none"
|
||||
width="auto"
|
||||
:scrim="false"
|
||||
:scrim="true"
|
||||
@click:outside="closeDialog"
|
||||
@keydown.esc="closeDialog"
|
||||
no-click-animation
|
||||
|
||||
@@ -101,7 +101,7 @@ onBeforeUnmount(() => {
|
||||
:modelValue="show"
|
||||
scroll-strategy="none"
|
||||
width="auto"
|
||||
:scrim="false"
|
||||
:scrim="true"
|
||||
@click:outside="closeDialog"
|
||||
@keydown.esc="closeDialog"
|
||||
no-click-animation
|
||||
@@ -121,7 +121,7 @@ onBeforeUnmount(() => {
|
||||
<v-icon icon="mdi-search-web" class="ml-5" />
|
||||
</v-col>
|
||||
|
||||
<v-col cols="8" xs="8" sm="9" md="9" lg="10">
|
||||
<v-col cols="8" xs="8" sm="9" md="10" lg="10">
|
||||
<v-item-group mandatory v-model="selectedScrapSource">
|
||||
<v-item v-slot="{ isSelected, toggle }">
|
||||
<v-chip
|
||||
@@ -152,7 +152,7 @@ onBeforeUnmount(() => {
|
||||
</v-item-group>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="2" xs="2" sm="2" md="2" lg="1">
|
||||
<v-col cols="2" xs="2" sm="2" md="1" lg="1">
|
||||
<v-btn
|
||||
@click="closeDialog"
|
||||
rounded="0"
|
||||
@@ -170,6 +170,7 @@ onBeforeUnmount(() => {
|
||||
<v-row class="align-center" no-gutters>
|
||||
<v-col cols="7" xs="7" sm="8" md="8" lg="9">
|
||||
<v-text-field
|
||||
autofocus
|
||||
@keyup.enter="searchRom()"
|
||||
@click:clear="searchTerm = ''"
|
||||
class="bg-terciary"
|
||||
@@ -293,12 +294,12 @@ onBeforeUnmount(() => {
|
||||
}
|
||||
|
||||
.search-content {
|
||||
width: 900px;
|
||||
height: 640px;
|
||||
width: 60vw;
|
||||
height: 80vh;
|
||||
}
|
||||
|
||||
.search-content-tablet {
|
||||
width: 570px;
|
||||
width: 75vw;
|
||||
height: 640px;
|
||||
}
|
||||
|
||||
|
||||
280
frontend/src/components/Dialog/Rom/SearchRomGlobal.vue
Normal file
280
frontend/src/components/Dialog/Rom/SearchRomGlobal.vue
Normal file
@@ -0,0 +1,280 @@
|
||||
<script setup lang="ts">
|
||||
import type { RomSchema } from "@/__generated__";
|
||||
import PlatformIcon from "@/components/Platform/PlatformIcon.vue";
|
||||
import api_rom from "@/services/api_rom";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import type { Emitter } from "mitt";
|
||||
import { inject, onBeforeUnmount, ref } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useDisplay } from "vuetify";
|
||||
|
||||
const { xs, mdAndDown, lgAndUp } = useDisplay();
|
||||
const show = ref(false);
|
||||
const searching = ref(false);
|
||||
const router = useRouter();
|
||||
const searchedRoms = ref();
|
||||
const filteredRoms = ref();
|
||||
const platforms = ref();
|
||||
const selectedPlatform = ref();
|
||||
const searchValue = ref("");
|
||||
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
emitter?.on("showSearchRomGlobalDialog", () => {
|
||||
show.value = true;
|
||||
});
|
||||
|
||||
function clearFilter() {
|
||||
selectedPlatform.value = null;
|
||||
}
|
||||
|
||||
async function searchRoms() {
|
||||
searching.value = true;
|
||||
searchedRoms.value = (
|
||||
await api_rom.getRoms({ searchTerm: searchValue.value, size: 250 })
|
||||
).data.items.sort((a, b) => {
|
||||
return a.platform_name.localeCompare(b.platform_name);
|
||||
});
|
||||
platforms.value = [
|
||||
...new Set(
|
||||
searchedRoms.value.map(
|
||||
(rom: { platform_name: string }) => rom.platform_name
|
||||
)
|
||||
),
|
||||
];
|
||||
filterRoms();
|
||||
searching.value = false;
|
||||
}
|
||||
|
||||
async function filterRoms() {
|
||||
if (!selectedPlatform.value) {
|
||||
filteredRoms.value = searchedRoms.value;
|
||||
} else {
|
||||
filteredRoms.value = searchedRoms.value.filter(
|
||||
(rom: { platform_name: string }) =>
|
||||
rom.platform_name == selectedPlatform.value
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function romDetails(rom: RomSchema) {
|
||||
router.push({
|
||||
name: "rom",
|
||||
params: { rom: rom.id },
|
||||
});
|
||||
closeDialog();
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
emitter?.off("showSearchRomGlobalDialog");
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-dialog
|
||||
:modelValue="show"
|
||||
scroll-strategy="none"
|
||||
width="auto"
|
||||
:scrim="true"
|
||||
@click:outside="closeDialog"
|
||||
@keydown.esc="closeDialog"
|
||||
no-click-animation
|
||||
persistent
|
||||
>
|
||||
<v-card
|
||||
:class="{
|
||||
'search-content': lgAndUp,
|
||||
'search-content-tablet': mdAndDown,
|
||||
'search-content-mobile': xs,
|
||||
}"
|
||||
rounded="0"
|
||||
>
|
||||
<v-toolbar density="compact" class="bg-terciary">
|
||||
<v-row class="align-center" no-gutters>
|
||||
<v-col cols="4" xs="4" sm="3" md="2" lg="2">
|
||||
<v-icon icon="mdi-magnify" class="ml-5" />
|
||||
<v-avatar :rounded="0" :size="30" class="mx-4"
|
||||
><v-img src="/assets/isotipo.svg"
|
||||
/></v-avatar>
|
||||
</v-col>
|
||||
|
||||
<v-col cols="6" xs="6" sm="8" md="9" lg="9" />
|
||||
|
||||
<v-col cols="2" xs="2" sm="1" md="1" lg="1">
|
||||
<v-btn
|
||||
@click="closeDialog"
|
||||
rounded="0"
|
||||
variant="text"
|
||||
icon="mdi-close"
|
||||
block
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-toolbar>
|
||||
|
||||
<v-divider class="border-opacity-25" :thickness="1" />
|
||||
|
||||
<v-toolbar density="compact" class="bg-primary">
|
||||
<v-row class="align-center" no-gutters>
|
||||
<v-col cols="6" xs="6" sm="6" md="6" lg="7">
|
||||
<v-text-field
|
||||
autofocus
|
||||
@keyup.enter="searchRoms"
|
||||
@click:clear="searchRoms"
|
||||
v-model="searchValue"
|
||||
label="Search"
|
||||
hide-details
|
||||
class="bg-terciary"
|
||||
clearable
|
||||
/>
|
||||
</v-col>
|
||||
<v-col cols="4" xs="4" sm="5" md="5" lg="4">
|
||||
<v-select
|
||||
@click:clear="clearFilter"
|
||||
clearable
|
||||
label="Platform"
|
||||
class="bg-terciary"
|
||||
hide-details
|
||||
v-model="selectedPlatform"
|
||||
@update:model-value="filterRoms"
|
||||
:items="platforms"
|
||||
>
|
||||
</v-select>
|
||||
</v-col>
|
||||
<v-col cols="2" xs="2" sm="1" md="1" lg="1">
|
||||
<v-btn
|
||||
type="submit"
|
||||
@click="searchRoms"
|
||||
class="bg-terciary"
|
||||
rounded="0"
|
||||
variant="text"
|
||||
icon="mdi-magnify"
|
||||
block
|
||||
:disabled="searching"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-toolbar>
|
||||
|
||||
<v-divider class="border-opacity-25" :thickness="1" />
|
||||
|
||||
<v-card-text class="pa-1 scroll">
|
||||
<v-row
|
||||
class="justify-center loader-searching"
|
||||
v-show="searching"
|
||||
no-gutters
|
||||
>
|
||||
<v-progress-circular
|
||||
:width="2"
|
||||
:size="40"
|
||||
color="romm-accent-1"
|
||||
indeterminate
|
||||
/>
|
||||
</v-row>
|
||||
<v-row
|
||||
class="justify-center no-results-searching"
|
||||
v-show="!searching && searchedRoms?.length == 0"
|
||||
no-gutters
|
||||
>
|
||||
<span>No results found</span>
|
||||
</v-row>
|
||||
<v-row no-gutters>
|
||||
<v-col
|
||||
class="pa-1"
|
||||
cols="4"
|
||||
sm="2"
|
||||
md="2"
|
||||
lg="2"
|
||||
xl="2"
|
||||
v-show="!searching"
|
||||
v-for="rom in filteredRoms"
|
||||
>
|
||||
<v-hover v-slot="{ isHovering, props }">
|
||||
<v-card
|
||||
@click="romDetails(rom)"
|
||||
v-bind="props"
|
||||
class="matched-rom"
|
||||
:class="{ 'on-hover': isHovering }"
|
||||
:elevation="isHovering ? 20 : 3"
|
||||
>
|
||||
<v-tooltip activator="parent" location="top" class="tooltip">{{
|
||||
rom.name
|
||||
}}</v-tooltip>
|
||||
<v-img
|
||||
v-bind="props"
|
||||
:src="`/assets/romm/resources/${rom.path_cover_l}`"
|
||||
:aspect-ratio="3 / 4"
|
||||
/>
|
||||
<v-card-text>
|
||||
<v-row class="pa-1 align-center">
|
||||
<v-col
|
||||
class="pa-0 pr-2 ma-0 text-truncate"
|
||||
cols="9"
|
||||
sm="8"
|
||||
md="9"
|
||||
lg="8"
|
||||
xl="10"
|
||||
>
|
||||
<span>{{ rom.name }}</span>
|
||||
</v-col>
|
||||
<v-col
|
||||
class="pa-0 ma-0"
|
||||
>
|
||||
<v-avatar :rounded="0" size="20">
|
||||
<platform-icon
|
||||
:key="rom.platform_slug"
|
||||
:slug="rom.platform_slug"
|
||||
/>
|
||||
</v-avatar>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-hover>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.tooltip :deep(.v-overlay__content) {
|
||||
background: rgba(201, 201, 201, 0.98) !important;
|
||||
color: rgb(41, 41, 41) !important;
|
||||
}
|
||||
.scroll {
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.loader-searching,
|
||||
.no-results-searching {
|
||||
margin-top: 200px;
|
||||
}
|
||||
|
||||
.search-content {
|
||||
width: 75vw;
|
||||
height: 80vh;
|
||||
}
|
||||
|
||||
.search-content-tablet {
|
||||
width: 75vw;
|
||||
height: 640px;
|
||||
}
|
||||
|
||||
.search-content-mobile {
|
||||
width: 85vw;
|
||||
height: 640px;
|
||||
}
|
||||
.matched-rom {
|
||||
transition-property: all;
|
||||
transition-duration: 0.1s;
|
||||
}
|
||||
.matched-rom.on-hover {
|
||||
z-index: 1 !important;
|
||||
opacity: 1;
|
||||
transform: scale(1.05);
|
||||
}
|
||||
</style>
|
||||
@@ -113,7 +113,7 @@ onBeforeUnmount(() => {
|
||||
:modelValue="show"
|
||||
scroll-strategy="none"
|
||||
width="auto"
|
||||
:scrim="false"
|
||||
:scrim="true"
|
||||
@click:outside="closeDialog"
|
||||
@keydown.esc="closeDialog"
|
||||
no-click-animation
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, inject } from "vue";
|
||||
import { useDisplay } from "vuetify";
|
||||
import type { Emitter } from "mitt";
|
||||
import type { Events } from "@/types/emitter";
|
||||
|
||||
import storePlatforms from "@/stores/platforms";
|
||||
import storeAuth from "@/stores/auth";
|
||||
import type { Emitter } from "mitt";
|
||||
import { inject, onMounted, ref } from "vue";
|
||||
import { useDisplay } from "vuetify";
|
||||
|
||||
import SearchRomGlobalDialog from "@/components/Dialog/Rom/SearchRomGlobal.vue";
|
||||
import RailFooter from "@/components/Drawer/Footer.vue";
|
||||
import DrawerHeader from "@/components/Drawer/Header.vue";
|
||||
import PlatformListItem from "@/components/Platform/PlatformListItem.vue";
|
||||
import RailFooter from "@/components/Drawer/Footer.vue";
|
||||
import storeAuth from "@/stores/auth";
|
||||
import storePlatforms from "@/stores/platforms";
|
||||
|
||||
// Props
|
||||
const { lgAndUp } = useDisplay();
|
||||
const platforms = storePlatforms();
|
||||
const auth = storeAuth();
|
||||
const drawer = ref(!!lgAndUp.value);
|
||||
const open = ref(["Platforms", "Library", "Settings"]);
|
||||
const drawer = ref(lgAndUp.value);
|
||||
const rail = ref(localStorage.getItem("rail") == "true");
|
||||
|
||||
// Event listeners bus
|
||||
@@ -27,6 +28,8 @@ emitter?.on("toggleDrawerRail", () => {
|
||||
rail.value = !rail.value;
|
||||
localStorage.setItem("rail", rail.value.toString());
|
||||
});
|
||||
|
||||
onMounted(() => {});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -40,8 +43,22 @@ emitter?.on("toggleDrawerRail", () => {
|
||||
<template v-slot:prepend>
|
||||
<drawer-header :rail="rail" />
|
||||
<v-divider />
|
||||
<v-list-item
|
||||
@click="emitter?.emit('showSearchRomGlobalDialog', null)"
|
||||
:class="{ 'px-4': !rail }"
|
||||
class="bg-terciary"
|
||||
>
|
||||
<span v-if="!rail">Search</span>
|
||||
<template v-slot:prepend>
|
||||
<v-avatar :rounded="0" size="40"
|
||||
><v-icon>mdi-magnify</v-icon></v-avatar
|
||||
>
|
||||
</template>
|
||||
</v-list-item>
|
||||
<v-divider />
|
||||
</template>
|
||||
<v-list v-model:opened="open" class="pa-0">
|
||||
|
||||
<v-list class="pa-0">
|
||||
<v-list-group value="Platforms" fluid>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-list-item v-bind="props">
|
||||
@@ -62,7 +79,8 @@ emitter?.on("toggleDrawerRail", () => {
|
||||
:key="platform.slug"
|
||||
/>
|
||||
</v-list-group>
|
||||
|
||||
</v-list>
|
||||
<v-list>
|
||||
<v-list-group
|
||||
value="Library"
|
||||
v-if="auth.scopes.includes('roms.write')"
|
||||
@@ -87,7 +105,9 @@ emitter?.on("toggleDrawerRail", () => {
|
||||
</template>
|
||||
</v-list-item>
|
||||
</v-list-group>
|
||||
</v-list>
|
||||
|
||||
<v-list>
|
||||
<v-list-group value="Settings" fluid>
|
||||
<template v-slot:activator="{ props }">
|
||||
<v-list-item v-bind="props">
|
||||
@@ -117,4 +137,6 @@ emitter?.on("toggleDrawerRail", () => {
|
||||
<rail-footer :rail="rail" />
|
||||
</template>
|
||||
</v-navigation-drawer>
|
||||
|
||||
<search-rom-global-dialog />
|
||||
</template>
|
||||
|
||||
@@ -4,13 +4,13 @@ import RailBtn from "@/components/Drawer/RailBtn.vue";
|
||||
defineProps<{ rail: boolean }>();
|
||||
</script>
|
||||
<template>
|
||||
<v-list-item :class="{ 'ml-9': !rail, 'ml-0': rail }" class="my-2">
|
||||
<v-list-item :class="{ 'ml-8': !rail, 'ml-0': rail }" class="my-2">
|
||||
<template v-slot:prepend>
|
||||
<router-link :to="{ name: 'dashboard' }">
|
||||
<v-avatar :rounded="0" :size="rail ? 40 : 60" class="mr-3"
|
||||
<v-avatar :rounded="0" :size="rail ? 40 : 60"
|
||||
><v-img src="/assets/isotipo.svg"
|
||||
/></v-avatar>
|
||||
<v-avatar v-if="!rail" :rounded="0" size="60"
|
||||
<v-avatar v-if="!rail" :rounded="0" size="60" class="ml-3"
|
||||
><v-img src="/assets/logotipo.svg"
|
||||
/></v-avatar>
|
||||
</router-link>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import { inject, ref, onMounted } from "vue";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import { debounce } from "lodash";
|
||||
import type { Emitter } from "mitt";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import { inject, onMounted, ref } from "vue";
|
||||
|
||||
import storeGalleryFilter from "@/stores/galleryFilter";
|
||||
|
||||
@@ -12,9 +12,6 @@ const filterValue = ref("");
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
onMounted(() => {
|
||||
filterValue.value = galleryFilter.filter;
|
||||
});
|
||||
|
||||
function clearFilter() {
|
||||
galleryFilter.set("");
|
||||
@@ -25,6 +22,10 @@ const filterRoms = debounce(() => {
|
||||
galleryFilter.set(filterValue.value);
|
||||
emitter?.emit("filter", null);
|
||||
}, 500);
|
||||
|
||||
onMounted(() => {
|
||||
filterValue.value = galleryFilter.filter;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -32,8 +33,8 @@ const filterRoms = debounce(() => {
|
||||
@click:clear="clearFilter"
|
||||
@keyup="filterRoms"
|
||||
v-model="filterValue"
|
||||
prepend-inner-icon="mdi-magnify"
|
||||
label="Search"
|
||||
prepend-inner-icon="mdi-filter-variant"
|
||||
label="Filter"
|
||||
rounded="0"
|
||||
hide-details
|
||||
clearable
|
||||
|
||||
@@ -28,7 +28,7 @@ defineProps<{ platform: Platform }>();
|
||||
</v-row>
|
||||
<v-row class="pa-1 justify-center">
|
||||
<v-avatar :rounded="0" size="105" class="mt-2">
|
||||
<platform-icon :slug="platform.slug"></platform-icon>
|
||||
<platform-icon :key="platform.slug" :slug="platform.slug" />
|
||||
</v-avatar>
|
||||
<v-chip
|
||||
class="bg-chip position-absolute"
|
||||
|
||||
@@ -16,7 +16,7 @@ defineProps<{ platform: Platform; rail: boolean }>();
|
||||
<span v-if="!rail" class="text-body-2">{{ platform.name }}</span>
|
||||
<template v-slot:prepend>
|
||||
<v-avatar :rounded="0" size="40">
|
||||
<platform-icon :slug="platform.slug" />
|
||||
<platform-icon :key="platform.slug" :slug="platform.slug" />
|
||||
<div
|
||||
class="igdb-icon"
|
||||
v-if="!platform.igdb_id"
|
||||
|
||||
@@ -51,7 +51,7 @@ const editable = ref(false);
|
||||
<v-list-item class="bg-terciary ma-1 pa-1 text-truncate">
|
||||
<template v-slot:prepend>
|
||||
<v-avatar :rounded="0" size="40" class="mx-2">
|
||||
<platform-icon class="platform-icon" :slug="slug" />
|
||||
<platform-icon class="platform-icon" :key="slug" :slug="slug" />
|
||||
</v-avatar>
|
||||
</template>
|
||||
<v-list-item class="bg-primary pr-2 pl-2">
|
||||
|
||||
@@ -32,19 +32,19 @@ async function uploadRoms({
|
||||
}
|
||||
|
||||
async function getRoms({
|
||||
platformId,
|
||||
platformId = null,
|
||||
size = 60,
|
||||
cursor = "",
|
||||
searchTerm = "",
|
||||
orderBy = "name",
|
||||
orderDir = "asc",
|
||||
}: {
|
||||
platformId: number;
|
||||
size?: number;
|
||||
platformId?: number | null;
|
||||
size?: number | null;
|
||||
cursor?: string | null;
|
||||
searchTerm?: string;
|
||||
orderBy?: string;
|
||||
orderDir?: string;
|
||||
searchTerm?: string | null;
|
||||
orderBy?: string | null;
|
||||
orderDir?: string | null;
|
||||
}): Promise<{ data: CursorPage_RomSchema_ }> {
|
||||
return api.get(`/roms`, {
|
||||
params: {
|
||||
|
||||
1
frontend/src/types/emitter.d.ts
vendored
1
frontend/src/types/emitter.d.ts
vendored
@@ -18,6 +18,7 @@ export type SnackbarStatus = {
|
||||
export type Events = {
|
||||
showDeletePlatformDialog: Platform;
|
||||
showSearchRomDialog: Rom;
|
||||
showSearchRomGlobalDialog: null;
|
||||
showEditRomDialog: Rom;
|
||||
showDeleteRomDialog: Rom[];
|
||||
showUploadRomDialog: null;
|
||||
|
||||
5
frontend/src/types/rom.d.ts
vendored
Normal file
5
frontend/src/types/rom.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export type RomSelectEvent = {
|
||||
event: MouseEvent;
|
||||
index: number;
|
||||
selected: boolean;
|
||||
};
|
||||
@@ -19,6 +19,7 @@ import api_rom from "@/services/api_rom";
|
||||
import storeGalleryFilter from "@/stores/galleryFilter";
|
||||
import storeGalleryView from "@/stores/galleryView";
|
||||
import storeRoms from "@/stores/roms";
|
||||
import type { RomSelectEvent } from "@/types/rom";
|
||||
import { normalizeString, toTop, views } from "@/utils";
|
||||
|
||||
// Props
|
||||
@@ -127,12 +128,6 @@ function onScroll() {
|
||||
}
|
||||
}
|
||||
|
||||
type RomSelectEvent = {
|
||||
event: MouseEvent;
|
||||
index: number;
|
||||
selected: boolean;
|
||||
};
|
||||
|
||||
function selectRom({ event, index, selected }: RomSelectEvent) {
|
||||
if (event.shiftKey) {
|
||||
const [start, end] = [romsStore.lastSelectedIndex, index].sort(
|
||||
|
||||
@@ -185,7 +185,7 @@ onBeforeUnmount(() => {
|
||||
:to="{ name: 'platform', params: { platform: platform.id } }"
|
||||
>
|
||||
<v-avatar :rounded="0" size="40">
|
||||
<platform-icon :slug="platform.slug"></platform-icon>
|
||||
<platform-icon :key="platform.slug" :slug="platform.slug" />
|
||||
</v-avatar>
|
||||
<span class="text-body-2 ml-5"> {{ platform.name }}</span>
|
||||
</v-list-item>
|
||||
|
||||
Reference in New Issue
Block a user