feat: render hourly investment states
Frontend verify / commits (push) Skipped
Frontend verify / security (push) Successful in 12s
Frontend verify / verify (push) Successful in 7m41s

This commit was merged in pull request #51.
This commit is contained in:
2026-10-09 21:13:34 +03:00
committed by ksv741
parent 20b2cdfd43
commit 3c226f8c29
36 changed files with 1388 additions and 1238 deletions
@@ -1,45 +1,24 @@
import type { FC } from "react";
import { Badge, Button, Stack, Text, Title } from "@mantine/core";
import { Button, Stack, Text, Title } from "@mantine/core";
import { useTranslation } from "react-i18next";
import { Link } from "react-router";
import type { InvestmentResourceMeta } from "@/shared/api";
import {
type BrokerageAccountCard,
BrokerageAccountList,
} from "@/entities/brokerage-account";
import { SourceSyncStatus } from "@/shared/ui";
type AccountsPageLoadedProps = {
accounts: BrokerageAccountCard[];
sync:
| null
| undefined
| {
finishedAt: null | string;
sections: {
accountId?: string;
errorCode: null | string;
section: string;
}[];
startedAt: string;
state: string;
};
meta: InvestmentResourceMeta;
};
const AccountsPageLoaded: FC<AccountsPageLoadedProps> = (props) => {
const { t } = useTranslation();
const sync = props.sync;
const syncLabel = sync
? new Intl.DateTimeFormat("ru-RU", {
dateStyle: "short",
timeStyle: "short",
}).format(new Date(sync.finishedAt ?? sync.startedAt))
: null;
const syncColor = sync?.state === "failed" || sync?.state === "partial"
? "red"
: "gray";
return (
<Stack gap="lg">
@@ -50,20 +29,11 @@ const AccountsPageLoaded: FC<AccountsPageLoadedProps> = (props) => {
{t("accounts.subtitle")}
</Text>
{sync && (
<Text c="dimmed" size="xs">
Последний обход:
{" "}
{syncLabel}
{" "}
<Badge
color={syncColor}
size="xs"
>
{sync.state}
</Badge>
</Text>
)}
<SourceSyncStatus
lastAttempt={props.meta.lastAttempt}
lastSuccessfulAt={props.meta.lastSuccessfulAt}
stale={props.meta.freshness === "stale"}
/>
</Stack>
<Button