import Tabs from '@/components/tabs'; import { Button } from '@/components/ui/button'; import { Card } from '@/components/ui/card'; import { ScrollArea } from '@/components/ui/scroll-area'; import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet'; import { TabsContent } from '@/components/ui/tabs'; import useScreen from '@/hooks/use-screen'; import LandingLayout from '@/layouts/landing-layout'; import { SharedData } from '@/types/global'; import { Link, useForm, usePage } from '@inertiajs/react'; import { FileQuestion, GraduationCap, Heart, ListFilter, LoaderCircle, Settings as SettingsIcon, UserCircle } from 'lucide-react'; import { FormEventHandler, ReactNode, useMemo, useState } from 'react'; import TabLists from './tab-lists'; const Layout = ({ children, tab }: { children: ReactNode; tab: string }) => { const { screen } = useScreen(); const [open, setOpen] = useState(false); const { props } = usePage(); const { translate, auth, system } = props; const { button } = translate; const tabs = useMemo( () => { const list = [ { id: 'courses', name: button.courses, slug: 'courses', Icon: GraduationCap, }, ...(system.fields?.show_student_exams === false ? [] : [ { id: 'exams', name: 'Prüfungen', slug: 'exams', Icon: FileQuestion, }, ]), ...(system.fields?.show_student_wishlist === false ? [] : [ { id: 'wishlist', name: button.wishlist, slug: 'wishlist', Icon: Heart, }, ]), { id: 'profile', name: button.profile, slug: 'profile', Icon: UserCircle, }, { id: 'settings', name: button.settings, slug: 'settings', Icon: SettingsIcon, }, ]; return list; }, [button.courses, button.wishlist, button.profile, button.settings, system.fields?.show_student_exams, system.fields?.show_student_wishlist], ); const { post, processing } = useForm({}); const submit: FormEventHandler = (e) => { e.preventDefault(); post(route('verification.send')); }; return (
{screen > 768 && ( )}
{!auth.user.email_verified_at && (
{status === 'verification-link-sent' ? (

Ein neuer Verifizierungslink wurde an die bei der Registrierung angegebene E-Mail-Adresse gesendet.

) : (

Ihre E-Mail-Adresse ist noch nicht verifiziert. Bitte bestätigen Sie Ihre E-Mail-Adresse, indem Sie auf den Link klicken, den wir Ihnen soeben per E-Mail gesendet haben.

)}
)} {tabs.map(({ id, slug }) => ( {screen < 768 && ( )} {children} ))}
); }; export default Layout;