From 715a7d3a1fb4e859784beabf18bae5e0783a497f Mon Sep 17 00:00:00 2001 From: zurdi Date: Fri, 28 Jun 2024 10:56:01 +0200 Subject: [PATCH 01/33] main navigation components extracted --- .../components/common/Navigation/HomeBtn.vue | 17 + .../common/Navigation/MainAppBar.vue | 29 ++ .../common/Navigation/MainDrawer.vue | 43 +++ .../common/Navigation/PlatformsBtn.vue | 19 ++ .../common/Navigation/PlatformsDrawer.vue | 31 ++ .../components/common/Navigation/ScanBtn.vue | 21 ++ .../common/Navigation/SearchBtn.vue | 15 + .../common/Navigation/SettingsDrawer.vue | 102 ++++++ .../common/Navigation/UploadBtn.vue | 20 ++ .../components/common/Navigation/UserBtn.vue | 28 ++ frontend/src/plugins/pinia.ts | 6 +- frontend/src/stores/navigation.ts | 10 + frontend/src/views/Home.vue | 292 +----------------- 13 files changed, 350 insertions(+), 283 deletions(-) create mode 100644 frontend/src/components/common/Navigation/HomeBtn.vue create mode 100644 frontend/src/components/common/Navigation/MainAppBar.vue create mode 100644 frontend/src/components/common/Navigation/MainDrawer.vue create mode 100644 frontend/src/components/common/Navigation/PlatformsBtn.vue create mode 100644 frontend/src/components/common/Navigation/PlatformsDrawer.vue create mode 100644 frontend/src/components/common/Navigation/ScanBtn.vue create mode 100644 frontend/src/components/common/Navigation/SearchBtn.vue create mode 100644 frontend/src/components/common/Navigation/SettingsDrawer.vue create mode 100644 frontend/src/components/common/Navigation/UploadBtn.vue create mode 100644 frontend/src/components/common/Navigation/UserBtn.vue diff --git a/frontend/src/components/common/Navigation/HomeBtn.vue b/frontend/src/components/common/Navigation/HomeBtn.vue new file mode 100644 index 000000000..e88bc2158 --- /dev/null +++ b/frontend/src/components/common/Navigation/HomeBtn.vue @@ -0,0 +1,17 @@ + + diff --git a/frontend/src/components/common/Navigation/MainAppBar.vue b/frontend/src/components/common/Navigation/MainAppBar.vue new file mode 100644 index 000000000..9f59e7390 --- /dev/null +++ b/frontend/src/components/common/Navigation/MainAppBar.vue @@ -0,0 +1,29 @@ + + diff --git a/frontend/src/components/common/Navigation/MainDrawer.vue b/frontend/src/components/common/Navigation/MainDrawer.vue new file mode 100644 index 000000000..f44e3d2d1 --- /dev/null +++ b/frontend/src/components/common/Navigation/MainDrawer.vue @@ -0,0 +1,43 @@ + + diff --git a/frontend/src/components/common/Navigation/PlatformsBtn.vue b/frontend/src/components/common/Navigation/PlatformsBtn.vue new file mode 100644 index 000000000..d2571f0fe --- /dev/null +++ b/frontend/src/components/common/Navigation/PlatformsBtn.vue @@ -0,0 +1,19 @@ + + diff --git a/frontend/src/components/common/Navigation/PlatformsDrawer.vue b/frontend/src/components/common/Navigation/PlatformsDrawer.vue new file mode 100644 index 000000000..f622a98fd --- /dev/null +++ b/frontend/src/components/common/Navigation/PlatformsDrawer.vue @@ -0,0 +1,31 @@ + + diff --git a/frontend/src/components/common/Navigation/ScanBtn.vue b/frontend/src/components/common/Navigation/ScanBtn.vue new file mode 100644 index 000000000..a6ef5e925 --- /dev/null +++ b/frontend/src/components/common/Navigation/ScanBtn.vue @@ -0,0 +1,21 @@ + + diff --git a/frontend/src/components/common/Navigation/SearchBtn.vue b/frontend/src/components/common/Navigation/SearchBtn.vue new file mode 100644 index 000000000..f1854310a --- /dev/null +++ b/frontend/src/components/common/Navigation/SearchBtn.vue @@ -0,0 +1,15 @@ + + diff --git a/frontend/src/components/common/Navigation/SettingsDrawer.vue b/frontend/src/components/common/Navigation/SettingsDrawer.vue new file mode 100644 index 000000000..2e60c9193 --- /dev/null +++ b/frontend/src/components/common/Navigation/SettingsDrawer.vue @@ -0,0 +1,102 @@ + + diff --git a/frontend/src/components/common/Navigation/UploadBtn.vue b/frontend/src/components/common/Navigation/UploadBtn.vue new file mode 100644 index 000000000..c3e76fe7a --- /dev/null +++ b/frontend/src/components/common/Navigation/UploadBtn.vue @@ -0,0 +1,20 @@ + + diff --git a/frontend/src/components/common/Navigation/UserBtn.vue b/frontend/src/components/common/Navigation/UserBtn.vue new file mode 100644 index 000000000..c4765a0f4 --- /dev/null +++ b/frontend/src/components/common/Navigation/UserBtn.vue @@ -0,0 +1,28 @@ + + diff --git a/frontend/src/plugins/pinia.ts b/frontend/src/plugins/pinia.ts index b0b380854..4b3a8a582 100644 --- a/frontend/src/plugins/pinia.ts +++ b/frontend/src/plugins/pinia.ts @@ -1,5 +1,9 @@ import { createPinia } from "pinia"; +import { markRaw } from "vue"; +import router from "@/plugins/router"; const pinia = createPinia(); - +pinia.use(({ store }) => { + store.$router = markRaw(router); +}); export default pinia; diff --git a/frontend/src/stores/navigation.ts b/frontend/src/stores/navigation.ts index 61c710c86..3bb9ad9b2 100644 --- a/frontend/src/stores/navigation.ts +++ b/frontend/src/stores/navigation.ts @@ -8,11 +8,21 @@ export default defineStore("navigation", { actions: { switchActivePlatformsDrawer() { + this.activeSettingsDrawer = false; this.activePlatformsDrawer = !this.activePlatformsDrawer; }, switchActiveSettingsDrawer() { + this.activePlatformsDrawer = false; this.activeSettingsDrawer = !this.activeSettingsDrawer; }, + goHome() { + this.resetDrawers(); + this.$router.push({ name: "dashboard" }); + }, + goScan() { + this.resetDrawers(); + this.$router.push({ name: "scan" }); + }, resetDrawers() { this.activePlatformsDrawer = false; this.activeSettingsDrawer = false; diff --git a/frontend/src/views/Home.vue b/frontend/src/views/Home.vue index 42f2d7e66..896151a86 100644 --- a/frontend/src/views/Home.vue +++ b/frontend/src/views/Home.vue @@ -16,11 +16,12 @@ import SearchCoverDialog from "@/components/common/Game/Dialog/SearchCoverRom.vu import SearchRomDialog from "@/components/common/Game/Dialog/SearchRom.vue"; import UploadRomDialog from "@/components/common/Game/Dialog/UploadRom.vue"; import LoadingView from "@/components/common/LoadingView.vue"; +import MainAppBar from "@/components/common/Navigation/MainAppBar.vue"; +import MainDrawer from "@/components/common/Navigation/MainDrawer.vue"; import NewVersion from "@/components/common/NewVersion.vue"; import DeletePlatformDialog from "@/components/common/Platform/Dialog/DeletePlatform.vue"; -import PlatformListItem from "@/components/common/Platform/ListItem.vue"; -import RommIso from "@/components/common/RommIso.vue"; -import identityApi from "@/services/api/identity"; +import PlatformsDrawer from "@/components/common/Navigation/PlatformsDrawer.vue"; +import SettingsDrawer from "@/components/common/Navigation/SettingsDrawer.vue"; import platformApi from "@/services/api/platform"; import userApi from "@/services/api/user"; import storeAuth from "@/stores/auth"; @@ -28,11 +29,9 @@ import storeNavigation from "@/stores/navigation"; import storePlatforms from "@/stores/platforms"; import storeScanning from "@/stores/scanning"; import type { Events } from "@/types/emitter"; -import { defaultAvatarPath } from "@/utils"; import type { Emitter } from "mitt"; import { storeToRefs } from "pinia"; -import { inject, onMounted, ref } from "vue"; -import { useRouter } from "vue-router"; +import { inject, onMounted } from "vue"; import { useDisplay } from "vuetify"; // Props @@ -41,9 +40,6 @@ const scanningStore = storeScanning(); const { scanning } = storeToRefs(scanningStore); const navigationStore = storeNavigation(); const platformsStore = storePlatforms(); -const { activePlatformsDrawer, activeSettingsDrawer } = - storeToRefs(navigationStore); -const router = useRouter(); const auth = storeAuth(); const emitter = inject>("emitter"); emitter?.on("refreshDrawer", async () => { @@ -52,45 +48,6 @@ emitter?.on("refreshDrawer", async () => { }); // Functions -function goHome() { - navigationStore.resetDrawers(); - router.push({ name: "dashboard" }); -} - -function goScan() { - navigationStore.resetDrawers(); - router.push({ name: "scan" }); -} - -function togglePlatformsDrawer() { - activeSettingsDrawer.value = false; - navigationStore.switchActivePlatformsDrawer(); -} - -function toggleSettingsDrawer() { - activePlatformsDrawer.value = false; - navigationStore.switchActiveSettingsDrawer(); -} - -async function logout() { - identityApi - .logout() - .then(({ data }) => { - emitter?.emit("snackbarShow", { - msg: data.msg, - icon: "mdi-check-bold", - color: "green", - }); - router.push({ name: "login" }); - }) - .catch(() => { - router.push({ name: "login" }); - }) - .finally(() => { - auth.setUser(null); - }); -} - onMounted(async () => { navigationStore.resetDrawers(); await userApi @@ -122,241 +79,13 @@ onMounted(async () => { /> - - - - mdi-controller - mdi-magnify-scan - - - - - - + - mdi-controller - mdi-magnify-scan - - + - - - - - + - - - - - - - - - - - - - UI Settings - Library Management - - Administration - - - - + @@ -381,8 +110,7 @@ onMounted(async () => { From 02f4bf4961948f2b5530ec10bca2bc43f5a2040d Mon Sep 17 00:00:00 2001 From: zurdi Date: Fri, 28 Jun 2024 11:49:23 +0200 Subject: [PATCH 02/33] collections view added --- .../components/common/Game/Card/ActionBar.vue | 12 +- .../common/Navigation/CollectionsBtn.vue | 31 ++ .../common/Navigation/CollectionsDrawer.vue | 64 ++++ .../common/Navigation/MainAppBar.vue | 2 + .../common/Navigation/MainDrawer.vue | 14 +- .../common/Navigation/PlatformsBtn.vue | 9 + .../common/Navigation/PlatformsDrawer.vue | 2 +- .../components/common/Navigation/ScanBtn.vue | 9 + .../common/Navigation/SettingsDrawer.vue | 14 +- .../components/common/Platform/ListItem.vue | 2 +- frontend/src/plugins/router.ts | 7 +- frontend/src/stores/navigation.ts | 9 + frontend/src/views/Gallery/Collection.vue | 311 ++++++++++++++++++ .../{Gallery.vue => Gallery/Platform.vue} | 0 frontend/src/views/Home.vue | 3 + 15 files changed, 465 insertions(+), 24 deletions(-) create mode 100644 frontend/src/components/common/Navigation/CollectionsBtn.vue create mode 100644 frontend/src/components/common/Navigation/CollectionsDrawer.vue create mode 100644 frontend/src/views/Gallery/Collection.vue rename frontend/src/views/{Gallery.vue => Gallery/Platform.vue} (100%) diff --git a/frontend/src/components/common/Game/Card/ActionBar.vue b/frontend/src/components/common/Game/Card/ActionBar.vue index 255bb21fa..c3b8e9720 100644 --- a/frontend/src/components/common/Game/Card/ActionBar.vue +++ b/frontend/src/components/common/Game/Card/ActionBar.vue @@ -1,19 +1,15 @@