mirror of
https://github.com/rommapp/romm.git
synced 2026-12-04 12:52:19 +01:00
Merge pull request #1670 from rommapp/3.8-beta-fixes
Fixes for `3.8.0-beta.1`
This commit is contained in:
@@ -105,7 +105,9 @@ def upgrade() -> None:
|
||||
CASE WHEN NOT r.multi THEN r.md5_hash ELSE NULL END AS md5_hash,
|
||||
CASE WHEN NOT r.multi THEN r.sha1_hash ELSE NULL END AS sha1_hash
|
||||
FROM roms r
|
||||
CROSS JOIN jsonb_array_elements(r.files) AS file_data;
|
||||
CROSS JOIN jsonb_array_elements(r.files) AS file_data
|
||||
WHERE file_data->>'filename' IS NOT NULL
|
||||
AND file_data->>'filename' <> '';
|
||||
"""
|
||||
)
|
||||
else:
|
||||
@@ -124,7 +126,10 @@ def upgrade() -> None:
|
||||
SELECT
|
||||
r.id AS rom_id,
|
||||
JSON_UNQUOTE(JSON_EXTRACT(file_data, '$.filename')) AS file_name,
|
||||
CASE WHEN r.multi = 0 THEN r.file_path ELSE CONCAT(TRIM(TRAILING '/' FROM r.file_path), '/', r.file_name) END AS file_path,
|
||||
CASE
|
||||
WHEN r.multi = 0 THEN r.file_path
|
||||
ELSE CONCAT(TRIM(TRAILING '/' FROM r.file_path), '/', r.file_name)
|
||||
END AS file_path,
|
||||
JSON_UNQUOTE(JSON_EXTRACT(file_data, '$.size')) AS file_size_bytes,
|
||||
JSON_UNQUOTE(JSON_EXTRACT(file_data, '$.last_modified')) AS last_modified,
|
||||
CASE WHEN r.multi = 0 THEN r.crc_hash ELSE NULL END AS crc_hash,
|
||||
@@ -135,7 +140,9 @@ def upgrade() -> None:
|
||||
COLUMNS (
|
||||
file_data JSON PATH '$'
|
||||
)
|
||||
) AS extracted_files;
|
||||
) AS extracted_files
|
||||
WHERE JSON_UNQUOTE(JSON_EXTRACT(file_data, '$.filename')) IS NOT NULL
|
||||
AND JSON_UNQUOTE(JSON_EXTRACT(file_data, '$.filename')) <> '';
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
@@ -257,7 +257,10 @@ class ConfigManager:
|
||||
},
|
||||
},
|
||||
},
|
||||
"filesystem": {"roms_folder": self.config.ROMS_FOLDER_NAME},
|
||||
"filesystem": {
|
||||
"roms_folder": self.config.ROMS_FOLDER_NAME,
|
||||
"firmware_folder": self.config.FIRMWARE_FOLDER_NAME,
|
||||
},
|
||||
"system": {
|
||||
"platforms": self.config.PLATFORMS_BINDING,
|
||||
"versions": self.config.PLATFORMS_VERSIONS,
|
||||
|
||||
@@ -77,16 +77,20 @@ class DBCollectionsHandler(DBBaseHandler):
|
||||
.execution_options(synchronize_session="evaluate")
|
||||
)
|
||||
|
||||
if rom_ids:
|
||||
if rom_ids is not None:
|
||||
# Delete all existing CollectionRom entries for this collection
|
||||
session.execute(
|
||||
delete(CollectionRom).where(CollectionRom.collection_id == id)
|
||||
)
|
||||
# Insert new CollectionRom entries for this collection
|
||||
session.execute(
|
||||
insert(CollectionRom),
|
||||
[{"collection_id": id, "rom_id": rom_id} for rom_id in set(rom_ids)],
|
||||
)
|
||||
if rom_ids:
|
||||
session.execute(
|
||||
insert(CollectionRom),
|
||||
[
|
||||
{"collection_id": id, "rom_id": rom_id}
|
||||
for rom_id in set(rom_ids)
|
||||
],
|
||||
)
|
||||
|
||||
return session.query(Collection).filter_by(id=id).one()
|
||||
|
||||
|
||||
@@ -881,7 +881,6 @@ IGDB_PLATFORM_LIST = (
|
||||
{"slug": "nuon", "name": "Nuon"},
|
||||
{"slug": "ps", "name": "PlayStation"},
|
||||
{"slug": "64dd", "name": "Nintendo 64DD"},
|
||||
{"slug": "64dd", "name": "Nintendo 64DD"},
|
||||
{"slug": "neo-geo-pocket-color", "name": "Neo Geo Pocket Color"},
|
||||
{"slug": "dvd-player", "name": "DVD Player"},
|
||||
{"slug": "pocketstation", "name": "PocketStation"},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { type FilterType } from "@/stores/galleryFilter";
|
||||
import RDialog from "@/components/common/RDialog.vue";
|
||||
import RAvatar from "@/components/common/Collection/RAvatar.vue";
|
||||
import type { DetailedRom } from "@/stores/roms";
|
||||
import { ROUTES } from "@/plugins/router";
|
||||
@@ -15,6 +16,7 @@ const props = defineProps<{ rom: DetailedRom }>();
|
||||
const { xs } = useDisplay();
|
||||
const theme = useTheme();
|
||||
const show = ref(false);
|
||||
const zoom = ref(false);
|
||||
const carousel = ref(0);
|
||||
const router = useRouter();
|
||||
const filters = [
|
||||
@@ -181,23 +183,26 @@ function onFilterClick(filter: FilterType, value: string) {
|
||||
/>
|
||||
</template>
|
||||
</v-carousel>
|
||||
<v-dialog v-model="show">
|
||||
<v-list-item>
|
||||
<template #append>
|
||||
<v-btn @click="show = false" icon variant="flat" size="large"
|
||||
><v-icon class="text-white text-shadow" size="25"
|
||||
>mdi-close</v-icon
|
||||
></v-btn
|
||||
>
|
||||
</template>
|
||||
</v-list-item>
|
||||
<r-dialog v-model="show">
|
||||
<v-btn
|
||||
@click="show = false"
|
||||
icon
|
||||
variant="flat"
|
||||
size="large"
|
||||
class="position-absolute right-0"
|
||||
>
|
||||
<v-icon class="text-white text-shadow" size="25">
|
||||
mdi-close
|
||||
</v-icon>
|
||||
</v-btn>
|
||||
<v-carousel
|
||||
v-model="carousel"
|
||||
hide-delimiter-background
|
||||
delimiter-icon="mdi-square"
|
||||
show-arrows="hover"
|
||||
hide-delimiters
|
||||
:height="xs ? '500' : '600'"
|
||||
:height="zoom ? '100%' : xs ? '500' : '600'"
|
||||
style="overflow: scroll"
|
||||
>
|
||||
<template #prev="{ props }">
|
||||
<v-btn
|
||||
@@ -226,8 +231,10 @@ function onFilterClick(filter: FilterType, value: string) {
|
||||
v-for="screenshot_url in rom.merged_screenshots"
|
||||
:key="screenshot_url"
|
||||
:src="screenshot_url"
|
||||
>
|
||||
</v-carousel-item>
|
||||
@click="zoom = !zoom"
|
||||
class="dialog-screenshot"
|
||||
:class="{ zoomed: zoom }"
|
||||
/>
|
||||
<template #next="{ props }">
|
||||
<v-btn
|
||||
icon="mdi-chevron-right"
|
||||
@@ -236,10 +243,20 @@ function onFilterClick(filter: FilterType, value: string) {
|
||||
/>
|
||||
</template>
|
||||
</v-carousel>
|
||||
</v-dialog>
|
||||
</r-dialog>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.dialog-screenshot {
|
||||
cursor: zoom-in;
|
||||
|
||||
&.zoomed {
|
||||
cursor: zoom-out;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { DetailedRom } from "@/stores/roms";
|
||||
import VuePdfApp from "vue3-pdf-app";
|
||||
|
||||
// Props
|
||||
const props = defineProps<{ rom: DetailedRom }>();
|
||||
defineProps<{ rom: DetailedRom }>();
|
||||
const { xs } = useDisplay();
|
||||
const theme = useTheme();
|
||||
const pdfViewerConfig = {
|
||||
|
||||
@@ -31,7 +31,7 @@ const { currentCollection } = storeToRefs(romsStore);
|
||||
>
|
||||
<template #prepend>
|
||||
<r-avatar
|
||||
@click="navigationStore.swtichActiveCollectionInfoDrawer"
|
||||
@click="navigationStore.switchActiveCollectionInfoDrawer"
|
||||
class="collection-icon cursor-pointer"
|
||||
v-if="currentCollection"
|
||||
:size="45"
|
||||
|
||||
@@ -25,7 +25,6 @@ const auth = storeAuth();
|
||||
const romsStore = storeRoms();
|
||||
const collectionsStore = storeCollection();
|
||||
const { currentCollection } = storeToRefs(romsStore);
|
||||
const { allCollections } = storeToRefs(collectionsStore);
|
||||
const navigationStore = storeNavigation();
|
||||
const imagePreviewUrl = ref<string | undefined>("");
|
||||
const removeCover = ref(false);
|
||||
@@ -105,19 +104,14 @@ async function updateCollection() {
|
||||
collection: updatedCollection.value,
|
||||
removeCover: removeCover.value,
|
||||
})
|
||||
.then(({ data: collection }) => {
|
||||
.then(({ data }) => {
|
||||
emitter?.emit("snackbarShow", {
|
||||
msg: "Collection updated successfully",
|
||||
icon: "mdi-check-bold",
|
||||
color: "green",
|
||||
});
|
||||
currentCollection.value = collection;
|
||||
const index = allCollections.value.findIndex(
|
||||
(p) => p.id === collection.id,
|
||||
);
|
||||
if (index !== -1) {
|
||||
allCollections.value[index] = collection;
|
||||
}
|
||||
currentCollection.value = data;
|
||||
collectionsStore.update(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
emitter?.emit("snackbarShow", {
|
||||
|
||||
@@ -52,7 +52,7 @@ const { activePlatformInfoDrawer } = storeToRefs(navigationStore);
|
||||
</v-app-bar>
|
||||
|
||||
<platform-info-drawer />
|
||||
<filter-drawer />
|
||||
<filter-drawer hide-platforms />
|
||||
<firmware-drawer />
|
||||
</template>
|
||||
|
||||
|
||||
@@ -3,14 +3,11 @@ import FilterBtn from "@/components/Gallery/AppBar/common/FilterBtn.vue";
|
||||
import FilterDrawer from "@/components/Gallery/AppBar/common/FilterDrawer/Base.vue";
|
||||
import GalleryViewBtn from "@/components/Gallery/AppBar/common/GalleryViewBtn.vue";
|
||||
import SearchTextField from "@/components/Gallery/AppBar/Search/SearchTextField.vue";
|
||||
import PlatformSelector from "@/components/Gallery/AppBar/Search/PlatformSelector.vue";
|
||||
import SelectingBtn from "@/components/Gallery/AppBar/common/SelectingBtn.vue";
|
||||
import SearchBtn from "@/components/Gallery/AppBar/Search/SearchBtn.vue";
|
||||
import { useDisplay } from "vuetify";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
// Props
|
||||
const { t } = useI18n();
|
||||
const { xs, smAndDown } = useDisplay();
|
||||
</script>
|
||||
|
||||
@@ -28,7 +25,6 @@ const { xs, smAndDown } = useDisplay();
|
||||
<filter-btn />
|
||||
<template v-if="!xs">
|
||||
<search-text-field />
|
||||
<platform-selector />
|
||||
</template>
|
||||
<template #append>
|
||||
<search-btn v-if="!xs" />
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import PlatformIcon from "@/components/common/Platform/Icon.vue";
|
||||
import type { Platform } from "@/stores/platforms";
|
||||
import romApi from "@/services/api/rom";
|
||||
import storeRoms from "@/stores/roms";
|
||||
import storeGalleryFilter from "@/stores/galleryFilter";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import { inject, ref } from "vue";
|
||||
import { useDisplay } from "vuetify";
|
||||
import type { Emitter } from "mitt";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
// Props
|
||||
const { xs } = useDisplay();
|
||||
const { t } = useI18n();
|
||||
const romsStore = storeRoms();
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
const searching = ref(false);
|
||||
const searched = ref(false);
|
||||
const selectedPlatform = ref<Platform | null>(null);
|
||||
const galleryFilterStore = storeGalleryFilter();
|
||||
const { filterPlatforms } = storeToRefs(galleryFilterStore);
|
||||
|
||||
// Functions
|
||||
function setFilters() {
|
||||
galleryFilterStore.setFilterGenres([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.genres.map((genre) => genre))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterFranchises([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.franchises.map((franchise) => franchise))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterCompanies([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.companies.map((company) => company))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterCollections([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.meta_collections.map((collection) => collection))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterAgeRatings([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.age_ratings.map((ageRating) => ageRating))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
function filterRoms() {
|
||||
if (selectedPlatform.value) {
|
||||
romsStore.setFiltered(
|
||||
romsStore.allRoms.filter(
|
||||
(rom) => rom.platform_id === selectedPlatform.value?.id,
|
||||
),
|
||||
galleryFilterStore,
|
||||
);
|
||||
} else {
|
||||
romsStore.setFiltered(romsStore.allRoms, galleryFilterStore);
|
||||
}
|
||||
setFilters();
|
||||
}
|
||||
|
||||
function clearFilter() {
|
||||
selectedPlatform.value = null;
|
||||
filterRoms();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-select
|
||||
:density="xs ? 'comfortable' : 'default'"
|
||||
@click:clear="clearFilter"
|
||||
:label="t('common.platform')"
|
||||
class="bg-toplayer"
|
||||
item-title="platform_name"
|
||||
:disabled="filterPlatforms.length == 0 || searching"
|
||||
hide-details
|
||||
clearable
|
||||
single-line
|
||||
return-object
|
||||
v-model="selectedPlatform"
|
||||
@update:model-value="filterRoms"
|
||||
:items="filterPlatforms"
|
||||
>
|
||||
<template #item="{ props, item }">
|
||||
<v-list-item
|
||||
class="py-2"
|
||||
v-bind="props"
|
||||
:title="item.raw.display_name ?? ''"
|
||||
>
|
||||
<template #prepend>
|
||||
<platform-icon
|
||||
:size="35"
|
||||
:key="item.raw.slug"
|
||||
:slug="item.raw.slug"
|
||||
:name="item.raw.display_name"
|
||||
:fs-slug="item.raw.fs_slug"
|
||||
/>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</template>
|
||||
<template #selection="{ item }">
|
||||
<v-list-item class="px-0" :title="item.raw.display_name ?? ''">
|
||||
<template #prepend>
|
||||
<platform-icon
|
||||
:size="35"
|
||||
:key="item.raw.slug"
|
||||
:slug="item.raw.slug"
|
||||
:name="item.raw.display_name"
|
||||
:fs-slug="item.raw.fs_slug"
|
||||
/>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</template>
|
||||
</v-select>
|
||||
</template>
|
||||
@@ -2,14 +2,12 @@
|
||||
import romApi from "@/services/api/rom";
|
||||
import storeRoms from "@/stores/roms";
|
||||
import storeGalleryFilter from "@/stores/galleryFilter";
|
||||
import storePlatforms from "@/stores/platforms";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import type { Emitter } from "mitt";
|
||||
import { inject, onMounted, watch } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { useDisplay } from "vuetify";
|
||||
import { useRouter } from "vue-router";
|
||||
import type { Platform } from "@/stores/platforms";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
// Props
|
||||
@@ -19,50 +17,9 @@ const router = useRouter();
|
||||
const romsStore = storeRoms();
|
||||
const { gettingRoms } = storeToRefs(romsStore);
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
const platformsStore = storePlatforms();
|
||||
const { allPlatforms } = storeToRefs(platformsStore);
|
||||
const galleryFilterStore = storeGalleryFilter();
|
||||
const { searchText } = storeToRefs(galleryFilterStore);
|
||||
|
||||
// Functions
|
||||
function setFilters() {
|
||||
galleryFilterStore.setFilterGenres([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.genres.map((genre) => genre))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterFranchises([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.franchises.map((franchise) => franchise))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterCompanies([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.companies.map((company) => company))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterCollections([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.meta_collections.map((collection) => collection))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterAgeRatings([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.age_ratings.map((ageRating) => ageRating))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
async function fetchRoms() {
|
||||
if (searchText.value) {
|
||||
// Auto hide android keyboard
|
||||
@@ -90,18 +47,6 @@ async function fetchRoms() {
|
||||
console.error(`Couldn't fetch roms: ${error}`);
|
||||
} finally {
|
||||
gettingRoms.value = false;
|
||||
|
||||
galleryFilterStore.setFilterPlatforms([
|
||||
...new Map(
|
||||
romsStore.filteredRoms.map((rom) => {
|
||||
const platform = allPlatforms.value.find(
|
||||
(p) => p.id === rom.platform_id,
|
||||
);
|
||||
return [rom.platform_name, platform];
|
||||
}),
|
||||
).values(),
|
||||
] as Platform[]);
|
||||
setFilters();
|
||||
galleryFilterStore.activeFilterDrawer = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,23 +4,30 @@ import FilterMatchedBtn from "@/components/Gallery/AppBar/common/FilterDrawer/Fi
|
||||
import FilterFavouritesBtn from "@/components/Gallery/AppBar/common/FilterDrawer/FilterFavouritesBtn.vue";
|
||||
import FilterDuplicatesBtn from "@/components/Gallery/AppBar/common/FilterDrawer/FilterDuplicatesBtn.vue";
|
||||
import FilterTextField from "@/components/Gallery/AppBar/common/FilterTextField.vue";
|
||||
import PlatformSelector from "@/components/Gallery/AppBar/Search/PlatformSelector.vue";
|
||||
import SearchTextField from "@/components/Gallery/AppBar/Search/SearchTextField.vue";
|
||||
import SearchBtn from "@/components/Gallery/AppBar/Search/SearchBtn.vue";
|
||||
import storeGalleryFilter from "@/stores/galleryFilter";
|
||||
import storeRoms from "@/stores/roms";
|
||||
import storePlatforms from "@/stores/platforms";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import type { Emitter } from "mitt";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { inject, nextTick, ref } from "vue";
|
||||
import { inject, nextTick, onMounted, ref, watch } from "vue";
|
||||
import { useDisplay } from "vuetify";
|
||||
import { useI18n } from "vue-i18n";
|
||||
|
||||
// Props
|
||||
withDefaults(defineProps<{ hidePlatforms?: boolean }>(), {
|
||||
hidePlatforms: false,
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
const { xs, smAndDown } = useDisplay();
|
||||
const viewportWidth = ref(window.innerWidth);
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
const galleryFilterStore = storeGalleryFilter();
|
||||
const romsStore = storeRoms();
|
||||
const platformsStore = storePlatforms();
|
||||
const {
|
||||
activeFilterDrawer,
|
||||
selectedGenre,
|
||||
@@ -35,7 +42,12 @@ const {
|
||||
filterAgeRatings,
|
||||
selectedStatus,
|
||||
filterStatuses,
|
||||
selectedPlatform,
|
||||
filterPlatforms,
|
||||
} = storeToRefs(galleryFilterStore);
|
||||
const { filteredRoms } = storeToRefs(romsStore);
|
||||
const { allPlatforms } = storeToRefs(platformsStore);
|
||||
|
||||
const filters = [
|
||||
{
|
||||
label: t("platform.genre"),
|
||||
@@ -71,6 +83,7 @@ const filters = [
|
||||
|
||||
// Functions
|
||||
function resetFilters() {
|
||||
selectedPlatform.value = null;
|
||||
selectedGenre.value = null;
|
||||
selectedFranchise.value = null;
|
||||
selectedCollection.value = null;
|
||||
@@ -82,6 +95,66 @@ function resetFilters() {
|
||||
galleryFilterStore.disableFilterFavourites();
|
||||
nextTick(() => emitter?.emit("filter", null));
|
||||
}
|
||||
|
||||
function setFilter() {
|
||||
galleryFilterStore.setFilterPlatforms([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => platformsStore.get(rom.platform_id))
|
||||
.filter((platform) => !!platform)
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterGenres([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.genres.map((genre) => genre))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterFranchises([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.franchises.map((franchise) => franchise))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterCompanies([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.companies.map((company) => company))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterCollections([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.meta_collections.map((collection) => collection))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterAgeRatings([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.age_ratings.map((ageRating) => ageRating))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
watch(
|
||||
() => filteredRoms.value,
|
||||
async () => setFilter(),
|
||||
{ immediate: true }, // Ensure watcher is triggered immediately
|
||||
);
|
||||
|
||||
watch(
|
||||
() => allPlatforms.value,
|
||||
async () => setFilter(),
|
||||
{ immediate: true }, // Ensure watcher is triggered immediately
|
||||
);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -117,9 +190,6 @@ function resetFilters() {
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-list-item>
|
||||
<v-list-item>
|
||||
<platform-selector />
|
||||
</v-list-item>
|
||||
</template>
|
||||
</template>
|
||||
<v-list-item>
|
||||
@@ -128,6 +198,18 @@ function resetFilters() {
|
||||
<filter-favourites-btn class="mt-2" />
|
||||
<filter-duplicates-btn class="mt-2" />
|
||||
</v-list-item>
|
||||
<v-list-item v-if="!hidePlatforms">
|
||||
<v-autocomplete
|
||||
v-model="selectedPlatform"
|
||||
hide-details
|
||||
clearable
|
||||
:label="t('common.platform')"
|
||||
variant="solo-filled"
|
||||
density="comfortable"
|
||||
:items="filterPlatforms.map((p) => ({ title: p.name, value: p }))"
|
||||
@update:model-value="nextTick(() => emitter?.emit('filter', null))"
|
||||
/>
|
||||
</v-list-item>
|
||||
<v-list-item v-for="filter in filters">
|
||||
<v-autocomplete
|
||||
v-model="filter.selected.value"
|
||||
|
||||
@@ -52,7 +52,7 @@ async function onScan() {
|
||||
socket.emit("scan", {
|
||||
platforms: [Number(route.params.platform)],
|
||||
roms_ids: romsStore.selectedRoms.map((r) => r.id),
|
||||
type: "partial", // Quick scan so we can filter by selected roms
|
||||
type: "quick", // Quick scan so we can filter by selected roms
|
||||
apis: heartbeat.getMetadataOptions().map((s) => s.value),
|
||||
});
|
||||
}
|
||||
@@ -105,13 +105,15 @@ async function removeFromFavourites() {
|
||||
}
|
||||
await collectionApi
|
||||
.updateCollection({ collection: favCollection.value as Collection })
|
||||
.then(() => {
|
||||
.then(({ data }) => {
|
||||
emitter?.emit("snackbarShow", {
|
||||
msg: "Roms removed from favourites successfully!",
|
||||
icon: "mdi-check-bold",
|
||||
color: "green",
|
||||
timeout: 2000,
|
||||
});
|
||||
favCollection.value = data;
|
||||
collectionsStore.update(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
|
||||
@@ -11,8 +11,8 @@ const { currentView } = storeToRefs(galleryViewStore);
|
||||
<template>
|
||||
<v-row no-gutters>
|
||||
<v-col>
|
||||
<v-row v-show="currentView != 2" no-gutters class="mx-1 mt-3"
|
||||
><v-col
|
||||
<v-row v-if="currentView != 2" no-gutters class="mx-1 mt-3">
|
||||
<v-col
|
||||
v-for="_ in 60"
|
||||
class="pa-1 align-self-end"
|
||||
:cols="views[currentView]['size-cols']"
|
||||
@@ -20,15 +20,17 @@ const { currentView } = storeToRefs(galleryViewStore);
|
||||
:md="views[currentView]['size-md']"
|
||||
:lg="views[currentView]['size-lg']"
|
||||
:xl="views[currentView]['size-xl']"
|
||||
><v-skeleton-loader type="card" /></v-col
|
||||
></v-row>
|
||||
>
|
||||
<v-skeleton-loader type="card" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-row class="h-100" v-show="currentView == 2" no-gutters>
|
||||
<v-row class="h-100" v-if="currentView == 2" no-gutters>
|
||||
<v-col class="h-100 pt-4 pb-2">
|
||||
<v-skeleton-loader
|
||||
class="mx-2"
|
||||
type="table-heading, table-tbody, table-tbody, table-row, table-row, table-row, table-row, table-row"
|
||||
></v-skeleton-loader>
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-col>
|
||||
|
||||
@@ -47,6 +47,8 @@ async function addRomsToCollection() {
|
||||
color: "green",
|
||||
timeout: 2000,
|
||||
});
|
||||
emitter?.emit("refreshDrawer", null);
|
||||
collectionsStore.update(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
|
||||
@@ -7,7 +7,6 @@ import type { UpdatedCollection } from "@/services/api/collection";
|
||||
import collectionApi from "@/services/api/collection";
|
||||
import storeCollections from "@/stores/collections";
|
||||
import storeRoms, { type SimpleRom } from "@/stores/roms";
|
||||
import { ROUTES } from "@/plugins/router";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import type { Emitter } from "mitt";
|
||||
import { inject, ref, watch } from "vue";
|
||||
@@ -53,6 +52,7 @@ async function removeRomsFromCollection() {
|
||||
timeout: 2000,
|
||||
});
|
||||
emitter?.emit("refreshDrawer", null);
|
||||
collectionsStore.update(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
|
||||
@@ -11,8 +11,6 @@ const props = withDefaults(
|
||||
size: 45,
|
||||
},
|
||||
);
|
||||
const theme = useTheme();
|
||||
const collectionsStore = storeCollections();
|
||||
|
||||
const memoizedCovers = ref({
|
||||
large: ["", ""],
|
||||
|
||||
@@ -67,7 +67,7 @@ async function switchFromFavourites() {
|
||||
}
|
||||
await collectionApi
|
||||
.updateCollection({ collection: favCollection.value as Collection })
|
||||
.then(() => {
|
||||
.then(({ data }) => {
|
||||
emitter?.emit("snackbarShow", {
|
||||
msg: `${props.rom.name} ${
|
||||
collectionsStore.isFav(props.rom) ? "added to" : "removed from"
|
||||
@@ -76,6 +76,8 @@ async function switchFromFavourites() {
|
||||
color: "green",
|
||||
timeout: 2000,
|
||||
});
|
||||
favCollection.value = data;
|
||||
collectionsStore.update(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
@@ -131,7 +133,7 @@ async function onScan() {
|
||||
socket.emit("scan", {
|
||||
platforms: [props.rom.platform_id],
|
||||
roms_ids: [props.rom.id],
|
||||
type: "partial", // Quick scan so we can filter by selected roms
|
||||
type: "quick", // Quick scan so we can filter by selected roms
|
||||
apis: heartbeat.getMetadataOptions().map((s) => s.value),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -69,6 +69,8 @@ async function switchFromFavourites() {
|
||||
color: "green",
|
||||
timeout: 2000,
|
||||
});
|
||||
favCollection.value = data;
|
||||
collectionsStore.update(data);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import RIsotipo from "@/components/common/RIsotipo.vue";
|
||||
import storeNavigation from "@/stores/navigation";
|
||||
import { ROUTES } from "@/plugins/router";
|
||||
|
||||
const navigationStore = storeNavigation();
|
||||
</script>
|
||||
<template>
|
||||
<r-isotipo
|
||||
:to="{ name: ROUTES.HOME }"
|
||||
@click="navigationStore.goHome"
|
||||
class="cursor-pointer"
|
||||
:size="40"
|
||||
/>
|
||||
<r-isotipo :to="{ name: ROUTES.HOME }" class="cursor-pointer" :size="40" />
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -36,14 +36,14 @@ async function logout() {
|
||||
color: "green",
|
||||
});
|
||||
|
||||
// Redirect to login page
|
||||
await router.push({ name: ROUTES.LOGIN });
|
||||
|
||||
// Clear all pinia stores
|
||||
// @ts-expect-error(2339)
|
||||
getActivePinia()?._s.forEach((store: StateTree) => {
|
||||
store.reset?.();
|
||||
});
|
||||
|
||||
// Redirect to login page
|
||||
await router.push({ name: ROUTES.LOGIN });
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -11,7 +11,6 @@ withDefaults(defineProps<{ platform: Platform; rail?: boolean }>(), {
|
||||
|
||||
<template>
|
||||
<v-list-item
|
||||
:key="platform.slug"
|
||||
:to="{ name: ROUTES.PLATFORM, params: { platform: platform.id } }"
|
||||
:value="platform.slug"
|
||||
rounded
|
||||
@@ -20,7 +19,6 @@ withDefaults(defineProps<{ platform: Platform; rail?: boolean }>(), {
|
||||
>
|
||||
<template #prepend>
|
||||
<platform-icon
|
||||
:key="platform.slug"
|
||||
:slug="platform.slug"
|
||||
:name="platform.name"
|
||||
:fs-slug="platform.fs_slug"
|
||||
|
||||
@@ -4,6 +4,7 @@ import EmptyGame from "@/components/common/EmptyStates/EmptyGame.vue";
|
||||
import EmptyPlatform from "@/components/common/EmptyStates/EmptyPlatform.vue";
|
||||
import RIsotipo from "@/components/common/RIsotipo.vue";
|
||||
import { onMounted, ref, useSlots } from "vue";
|
||||
import { useTheme } from "vuetify";
|
||||
|
||||
// Props
|
||||
withDefaults(
|
||||
@@ -36,6 +37,7 @@ const hasToolbarSlot = ref(false);
|
||||
const hasPrependSlot = ref(false);
|
||||
const hasAppendSlot = ref(false);
|
||||
const hasFooterSlot = ref(false);
|
||||
const theme = useTheme();
|
||||
|
||||
function closeDialog() {
|
||||
emit("update:modelValue", false);
|
||||
@@ -60,6 +62,8 @@ onMounted(() => {
|
||||
scroll-strategy="block"
|
||||
no-click-animation
|
||||
persistent
|
||||
z-index="10000"
|
||||
:scrim="theme.name.value == 'dark' ? 'black' : 'white'"
|
||||
>
|
||||
<v-card :min-height="height" :max-height="height">
|
||||
<v-toolbar density="compact" class="bg-toplayer">
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import type { RouteLocationRaw } from "vue-router";
|
||||
|
||||
withDefaults(defineProps<{ size?: number }>(), { size: 40 });
|
||||
withDefaults(defineProps<{ size?: number; to?: RouteLocationRaw }>(), {
|
||||
size: 40,
|
||||
});
|
||||
|
||||
const logos = {
|
||||
xbox: { path: "romm_logo_xbox_one_circle.svg", weight: 0.945 },
|
||||
@@ -26,7 +29,17 @@ const randomLogo = ref<string>(getRandomLogo());
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-avatar :size="size">
|
||||
<img :src="`/assets/logos/${randomLogo}`" alt="Romm Logo" :width="size" />
|
||||
</v-avatar>
|
||||
<v-btn
|
||||
:to="to"
|
||||
icon
|
||||
variant="flat"
|
||||
color="background"
|
||||
class="rounded-50"
|
||||
:height="size"
|
||||
:width="size"
|
||||
>
|
||||
<v-avatar :size="size">
|
||||
<img :src="`/assets/logos/${randomLogo}`" alt="Romm Logo" :width="size" />
|
||||
</v-avatar>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
@@ -58,8 +58,6 @@ export default defineStore("config", {
|
||||
isExclusionType(type: string): type is ExclusionTypes {
|
||||
return Object.keys(this.config).includes(type);
|
||||
},
|
||||
reset() {
|
||||
this.config = defaultConfig;
|
||||
},
|
||||
reset() {},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -20,9 +20,9 @@ export type FilterType = (typeof filters)[number];
|
||||
const defaultFilterState = {
|
||||
activeFilterDrawer: false,
|
||||
searchText: "",
|
||||
filterPlatforms: [] as Platform[],
|
||||
filterText: "",
|
||||
filters: filters,
|
||||
filterPlatforms: [] as Platform[],
|
||||
filterGenres: [] as string[],
|
||||
filterFranchises: [] as string[],
|
||||
filterCollections: [] as string[],
|
||||
@@ -33,6 +33,7 @@ const defaultFilterState = {
|
||||
filterMatched: false,
|
||||
filterFavourites: false,
|
||||
filterDuplicates: false,
|
||||
selectedPlatform: null as Platform | null,
|
||||
selectedGenre: null as string | null,
|
||||
selectedFranchise: null as string | null,
|
||||
selectedCollection: null as string | null,
|
||||
@@ -66,6 +67,11 @@ export default defineStore("galleryFilter", {
|
||||
setFilterAgeRatings(ageRatings: string[]) {
|
||||
this.filterAgeRatings = ageRatings;
|
||||
},
|
||||
setSelectedFilterPlatform(platform: Platform) {
|
||||
this.selectedPlatform = platform
|
||||
? this.filterPlatforms.find((p) => p.id === platform.id) || null
|
||||
: null;
|
||||
},
|
||||
setSelectedFilterGenre(genre: string) {
|
||||
this.selectedGenre = genre;
|
||||
},
|
||||
@@ -117,6 +123,7 @@ export default defineStore("galleryFilter", {
|
||||
this.filterMatched ||
|
||||
this.filterFavourites ||
|
||||
this.filterDuplicates ||
|
||||
this.selectedPlatform ||
|
||||
this.selectedGenre ||
|
||||
this.selectedFranchise ||
|
||||
this.selectedCollection ||
|
||||
|
||||
@@ -32,8 +32,6 @@ export default defineStore("heartbeat", {
|
||||
},
|
||||
]).value.filter((s) => !s.disabled);
|
||||
},
|
||||
reset() {
|
||||
this.value = {} as HeartbeatResponse;
|
||||
},
|
||||
reset() {},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ export default defineStore("navigation", {
|
||||
this.resetDrawersExcept("activePlatformInfoDrawer");
|
||||
this.activePlatformInfoDrawer = !this.activePlatformInfoDrawer;
|
||||
},
|
||||
swtichActiveCollectionInfoDrawer() {
|
||||
switchActiveCollectionInfoDrawer() {
|
||||
this.resetDrawersExcept("activeCollectionInfoDrawer");
|
||||
this.activeCollectionInfoDrawer = !this.activeCollectionInfoDrawer;
|
||||
},
|
||||
|
||||
@@ -40,11 +40,8 @@ export default defineStore("platforms", {
|
||||
this.allPlatforms.push(platform);
|
||||
this._reorder();
|
||||
},
|
||||
exists(platform: Platform) {
|
||||
return (
|
||||
this.allPlatforms.filter((p) => p.fs_slug == platform.fs_slug).length >
|
||||
0
|
||||
);
|
||||
has(id: number) {
|
||||
return this.allPlatforms.some((p) => p.id == id);
|
||||
},
|
||||
remove(platform: Platform) {
|
||||
this.allPlatforms = this.allPlatforms.filter((p) => {
|
||||
|
||||
@@ -172,6 +172,9 @@ export default defineStore("roms", {
|
||||
if (galleryFilter.filterDuplicates) {
|
||||
this._filterDuplicates();
|
||||
}
|
||||
if (galleryFilter.selectedPlatform) {
|
||||
this._filterPlatform(galleryFilter.selectedPlatform);
|
||||
}
|
||||
if (galleryFilter.selectedGenre) {
|
||||
this._filterGenre(galleryFilter.selectedGenre);
|
||||
}
|
||||
@@ -256,6 +259,16 @@ export default defineStore("roms", {
|
||||
// @ts-expect-error intersection is recently defined on Set
|
||||
this._filteredIDs = byDuplicates.intersection(this._filteredIDs);
|
||||
},
|
||||
_filterPlatform(platformToFilter: Platform) {
|
||||
const byPlatform = new Set(
|
||||
this.filteredRoms
|
||||
.filter((rom) => rom.platform_id === platformToFilter.id)
|
||||
.map((rom) => rom.id),
|
||||
);
|
||||
|
||||
// @ts-expect-error intersection is recently defined on Set
|
||||
this._filteredIDs = byPlatform.intersection(this._filteredIDs);
|
||||
},
|
||||
_filterGenre(genreToFilter: string) {
|
||||
const byGenre = new Set(
|
||||
this.filteredRoms
|
||||
|
||||
@@ -87,44 +87,6 @@ async function fetchRoms() {
|
||||
}
|
||||
}
|
||||
|
||||
function setFilters() {
|
||||
galleryFilterStore.setFilterGenres([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.genres.map((genre) => genre))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterFranchises([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.franchises.map((franchise) => franchise))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterCompanies([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.companies.map((company) => company))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterCollections([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.meta_collections.map((collection) => collection))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
galleryFilterStore.setFilterAgeRatings([
|
||||
...new Set(
|
||||
romsStore.filteredRoms
|
||||
.flatMap((rom) => rom.age_ratings.map((ageRating) => ageRating))
|
||||
.sort(),
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
async function onFilterChange() {
|
||||
romsStore.setFiltered(allRoms.value, galleryFilterStore);
|
||||
emitter?.emit("updateDataTablePages", null);
|
||||
@@ -197,7 +159,6 @@ function onScroll() {
|
||||
itemsShown.value < filteredRoms.value.length
|
||||
) {
|
||||
itemsShown.value = itemsShown.value + itemsPerBatch.value;
|
||||
setFilters();
|
||||
galleryViewStore.scroll = scrollHeight;
|
||||
}
|
||||
}, 100);
|
||||
@@ -241,7 +202,6 @@ onMounted(async () => {
|
||||
romsStore.setCurrentVirtualCollection(null);
|
||||
resetGallery();
|
||||
await fetchRoms();
|
||||
setFilters();
|
||||
}
|
||||
|
||||
window.addEventListener("wheel", onScroll);
|
||||
@@ -273,7 +233,6 @@ onMounted(async () => {
|
||||
romsStore.setCurrentVirtualCollection(collection);
|
||||
resetGallery();
|
||||
await fetchRoms();
|
||||
setFilters();
|
||||
}
|
||||
|
||||
window.addEventListener("wheel", onScroll);
|
||||
@@ -311,7 +270,6 @@ onBeforeRouteUpdate(async (to, from) => {
|
||||
romsStore.setCurrentCollection(collection);
|
||||
romsStore.setCurrentVirtualCollection(null);
|
||||
await fetchRoms();
|
||||
setFilters();
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -335,7 +293,6 @@ onBeforeRouteUpdate(async (to, from) => {
|
||||
romsStore.setCurrentCollection(null);
|
||||
romsStore.setCurrentVirtualCollection(collection);
|
||||
await fetchRoms();
|
||||
setFilters();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -313,9 +313,8 @@ onBeforeUnmount(() => {
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-if="filteredRoms.length > 0">
|
||||
<v-row v-show="currentView != 2" class="pb-2 mx-1 mt-3" no-gutters>
|
||||
<v-row v-if="currentView != 2" class="pb-2 mx-1 mt-3" no-gutters>
|
||||
<!-- Gallery cards view -->
|
||||
<!-- v-show instead of v-if to avoid recalculate on view change -->
|
||||
<v-col
|
||||
v-for="rom in filteredRoms.slice(0, itemsShown)"
|
||||
:key="rom.id"
|
||||
@@ -349,7 +348,7 @@ onBeforeUnmount(() => {
|
||||
</v-row>
|
||||
|
||||
<!-- Gallery list view -->
|
||||
<v-row class="h-100" v-show="currentView == 2" no-gutters>
|
||||
<v-row class="h-100" v-if="currentView == 2" no-gutters>
|
||||
<v-col class="h-100 pt-4 pb-2">
|
||||
<game-data-table class="h-100 mx-2" />
|
||||
</v-col>
|
||||
|
||||
Reference in New Issue
Block a user