refactor!: support RUB only (WealthLedger/main#55) (#168)
Frontend verify / commits (push) Skipped
Frontend verify / security (push) Successful in 11s
Frontend verify / verify (push) Failing after 9m0s

This commit was merged in pull request #168.
This commit is contained in:
2026-11-11 09:36:29 +03:00
parent e2062ce837
commit 2b94a16ae5
55 changed files with 540 additions and 1153 deletions
@@ -4,8 +4,6 @@ import type {
BrokerageAccount,
} from "../api/useBrokerageAccounts";
const VISIBLE_CURRENCY_LIMIT = 2;
type BrokerageAccountCard = {
account: BrokerageAccount;
positionCounts: null | PositionCounts;
@@ -13,18 +11,13 @@ type BrokerageAccountCard = {
summary:
| {
portfolio: NonNullable<BrokerageAccount["portfolioSummary"]>;
remainingCurrencyCount: number;
state: "available";
totals: Money[];
totals: NonNullable<BrokerageAccount["portfolioSummary"]>["totals"];
}
| { state: "empty" }
| { state: "unavailable" };
};
type Money = NonNullable<
BrokerageAccount["portfolioSummary"]
>["totalsByCurrency"][number];
type PositionCounts = { bonds: number; stocks: number; total: number };
function accountTypeKey(type: BrokerageAccount["type"]) {
@@ -57,7 +50,7 @@ function brokerageAccountCards(
total: summary.totalPositionCount,
};
if (summary.totalsByCurrency.length === 0)
if (Number(summary.totals.value) === 0)
return { account, positionCounts, source, summary: { state: "empty" } };
return {
@@ -66,12 +59,8 @@ function brokerageAccountCards(
source,
summary: {
portfolio: summary,
remainingCurrencyCount: Math.max(
summary.totalsByCurrency.length - VISIBLE_CURRENCY_LIMIT,
0,
),
state: "available",
totals: summary.totalsByCurrency.slice(0, VISIBLE_CURRENCY_LIMIT),
totals: summary.totals,
},
};
});