import { noop } from "lodash"; import { useRouter } from "next/router"; import React, { useEffect, useState } from "react"; import { Toaster } from "react-hot-toast"; import { APP_NAME } from "@calcom/lib/constants"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { StepCard, Steps, Button, SkeletonText } from "@calcom/ui"; export function WizardLayout({ children, maxSteps = 2, currentStep = 0, isOptionalCallback, }: { children: React.ReactNode; } & { maxSteps?: number; currentStep?: number; isOptionalCallback?: () => void }) { const { t, isLocaleReady } = useLocale(); const [meta, setMeta] = useState({ title: "", subtitle: " " }); const router = useRouter(); const { title, subtitle } = meta; useEffect(() => { setMeta({ title: window.document.title, subtitle: window.document.querySelector('meta[name="description"]')?.getAttribute("content") || "", }); }, [router.asPath]); return (
{isLocaleReady ? ( <>

{title.replace(` | ${APP_NAME}`, "")} 

{subtitle} 

) : ( <> )}
{children}
{isOptionalCallback && (
)}
); } export const getLayout = (page: React.ReactElement) => {page};