import type { FC } from "react"; import { Button } from "@mantine/core"; import { StateView } from "@wealthledger/ui"; import { useTranslation } from "react-i18next"; import { Link } from "react-router"; import { ApiErrorCode, isApiErrorCode } from "@/shared/api"; import { ReadRetryButton, type ReadRetryProps } from "@/shared/ui"; type AccountPageErrorProps = { code?: string; readRetry?: ReadRetryProps; }; const AccountPageError: FC = (props) => { const { code } = props; const { t } = useTranslation(); if (isApiErrorCode(code, ApiErrorCode.NotFound)) return ( {t("portfolio.back")} )} error text={t("portfolio.accountUnavailableText")} title={t("portfolio.accountUnavailableTitle")} /> ); if ( isApiErrorCode(code, ApiErrorCode.TbankNotConnected) || isApiErrorCode(code, ApiErrorCode.InvalidTbankToken) ) return ( {t("accounts.openSettings")} )} error text={t("portfolio.connectionErrorText")} title={t("portfolio.connectionErrorTitle")} /> ); const retry = props.readRetry?.exhausted ? ( ) : undefined; return ( ); }; export { AccountPageError };