import { useMemo } from "react"; import { Trans, useTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; import { useAsync } from "react-use"; import { MetaResponse, getBackendMeta } from "@/backend/accounts/meta"; import { Button } from "@/components/buttons/Button"; import { Icon, Icons } from "@/components/Icon"; import { LargeCard, LargeCardButtons, LargeCardText, } from "@/components/layout/LargeCard"; import { Loading } from "@/components/layout/Loading"; import { MwLink } from "@/components/text/Link"; import { useBackendUrl } from "@/hooks/auth/useBackendUrl"; interface TrustBackendPartProps { onNext?: (meta: MetaResponse) => void; } export function TrustBackendPart(props: TrustBackendPartProps) { const navigate = useNavigate(); const backendUrl = useBackendUrl(); const hostname = useMemo(() => new URL(backendUrl).hostname, [backendUrl]); const result = useAsync(() => { return getBackendMeta(backendUrl); }, [backendUrl]); const { t } = useTranslation(); let cardContent = ( <>
{t("auth.trust.failed.text")}
> ); if (result.loading) cardContent ={result.value.description}
) : null} > ); return (