59 lines
2.3 KiB
Vue
59 lines
2.3 KiB
Vue
<script setup lang="ts">
|
|
import { computed } from 'vue';
|
|
import { Home, Settings2, Share2, ShoppingBag, Users } from '@lucide/vue';
|
|
import { SettingSection as SettingSectionConst } from '@/constants/setting-section';
|
|
import { useCan } from '@/composables/useCan';
|
|
import AdminLayout from '@/layouts/AdminLayout.vue';
|
|
import { cn } from '@/lib/utils';
|
|
import type { SettingSection } from '@/types/setting';
|
|
|
|
const activeSection = defineModel<SettingSection>('section', { required: true });
|
|
|
|
const { hasRole } = useCan();
|
|
|
|
const navItems = [
|
|
{ key: SettingSectionConst.SYSTEM, label: 'Sistem', icon: Settings2 },
|
|
{ key: SettingSectionConst.HOMEPAGE, label: 'Homepage', icon: Home },
|
|
{ key: SettingSectionConst.SOCIAL, label: 'Media Sosial', icon: Share2 },
|
|
{ key: SettingSectionConst.MARKETPLACE, label: 'Marketplace', icon: ShoppingBag },
|
|
{ key: SettingSectionConst.HR, label: 'HR / Pegawai', icon: Users },
|
|
];
|
|
|
|
const filteredNavItems = computed(() => {
|
|
if (hasRole('admin-toko')) {
|
|
return navItems.filter((item) => item.key === SettingSectionConst.MARKETPLACE);
|
|
}
|
|
return navItems;
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<AdminLayout>
|
|
<div class="space-y-6">
|
|
<div class="space-y-1">
|
|
<h2 class="text-2xl font-bold tracking-tight">
|
|
Pengaturan
|
|
</h2>
|
|
</div>
|
|
|
|
<div class="flex flex-col gap-6 lg:flex-row">
|
|
<nav class="flex shrink-0 flex-row gap-1 overflow-x-auto lg:w-56 lg:flex-col lg:overflow-visible">
|
|
<button v-for="item in filteredNavItems" :key="item.key" type="button" :class="cn(
|
|
'inline-flex items-center gap-2 rounded-md px-3 py-2 text-sm font-medium whitespace-nowrap transition-colors',
|
|
activeSection === item.key
|
|
? 'bg-accent text-accent-foreground'
|
|
: 'text-muted-foreground hover:bg-accent/50 hover:text-accent-foreground',
|
|
)" @click="activeSection = item.key">
|
|
<component :is="item.icon" class="size-4 shrink-0" />
|
|
{{ item.label }}
|
|
</button>
|
|
</nav>
|
|
|
|
<div class="min-w-0 flex-1">
|
|
<slot />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</AdminLayout>
|
|
</template>
|