feat: show persisted investment data and sync state

Consume the provided resource-envelope API snapshot. Preserve financial snapshots during
refresh, observe synchronization without importing, and fence late responses across
account and connection changes.
This commit is contained in:
2026-09-26 21:22:49 +03:00
parent b987fd8e78
commit 4e5f564fa1
81 changed files with 4714 additions and 1420 deletions
@@ -5,6 +5,7 @@ import {
MultiSelect,
Progress,
Stack,
Text,
Title,
} from "@mantine/core";
import { DatePickerInput } from "@mantine/dates";
@@ -16,6 +17,7 @@ import {
type OperationCategory,
operationCategories,
} from "@/entities/broker-operation";
import { formatSnapshotTime } from "@/shared/lib";
import type { AccountOperationsPageViewModel } from "../AccountOperationsPage.vm";
type AccountOperationsPageLoadedProps = Extract<
@@ -59,13 +61,31 @@ const AccountOperationsPageLoaded: FC<AccountOperationsPageLoadedProps> = (
return (
<Stack gap="lg">
{props.lastSuccessfulAt ? (
<Text size="xs" c="dimmed">
{t("investment.sourceTime", {
date: formatSnapshotTime(props.lastSuccessfulAt),
})}
</Text>
) : null}
<Title order={1}>{t("ledger.title")}</Title>
<Button onClick={props.retry} disabled={props.refreshing} w="fit-content">
{t("investment.refresh")}
</Button>
{props.partial ? (
<Alert role="status">{t("investment.partial")}</Alert>
) : null}
{props.historyLoading ? <Alert>{t("investment.history")}</Alert> : null}
{props.refreshing ? (
<Progress value={100} animated aria-label={t("accounts.refreshing")} />
) : null}
{props.refreshError ? (
<Alert color="yellow">
{t("accounts.refreshError")}
<Alert color="yellow" role="status" aria-live="polite">
{t(
props.sourceError
? "investment.syncFailed"
: "accounts.refreshError",
)}
<Button variant="subtle" onClick={props.retry}>
{t("accounts.retry")}
</Button>
@@ -120,12 +140,12 @@ const AccountOperationsPageLoaded: FC<AccountOperationsPageLoadedProps> = (
operation={operation}
/>
))
) : (
) : !props.partial ? (
<StateView
title={t("ledger.emptyTitle")}
text={t("ledger.emptyText")}
/>
)}
) : null}
{hasNext || hasPrevious ? (
<Group justify="space-between">
<Button disabled={!hasPrevious} onClick={onPrevious}>