mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 18:11:16 +01:00
unify platform and collection layout
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import FilterBtn from "@/components/Gallery/AppBar/common/FilterBtn.vue";
|
||||
import CollectionInfoDrawer from "@/components/Gallery/AppBar/Collection/CollectionInfoDrawer.vue";
|
||||
import FilterDrawer from "@/components/Gallery/AppBar/common/FilterDrawer/Base.vue";
|
||||
import FilterTextField from "@/components/Gallery/AppBar/common/FilterTextField.vue";
|
||||
import GalleryViewBtn from "@/components/Gallery/AppBar/common/GalleryViewBtn.vue";
|
||||
@@ -11,6 +12,7 @@ import storeRoms from "@/stores/roms";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import type { Emitter } from "mitt";
|
||||
import { storeToRefs } from "pinia";
|
||||
import storeNavigation from "@/stores/navigation";
|
||||
import { inject, ref } from "vue";
|
||||
import { useDisplay } from "vuetify";
|
||||
|
||||
@@ -21,29 +23,9 @@ const viewportWidth = ref(window.innerWidth);
|
||||
const auth = storeAuth();
|
||||
const romsStore = storeRoms();
|
||||
const { currentCollection } = storeToRefs(romsStore);
|
||||
const navigationStore = storeNavigation();
|
||||
const { activeCollectionInfoDrawer } = storeToRefs(navigationStore);
|
||||
const open = ref(false);
|
||||
const collectionInfoFields = [
|
||||
{
|
||||
key: "name",
|
||||
label: "Name",
|
||||
},
|
||||
{
|
||||
key: "description",
|
||||
label: "Description",
|
||||
},
|
||||
{
|
||||
key: "rom_count",
|
||||
label: "Roms",
|
||||
},
|
||||
{
|
||||
key: "user__username",
|
||||
label: "Owner",
|
||||
},
|
||||
{
|
||||
key: "is_public",
|
||||
label: "Public",
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -58,9 +40,9 @@ const collectionInfoFields = [
|
||||
>
|
||||
<template #prepend>
|
||||
<v-btn
|
||||
:color="open ? 'romm-accent-1' : ''"
|
||||
:color="activeCollectionInfoDrawer ? 'romm-accent-1' : ''"
|
||||
rounded="0"
|
||||
@click="open = !open"
|
||||
@click="navigationStore.swtichActiveCollectionInfoDrawer"
|
||||
icon="mdi-information"
|
||||
></v-btn>
|
||||
<filter-btn />
|
||||
@@ -72,91 +54,7 @@ const collectionInfoFields = [
|
||||
</template>
|
||||
</v-app-bar>
|
||||
|
||||
<v-navigation-drawer
|
||||
v-model="open"
|
||||
floating
|
||||
mobile
|
||||
:width="xs ? viewportWidth : '500'"
|
||||
v-if="currentCollection"
|
||||
>
|
||||
<v-row no-gutters class="text-center justify-center align-center mt-4">
|
||||
<v-col style="max-width: 240px">
|
||||
<collection-card
|
||||
:key="currentCollection.updated_at"
|
||||
:collection="currentCollection"
|
||||
/>
|
||||
<v-btn
|
||||
rounded="4"
|
||||
@click="
|
||||
emitter?.emit('showEditCollectionDialog', { ...currentCollection })
|
||||
"
|
||||
class="mt-4 bg-terciary"
|
||||
>
|
||||
<template #prepend>
|
||||
<v-icon>mdi-pencil-box</v-icon>
|
||||
</template>
|
||||
Edit collection
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="mt-4">
|
||||
<v-col cols="12">
|
||||
<v-card class="mx-4 bg-terciary" elevation="0">
|
||||
<v-card-text class="pa-4">
|
||||
<template
|
||||
v-for="(field, index) in collectionInfoFields"
|
||||
:key="field.key"
|
||||
>
|
||||
<div
|
||||
v-if="
|
||||
currentCollection[field.key as keyof typeof currentCollection]
|
||||
"
|
||||
:class="{ 'mt-4': index !== 0 }"
|
||||
>
|
||||
<p class="text-subtitle-1 text-decoration-underline">
|
||||
{{ field.label }}
|
||||
</p>
|
||||
<p class="text-subtitle-2">
|
||||
{{
|
||||
currentCollection[
|
||||
field.key as keyof typeof currentCollection
|
||||
]
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row no-gutters class="mt-4">
|
||||
<v-col cols="12">
|
||||
<r-section
|
||||
v-if="auth.scopes.includes('collections.write')"
|
||||
icon="mdi-alert"
|
||||
icon-color="red"
|
||||
title="Danger zone"
|
||||
elevation="0"
|
||||
>
|
||||
<template #content>
|
||||
<div class="text-center my-2">
|
||||
<v-btn
|
||||
class="text-romm-red bg-terciary"
|
||||
variant="flat"
|
||||
@click="
|
||||
emitter?.emit('showDeleteCollectionDialog', currentCollection)
|
||||
"
|
||||
>
|
||||
<v-icon class="text-romm-red mr-2">mdi-delete</v-icon>
|
||||
Delete collection
|
||||
</v-btn>
|
||||
</div>
|
||||
</template>
|
||||
</r-section>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-navigation-drawer>
|
||||
|
||||
<collection-info-drawer />
|
||||
<filter-drawer />
|
||||
</template>
|
||||
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
<script setup lang="ts">
|
||||
import FilterBtn from "@/components/Gallery/AppBar/common/FilterBtn.vue";
|
||||
import FilterDrawer from "@/components/Gallery/AppBar/common/FilterDrawer/Base.vue";
|
||||
import FilterTextField from "@/components/Gallery/AppBar/common/FilterTextField.vue";
|
||||
import GalleryViewBtn from "@/components/Gallery/AppBar/common/GalleryViewBtn.vue";
|
||||
import SelectingBtn from "@/components/Gallery/AppBar/common/SelectingBtn.vue";
|
||||
import CollectionCard from "@/components/common/Collection/Card.vue";
|
||||
import RSection from "@/components/common/RSection.vue";
|
||||
import storeAuth from "@/stores/auth";
|
||||
import storeRoms from "@/stores/roms";
|
||||
import storeNavigation from "@/stores/navigation";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import type { Emitter } from "mitt";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { inject, ref } from "vue";
|
||||
import { useDisplay } from "vuetify";
|
||||
|
||||
// Props
|
||||
const { xs } = useDisplay();
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
const viewportWidth = ref(window.innerWidth);
|
||||
const auth = storeAuth();
|
||||
const romsStore = storeRoms();
|
||||
const { currentCollection } = storeToRefs(romsStore);
|
||||
const navigationStore = storeNavigation();
|
||||
const { activeCollectionInfoDrawer } = storeToRefs(navigationStore);
|
||||
const collectionInfoFields = [
|
||||
{
|
||||
key: "name",
|
||||
label: "Name",
|
||||
},
|
||||
{
|
||||
key: "description",
|
||||
label: "Description",
|
||||
},
|
||||
{
|
||||
key: "rom_count",
|
||||
label: "Roms",
|
||||
},
|
||||
{
|
||||
key: "user__username",
|
||||
label: "Owner",
|
||||
},
|
||||
{
|
||||
key: "is_public",
|
||||
label: "Public",
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-navigation-drawer
|
||||
v-model="activeCollectionInfoDrawer"
|
||||
floating
|
||||
mobile
|
||||
:width="xs ? viewportWidth : '500'"
|
||||
v-if="currentCollection"
|
||||
>
|
||||
<v-row no-gutters class="justify-center align-center pa-4">
|
||||
<v-col style="max-width: 240px" cols="12">
|
||||
<div class="text-center justify-center align-center">
|
||||
<collection-card
|
||||
:key="currentCollection.updated_at"
|
||||
:collection="currentCollection"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="text-center mt-4"
|
||||
v-if="auth.scopes.includes('collections.write')"
|
||||
>
|
||||
<v-btn
|
||||
rounded="4"
|
||||
@click="
|
||||
emitter?.emit('showEditCollectionDialog', {
|
||||
...currentCollection,
|
||||
})
|
||||
"
|
||||
class="bg-terciary"
|
||||
>
|
||||
<template #prepend>
|
||||
<v-icon>mdi-pencil-box</v-icon>
|
||||
</template>
|
||||
Edit collection
|
||||
</v-btn>
|
||||
</div>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
<v-card class="mt-4 bg-terciary fill-width" elevation="0">
|
||||
<v-card-text class="pa-4">
|
||||
<template
|
||||
v-for="(field, index) in collectionInfoFields"
|
||||
:key="field.key"
|
||||
>
|
||||
<div
|
||||
v-if="
|
||||
currentCollection[field.key as keyof typeof currentCollection]
|
||||
"
|
||||
:class="{ 'mt-4': index !== 0 }"
|
||||
>
|
||||
<p class="text-subtitle-1 text-decoration-underline">
|
||||
{{ field.label }}
|
||||
</p>
|
||||
<p class="text-subtitle-2">
|
||||
{{
|
||||
currentCollection[
|
||||
field.key as keyof typeof currentCollection
|
||||
]
|
||||
}}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<r-section
|
||||
v-if="auth.scopes.includes('collections.write')"
|
||||
icon="mdi-alert"
|
||||
icon-color="red"
|
||||
title="Danger zone"
|
||||
elevation="0"
|
||||
>
|
||||
<template #content>
|
||||
<div class="text-center">
|
||||
<v-btn
|
||||
class="text-romm-red bg-terciary ma-2"
|
||||
variant="flat"
|
||||
@click="
|
||||
emitter?.emit('showDeleteCollectionDialog', currentCollection)
|
||||
"
|
||||
>
|
||||
<v-icon class="text-romm-red mr-2">mdi-delete</v-icon>
|
||||
Delete collection
|
||||
</v-btn>
|
||||
</div>
|
||||
</template>
|
||||
</r-section>
|
||||
</v-navigation-drawer>
|
||||
</template>
|
||||
@@ -125,9 +125,9 @@ async function setAspectRatio() {
|
||||
:width="xs ? viewportWidth : '500'"
|
||||
v-if="currentPlatform"
|
||||
>
|
||||
<v-row no-gutters class="justify-center align-center">
|
||||
<v-row no-gutters class="justify-center align-center pa-4">
|
||||
<v-col cols="12">
|
||||
<div class="text-center mt-2">
|
||||
<div class="text-center justify-center align-center">
|
||||
<platform-icon
|
||||
:slug="currentPlatform.slug"
|
||||
:name="currentPlatform.name"
|
||||
@@ -194,7 +194,7 @@ async function setAspectRatio() {
|
||||
<span>ID: {{ currentPlatform.moby_id }}</span>
|
||||
</v-chip>
|
||||
</div>
|
||||
<v-card class="mt-4 mx-4 bg-terciary fill-width" elevation="0">
|
||||
<v-card class="mt-4 bg-terciary fill-width" elevation="0">
|
||||
<v-card-text class="pa-4">
|
||||
<template
|
||||
v-for="(field, index) in platformInfoFields"
|
||||
@@ -220,84 +220,80 @@ async function setAspectRatio() {
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row class="mt-4" no-gutters>
|
||||
<v-col cols="12">
|
||||
<r-section
|
||||
v-if="auth.scopes.includes('platforms.write')"
|
||||
icon="mdi-cog"
|
||||
title="Settings"
|
||||
elevation="0"
|
||||
>
|
||||
<template #content>
|
||||
<v-chip
|
||||
label
|
||||
variant="text"
|
||||
class="ma-1"
|
||||
prepend-icon="mdi-aspect-ratio"
|
||||
>Set cover style</v-chip
|
||||
<r-section
|
||||
v-if="auth.scopes.includes('platforms.write')"
|
||||
icon="mdi-cog"
|
||||
title="Settings"
|
||||
elevation="0"
|
||||
>
|
||||
<template #content>
|
||||
<div class="text-center">
|
||||
<v-chip label variant="text" prepend-icon="mdi-aspect-ratio"
|
||||
>Set cover style</v-chip
|
||||
>
|
||||
<v-divider class="border-opacity-25 mx-2" />
|
||||
<v-item-group
|
||||
v-model="selectedAspectRatio"
|
||||
mandatory
|
||||
@update:model-value="setAspectRatio"
|
||||
>
|
||||
<v-row
|
||||
no-gutters
|
||||
class="text-center justify-center align-center pa-2"
|
||||
>
|
||||
<v-item-group
|
||||
v-model="selectedAspectRatio"
|
||||
mandatory
|
||||
@update:model-value="setAspectRatio"
|
||||
>
|
||||
<v-row no-gutters class="text-center justify-center align-center">
|
||||
<v-col class="ma-2" v-for="aspectRatio in aspectRatioOptions">
|
||||
<v-item v-slot="{ isSelected, toggle }">
|
||||
<v-card
|
||||
:color="isSelected ? 'romm-accent-1' : 'romm-gray'"
|
||||
variant="outlined"
|
||||
@click="toggle"
|
||||
<v-col class="pa-2" v-for="aspectRatio in aspectRatioOptions">
|
||||
<v-item v-slot="{ isSelected, toggle }">
|
||||
<v-card
|
||||
:color="isSelected ? 'romm-accent-1' : 'romm-gray'"
|
||||
variant="outlined"
|
||||
@click="toggle"
|
||||
>
|
||||
<v-card-text
|
||||
class="pa-0 text-center align-center justify-center"
|
||||
>
|
||||
<v-card-text
|
||||
class="pa-0 text-center align-center justify-center"
|
||||
<v-img
|
||||
:aspect-ratio="aspectRatio.size"
|
||||
cover
|
||||
src="/assets/login_bg.png"
|
||||
:class="{ greyscale: !isSelected }"
|
||||
class="d-flex align-center justify-center"
|
||||
>
|
||||
<v-img
|
||||
:aspect-ratio="aspectRatio.size"
|
||||
cover
|
||||
src="/assets/login_bg.png"
|
||||
:class="{ greyscale: !isSelected }"
|
||||
class="d-flex align-center justify-center"
|
||||
>
|
||||
<p class="text-h5 text-romm-white">
|
||||
{{ aspectRatio.name }}
|
||||
</p>
|
||||
</v-img>
|
||||
<p class="text-center mx-2 text-caption">
|
||||
{{ aspectRatio.source }}
|
||||
<p class="text-h5 text-romm-white">
|
||||
{{ aspectRatio.name }}
|
||||
</p>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-item>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-item-group>
|
||||
</template>
|
||||
</r-section>
|
||||
<r-section
|
||||
v-if="auth.scopes.includes('platforms.write')"
|
||||
icon="mdi-alert"
|
||||
icon-color="red"
|
||||
title="Danger zone"
|
||||
elevation="0"
|
||||
>
|
||||
<template #content>
|
||||
<div class="text-center my-2">
|
||||
<v-btn
|
||||
class="text-romm-red bg-terciary"
|
||||
variant="flat"
|
||||
@click="
|
||||
emitter?.emit('showDeletePlatformDialog', currentPlatform)
|
||||
"
|
||||
>
|
||||
<v-icon class="text-romm-red mr-2">mdi-delete</v-icon>
|
||||
Delete platform
|
||||
</v-btn>
|
||||
</div>
|
||||
</template>
|
||||
</r-section>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-img>
|
||||
<p class="text-center text-caption">
|
||||
{{ aspectRatio.source }}
|
||||
</p>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-item>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-item-group>
|
||||
</div>
|
||||
</template>
|
||||
</r-section>
|
||||
<r-section
|
||||
v-if="auth.scopes.includes('platforms.write')"
|
||||
icon="mdi-alert"
|
||||
icon-color="red"
|
||||
title="Danger zone"
|
||||
elevation="0"
|
||||
>
|
||||
<template #content>
|
||||
<div class="text-center">
|
||||
<v-btn
|
||||
class="text-romm-red bg-terciary ma-2"
|
||||
variant="flat"
|
||||
@click="emitter?.emit('showDeletePlatformDialog', currentPlatform)"
|
||||
>
|
||||
<v-icon class="text-romm-red mr-2">mdi-delete</v-icon>
|
||||
Delete platform
|
||||
</v-btn>
|
||||
</div>
|
||||
</template>
|
||||
</r-section>
|
||||
</v-navigation-drawer>
|
||||
</template>
|
||||
<style scoped>
|
||||
|
||||
@@ -6,6 +6,7 @@ export default defineStore("navigation", {
|
||||
activeCollectionsDrawer: false,
|
||||
activeSettingsDrawer: false,
|
||||
activePlatformInfoDrawer: false,
|
||||
activeCollectionInfoDrawer: false,
|
||||
}),
|
||||
|
||||
actions: {
|
||||
@@ -25,6 +26,10 @@ export default defineStore("navigation", {
|
||||
this.resetDrawersExcept("activePlatformInfoDrawer");
|
||||
this.activePlatformInfoDrawer = !this.activePlatformInfoDrawer;
|
||||
},
|
||||
swtichActiveCollectionInfoDrawer() {
|
||||
this.resetDrawersExcept("activeCollectionInfoDrawer");
|
||||
this.activeCollectionInfoDrawer = !this.activeCollectionInfoDrawer;
|
||||
},
|
||||
goHome() {
|
||||
this.resetDrawers();
|
||||
this.$router.push({ name: "dashboard" });
|
||||
@@ -38,6 +43,7 @@ export default defineStore("navigation", {
|
||||
this.activeCollectionsDrawer = false;
|
||||
this.activeSettingsDrawer = false;
|
||||
this.activePlatformInfoDrawer = false;
|
||||
this.activeCollectionInfoDrawer = false;
|
||||
},
|
||||
resetDrawersExcept(drawer: string) {
|
||||
this.activePlatformsDrawer =
|
||||
@@ -52,6 +58,10 @@ export default defineStore("navigation", {
|
||||
drawer === "activePlatformInfoDrawer"
|
||||
? this.activePlatformInfoDrawer
|
||||
: false;
|
||||
this.activeCollectionInfoDrawer =
|
||||
drawer === "activeCollectionInfoDrawer"
|
||||
? this.activeCollectionInfoDrawer
|
||||
: false;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user