UI redesign

This commit is contained in:
zurdi zurdo
2023-04-20 18:19:52 +02:00
parent dc9a454e62
commit f21e4e09ba
17 changed files with 143 additions and 102 deletions

View File

@@ -2,7 +2,7 @@
import { ref, inject } from "vue"
import { useTheme } from "vuetify"
import AppBar from '@/components/AppBar/Base.vue'
import PlatformsDrawer from '@/components/PlatformsDrawer/Base.vue'
import MainDrawer from '@/components/MainDrawer/Base.vue'
import SettingsDrawer from '@/components/SettingsDrawer/Base.vue'
import Notification from '@/components/Notification.vue'
@@ -22,7 +22,7 @@ emitter.on('refresh', () => { refresh.value = !refresh.value })
<app-bar/>
<platforms-drawer :key="refresh"/>
<main-drawer :key="refresh"/>
<v-main>
<v-container fluid>
@@ -30,7 +30,7 @@ emitter.on('refresh', () => { refresh.value = !refresh.value })
</v-container>
</v-main>
<notification/>
<notification class="mt-4"/>
</v-app>
</template>

View File

@@ -24,13 +24,13 @@ emitter.on('scanning', (s) => { scanning.value = s })
<v-avatar size="100" class="ml-3 home-btn hidden-sm-and-down"><v-img src="/assets/romm_complete.svg"></v-img></v-avatar>
</router-link>
<platforms-btn/>
<platforms-btn class="ml-2 hidden-lg-and-up"/>
<v-spacer class="hidden-xs-and-down"/>
<upload-btn/>
<!-- <upload-btn/> -->
<search-bar/>
<search-bar class="mr-2 ml-2 hidden-xs"/>
<template v-slot:append>
<gallery-view-btn/>

View File

@@ -18,7 +18,6 @@ function changeView() {
<template>
<v-app-bar-nav-icon
@click="changeView()"
class="ma-2"
rounded="0">
<v-icon :icon="views[currentView]['icon']"/>
</v-app-bar-nav-icon>

View File

@@ -9,7 +9,6 @@ const emitter = inject('emitter')
<template>
<v-btn
@click="emitter.emit('togglePlatforms')"
class="ma-4 hidden-lg-and-up"
rounded="0"
icon
>

View File

@@ -15,7 +15,7 @@ const emitter = inject('emitter')
v-model="filter"
label="search"
prepend-inner-icon="mdi-magnify"
class="ml-2 mr-2 shrink"
class="shrink"
variant="outlined"
density="compact"
hide-details

View File

@@ -9,7 +9,6 @@ const emitter = inject('emitter')
<v-app-bar-nav-icon
title="settings"
@click="emitter.emit('toggleSettings')"
class="ml-2"
rounded="0">
<v-icon>mdi-cog</v-icon>
</v-app-bar-nav-icon>

View File

@@ -11,7 +11,6 @@ function uploadRom() {console.log("uploading rom")}
<template>
<v-app-bar-nav-icon
@click="uploadRom()"
class="ma-2"
rounded="0"
disabled>
<v-icon>mdi-upload</v-icon>

View File

@@ -7,7 +7,7 @@ const forceImgReload = Date.now()
<template>
<router-link
style="text-decoration: none; color: inherit;"
:to="`/${$route.params.platform}/roms/${rom.id}`">
:to="`/platform/${$route.params.platform}/rom/${rom.id}`">
<v-img
:value="rom.id"
:key="rom.id"

View File

@@ -13,7 +13,7 @@ const emitter = inject('emitter')
<template>
<v-list-item
:to="`/${$route.params.platform}/roms/${rom.id}`"
:to="`/platform/${$route.params.platform}/rom/${rom.id}`"
:value="rom.id"
:key="rom.id">
<v-row class="text-subtitle-2">

View File

@@ -0,0 +1,101 @@
<script setup>
import axios from "axios"
import { ref, inject } from "vue"
import RailBtn from '@/components/MainDrawer/RailBtn.vue'
import Platform from '@/components/MainDrawer/Platform.vue'
// Props
const platforms = ref([])
const platformsDrawer = ref(null)
const open = ref(['Platforms'])
const rail = (localStorage.getItem('rail') == 'true') ? ref(true) : ref(false)
// Event listeners bus
const emitter = inject('emitter')
emitter.on('platforms', (p) => { platforms.value = p })
emitter.on('togglePlatforms', () => { platformsDrawer.value = !platformsDrawer.value })
emitter.on('togglePlatformsRail', () => { rail.value = !rail.value; localStorage.setItem('rail', rail.value)})
// Functions
async function getPlatforms() {
axios.get('/api/platforms').then((response) => {
platforms.value = response.data.data
emitter.emit('platforms', platforms.value)
}).catch((error) => {console.log(error)})
}
getPlatforms()
</script>
<template>
<v-navigation-drawer v-model="platformsDrawer" :rail="rail" width="300" rail-width="145">
<v-list v-model:opened="open">
<router-link to="/" class="hidden-md-and-up">
<v-row class="justify-center">
<v-img v-show="!rail" src="/assets/romm_complete.svg" class="home-btn justify-center"/>
<v-img v-show="rail" src="/assets/romm.svg" class="home-btn justify-center"/>
</v-row>
</router-link>
<v-divider class="border-opacity-25 hidden-md-and-up"/>
<v-list-group value="Platforms">
<template v-slot:activator="{ props }">
<v-list-item
v-bind="props">
<p class="text-body-1 text-truncate">{{ rail ? '' : 'Platforms' }}</p>
<template v-slot:prepend>
<v-avatar :rounded="0" size="40"><v-icon>mdi-controller</v-icon></v-avatar>
</template>
</v-list-item>
</template>
<platform class="drawer-item" v-for="platform in platforms" :platform="platform" :rail="rail" :key="platform.slug"/>
</v-list-group>
<v-list-group value="Library">
<template v-slot:activator="{ props }">
<v-list-item
v-bind="props">
<p class="text-body-1 text-truncate">{{ rail ? '' : 'Library' }}</p>
<template v-slot:prepend>
<v-avatar :rounded="0" size="40"><v-icon>mdi-animation-outline</v-icon></v-avatar>
</template>
</v-list-item>
</template>
<v-list-item class="drawer-item" disabled>
<p class="text-body-2 text-truncate">{{ rail ? '' : 'Upload roms' }}</p>
<template v-slot:prepend>
<v-avatar :rounded="0" size="40"><v-icon>mdi-upload</v-icon></v-avatar>
</template>
</v-list-item>
<v-list-item class="drawer-item" disabled>
<p class="text-body-2 text-truncate">{{ rail ? '' : 'Upload saves' }}</p>
<template v-slot:prepend>
<v-avatar :rounded="0" size="40"><v-icon>mdi-content-save-all</v-icon></v-avatar>
</template>
</v-list-item>
</v-list-group>
</v-list>
<template v-slot:append>
<v-divider class="border-opacity-25" :thickness="1"/>
<rail-btn :rail="rail"/>
</template>
</v-navigation-drawer>
</template>
<style scoped>
.home-btn{
width: 100px;
height: 100px;
cursor: pointer;
}
.drawer-item {
padding-inline-start: 30px !important;
}
</style>

View File

@@ -0,0 +1,21 @@
<script setup>
// Props
const props = defineProps(['platform', 'rail'])
</script>
<template>
<v-list-item :to="`/platform/${platform.slug}`" :value="platform.slug" :key="platform" class="pt-4 pb-4">
<p class="text-body-2 text-truncate">{{ rail ? '' : platform.name }}</p>
<template v-slot:prepend>
<v-avatar :rounded="0" size="40"><v-img :src="'/assets/platforms/'+platform.slug+'.ico'"></v-img></v-avatar>
</template>
<template v-slot:append>
<v-chip class="ml-4 bg-chip" size="small">{{ platform.n_roms }}</v-chip>
</template>
</v-list-item>
</template>
<style scoped>
</style>

View File

@@ -14,7 +14,7 @@ emitter.on('snackbarScan', (snackbar) => {
</script>
<template>
<v-snackbar v-model="snackbarShow" :timeout="4000" location="top" class="mt-4" color="notification">
<v-snackbar v-model="snackbarShow" :timeout="4000" location="top" color="notification">
<v-icon :icon="snackbarStatus.icon" :color="snackbarStatus.color" class="ml-2 mr-2"/>
{{ snackbarStatus.msg }}
<template v-slot:actions>

View File

@@ -1,60 +0,0 @@
<script setup>
import axios from "axios"
import { ref, inject } from "vue"
import RailBtn from '@/components/PlatformsDrawer/RailBtn.vue'
import Platform from '@/components/PlatformsDrawer/Platform.vue'
// Props
const platforms = ref([])
const platformsDrawer = ref(null)
const rail = (localStorage.getItem('rail') == 'true') ? ref(true) : ref(false)
// Event listeners bus
const emitter = inject('emitter')
emitter.on('platforms', (p) => { platforms.value = p })
emitter.on('togglePlatforms', () => { platformsDrawer.value = !platformsDrawer.value })
emitter.on('togglePlatformsRail', () => { rail.value = !rail.value; localStorage.setItem('rail', rail.value)})
// Functions
async function getPlatforms() {
axios.get('/api/platforms').then((response) => {
platforms.value = response.data.data
emitter.emit('platforms', platforms.value)
}).catch((error) => {console.log(error)})
}
getPlatforms()
</script>
<template>
<v-navigation-drawer v-model="platformsDrawer" :rail="rail" width="300" rail-width="75">
<v-list>
<router-link to="/">
<v-row class="justify-center hidden-md-and-up">
<v-img v-show="!rail" src="/assets/romm_complete.svg" class="home-btn justify-center"/>
<v-img v-show="rail" src="/assets/romm.svg" class="home-btn justify-center"/>
</v-row>
</router-link>
<v-divider class="border-opacity-25 hidden-md-and-up"/>
<platform v-for="platform in platforms" :platform="platform" :rail="rail" :key="platform.slug"/>
</v-list>
<template v-slot:append>
<v-divider class="border-opacity-25" :thickness="1"/>
<rail-btn :rail="rail"/>
</template>
</v-navigation-drawer>
</template>
<style scoped>
.home-btn{
width: 100px;
height: 100px;
cursor: pointer;
}
</style>

View File

@@ -1,24 +0,0 @@
<script setup>
// Props
const props = defineProps(['platform', 'rail'])
</script>
<template>
<v-list-item :to="`/${platform.slug}`" :value="platform.slug" :key="platform" class="pt-4 pb-4">
<p class="text-subtitle-2 text-truncate">{{ rail ? '' : platform.name }}</p>
<template v-slot:prepend>
<v-avatar :rounded="0"><v-img :src="'/assets/platforms/'+platform.slug+'.ico'"></v-img></v-avatar>
</template>
<template v-slot:append>
<v-chip class="ml-4 bg-chip" size="small">{{ platform.n_roms }}</v-chip>
</template>
</v-list-item>
</template>
<style scoped>
.v-navigation-drawer--rail:not(.v-navigation-drawer--is-hovering) .v-list .v-avatar {
--v-avatar-height: 40px;
}
</style>

View File

@@ -7,11 +7,11 @@ const routes = [
component: () => import('@/views/Home.vue')
},
{
path: '/:platform',
path: '/platform/:platform',
component: () => import('@/views/Gallery.vue')
},
{
path: '/:platform/roms/:rom',
path: '/platform/:platform/rom/:rom',
component: () => import('@/views/Details.vue')
}
]

View File

@@ -2,7 +2,9 @@
import axios from 'axios'
import { ref, inject, onMounted } from 'vue'
import { onBeforeRouteUpdate, useRoute } from 'vue-router'
import { useDisplay } from "vuetify"
import { normalizeString, views } from '@/utils/utils.js'
import SearchBar from '@/components/AppBar/SearchBar.vue'
import GameCard from '@/components/GameGallery/Card/Base.vue'
import GameListHeader from '@/components/GameGallery/ListItem/Header.vue'
import GameListItem from '@/components/GameGallery/ListItem/Item.vue'
@@ -15,6 +17,7 @@ const noRoms = ref(false)
const romsFiltered = ref([])
const currentFilter = ref('')
const currentView = ref(JSON.parse(localStorage.getItem('currentView')) || 0)
const { xs } = useDisplay()
// Event listeners bus
const emitter = inject('emitter')
@@ -55,6 +58,10 @@ onBeforeRouteUpdate(async (to, from) => {
<template>
<v-row v-if="xs" class="pa-1">
<search-bar/>
</v-row>
<v-row v-show="currentView != 2">
<v-col v-for="rom in romsFiltered"
:key="rom.file_name"
@@ -69,8 +76,8 @@ onBeforeRouteUpdate(async (to, from) => {
</v-row>
<v-table v-show="currentView == 2" class="bg-secondary">
<game-list-header/>
<v-table v-show="currentView == 2" class="bg-secondary pt-1">
<game-list-header />
<v-divider class="border-opacity-100 ml-1 mb-4 mr-1" color="rommAccent1" :thickness="1"/>
<tbody>
<game-list-item v-for="rom in romsFiltered" :key="rom.file_name" :rom="rom"/>