Frontend security / security (push) Successful in 9s
Frontend verify / verify (push) Successful in 5m27s
Frontend security / security (pull_request) Successful in 10s
Frontend verify / verify (pull_request) Successful in 5m24s
Conventional commits / commits (pull_request) Failing after 26s
OpenSpec change: evolve-frontend-stack
58 lines
1.4 KiB
TypeScript
58 lines
1.4 KiB
TypeScript
import { Button } from "@mantine/core";
|
|
import { StateView } from "@wealthledger/ui";
|
|
import type { FC } from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import { Link } from "react-router";
|
|
|
|
type AccountPageErrorProps = { code?: string; retry: () => void };
|
|
|
|
const AccountPageError: FC<AccountPageErrorProps> = (props) => {
|
|
const { code, retry } = props;
|
|
const { t } = useTranslation();
|
|
if (code === "NOT_FOUND")
|
|
return (
|
|
<StateView
|
|
error
|
|
title={t("portfolio.accountUnavailableTitle")}
|
|
text={t("portfolio.accountUnavailableText")}
|
|
action={
|
|
<Button component={Link} to="/accounts">
|
|
{t("portfolio.back")}
|
|
</Button>
|
|
}
|
|
/>
|
|
);
|
|
if (code === "TBANK_NOT_CONNECTED" || code === "INVALID_TBANK_TOKEN")
|
|
return (
|
|
<StateView
|
|
error
|
|
title={t("portfolio.connectionErrorTitle")}
|
|
text={t("portfolio.connectionErrorText")}
|
|
action={
|
|
<Button component={Link} to="/settings">
|
|
{t("accounts.openSettings")}
|
|
</Button>
|
|
}
|
|
/>
|
|
);
|
|
if (code === "TBANK_UNAVAILABLE")
|
|
return (
|
|
<StateView
|
|
error
|
|
title={t("accounts.unavailableTitle")}
|
|
text={t("accounts.unavailableText")}
|
|
action={<Button onClick={retry}>{t("accounts.retry")}</Button>}
|
|
/>
|
|
);
|
|
return (
|
|
<StateView
|
|
error
|
|
title={t("states.errorTitle")}
|
|
text={t("states.errorText")}
|
|
action={<Button onClick={retry}>{t("accounts.retry")}</Button>}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export { AccountPageError };
|