main layout
This commit is contained in:
parent
62990170de
commit
f1e6e8b8d3
38 changed files with 1353 additions and 20 deletions
25
src/stores/account.ts
Normal file
25
src/stores/account.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { defineStore } from "pinia";
|
||||
|
||||
export const useAccountStore = defineStore("account", {
|
||||
state: () => {
|
||||
return {
|
||||
firstname: "" as string,
|
||||
lastname: "" as string,
|
||||
mail: "" as string,
|
||||
alias: "" as string,
|
||||
};
|
||||
},
|
||||
actions: {
|
||||
logoutAccount() {
|
||||
localStorage.removeItem("accessToken");
|
||||
localStorage.removeItem("refreshToken");
|
||||
window.open("/login", "_self");
|
||||
},
|
||||
setAccountData(firstname: string, lastname: string, mail: string, alias: string) {
|
||||
this.firstname = firstname;
|
||||
this.lastname = lastname;
|
||||
this.mail = mail;
|
||||
this.alias = alias;
|
||||
},
|
||||
},
|
||||
});
|
151
src/stores/admin/navigation.ts
Normal file
151
src/stores/admin/navigation.ts
Normal file
|
@ -0,0 +1,151 @@
|
|||
import { defineStore } from "pinia";
|
||||
import { shallowRef, defineAsyncComponent } from "vue";
|
||||
|
||||
export interface navigationModel {
|
||||
club: navigationSplitModel;
|
||||
settings: navigationSplitModel;
|
||||
user: navigationSplitModel;
|
||||
}
|
||||
|
||||
export interface navigationSplitModel {
|
||||
topTitle?: string;
|
||||
top?: Array<navigationLinkModel>;
|
||||
mainTitle: string;
|
||||
main: Array<navigationLinkModel>;
|
||||
}
|
||||
|
||||
export type topLevelNavigationType = "club" | "settings" | "user";
|
||||
|
||||
export interface topLevelNavigationModel {
|
||||
key: topLevelNavigationType;
|
||||
title: string;
|
||||
levelDefault: string;
|
||||
}
|
||||
|
||||
export interface navigationLinkModel {
|
||||
key: string;
|
||||
title: string;
|
||||
component: any;
|
||||
}
|
||||
|
||||
export const useNavigationStore = defineStore("navigation", {
|
||||
state: () => {
|
||||
return {
|
||||
activeNavigation: "club" as topLevelNavigationType,
|
||||
activeLink: null as null | navigationLinkModel,
|
||||
topLevel: [
|
||||
{
|
||||
key: "club",
|
||||
title: "Verein",
|
||||
levelDefault: "#members",
|
||||
},
|
||||
{
|
||||
key: "settings",
|
||||
title: "Einstellungen",
|
||||
levelDefault: "#qualification",
|
||||
},
|
||||
] as Array<topLevelNavigationModel>,
|
||||
navigation: {
|
||||
club: {
|
||||
mainTitle: "Verein",
|
||||
main: [
|
||||
{
|
||||
key: "#members",
|
||||
title: "Mitglieder",
|
||||
component: shallowRef(defineAsyncComponent(() => import("@/views/admin/members/Overview.vue"))),
|
||||
},
|
||||
{
|
||||
key: "#calendar",
|
||||
title: "Termine",
|
||||
component: shallowRef(defineAsyncComponent(() => import("@/views/admin/members/Overview.vue"))),
|
||||
},
|
||||
{
|
||||
key: "#newsletter",
|
||||
title: "Newsletter",
|
||||
component: shallowRef(defineAsyncComponent(() => import("@/views/admin/members/Overview.vue"))),
|
||||
},
|
||||
{
|
||||
key: "#protocol",
|
||||
title: "Prookolle",
|
||||
component: shallowRef(defineAsyncComponent(() => import("@/views/admin/members/Overview.vue"))),
|
||||
},
|
||||
],
|
||||
},
|
||||
settings: {
|
||||
mainTitle: "Einstellungen",
|
||||
main: [
|
||||
{
|
||||
key: "#qualification",
|
||||
title: "Qualifikationen",
|
||||
component: shallowRef(defineAsyncComponent(() => import("@/views/admin/members/Overview.vue"))),
|
||||
},
|
||||
{
|
||||
key: "#award",
|
||||
title: "Auszeichnungen",
|
||||
component: shallowRef(defineAsyncComponent(() => import("@/views/admin/members/Overview.vue"))),
|
||||
},
|
||||
{
|
||||
key: "#executive_position",
|
||||
title: "Vereinsämter",
|
||||
component: shallowRef(defineAsyncComponent(() => import("@/views/admin/members/Overview.vue"))),
|
||||
},
|
||||
{
|
||||
key: "#communication",
|
||||
title: "Mitgliederdaten",
|
||||
component: shallowRef(defineAsyncComponent(() => import("@/views/admin/members/Overview.vue"))),
|
||||
},
|
||||
],
|
||||
},
|
||||
user: {
|
||||
mainTitle: "Benutzer",
|
||||
main: [
|
||||
{
|
||||
key: "#user",
|
||||
title: "Benutzer",
|
||||
component: shallowRef(defineAsyncComponent(() => import("@/views/admin/members/Overview.vue"))),
|
||||
},
|
||||
{
|
||||
key: "#roles",
|
||||
title: "Rollen",
|
||||
component: shallowRef(defineAsyncComponent(() => import("@/views/admin/members/Overview.vue"))),
|
||||
},
|
||||
],
|
||||
},
|
||||
} as navigationModel,
|
||||
};
|
||||
},
|
||||
getters: {
|
||||
activeNavigationObject: (state) => (state.navigation[state.activeNavigation] ?? {}) as navigationSplitModel,
|
||||
activeTopLevelObject: (state) =>
|
||||
(state.topLevel.find((elem) => elem.key == state.activeNavigation) ?? {}) as topLevelNavigationModel,
|
||||
},
|
||||
actions: {
|
||||
setTopLevel(key: topLevelNavigationType, disableSubLink: boolean = true) {
|
||||
let level = this.topLevel.find((e) => e.key == key) ?? null;
|
||||
if (!level) {
|
||||
this.activeNavigation = "club";
|
||||
if (!disableSubLink) this.setLink(this.topLevel.find((e) => e.key == "club")?.levelDefault ?? null);
|
||||
else this.setLink(null);
|
||||
} else {
|
||||
this.activeNavigation = level.key;
|
||||
if (!disableSubLink) this.setLink(level.levelDefault);
|
||||
else this.setLink(null);
|
||||
}
|
||||
},
|
||||
setLink(key: string | null) {
|
||||
let nav = this.navigation[this.activeNavigation];
|
||||
if (!nav) {
|
||||
this.activeLink = null;
|
||||
return;
|
||||
}
|
||||
let links = [...Object.values(nav.main), ...Object.values(nav.top ?? {})];
|
||||
this.activeLink = links.find((e) => e.key == key) ?? null;
|
||||
},
|
||||
setTopLevelNav(topLeveLinks: Array<topLevelNavigationModel>) {
|
||||
this.topLevel = topLeveLinks;
|
||||
},
|
||||
resetNavigation() {
|
||||
this.$reset();
|
||||
},
|
||||
},
|
||||
});
|
14
src/stores/auth.ts
Normal file
14
src/stores/auth.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { defineStore } from "pinia";
|
||||
|
||||
export const useAuthStore = defineStore("auth", {
|
||||
state: () => {
|
||||
return {
|
||||
authCheck: false,
|
||||
};
|
||||
},
|
||||
actions: {
|
||||
setSuccess() {
|
||||
this.authCheck = true;
|
||||
},
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue