mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 18:11:16 +01:00
dashboard splitted into sub-views
This commit is contained in:
@@ -15,27 +15,27 @@ const routes = [
|
||||
{
|
||||
path: "/",
|
||||
name: "dashboard",
|
||||
component: () => import("@/views/Dashboard.vue"),
|
||||
component: () => import("@/views/Dashboard/Base.vue"),
|
||||
},
|
||||
{
|
||||
path: "/platform/:platform",
|
||||
name: "platform",
|
||||
component: () => import("@/views/Gallery.vue"),
|
||||
component: () => import("@/views/Gallery/Base.vue"),
|
||||
},
|
||||
{
|
||||
path: "/platform/:platform/:rom",
|
||||
name: "rom",
|
||||
component: () => import("@/views/Details.vue"),
|
||||
component: () => import("@/views/Details/Base.vue"),
|
||||
},
|
||||
{
|
||||
path: "/library/scan",
|
||||
name: "scan",
|
||||
component: () => import("@/views/library/Scan.vue"),
|
||||
component: () => import("@/views/Library/Scan.vue"),
|
||||
},
|
||||
{
|
||||
path: "/settings/control-panel",
|
||||
name: "controlPanel",
|
||||
component: () => import("@/views/settings/ControlPanel.vue"),
|
||||
component: () => import("@/views/Settings/ControlPanel.vue"),
|
||||
},
|
||||
{
|
||||
path: "/:pathMatch(.*)*",
|
||||
@@ -56,15 +56,14 @@ function isAuthenticated() {
|
||||
}
|
||||
|
||||
router.beforeEach(async (to, from) => {
|
||||
|
||||
const publicPages = ['/login'];
|
||||
const publicPages = ["/login"];
|
||||
const authRequired = !publicPages.includes(to.path);
|
||||
|
||||
if (!isAuthenticated() && to.name !== "login" && authRequired) {
|
||||
return { name: "login" };
|
||||
} else if (isAuthenticated() && to.name === "login") {
|
||||
return { name: "dashboard" };
|
||||
} else if (to.name == "noMatch"){
|
||||
} else if (to.name == "noMatch") {
|
||||
return { name: "dashboard" };
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
<script setup>
|
||||
import { useDisplay } from "vuetify";
|
||||
import { views } from "@/utils/utils.js";
|
||||
import storePlatforms from "@/stores/platforms.js";
|
||||
import PlatformCard from "@/components/Platform/PlatformCard.vue";
|
||||
|
||||
// Props
|
||||
const platforms = storePlatforms();
|
||||
const totalGames = platforms.totalGames;
|
||||
const { lgAndUp } = useDisplay();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- Summary -->
|
||||
<v-row class="pa-1" no-gutters>
|
||||
<v-col>
|
||||
<v-card rounded="0">
|
||||
<v-card-title class="bg-terciary"
|
||||
><v-icon class="mr-3">mdi-text-box-outline</v-icon
|
||||
>Summary</v-card-title
|
||||
>
|
||||
<v-divider class="border-opacity-25" />
|
||||
<v-card-text>
|
||||
<v-chip-group>
|
||||
<v-chip class="text-overline bg-chip" label>
|
||||
<v-icon class="mr-2">mdi-controller</v-icon
|
||||
>{{ platforms.value.length }} Platforms
|
||||
</v-chip>
|
||||
<v-chip class="text-overline bg-chip" label>
|
||||
<v-icon class="mr-2">mdi-disc</v-icon>{{ totalGames }} Games
|
||||
</v-chip>
|
||||
</v-chip-group>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<!-- Platforms -->
|
||||
<template v-if="platforms.value.length > 0">
|
||||
<v-row class="pa-1" no-gutters>
|
||||
<v-col>
|
||||
<v-card rounded="0">
|
||||
<v-card-title class="bg-terciary"
|
||||
><v-icon class="mr-3">mdi-controller</v-icon>Platforms</v-card-title
|
||||
>
|
||||
<v-divider class="border-opacity-25" />
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col
|
||||
v-for="platform in platforms.value"
|
||||
class="pa-1"
|
||||
:key="platform.slug"
|
||||
:cols="views[0]['size-cols']"
|
||||
:xs="views[0]['size-xs']"
|
||||
:sm="views[0]['size-sm']"
|
||||
:md="views[0]['size-md']"
|
||||
:lg="views[0]['size-lg']"
|
||||
>
|
||||
<platform-card :platform="platform" :key="platform.slug" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
</template>
|
||||
27
frontend/src/views/Dashboard/Base.vue
Normal file
27
frontend/src/views/Dashboard/Base.vue
Normal file
@@ -0,0 +1,27 @@
|
||||
<script setup>
|
||||
import storePlatforms from "@/stores/platforms.js";
|
||||
import dashboardSummary from "@/views/Dashboard/Summary.vue"
|
||||
import dashboardPlatforms from "@/views/Dashboard/Platforms.vue"
|
||||
|
||||
// Props
|
||||
const platforms = storePlatforms();
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- Summary -->
|
||||
<v-row class="pa-1" no-gutters>
|
||||
<v-col>
|
||||
<dashboard-summary />
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<!-- Platforms -->
|
||||
<template v-if="platforms.value.length > 0">
|
||||
<v-row class="pa-1" no-gutters>
|
||||
<v-col>
|
||||
<dashboard-platforms />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
</template>
|
||||
33
frontend/src/views/Dashboard/Platforms.vue
Normal file
33
frontend/src/views/Dashboard/Platforms.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<script setup>
|
||||
import { views } from "@/utils/utils.js";
|
||||
import PlatformCard from "@/components/Platform/PlatformCard.vue";
|
||||
import storePlatforms from "@/stores/platforms.js";
|
||||
|
||||
const platforms = storePlatforms();
|
||||
</script>
|
||||
<template>
|
||||
<v-card rounded="0">
|
||||
<v-toolbar class="bg-terciary" density="compact"
|
||||
><v-toolbar-title class="text-button"
|
||||
><v-icon class="mr-3">mdi-controller</v-icon>Platforms</v-toolbar-title
|
||||
></v-toolbar
|
||||
>
|
||||
<v-divider class="border-opacity-25" />
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col
|
||||
v-for="platform in platforms.value"
|
||||
class="pa-1"
|
||||
:key="platform.slug"
|
||||
:cols="views[0]['size-cols']"
|
||||
:xs="views[0]['size-xs']"
|
||||
:sm="views[0]['size-sm']"
|
||||
:md="views[0]['size-md']"
|
||||
:lg="views[0]['size-lg']"
|
||||
>
|
||||
<platform-card :platform="platform" :key="platform.slug" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
27
frontend/src/views/Dashboard/Summary.vue
Normal file
27
frontend/src/views/Dashboard/Summary.vue
Normal file
@@ -0,0 +1,27 @@
|
||||
<script setup>
|
||||
import storePlatforms from "@/stores/platforms.js";
|
||||
const platforms = storePlatforms();
|
||||
const totalGames = platforms.totalGames;
|
||||
</script>
|
||||
<template>
|
||||
<v-card rounded="0">
|
||||
<v-toolbar class="bg-terciary" density="compact">
|
||||
<v-toolbar-title class="text-button">
|
||||
<v-icon class="mr-3">mdi-text-box-outline</v-icon
|
||||
>Summary</v-toolbar-title
|
||||
>
|
||||
</v-toolbar>
|
||||
<v-divider class="border-opacity-25" />
|
||||
<v-card-text>
|
||||
<v-chip-group>
|
||||
<v-chip class="text-overline bg-chip" label>
|
||||
<v-icon class="mr-2">mdi-controller</v-icon
|
||||
>{{ platforms.value.length }} Platforms
|
||||
</v-chip>
|
||||
<v-chip class="text-overline bg-chip" label>
|
||||
<v-icon class="mr-2">mdi-disc</v-icon>{{ totalGames }} Games
|
||||
</v-chip>
|
||||
</v-chip-group>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
@@ -237,10 +237,10 @@ onBeforeRouteUpdate(async (to, _) => {
|
||||
|
||||
<!-- Empty gallery message -->
|
||||
<template v-else>
|
||||
<v-row class="fill-height justify-center align-center" no-gutters>
|
||||
<div class="text-h6">
|
||||
Feels empty here... <v-icon>mdi-emoticon-sad</v-icon>
|
||||
</div>
|
||||
<v-row class="align-center justify-center" no-gutters>
|
||||
<v-col cols="6" md="2">
|
||||
<v-card-text class="mt-16">Feels empty here... <v-icon>mdi-emoticon-sad</v-icon></v-card-text>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import Users from "@/views/settings/General/Users.vue";
|
||||
import Theme from "@/views/settings/UserInterface/Theme.vue";
|
||||
import Users from "@/views/Settings/General/Users.vue";
|
||||
import Theme from "@/views/Settings/UserInterface/Theme.vue";
|
||||
import version from "../../../package";
|
||||
|
||||
// Props
|
||||
@@ -130,8 +130,8 @@ const userSearch = ref("");
|
||||
</script>
|
||||
<template>
|
||||
<v-card rounded="0">
|
||||
<v-toolbar class="bg-terciary" density="comfortable">
|
||||
<v-toolbar-title
|
||||
<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
|
||||
>
|
||||
<v-btn
|
||||
@@ -15,8 +15,8 @@ function toggleTheme() {
|
||||
</script>
|
||||
<template>
|
||||
<v-card rounded="0">
|
||||
<v-toolbar class="bg-terciary" density="comfortable">
|
||||
<v-toolbar-title
|
||||
<v-toolbar class="bg-terciary" density="compact">
|
||||
<v-toolbar-title class="text-button"
|
||||
><v-icon class="mr-3">mdi-theme-light-dark</v-icon
|
||||
>Theme</v-toolbar-title
|
||||
>
|
||||
Reference in New Issue
Block a user