Add admin layout and pages: implement sidebar navigation and user role checks
This commit is contained in:
1 parent
a9cb8c45d5
commit
0f76978a33
7 files changed
+121
No files matched your search
@@ -0,0 +1,92 @@
|
|||||||
|
<template>
|
||||||
|
<Sidebar>
|
||||||
|
<template #sidebar>
|
||||||
|
<p class="title">Music - Admin</p>
|
||||||
|
|
||||||
|
<div class="category">
|
||||||
|
<Button
|
||||||
|
full
|
||||||
|
variant="ghost"
|
||||||
|
to="/admin"
|
||||||
|
type="link"
|
||||||
|
icon-name="lucide:house"
|
||||||
|
>
|
||||||
|
Dashboard
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="category">
|
||||||
|
<p>Manage</p>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
full
|
||||||
|
variant="ghost"
|
||||||
|
to="/admin/artists"
|
||||||
|
type="link"
|
||||||
|
icon-name="lucide:mic-vocal"
|
||||||
|
>
|
||||||
|
Manage Artists
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
full
|
||||||
|
variant="ghost"
|
||||||
|
to="/admin/albums"
|
||||||
|
type="link"
|
||||||
|
icon-name="lucide:gallery-vertical-end"
|
||||||
|
>
|
||||||
|
Manage Albums
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
full
|
||||||
|
variant="ghost"
|
||||||
|
to="/admin/songs"
|
||||||
|
type="link"
|
||||||
|
icon-name="lucide:music"
|
||||||
|
>
|
||||||
|
Manage Songs
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="category">
|
||||||
|
<p>Exit</p>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
full
|
||||||
|
variant="ghost"
|
||||||
|
to="/"
|
||||||
|
type="link"
|
||||||
|
icon-name="lucide:settings-2"
|
||||||
|
>
|
||||||
|
Exit Admin Panel
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template #default>
|
||||||
|
<slot />
|
||||||
|
</template>
|
||||||
|
</Sidebar>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
@use "@/styles/util" as *;
|
||||||
|
|
||||||
|
.title {
|
||||||
|
@include fontSize(24px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.search-input,
|
||||||
|
.title {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.category {
|
||||||
|
margin-bottom: 0.8rem;
|
||||||
|
|
||||||
|
& > p {
|
||||||
|
@include fontSize(13px);
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 0.1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -11,6 +11,8 @@ const onSearchInput = (v: string) => {
|
|||||||
else router.replace("/search")
|
else router.replace("/search")
|
||||||
}, 300)
|
}, 300)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { data: user } = useApiFetch<any>("/user")
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -69,6 +71,20 @@ const onSearchInput = (v: string) => {
|
|||||||
Songs
|
Songs
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="user?.role == 'admin'" class="category">
|
||||||
|
<p>Secret stuff</p>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
full
|
||||||
|
variant="ghost"
|
||||||
|
to="/admin"
|
||||||
|
type="link"
|
||||||
|
icon-name="lucide:settings-2"
|
||||||
|
>
|
||||||
|
Go To Admin Panel
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #default>
|
<template #default>
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
definePageMeta({
|
||||||
|
layout: "admin",
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<NuxtPage />
|
||||||
|
</template>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<template></template>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<template></template>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<template>Hello</template>
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<template>Songs</template>
|
||||||
Reference in new issue
Block a user