File size: 637 Bytes
9fc92d7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import AdminSidebar from './AdminSidebar'
import { useAuth } from '../context/AuthContext'

export default function AdminLayout({ children }) {
  const { user } = useAuth()

  if (!user || user.role !== 'admin') {
    return (
      <div className="text-center py-20">
        <h2 className="text-2xl font-bold">Unauthorized Access</h2>
        <p>You do not have permission to view this page</p>
      </div>
    )
  }

  return (
    <div className="bg-gray-100 min-h-screen">
      <div className="flex">
        <AdminSidebar />
        <main className="flex-1 p-8">
          {children}
        </main>
      </div>
    </div>
  )
}