File size: 1,859 Bytes
53a811b
1e5ae4b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45e7f4a
1e5ae4b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53a811b
 
 
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { Head } from '@inertiajs/react';
import { AlertCircle } from 'lucide-react';
import type { ReactNode } from 'react';

import { AdminShell } from '@/components/admin/admin-shell';
import type { AdminMenu } from '@/components/admin/admin-shell';
import AppearanceToggle from '@/components/appearance-toggle';
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';

export function AdminPage({
    activeMenu,
    backendMessage,
    children,
    description,
    title,
}: {
    activeMenu: AdminMenu;
    backendMessage?: string | null;
    children: ReactNode;
    description: string;
    title: string;
}) {
    return (
        <>
            <Head title={title} />

            <AdminShell activeMenu={activeMenu}>
                <main className="lecturer-page">
                    <section className="lecturer-page-header">
                        <div>
                            <h1>{title}</h1>
                            <p>{description}</p>
                        </div>

                        <div className="lecturer-header-actions hidden sm:flex">
                            <AppearanceToggle className="lecturer-theme-toggle" />
                        </div>
                    </section>

                    {backendMessage ? (
                        <Alert
                            className="border-destructive/30 bg-destructive/10"
                            variant="destructive"
                        >
                            <AlertCircle className="size-4" />
                            <AlertTitle>Response backend</AlertTitle>
                            <AlertDescription>{backendMessage}</AlertDescription>
                        </Alert>
                    ) : null}

                    {children}
                </main>
            </AdminShell>
        </>
    );
}