chore: commit current workspace changes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React, { useState } from 'react'
|
||||
import { Link, usePage } from '@inertiajs/react'
|
||||
|
||||
const adminNavGroups = [
|
||||
const buildAdminNavGroups = (isAdmin) => [
|
||||
{
|
||||
label: 'Overview',
|
||||
items: [
|
||||
@@ -31,6 +31,7 @@ const adminNavGroups = [
|
||||
{
|
||||
label: 'System',
|
||||
items: [
|
||||
...(isAdmin ? [{ label: 'Auth Audit', href: '/moderation/auth-audit', icon: 'fa-solid fa-user-shield' }] : []),
|
||||
{ label: 'Settings', href: '/moderation/settings', icon: 'fa-solid fa-gear' },
|
||||
],
|
||||
},
|
||||
@@ -51,7 +52,9 @@ function NavLink({ item, active }) {
|
||||
)
|
||||
}
|
||||
|
||||
function Sidebar({ pathname }) {
|
||||
function Sidebar({ pathname, isAdmin }) {
|
||||
const adminNavGroups = buildAdminNavGroups(isAdmin)
|
||||
|
||||
const isActive = (item) => {
|
||||
if (item.exact) return pathname === item.href
|
||||
return pathname.startsWith(item.href.split('?')[0])
|
||||
@@ -103,9 +106,10 @@ function Sidebar({ pathname }) {
|
||||
}
|
||||
|
||||
export default function AdminLayout({ children, title, subtitle }) {
|
||||
const { url } = usePage()
|
||||
const { url, props } = usePage()
|
||||
const [mobileOpen, setMobileOpen] = useState(false)
|
||||
const pathname = url.split('?')[0]
|
||||
const currentUserIsAdmin = Boolean(props.auth?.user?.is_admin)
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen bg-[radial-gradient(ellipse_at_top,_rgba(239,68,68,0.08),_transparent_40%),linear-gradient(180deg,#060a12_0%,#020409_100%)]">
|
||||
@@ -113,7 +117,7 @@ export default function AdminLayout({ children, title, subtitle }) {
|
||||
{/* Desktop sidebar */}
|
||||
<div className="hidden lg:flex lg:w-64 lg:flex-shrink-0">
|
||||
<div className="fixed inset-y-0 left-0 w-64">
|
||||
<Sidebar pathname={pathname} />
|
||||
<Sidebar pathname={pathname} isAdmin={currentUserIsAdmin} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -137,13 +141,13 @@ export default function AdminLayout({ children, title, subtitle }) {
|
||||
<div className="fixed inset-0 z-30 lg:hidden">
|
||||
<div className="absolute inset-0 bg-black/60 backdrop-blur-sm" onClick={() => setMobileOpen(false)} />
|
||||
<div className="absolute left-0 top-0 h-full w-72 pt-14">
|
||||
<Sidebar pathname={pathname} />
|
||||
<Sidebar pathname={pathname} isAdmin={currentUserIsAdmin} />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Main content */}
|
||||
<div className="flex flex-1 flex-col lg:pl-64">
|
||||
<div className="flex flex-1 flex-col lg:pl-8">
|
||||
<main className="flex-1 px-6 py-8 pt-20 lg:pt-8">
|
||||
{(title || subtitle) && (
|
||||
<div className="mb-8">
|
||||
|
||||
Reference in New Issue
Block a user