({ children }: any)
| 26 | import { useUser } from "../store/session"; |
| 27 | |
| 28 | export default function AdminLayout({ children }: any) { |
| 29 | const { t, lang } = useTranslation("peppermint"); |
| 30 | |
| 31 | const { loading, user } = useUser(); |
| 32 | |
| 33 | const [sidebarOpen, setSidebarOpen] = useState(false); |
| 34 | |
| 35 | if (user && !user.isAdmin) { |
| 36 | return ( |
| 37 | <div className="flex items-center justify-center h-screen"> |
| 38 | <h1 className="text-4xl font-bold">You are not an admin</h1> |
| 39 | </div> |
| 40 | ); |
| 41 | } |
| 42 | |
| 43 | const navigation = [ |
| 44 | { |
| 45 | name: "Back", |
| 46 | href: "/", |
| 47 | current: null, |
| 48 | icon: MoveLeft, |
| 49 | }, |
| 50 | { |
| 51 | name: t("sl_users"), |
| 52 | href: "/admin/users/internal", |
| 53 | current: location.pathname === "/admin/users/internal", |
| 54 | icon: UserRound, |
| 55 | }, |
| 56 | { |
| 57 | name: t("sl_clients"), |
| 58 | href: "/admin/clients", |
| 59 | current: location.pathname === "/admin/clients", |
| 60 | icon: ContactIcon, |
| 61 | }, |
| 62 | { |
| 63 | name: "Email Queues", |
| 64 | href: "/admin/email-queues", |
| 65 | current: location.pathname === "/admin/email-queues", |
| 66 | icon: Mail, |
| 67 | }, |
| 68 | { |
| 69 | name: "Webhooks", |
| 70 | href: "/admin/webhooks", |
| 71 | current: location.pathname === "/admin/webhooks", |
| 72 | icon: Webhook, |
| 73 | }, |
| 74 | { |
| 75 | name: "SMTP Email", |
| 76 | href: "/admin/smtp", |
| 77 | current: location.pathname === "/admin/smtp", |
| 78 | icon: Mailbox, |
| 79 | }, |
| 80 | { |
| 81 | name: "Authentication", |
| 82 | href: "/admin/authentication", |
| 83 | current: location.pathname === "/admin/authentication", |
| 84 | icon: KeyRound, |
| 85 | }, |
nothing calls this directly
no test coverage detected