Skip to content

Commit

Permalink
Add sprinkle-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
lcharette committed Sep 25, 2024
1 parent 4195785 commit 14c3d42
Show file tree
Hide file tree
Showing 7 changed files with 487 additions and 582 deletions.
9 changes: 6 additions & 3 deletions app/assets/components/NavBar.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
<script setup>
import { useAuthStore } from '@userfrosting/sprinkle-account/stores'
import { useRouter } from 'vue-router'
const router = useRouter()
// Logout API variables
const auth = useAuthStore()
</script>

<template>
<UFNavBar title="Userfrosting">
<UFNavBarItem :to="{ name: 'home' }" label="Home" />
<UFNavBar title="Userfrosting" :to="{ name: 'home' }">
<UFNavBarItem :to="{ name: 'about' }" label="About" />
<UFNavBarItem :to="{ name: 'auth' }" label="Auth" />
<UFNavBarItem :to="{ name: 'register' }" label="Register" v-if="!auth.isAuthenticated" />
<UFNavBarItem :to="{ name: 'account.register' }" label="Register" v-if="!auth.isAuthenticated" />
<UFNavBarLogin v-if="!auth.isAuthenticated" />
<UFNavBarUserCard
v-if="auth.isAuthenticated"
:username="auth.user.full_name"
:avatar="auth.user.avatar"
:meta="auth.user.user_name">
<UFNavBarUserCardButton label="Dashboard" @click="router.push({ name: 'admin.dashboard' })" />
<UFNavBarUserCardButton label="My Account" @click="router.push({ name: 'admin.dashboard' })" />
<UFNavBarUserCardButton label="Logout" @click="auth.logout()" />
</UFNavBarUserCard>
</UFNavBar>
Expand Down
2 changes: 2 additions & 0 deletions app/assets/layouts/LayoutDashboard.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<script setup lang="ts">
import NavBar from '../components/NavBar.vue'
import FooterContent from '../components/FooterContent.vue'
import AdminSidebarMenuItems from '@userfrosting/sprinkle-admin/components/SidebarMenuItems.vue'
</script>

<template>
<NavBar />
<UFSideBar>
<UFSideBarLabel label="NAVIGATION" />
<AdminSidebarMenuItems />
</UFSideBar>
<UFMainContent>
<RouterView />
Expand Down
33 changes: 12 additions & 21 deletions app/assets/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import AccountRoutes from '@userfrosting/sprinkle-account/routes'
import AdminRoutes from '@userfrosting/sprinkle-admin/routes'
import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
Expand All @@ -18,7 +20,7 @@ const router = createRouter({
name: 'about',
meta: {
auth: {
redirect: { name: 'login' },
redirect: { name: 'account.login' },
}
},
component: () => import('../views/AboutView.vue')
Expand All @@ -28,26 +30,15 @@ const router = createRouter({
name: 'auth',
component: () => import('../views/AuthView.vue')
},
{
path: '/login',
name: 'login',
meta: {
guest: {
redirect: { name: 'home' }
}
},
component: () => import('../views/LoginView.vue')
},
{
path: '/register',
name: 'register',
meta: {
guest: {
redirect: { name: 'home' }
}
},
component: () => import('../views/RegisterView.vue')
}
// Include sprinkles routes
...AccountRoutes,
]
},
{
path: '',
component: () => import('../layouts/LayoutDashboard.vue'),
children: [
...AdminRoutes
]
}
]
Expand Down
3 changes: 0 additions & 3 deletions app/assets/views/LoginView.vue

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/views/RegisterView.vue

This file was deleted.

Loading

0 comments on commit 14c3d42

Please sign in to comment.