Fix bugs + add back loading bar

This commit is contained in:
Georges-Antoine Assi
2023-07-27 11:10:55 -04:00
parent 504769a88e
commit a022ec48c5
6 changed files with 292 additions and 199 deletions

View File

@@ -1,12 +1,13 @@
<script setup>
import { ref } from 'vue'
import { downloadRomApi } from '@/services/api.js'
import useDownloadStore from "@/stores/download.js";
const downloadStore = useDownloadStore();
// Props
const props = defineProps(['rom'])
const saveFiles = ref(false)
// Event listeners bus
const downloadUrl = `${window.location.origin}${props.rom.download_path}`
</script>
@@ -15,48 +16,32 @@ const downloadUrl = `${window.location.origin}${props.rom.download_path}`
<v-row>
<v-col class="pa-0">
<template v-if="rom.multi">
<v-btn
@click="downloadRomApi(rom)"
icon="mdi-download"
size="x-small"
variant="text"/>
<v-btn @click="downloadRomApi(rom)" :disabled="downloadStore.value.includes(rom.file_name)" icon="mdi-download" size="x-small" variant="text" />
</template>
<template v-else>
<v-btn
:href="downloadUrl"
download
icon="mdi-download"
size="x-small"
variant="text"/>
<v-btn :href="downloadUrl" download icon="mdi-download" size="x-small" variant="text" />
</template>
<v-btn
icon="mdi-content-save-all"
size="x-small"
variant="text"
:disabled="!saveFiles"/>
<v-btn icon="mdi-content-save-all" size="x-small" variant="text" :disabled="!saveFiles" />
</v-col>
<v-menu location="bottom">
<template v-slot:activator="{ props }">
<v-btn
@click=""
v-bind="props"
icon="mdi-dots-vertical"
size="x-small"
variant="text"
disabled/>
<v-btn @click="" v-bind="props" icon="mdi-dots-vertical" size="x-small" variant="text" disabled />
</template>
<v-list rounded="0" class="pa-0">
<v-list-item @click="searchRomIGDB()" class="pt-4 pb-4 pr-5">
<v-list-item-title class="d-flex"><v-icon icon="mdi-search-web" class="mr-2"/>Search IGDB</v-list-item-title>
<v-list-item-title class="d-flex"><v-icon icon="mdi-search-web" class="mr-2" />Search
IGDB</v-list-item-title>
</v-list-item>
<v-divider class="border-opacity-25"/>
<v-list-item @click="dialogEditRom=true" class="pt-4 pb-4 pr-5">
<v-list-item-title class="d-flex"><v-icon icon="mdi-pencil-box" class="mr-2"/>Edit</v-list-item-title>
<v-divider class="border-opacity-25" />
<v-list-item @click="dialogEditRom = true" class="pt-4 pb-4 pr-5">
<v-list-item-title class="d-flex"><v-icon icon="mdi-pencil-box"
class="mr-2" />Edit</v-list-item-title>
</v-list-item>
<v-divider class="border-opacity-25"/>
<v-list-item @click="dialogDeleteRom=true" class="pt-4 pb-4 pr-5 text-red">
<v-list-item-title class="d-flex"><v-icon icon="mdi-delete" class="mr-2"/>Delete</v-list-item-title>
<v-divider class="border-opacity-25" />
<v-list-item @click="dialogDeleteRom = true" class="pt-4 pb-4 pr-5 text-red">
<v-list-item-title class="d-flex"><v-icon icon="mdi-delete"
class="mr-2" />Delete</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>

View File

@@ -1,24 +1,21 @@
<script setup>
import useDownloadStore from "@/stores/download.js";
const downloadStore = useDownloadStore();
// Props
const props = defineProps(['rom', 'isHovering', 'hoverProps', 'size'])
const forceImgReload = Date.now()
</script>
<template>
<router-link
style="text-decoration: none; color: inherit;"
:to="`/platform/${$route.params.platform}/${rom.id}`">
<v-img
:value="rom.id"
:key="rom.id"
v-bind="hoverProps"
:src="`/assets/romm/resources/${rom.path_cover_l}`"
:lazy-src="`/assets/romm/resources/${rom.path_cover_s}`"
class="cover"
cover>
<router-link style="text-decoration: none; color: inherit;" :to="`/platform/${$route.params.platform}/${rom.id}`">
<v-progress-linear color="rommAccent1" :active="downloadStore.value.includes(rom.file_name)" :indeterminate="true"
absolute />
<v-img :value="rom.id" :key="rom.id" v-bind="hoverProps" :src="`/assets/romm/resources/${rom.path_cover_l}`"
:lazy-src="`/assets/romm/resources/${rom.path_cover_s}`" class="cover" cover>
<template v-slot:placeholder>
<div class="d-flex align-center justify-center fill-height">
<v-progress-circular color="rommAccent1" :width="2" indeterminate/>
<v-progress-circular color="rommAccent1" :width="2" indeterminate />
</div>
</template>
<v-expand-transition>
@@ -28,18 +25,10 @@ const forceImgReload = Date.now()
</div>
</v-expand-transition>
<v-chip-group class="pl-1 pt-0">
<v-chip
v-show="rom.region"
size="x-small"
class="bg-chip"
label>
<v-chip v-show="rom.region" size="x-small" class="bg-chip" label>
{{ rom.region }}
</v-chip>
<v-chip
v-show="rom.revision"
size="x-small"
class="bg-chip"
label>
<v-chip v-show="rom.revision" size="x-small" class="bg-chip" label>
{{ rom.revision }}
</v-chip>
</v-chip-group>
@@ -48,7 +37,11 @@ const forceImgReload = Date.now()
</template>
<style scoped>
.rom-title.on-hover {
opacity: 1;
}
.rom-title.on-hover { opacity: 1; }
.rom-title:not(.on-hover) { opacity: 0.85; }
.rom-title:not(.on-hover) {
opacity: 0.85;
}
</style>

View File

@@ -1,83 +1,66 @@
<script setup>
import { ref } from 'vue'
import { downloadRomApi } from '@/services/api.js'
import useDownloadStore from "@/stores/download.js";
// Props
const props = defineProps(['rom'])
const saveFiles = ref(false)
const downloadStore = useDownloadStore();
const downloadUrl = `${window.location.origin}${props.rom.download_path}`
</script>
<template>
<v-row no-gutters>
<v-col>
<v-list-item
:to="`/platform/${$route.params.platform}/${rom.id}`"
:value="rom.id"
:key="rom.id">
<v-list-item :to="`/platform/${$route.params.platform}/${rom.id}`" :value="rom.id" :key="rom.id">
<v-row class="text-subtitle-2 align-center">
<v-col cols="9" xs="9" sm="6" md="3" lg="3"><span>{{ rom.r_name }}</span></v-col>
<v-col md="4" lg="4" class="hidden-sm-and-down"><span>{{ rom.file_name }}</span></v-col>
<v-col md="1" lg="1" class="hidden-sm-and-down"><span>{{ rom.p_slug }}</span></v-col>
<v-col sm="2" md="2" lg="2" class="hidden-xs"><span>{{ rom.file_size }} {{ rom.file_size_units }}</span></v-col>
<v-col sm="2" md="2" lg="2" class="hidden-xs"><span>{{ rom.file_size }} {{ rom.file_size_units
}}</span></v-col>
<v-col sm="1" md="1" lg="1" class="hidden-xs"><span>{{ rom.region }}</span></v-col>
<v-col sm="1" md="1" lg="1" class="hidden-xs"><span>{{ rom.revision }}</span></v-col>
</v-row>
<template v-slot:prepend>
<v-avatar :rounded="0">
<v-progress-linear color="rommAccent1" :indeterminate="true" absolute/>
<v-img
:src="`/assets/romm/resources/${rom.path_cover_s}`"
:lazy-src="`/assets/romm/resources/${rom.path_cover_s}`"
min-height="150"/>
<v-progress-linear color="rommAccent1" :active="downloadStore.value.includes(rom.file_name)"
:indeterminate="true" absolute />
<v-img :src="`/assets/romm/resources/${rom.path_cover_s}`"
:lazy-src="`/assets/romm/resources/${rom.path_cover_s}`" min-height="150" />
</v-avatar>
</template>
</v-list-item>
</v-col>
<v-col cols="3" xs="3" sm="1" md="1" lg="1" class="d-flex justify-center align-center mr-4">
<template v-if="rom.multi">
<v-btn
@click="downloadRomApi(rom)"
icon="mdi-download"
size="x-small"
variant="text"/>
<v-btn @click="downloadRomApi(rom)" :disabled="downloadStore.value.includes(rom.file_name)"
icon="mdi-download" size="x-small" variant="text" />
</template>
<template v-else>
<v-btn
:href="downloadUrl"
download
icon="mdi-download"
size="x-small"
variant="text"/>
<v-btn :href="downloadUrl" download icon="mdi-download" size="x-small" variant="text" />
</template>
<v-btn
icon="mdi-content-save-all"
size="x-small"
variant="text"
:disabled="!saveFiles"/>
<v-btn icon="mdi-content-save-all" size="x-small" variant="text" :disabled="!saveFiles" />
<v-menu location="bottom">
<template v-slot:activator="{ props }">
<v-btn
@click=""
v-bind="props"
icon="mdi-dots-vertical"
size="x-small"
variant="text"
disabled/>
<v-btn @click="" v-bind="props" icon="mdi-dots-vertical" size="x-small" variant="text" disabled />
</template>
<v-list rounded="0" class="pa-0">
<v-list-item @click="searchRomIGDB()" class="pt-4 pb-4 pr-5">
<v-list-item-title class="d-flex"><v-icon icon="mdi-search-web" class="mr-2"/>Search IGDB</v-list-item-title>
<v-list-item-title class="d-flex"><v-icon icon="mdi-search-web" class="mr-2" />Search
IGDB</v-list-item-title>
</v-list-item>
<v-divider class="border-opacity-25"/>
<v-list-item @click="dialogEditRom=true" class="pt-4 pb-4 pr-5">
<v-list-item-title class="d-flex"><v-icon icon="mdi-pencil-box" class="mr-2"/>Edit</v-list-item-title>
<v-divider class="border-opacity-25" />
<v-list-item @click="dialogEditRom = true" class="pt-4 pb-4 pr-5">
<v-list-item-title class="d-flex"><v-icon icon="mdi-pencil-box"
class="mr-2" />Edit</v-list-item-title>
</v-list-item>
<v-divider class="border-opacity-25"/>
<v-list-item @click="dialogDeleteRom=true" class="pt-4 pb-4 pr-5 text-red">
<v-list-item-title class="d-flex"><v-icon icon="mdi-delete" class="mr-2"/>Delete</v-list-item-title>
<v-divider class="border-opacity-25" />
<v-list-item @click="dialogDeleteRom = true" class="pt-4 pb-4 pr-5 text-red">
<v-list-item-title class="d-flex"><v-icon icon="mdi-delete"
class="mr-2" />Delete</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>

View File

@@ -1,4 +1,5 @@
import axios from "axios";
import useDownloadStore from "@/stores/download.js";
export async function fetchPlatformsApi() {
return axios.get("/api/platforms");
@@ -20,9 +21,14 @@ export async function fetchRomApi(platform, rom) {
}
export async function downloadRomApi(rom, files) {
const downloadStore = useDownloadStore();
downloadStore.add(rom.file_name);
axios
.get(
`/api/platforms/${rom.p_slug}/roms/${rom.id}/download?files=${files || rom.files}`,
`/api/platforms/${rom.p_slug}/roms/${rom.id}/download?files=${
files || rom.files
}`,
{
responseType: "blob",
}
@@ -32,6 +38,8 @@ export async function downloadRomApi(rom, files) {
a.href = window.URL.createObjectURL(new Blob([response.data]));
a.download = `${rom.r_name}.zip`;
a.click();
downloadStore.remove(rom.file_name);
});
}

View File

@@ -0,0 +1,14 @@
import { defineStore } from "pinia";
export default defineStore("download", {
state: () => ({ value: [] }),
actions: {
add(filename) {
this.value.push(filename);
},
remove(filename) {
this.value.splice(this.value.indexOf(filename), 1);
},
},
});

View File

@@ -3,10 +3,12 @@ import { ref, inject, onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useDisplay } from "vuetify"
import { fetchRomApi, downloadRomApi, updateRomApi, deleteRomApi, searchRomIGDBApi } from '@/services/api.js'
import useDownloadStore from "@/stores/download.js";
import BackgroundHeader from '@/components/GameDetails/BackgroundHeader.vue'
const router = useRouter()
const route = useRoute()
const downloadStore = useDownloadStore();
// Props
const rom = ref(undefined)
@@ -96,20 +98,20 @@ onMounted(() => {
</script>
<template>
<background-header :rom="rom" v-if="rom !== undefined" />
<background-header :rom="rom" v-if="rom !== undefined"/>
<div :class="{'content': lgAndUp, 'content-tablet': mdAndDown, 'content-mobile': xs}" v-if="rom !== undefined">
<div :class="{ 'content': lgAndUp, 'content-tablet': mdAndDown, 'content-mobile': xs }" v-if="rom !== undefined">
<v-row class="pt-8 justify-center">
<v-col :class="{'cover': lgAndUp, 'cover-tablet': mdAndDown, 'cover-mobile': xs}">
<v-col :class="{ 'cover': lgAndUp, 'cover-tablet': mdAndDown, 'cover-mobile': xs }">
<v-row>
<v-col>
<v-card elevation="2">
<v-img :src="`/assets/romm/resources/${rom.path_cover_l}`" :lazy-src="`/assets/romm/resources/${rom.path_cover_s}`" cover>
<v-card elevation="2" :loading="downloadStore.value.includes(rom.file_name) ? 'rommAccent1' : null">
<v-img :src="`/assets/romm/resources/${rom.path_cover_l}`"
:lazy-src="`/assets/romm/resources/${rom.path_cover_s}`" cover>
<template v-slot:placeholder>
<div class="d-flex align-center justify-center fill-height">
<v-progress-circular color="rommAccent1" :width="2" :size="20" indeterminate/>
</div>
<v-progress-circular color="rommAccent1" :width="2" :size="20" indeterminate />
</div>
</template>
</v-img>
</v-card>
@@ -118,44 +120,49 @@ onMounted(() => {
<v-row class="pl-3 pr-3 action-buttons">
<v-col class="pa-0">
<template v-if="rom.multi">
<v-btn @click="downloadRomApi(rom, filesToDownload)" rounded="0" color="primary" block>
<v-icon icon="mdi-download" size="large"/>
<v-btn @click="downloadRomApi(rom, filesToDownload)"
:disabled="downloadStore.value.includes(rom.file_name)" rounded="0" color="primary" block>
<v-icon icon="mdi-download" size="large" />
</v-btn>
</template>
<template v-else>
<v-btn :href="downloadUrl" rounded="0" color="primary" block>
<v-icon icon="mdi-download" size="large"/>
<v-icon icon="mdi-download" size="large" />
</v-btn>
</template>
</v-col>
<v-col class="pa-0">
<v-btn rounded="0" block :disabled="!saveFiles"><v-icon icon="mdi-content-save-all" size="large"/></v-btn>
<v-btn rounded="0" block :disabled="!saveFiles"><v-icon icon="mdi-content-save-all"
size="large" /></v-btn>
</v-col>
<v-col class="pa-0">
<v-menu location="bottom">
<template v-slot:activator="{ props }">
<v-btn v-bind="props" rounded="0" block>
<v-icon icon="mdi-dots-vertical" size="large"/>
<v-icon icon="mdi-dots-vertical" size="large" />
</v-btn>
</template>
<v-list rounded="0" class="pa-0">
<v-list-item @click="searchRomIGDB()" class="pt-4 pb-4 pr-5">
<v-list-item-title class="d-flex"><v-icon icon="mdi-search-web" class="mr-2"/>Search IGDB</v-list-item-title>
<v-list-item-title class="d-flex"><v-icon icon="mdi-search-web" class="mr-2" />Search
IGDB</v-list-item-title>
</v-list-item>
<v-divider class="border-opacity-25"/>
<v-list-item @click="dialogEditRom=true" class="pt-4 pb-4 pr-5">
<v-list-item-title class="d-flex"><v-icon icon="mdi-pencil-box" class="mr-2"/>Edit</v-list-item-title>
<v-divider class="border-opacity-25" />
<v-list-item @click="dialogEditRom = true" class="pt-4 pb-4 pr-5">
<v-list-item-title class="d-flex"><v-icon icon="mdi-pencil-box"
class="mr-2" />Edit</v-list-item-title>
</v-list-item>
<v-divider class="border-opacity-25"/>
<v-list-item @click="dialogDeleteRom=true" class="pt-4 pb-4 pr-5 text-red">
<v-list-item-title class="d-flex"><v-icon icon="mdi-delete" class="mr-2"/>Delete</v-list-item-title>
<v-divider class="border-opacity-25" />
<v-list-item @click="dialogDeleteRom = true" class="pt-4 pb-4 pr-5 text-red">
<v-list-item-title class="d-flex"><v-icon icon="mdi-delete"
class="mr-2" />Delete</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</v-col>
</v-row>
</v-col>
<v-col class="mt-10" :class="{'info': lgAndUp, 'info-tablet': mdAndDown, 'info-mobile': xs}">
<v-col class="mt-10" :class="{ 'info': lgAndUp, 'info-tablet': mdAndDown, 'info-mobile': xs }">
<div class="text-white">
<v-row no-gutters>
<span class="text-h4 font-weight-bold rom-name">{{ rom.r_name }}</span>
@@ -163,7 +170,7 @@ onMounted(() => {
<v-chip v-show="rom.region" size="x-small" class="bg-chip" label>{{ rom.region }}</v-chip>
<v-chip v-show="rom.revision" size="x-small" class="bg-chip" label>{{ rom.revision }}</v-chip>
</v-chip-group>
</v-row>
</v-row>
<v-row no-gutters class="align-center">
<span class="font-italic mt-1 rom-platform">{{ rom.p_name || rom.p_slug }}</span>
<v-chip-group class="ml-3 mt-1 hidden-sm-and-up">
@@ -172,44 +179,59 @@ onMounted(() => {
</v-chip-group>
</v-row>
</div>
<div :class="{'details-content': lgAndUp, 'details-content-tablet': mdAndDown, 'details-content-mobile': xs}">
<div
:class="{ 'details-content': lgAndUp, 'details-content-tablet': mdAndDown, 'details-content-mobile': xs }">
<v-tabs v-model="tab" slider-color="rommAccent1" rounded="0">
<v-tab value="details" rounded="0">Details</v-tab>
<v-tab value="saves" rounded="0" disabled>Saves<span class="text-caption text-truncate ml-1">[coming soon]</span></v-tab>
<v-tab v-if="rom.path_screenshots.length>0" value="screenshots" rounded="0">Screenshots</v-tab>
<v-tab value="saves" rounded="0" disabled>Saves<span class="text-caption text-truncate ml-1">[coming
soon]</span></v-tab>
<v-tab v-if="rom.path_screenshots.length > 0" value="screenshots" rounded="0">Screenshots</v-tab>
</v-tabs>
<v-window v-model="tab" class="mt-2">
<v-window-item value="details">
<v-row v-if="!rom.multi" class="d-flex align-center text-body-1 mt-0">
<v-col cols="3" xs="3" sm="2" md="2" lg="2" class="font-weight-medium"><span>File</span></v-col>
<v-col cols="3" xs="3" sm="2" md="2" lg="2"
class="font-weight-medium"><span>File</span></v-col>
<v-col class="text-body-1"><span>{{ rom.file_name }}</span></v-col>
</v-row>
<v-row v-if="rom.multi" class="d-flex align-center text-body-1 mt-0">
<v-col cols="3" xs="3" sm="2" md="2" lg="2" class="font-weight-medium"><span>Files</span></v-col>
<v-col><v-select :label="rom.file_name" item-title="file_name" v-model="filesToDownload" :items="rom.files" class="mt-2 mb-2" density="compact" variant="outlined" return-object multiple hide-details clearable chips/></v-col>
<v-col cols="3" xs="3" sm="2" md="2" lg="2"
class="font-weight-medium"><span>Files</span></v-col>
<v-col><v-select :label="rom.file_name" item-title="file_name" v-model="filesToDownload"
:items="rom.files" class="mt-2 mb-2" density="compact" variant="outlined"
return-object multiple hide-details clearable chips /></v-col>
</v-row>
<v-row class="d-flex align-center text-body-1 mt-0">
<v-col cols="3" xs="3" sm="2" md="2" lg="2" class="font-weight-medium"><span>Size</span></v-col>
<v-col cols="3" xs="3" sm="2" md="2" lg="2"
class="font-weight-medium"><span>Size</span></v-col>
<v-col><span>{{ rom.file_size }} {{ rom.file_size_units }}</span></v-col>
</v-row>
<v-row v-if="rom.r_igdb_id!=''" class="d-flex align-center text-body-1 mt-0">
<v-col cols="3" xs="3" sm="2" md="2" lg="2" class="font-weight-medium"><span>IGDB</span></v-col>
<v-row v-if="rom.r_igdb_id != ''" class="d-flex align-center text-body-1 mt-0">
<v-col cols="3" xs="3" sm="2" md="2" lg="2"
class="font-weight-medium"><span>IGDB</span></v-col>
<v-col>
<v-chip variant="outlined" :href="`https://www.igdb.com/games/${rom.r_slug}`" label>{{ rom.r_igdb_id }}</v-chip>
<v-chip variant="outlined" :href="`https://www.igdb.com/games/${rom.r_slug}`" label>{{
rom.r_igdb_id }}</v-chip>
</v-col>
</v-row>
<v-row v-if="rom.tags.length>0" class="d-flex align-center text-body-1 mt-0">
<v-col cols="3" xs="3" sm="2" md="2" lg="2" class="font-weight-medium"><span>Tags</span></v-col>
<v-col><v-chip-group class="pt-0"><v-chip v-for="tag in rom.tags" :key="tag" class="bg-chip" label>{{ tag }}</v-chip></v-chip-group></v-col>
<v-row v-if="rom.tags.length > 0" class="d-flex align-center text-body-1 mt-0">
<v-col cols="3" xs="3" sm="2" md="2" lg="2"
class="font-weight-medium"><span>Tags</span></v-col>
<v-col><v-chip-group class="pt-0"><v-chip v-for="tag in rom.tags" :key="tag" class="bg-chip"
label>{{ tag }}</v-chip></v-chip-group></v-col>
</v-row>
<v-row class="d-flex mt-3">
<v-col class="font-weight-medium text-caption"><p>{{ rom.summary }}</p></v-col>
<v-col class="font-weight-medium text-caption">
<p>{{ rom.summary }}</p>
</v-col>
</v-row>
</v-window-item>
<v-window-item value="screenshots">
<v-row class="d-flex mt-2">
<v-carousel hide-delimiter-background delimiter-icon="mdi-square" class="bg-rommBlack" show-arrows="hover" height="400">
<v-carousel-item v-for="screenshot in rom.path_screenshots" :src="`/assets/romm/resources/${screenshot}`"/>
<v-carousel hide-delimiter-background delimiter-icon="mdi-square" class="bg-rommBlack"
show-arrows="hover" height="400">
<v-carousel-item v-for="screenshot in rom.path_screenshots"
:src="`/assets/romm/resources/${screenshot}`" />
</v-carousel>
</v-row>
</v-window-item>
@@ -222,53 +244,54 @@ onMounted(() => {
</v-col>
</v-row>
</div>
<v-dialog v-model="dialogSearchRom" scroll-strategy="none" width="auto" :scrim="false" v-if="rom !== undefined">
<v-card :class="{'search-content': lgAndUp, 'search-content-tablet': mdAndDown, 'search-content-mobile': xs}" rounded="0">
<v-card :class="{ 'search-content': lgAndUp, 'search-content-tablet': mdAndDown, 'search-content-mobile': xs }"
rounded="0">
<v-toolbar density="compact" class="bg-primary">
<v-row class="align-center" no-gutters>
<v-col cols="9" xs="9" sm="10" md="10" lg="11">
<v-chip class="ml-5 text-rommAccent1" variant="outlined" label>IGDB</v-chip>
</v-col>
<v-col>
<v-btn @click="dialogSearchRom=false" class="bg-primary" rounded="0" variant="text" icon="mdi-close" block/>
<v-btn @click="dialogSearchRom = false" class="bg-primary" rounded="0" variant="text"
icon="mdi-close" block />
</v-col>
</v-row>
</v-toolbar>
<v-divider class="border-opacity-25" :thickness="1"/>
<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="7" xs="7" sm="8" md="8" lg="9">
<v-text-field
@keyup.enter="searchRomIGDB()"
@click:clear="searchTerm=''"
v-model="searchTerm"
label="search"
hide-details
clearable/>
<v-text-field @keyup.enter="searchRomIGDB()" @click:clear="searchTerm = ''" v-model="searchTerm"
label="search" hide-details clearable />
</v-col>
<v-col cols="3" xs="3" sm="2" md="2" lg="2">
<v-select label="by" :items="['ID', 'Name']" v-model="searchBy" hide-details/>
<v-select label="by" :items="['ID', 'Name']" v-model="searchBy" hide-details />
</v-col>
<v-col cols="2" xs="2" sm="2" md="2" lg="1">
<v-btn type="submit" @click="searchRomIGDB()" class="bg-primary" rounded="0" variant="text" icon="mdi-search-web" block/>
<v-btn type="submit" @click="searchRomIGDB()" class="bg-primary" rounded="0" variant="text"
icon="mdi-search-web" block />
</v-col>
</v-row>
</v-toolbar>
<v-card-text class="pa-1 scroll bg-secondary">
<v-row class="justify-center loader-searching" v-show="searching" no-gutters>
<v-progress-circular :width="2" :size="40" color="rommAccent1" indeterminate/>
<v-progress-circular :width="2" :size="40" color="rommAccent1" indeterminate />
</v-row>
<v-row class="justify-center no-results-searching" v-show="!searching && matchedRoms.length==0" no-gutters>
<v-row class="justify-center no-results-searching" v-show="!searching && matchedRoms.length == 0"
no-gutters>
<span>No results found</span>
</v-row>
<v-row no-gutters>
<v-col class="pa-1" cols="4" xs="4" sm="3" md="3" lg="2" v-show="!searching" v-for="rom in matchedRoms" :key="rom.file_name">
<v-hover v-slot="{isHovering, props}">
<v-card @click="updateRom(updatedData=rom)" v-bind="props" :class="{'on-hover': isHovering}" :elevation="isHovering ? 20 : 3">
<v-img v-bind="props" :src="rom.url_cover" cover/>
<v-col class="pa-1" cols="4" xs="4" sm="3" md="3" lg="2" v-show="!searching" v-for="rom in matchedRoms"
:key="rom.file_name">
<v-hover v-slot="{ isHovering, props }">
<v-card @click="updateRom(updatedData = rom)" v-bind="props" :class="{ 'on-hover': isHovering }"
:elevation="isHovering ? 20 : 3">
<v-img v-bind="props" :src="rom.url_cover" cover />
<v-card-text>
<v-row class="pa-1">
<span class="d-inline-block text-truncate">{{ rom.r_name }}</span>
@@ -280,61 +303,69 @@ onMounted(() => {
</v-row>
</v-card-text>
<v-divider class="border-opacity-25" :thickness="1"/>
<v-divider class="border-opacity-25" :thickness="1" />
<v-toolbar class="bg-primary" density="compact">
<v-checkbox v-model="renameAsIGDB" label="Rename rom" class="ml-3" hide-details/>
<v-checkbox v-model="renameAsIGDB" label="Rename rom" class="ml-3" hide-details />
</v-toolbar>
</v-card>
</v-dialog>
<v-dialog v-model="dialogEditRom" scroll-strategy="none" width="auto" :scrim="false" v-if="rom !== undefined">
<v-card rounded="0" :class="{'edit-content': lgAndUp, 'edit-content-tablet': mdAndDown, 'edit-content-mobile': xs}">
<v-card rounded="0"
:class="{ 'edit-content': lgAndUp, 'edit-content-tablet': mdAndDown, 'edit-content-mobile': xs }">
<v-toolbar density="compact" class="bg-primary">
<v-row class="align-center" no-gutters>
<v-col cols="9" xs="9" sm="10" md="10" lg="11">
<v-icon icon="mdi-pencil-box" class="ml-5"/>
<v-icon icon="mdi-pencil-box" class="ml-5" />
</v-col>
<v-col>
<v-btn @click="dialogEditRom=false" class="bg-primary" rounded="0" variant="text" icon="mdi-close" block/>
<v-btn @click="dialogEditRom = false" class="bg-primary" rounded="0" variant="text" icon="mdi-close"
block />
</v-col>
</v-row>
</v-toolbar>
<v-divider class="border-opacity-25" :thickness="1"/>
<v-divider class="border-opacity-25" :thickness="1" />
<v-card-text class="bg-secondary scroll">
<v-row class="justify-center pa-2" no-gutters>
<v-text-field @keyup.enter="updateRom()" v-model="updatedRom.r_name" label="Name" variant="outlined" required hide-details/>
<v-text-field @keyup.enter="updateRom()" v-model="updatedRom.r_name" label="Name" variant="outlined"
required hide-details />
</v-row>
<v-row class="justify-center pa-2" no-gutters>
<v-text-field @keyup.enter="updateRom()" v-model="updatedRom.file_name" label="File name" variant="outlined" required hide-details/>
<v-text-field @keyup.enter="updateRom()" v-model="updatedRom.file_name" label="File name"
variant="outlined" required hide-details />
</v-row>
<v-row class="justify-center pa-2" no-gutters>
<v-textarea @keyup.enter="updateRom()" v-model="updatedRom.summary" label="Summary" variant="outlined" required hide-details/>
<v-textarea @keyup.enter="updateRom()" v-model="updatedRom.summary" label="Summary" variant="outlined"
required hide-details />
</v-row>
<v-row class="justify-center pa-2" no-gutters>
<v-file-input @keyup.enter="updateRom()" label="Custom cover [Coming soon]" prepend-inner-icon="mdi-image" prepend-icon="" variant="outlined" disabled hide-details/>
<v-file-input @keyup.enter="updateRom()" label="Custom cover [Coming soon]"
prepend-inner-icon="mdi-image" prepend-icon="" variant="outlined" disabled hide-details />
</v-row>
<v-row class="justify-center pa-2" no-gutters>
<v-btn @click="updateRom()" class="text-rommGreen">Apply</v-btn>
<v-btn @click="dialogEditRom=false" class="ml-5">Cancel</v-btn>
<v-btn @click="dialogEditRom = false" class="ml-5">Cancel</v-btn>
</v-row>
</v-card-text>
</v-card>
</v-dialog>
<v-dialog v-model="dialogDeleteRom" width="auto" v-if="rom !== undefined">
<v-card rounded="0" :class="{'delete-content': lgAndUp, 'delete-content-tablet': mdAndDown, 'delete-content-mobile': xs}">
<v-card rounded="0"
:class="{ 'delete-content': lgAndUp, 'delete-content-tablet': mdAndDown, 'delete-content-mobile': xs }">
<v-toolbar density="compact" class="bg-primary">
<v-row class="align-center" no-gutters>
<v-col cols="9" xs="9" sm="10" md="10" lg="11">
<v-icon icon="mdi-delete" class="ml-5"/>
<v-icon icon="mdi-delete" class="ml-5" />
</v-col>
<v-col>
<v-btn @click="dialogDeleteRom=false" class="bg-primary" rounded="0" variant="text" icon="mdi-close" block/>
<v-btn @click="dialogDeleteRom = false" class="bg-primary" rounded="0" variant="text"
icon="mdi-close" block />
</v-col>
</v-row>
</v-toolbar>
<v-divider class="border-opacity-25" :thickness="1"/>
<v-divider class="border-opacity-25" :thickness="1" />
<v-card-text class="bg-secondary">
<v-row class="justify-center pa-2" no-gutters>
@@ -342,42 +373,121 @@ onMounted(() => {
</v-row>
<v-row class="justify-center pa-2" no-gutters>
<v-btn @click="deleteRom()" class="text-red">Confirm</v-btn>
<v-btn @click="dialogDeleteRom=false" class="ml-5">Cancel</v-btn>
<v-btn @click="dialogDeleteRom = false" class="ml-5">Cancel</v-btn>
</v-row>
</v-card-text>
<v-divider class="border-opacity-25" :thickness="1"/>
<v-divider class="border-opacity-25" :thickness="1" />
<v-toolbar class="bg-primary" density="compact">
<v-checkbox v-model="deleteFromFs" label="Remove from filesystem" class="ml-3" hide-details/>
<v-checkbox v-model="deleteFromFs" label="Remove from filesystem" class="ml-3" hide-details />
</v-toolbar>
</v-card>
</v-dialog>
<v-dialog :model-value="updating || loading" scroll-strategy="none" width="auto" :scrim="updating" persistent>
<v-progress-circular :width="3" :size="70" color="rommAccent1" indeterminate/>
<v-progress-circular :width="3" :size="70" color="rommAccent1" indeterminate />
</v-dialog>
</template>
<style scoped>
.scroll { overflow-y: scroll }
.rom-name, .rom-platform { text-shadow: 1px 1px 3px #000000, 0 0 3px #000000; }
.content, .content-tablet, .content-mobile { position: relative; }
.content, .content-tablet { margin-top: 64px; margin-left: 100px; margin-right: 100px; }
.content-mobile{ margin-top: 64px; margin-left: 20px; margin-right: 20px; }
.cover, .cover-tablet, .cover-mobile { min-width: 245px; min-height: 326px; max-width: 245px; max-height: 326px; }
.details, .details-tablet, .details-mobile { padding-left: 25px; padding-right: 25px; }
.details-content{ margin-top: 126px; max-width: 700px; }
.details-content-tablet { margin-top: 70px; }
.details-content-mobile{ margin-top: 40px; }
.loader-searching, .no-results-searching { margin-top: 200px; }
.search-content{ width: 900px; height: 640px;}
.search-content-tablet{ width: 570px; height: 640px; }
.search-content-mobile{ width: 85vw; height: 640px; }
.edit-content{ width: 900px; }
.edit-content-tablet{ width: 570px; }
.edit-content-mobile{ width: 85vw; }
.delete-content{ width: 900px; }
.delete-content-tablet{ width: 570px; }
.delete-content-mobile{ width: 85vw; }
.scroll {
overflow-y: scroll
}
.rom-name,
.rom-platform {
text-shadow: 1px 1px 3px #000000, 0 0 3px #000000;
}
.content,
.content-tablet,
.content-mobile {
position: relative;
}
.content,
.content-tablet {
margin-top: 64px;
margin-left: 100px;
margin-right: 100px;
}
.content-mobile {
margin-top: 64px;
margin-left: 20px;
margin-right: 20px;
}
.cover,
.cover-tablet,
.cover-mobile {
min-width: 245px;
min-height: 326px;
max-width: 245px;
max-height: 326px;
}
.details,
.details-tablet,
.details-mobile {
padding-left: 25px;
padding-right: 25px;
}
.details-content {
margin-top: 126px;
max-width: 700px;
}
.details-content-tablet {
margin-top: 70px;
}
.details-content-mobile {
margin-top: 40px;
}
.loader-searching,
.no-results-searching {
margin-top: 200px;
}
.search-content {
width: 900px;
height: 640px;
}
.search-content-tablet {
width: 570px;
height: 640px;
}
.search-content-mobile {
width: 85vw;
height: 640px;
}
.edit-content {
width: 900px;
}
.edit-content-tablet {
width: 570px;
}
.edit-content-mobile {
width: 85vw;
}
.delete-content {
width: 900px;
}
.delete-content-tablet {
width: 570px;
}
.delete-content-mobile {
width: 85vw;
}
</style>