show source filters only of enabled

This commit is contained in:
Zurdi
2024-04-11 23:59:35 +02:00
parent ba1b6fd414
commit 10cc41fa01
4 changed files with 23 additions and 11 deletions

View File

@@ -22,7 +22,7 @@ const isFiltered = normalizeString(galleryFilter.filterSearch).trim() != "";
const emitter = inject<Emitter<Events>>("emitter");
// Props
const heartbeatStore = storeHeartbeat();
const heartbeat = storeHeartbeat();
const configStore = storeConfig();
socket.on(
@@ -96,11 +96,11 @@ onBeforeUnmount(() => {
});
onBeforeMount(() => {
api.get("/heartbeat").then(({ data: heartBeatData }) => {
heartbeatStore.set(heartBeatData);
api.get("/heartbeat").then(({ data: data }) => {
heartbeat.set(data);
});
api.get("/config").then(({ data: configData }) => {
configStore.set(configData);
api.get("/config").then(({ data: data }) => {
configStore.set(data);
});
});
</script>

View File

@@ -2,6 +2,7 @@
import type { SearchRomSchema } from "@/__generated__";
import SelectSourceDialog from "@/components/Dialog/Rom/MatchRom/SelectSource.vue";
import romApi from "@/services/api/rom";
import storeHeartbeat from "@/stores/heartbeat";
import storeRoms, { type Rom } from "@/stores/roms";
import type { Events } from "@/types/emitter";
import type { Emitter } from "mitt";
@@ -21,6 +22,7 @@ const matchedRoms = ref<SearchRomSchema[]>([]);
const filteredMatchedRoms = ref<SearchRomSchema[]>();
const theme = useTheme();
const emitter = inject<Emitter<Events>>("emitter");
const heartbeat = storeHeartbeat();
const isIGDBFiltered = ref(true);
const isMobyFiltered = ref(true);
emitter?.on("showMatchRomDialog", (romToSearch) => {
@@ -184,6 +186,7 @@ onBeforeUnmount(() => {
open-delay="500"
><template v-slot:activator="{ props }">
<v-avatar
v-if="heartbeat.value.METADATA_SOURCES.IGDB_API_ENABLED"
@click="toggleSourceFilter('igdb')"
v-bind="props"
class="ml-3 source-filter"
@@ -203,6 +206,7 @@ onBeforeUnmount(() => {
open-delay="500"
><template v-slot:activator="{ props }">
<v-avatar
v-if="heartbeat.value.METADATA_SOURCES.MOBY_API_ENABLED"
@click="toggleSourceFilter('moby')"
v-bind="props"
class="ml-3 source-filter"

View File

@@ -1,14 +1,16 @@
<script setup lang="ts">
import type { SearchRomSchema } from "@/__generated__";
import type { Events } from "@/types/emitter";
import type { Emitter } from "mitt";
import { inject, ref } from "vue";
import { useTheme } from "vuetify";
import { useTheme, useDisplay } from "vuetify";
const show = ref(false);
const sources = ref<any>([]);
const theme = useTheme();
const emit = defineEmits(["updateRom"]);
const { xs } = useDisplay();
const emitter = inject<Emitter<Events>>("emitter");
emitter?.on("showSelectSourceDialog", (matchedRom: SearchRomSchema) => {
@@ -54,8 +56,12 @@ function closeDialog() {
scroll-strategy="none"
width="auto"
>
<v-row no-gutters>
<v-col class="pa-2 cover" v-for="source in sources">
<v-row class="justify-center" no-gutters>
<v-col
class="pa-2"
:class="{'cover':!xs, 'cover-xs': xs}"
v-for="source in sources"
>
<v-hover v-slot="{ isHovering, props }">
<v-card
@click="selectSource(source.rom, source.name)"
@@ -134,9 +140,11 @@ function closeDialog() {
<style scoped>
.cover {
min-width: 270px;
min-height: 360px;
max-width: 270px;
max-height: 360px;
}
.cover-xs {
min-width: 180px;
max-width: 180px;
}
.matched-rom {
transition-property: all;

View File

@@ -9,7 +9,7 @@ import storeScanning from "@/stores/scanning";
import type { Events } from "@/types/emitter";
import { formatBytes } from "@/utils";
import type { Emitter } from "mitt";
import { computed, inject, ref } from "vue";
import { inject, ref } from "vue";
import { useDisplay } from "vuetify";
// Props