Add admin dashboard page with usage stats, user breakdown, admin-only nav
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
import { useState } from 'react'
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom'
|
||||
import { Disc3, LayoutDashboard, Fingerprint, ListMusic, Compass, Store, Heart, Crown, Menu, X, LogOut, User } from 'lucide-react'
|
||||
import { Disc3, LayoutDashboard, Fingerprint, ListMusic, Compass, Store, Heart, Crown, Shield, Menu, X, LogOut, User } from 'lucide-react'
|
||||
import { useAuth } from '../lib/auth'
|
||||
|
||||
const navItems = [
|
||||
const ADMIN_EMAIL = 'chris.ryan@deepcutsai.com'
|
||||
|
||||
const baseNavItems = [
|
||||
{ path: '/dashboard', label: 'Dashboard', icon: LayoutDashboard },
|
||||
{ path: '/profile', label: 'My Taste', icon: Fingerprint },
|
||||
{ path: '/playlists', label: 'Playlists', icon: ListMusic },
|
||||
@@ -17,6 +19,10 @@ export default function Layout({ children }: { children: React.ReactNode }) {
|
||||
const [mobileMenuOpen, setMobileMenuOpen] = useState(false)
|
||||
const [userMenuOpen, setUserMenuOpen] = useState(false)
|
||||
const { user, logout } = useAuth()
|
||||
|
||||
const navItems = user?.email === ADMIN_EMAIL
|
||||
? [...baseNavItems, { path: '/admin', label: 'Admin', icon: Shield }]
|
||||
: baseNavItems
|
||||
const location = useLocation()
|
||||
const navigate = useNavigate()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user