import Tabs from '@/components/tabs'; import { TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import DashboardLayout from '@/layouts/dashboard/layout'; import { getQueryParams } from '@/lib/route'; import { SharedData } from '@/types/global'; import { router, usePage } from '@inertiajs/react'; import { ReactNode } from 'react'; import Google from './partials/google'; import Recaptcha from './partials/recaptcha'; interface Props extends SharedData { auths: Settings[]; } const Auth = ({ auths }: Props) => { const { props, url } = usePage(); const params = getQueryParams(url); const { translate } = props; const { common } = translate; const tabs = auths.map((auth) => { let Component; switch (auth.sub_type) { case 'google': Component = Google; break; case 'recaptcha': Component = Recaptcha; break; default: Component = ({ auth }: { auth: any }) =>
No component found
; break; } return { ...auth, Component, }; }); return (
{tabs.map(({ id, title, sub_type }) => ( router.get( route('settings.auth0', { tab: sub_type, }), ) } > {title} ))}
{tabs.map((auth) => ( ))}
); }; Auth.layout = (page: ReactNode) => ; export default Auth;