import DataSortModal from '@/components/data-sort-modal'; import Switch from '@/components/switch'; import { Button } from '@/components/ui/button'; import { Card } from '@/components/ui/card'; import { Label } from '@/components/ui/label'; import LandingLayout from '@/layouts/landing-layout'; import { IntroPageProps } from '@/types/page'; import { router, usePage } from '@inertiajs/react'; import { Settings } from 'lucide-react'; import { ReactNode } from 'react'; interface PageProps { page?: Page; navbarHeight?: boolean; children: ReactNode; } const Layout = ({ page: innerPage, navbarHeight = true, children }: PageProps) => { const { props } = usePage(); const { customize } = props; const page = innerPage || props.page; const slug = page.slug; const customizable = slug === 'about-us' || slug === 'our-team' || page.type !== 'inner_page'; const sections = page.sections.filter( (section) => section.slug !== 'footer_list_1' && section.slug !== 'footer_list_2' && section.slug !== 'footer_list_3', ); const sectionActiveChange = (id: string | number, active: boolean) => { router.post(route('page.section.update', id), { active, }); }; return ( {customize ? ( <> {customize && page && (
} onOrderChange={(newOrder, setOpen) => { router.post( route('page.section.sort'), { sortedData: newOrder, }, { preserveScroll: true, onSuccess: () => setOpen && setOpen(false) }, ); }} renderContent={(item) => (

{item.name}

sectionActiveChange(item.id, checked)} />
)} />
)} {/* Content */} {children} ) : ( children )}
); }; export default Layout;