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 { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'; import useScreen from '@/hooks/use-screen'; import LandingLayout from '@/layouts/landing-layout'; import { getQueryParams } from '@/lib/route'; import { router, usePage } from '@inertiajs/react'; import { Grid, List, ListFilter } from 'lucide-react'; import { ReactNode, useState } from 'react'; import { ExamsIndexProps } from './index'; import ExamFilter from './partials/exam-filter'; const Layout = ({ children }: { children: ReactNode }) => { const { url, props } = usePage(); const { category, translate } = props; const { frontend } = translate; const [open, setOpen] = useState(false); const urlParams = getQueryParams(url); const viewType = urlParams['view'] ?? 'grid'; const { screen } = useScreen(); const getQueryRoute = (newParams: Record, category?: string) => { const updatedParams = { ...urlParams }; if ('search' in updatedParams) { delete updatedParams.search; } return route('category.exams', { category: category || 'all', ...updatedParams, ...newParams, }); }; const gridListHandler = (view: string) => { router.get(getQueryRoute({ view }, category?.slug)); }; return (
{screen > 768 && ( )} {/* Main Content */}
{screen < 768 && ( )}

{category ? category.title : frontend.all} Exams

{category && category.description &&

{category.description}

}

{frontend.grid_view}

{frontend.list_view}

{/* Exam Grid */} {children}
); }; export default Layout;