import { type ReactNode } from 'react';

import DashboardLayout from '@admin/layouts/dashboard-layout';

/**
 * Inertia persistent-layout wrapper so Header/Sidebar/Synto JS stay mounted between visits.
 *
 * @see https://inertiajs.com/pages#persistent-layouts
 */
export function dashboardPersistentLayout(
    title: string,
    subtitle?: string,
    description?: string,
): (page: ReactNode) => React.JSX.Element {
    return (page: ReactNode) => (
        <DashboardLayout title={title} subtitle={subtitle} description={description}>
            {page}
        </DashboardLayout>
    );
}
