refactor!: support RUB only (WealthLedger/main#55) (#168)
This commit was merged in pull request #168.
This commit is contained in:
+3
-8
@@ -5,7 +5,6 @@ import {
|
||||
Stack,
|
||||
Title,
|
||||
} from "@mantine/core";
|
||||
import { StateView } from "@wealthledger/ui";
|
||||
import { FormProvider } from "react-hook-form";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
@@ -25,13 +24,9 @@ const AccountIncomePageLoadedSummary: FC<LoadedProps> = (props) => {
|
||||
|
||||
const { analytics } = props;
|
||||
|
||||
if (props.partial) {
|
||||
return <Alert role="status">{t("investment.partial")}</Alert>;
|
||||
}
|
||||
|
||||
return analytics.totalsByCurrency.length > 0
|
||||
? <IncomeSummary totals={analytics.totalsByCurrency} />
|
||||
: <StateView text={t("income.emptyText")} title={t("income.emptyTitle")} />;
|
||||
return props.partial
|
||||
? <Alert role="status">{t("investment.partial")}</Alert>
|
||||
: <IncomeSummary totals={analytics.total} />;
|
||||
};
|
||||
|
||||
const AccountIncomePageLoaded: FC<LoadedProps> = (props) => {
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { IncomeAnalytics } from "@/entities/income";
|
||||
|
||||
import { formatMoney } from "@/shared/lib";
|
||||
|
||||
type IncomeSummaryProps = { totals: IncomeAnalytics["totalsByCurrency"] };
|
||||
type IncomeSummaryProps = { totals: IncomeAnalytics["total"] };
|
||||
|
||||
const IncomeSummary: FC<IncomeSummaryProps> = (props) => {
|
||||
const { t } = useTranslation();
|
||||
@@ -16,16 +16,14 @@ const IncomeSummary: FC<IncomeSummaryProps> = (props) => {
|
||||
<Stack>
|
||||
<Title order={2}>{t("income.summaryTitle")}</Title>
|
||||
|
||||
{props.totals.map(total => (
|
||||
<Paper key={total.currency} p="md" radius="md" withBorder>
|
||||
<Text fw={700}>{formatMoney(total.total)}</Text>
|
||||
<Paper p="md" radius="md" withBorder>
|
||||
<Text fw={700}>{formatMoney(props.totals.total)}</Text>
|
||||
|
||||
<Text c="dimmed" size="sm">
|
||||
{t("income.coupon")}: {formatMoney(total.coupon)} ·{" "}
|
||||
{t("income.dividend")}: {formatMoney(total.dividend)}
|
||||
</Text>
|
||||
</Paper>
|
||||
))}
|
||||
<Text c="dimmed" size="sm">
|
||||
{t("income.coupon")}: {formatMoney(props.totals.coupon)} ·{" "}
|
||||
{t("income.dividend")}: {formatMoney(props.totals.dividend)}
|
||||
</Text>
|
||||
</Paper>
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user