mocked data-table to gallery list view

This commit is contained in:
zurdi
2023-08-17 13:32:20 +02:00
parent 6f25a066ef
commit c13a53df82
2 changed files with 128 additions and 11 deletions

View File

@@ -7,6 +7,7 @@ import { views, normalizeString } from "@/utils/utils.js";
import storeGalleryFilter from "@/stores/galleryFilter.js";
import storeGalleryView from "@/stores/galleryView.js";
import storeScanning from "@/stores/scanning.js";
import { VDataTable } from "vuetify/labs/VDataTable";
import FilterBar from "@/components/GalleryAppBar/FilterBar.vue";
import GalleryViewBtn from "@/components/GalleryAppBar/GalleryViewBtn.vue";
import GameCard from "@/components/Game/Card/Base.vue";
@@ -17,6 +18,65 @@ import EditRomDialog from "@/components/Dialog/Rom/EditRom.vue";
import DeleteRomDialog from "@/components/Dialog/Rom/DeleteRom.vue";
import LoadingDialog from "@/components/Dialog/Loading.vue";
import { downloadRomApi } from "@/services/api.js";
import useDownloadStore from "@/stores/download.js";
import AdminMenu from "@/components/AdminMenu/Base.vue";
const location = window.location.origin;
const downloadStore = useDownloadStore();
const saveFiles = ref(false);
const romsPerPage = ref(5);
const romsPerPageOptions = [
{ value: 5, title: "5" },
{ value: 10, title: "10" },
{ value: 25, title: "25" },
{ value: -1, title: "$vuetify.dataFooter.itemsPerPageAll" },
];
const romsHeaders = [
{
title: "",
align: "start",
sortable: false,
key: "path_cover_s",
},
{
title: "Name",
align: "start",
sortable: true,
key: "r_name",
},
{
title: "File",
align: "start",
sortable: true,
key: "file_name",
},
{
title: "Platform",
align: "start",
sortable: true,
key: "p_name",
},
{
title: "Size",
align: "start",
sortable: true,
key: "file_size",
},
{
title: "Region",
align: "start",
sortable: true,
key: "region",
},
{
title: "Revision",
align: "start",
sortable: true,
key: "revision",
},
{ align: "end", key: "actions", sortable: false },
];
// Props
const route = useRoute();
const roms = ref([]);
@@ -183,11 +243,7 @@ onBeforeRouteUpdate(async (to, _) => {
<template v-if="filteredRoms.length > 0 || gettingRoms">
<!-- Gallery cards view -->
<v-row
v-show="galleryView.value != 2"
no-gutters
v-scroll="onGridScroll"
>
<v-row v-show="galleryView.value != 2" no-gutters v-scroll="onGridScroll">
<v-col
v-for="rom in filteredRoms"
class="pa-1"
@@ -204,7 +260,7 @@ onBeforeRouteUpdate(async (to, _) => {
<!-- Gallery list view -->
<v-row v-show="galleryView.value == 2" no-gutters>
<v-col
<!-- <v-col
:cols="views[galleryView.value]['size-cols']"
:xs="views[galleryView.value]['size-xs']"
:sm="views[galleryView.value]['size-sm']"
@@ -230,7 +286,67 @@ onBeforeRouteUpdate(async (to, _) => {
</v-list>
</tbody>
</v-table>
</v-col>
</v-col> -->
<v-data-table
class="bg-background"
:fixed-header="true"
:items-per-page-options="romsPerPageOptions"
v-model:items-per-page="romsPerPage"
:headers="romsHeaders"
:items="filteredRoms"
:sort-by="[{ key: 'r_name', order: 'asc' }]"
>
<template v-slot:item.path_cover_s="{ item }">
<v-avatar :rounded="0">
<v-progress-linear
color="rommAccent1"
:active="downloadStore.value.includes(item.selectable.id)"
:indeterminate="true"
absolute
/>
<v-img
:src="`/assets/romm/resources/${item.selectable.path_cover_s}`"
:lazy-src="`/assets/romm/resources/${item.selectable.path_cover_s}`"
min-height="150"
/>
</v-avatar>
</template>
<template v-slot:item.file_size="{ item }">
<span>{{ item.selectable.file_size }} {{ item.selectable.file_size_units }}</span>
</template>
<template v-slot:item.actions="{ item }">
<template v-if="item.selectable.multi">
<v-btn
@click="downloadRomApi(item.selectable)"
:disabled="downloadStore.value.includes(item.selectable.id)"
download
size="small"
variant="text"
><v-icon>mdi-download</v-icon></v-btn
>
</template>
<template v-else>
<v-btn
:href="`${location}${item.selectable.download_path}`"
download
size="small"
variant="text"
><v-icon>mdi-download</v-icon></v-btn
>
</template>
<v-btn size="small" variant="text" :disabled="!saveFiles"
><v-icon>mdi-content-save-all</v-icon></v-btn
>
<v-menu location="bottom">
<template v-slot:activator="{ props }">
<v-btn @click="" v-bind="props" size="small" variant="text"
><v-icon>mdi-dots-vertical</v-icon></v-btn
>
</template>
<admin-menu :rom="item.selectable" />
</v-menu>
</template>
</v-data-table>
</v-row>
</template>
@@ -238,9 +354,9 @@ onBeforeRouteUpdate(async (to, _) => {
<template v-else>
<v-row class="align-center justify-center" no-gutters>
<v-col cols="6" md="2">
<div class="mt-16"
>Feels empty here... <v-icon>mdi-emoticon-sad</v-icon></div
>
<div class="mt-16">
Feels empty here... <v-icon>mdi-emoticon-sad</v-icon>
</div>
</v-col>
</v-row>
</template>

View File

@@ -130,7 +130,7 @@ const usersPerPageOptions = [
const userSearch = ref("");
</script>
<template>
<v-card rounded="0">
<v-card rounded="0" elevation="0">
<v-toolbar class="bg-terciary" density="compact">
<v-toolbar-title class="text-button"
><v-icon class="mr-3">mdi-account-group</v-icon>Users</v-toolbar-title
@@ -166,6 +166,7 @@ const userSearch = ref("");
<delete-user-dialog />
<v-data-table
class="bg-background"
:items-per-page-options="usersPerPageOptions"
v-model:items-per-page="usersPerPage"
:search="userSearch"