import { PageProps } from "../validations/translations/translation"; import { UnAuthorizedPage } from "./unauthorizedpage"; import menuPages from "./index"; export function retrievePageByUrl(url: string, lang: "en" | "tr"): React.FC { if (url in menuPages) { const PageComponent = menuPages[url as keyof typeof menuPages]; // Return a new component that passes the lang prop to the original component return (props: PageProps) => ; } // Also pass lang to UnAuthorizedPage return (props: PageProps) => ; }