feat: unify income payment cards and remove comparisons (WealthLedger/main#33) (#74)
feat: unify income payment cards and remove comparisons (WealthLedger/main#33)
This commit was merged in pull request #74.
This commit is contained in:
@@ -4,6 +4,7 @@ import { EntryCard } from "@wealthledger/ui";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { formatDate, formatMoney, instrumentLogoUrl } from "@/shared/lib";
|
||||
import { PayoutCard } from "@/shared/ui";
|
||||
|
||||
import type { BrokerageEvent } from "../api/useBrokerageEvents";
|
||||
|
||||
@@ -15,6 +16,27 @@ const BrokerageEventCard: FC<BrokerageEventCardProps> = (props) => {
|
||||
|
||||
const date = formatDate(event.date);
|
||||
|
||||
if (event.type === "coupon" || event.type === "dividend") {
|
||||
const title = [t(`events.type.${event.type}`), event.displayName].join(" · ");
|
||||
|
||||
const extraMetadata = [event.isin, event.account?.name]
|
||||
.filter(Boolean)
|
||||
.join(" · ");
|
||||
|
||||
return (
|
||||
<PayoutCard
|
||||
date={date}
|
||||
dateKind={event.dateKind}
|
||||
extraMetadata={extraMetadata}
|
||||
imageSrc={instrumentLogoUrl(event.logoName)}
|
||||
initial={(event.ticker.trim()[0] ?? "?").toUpperCase()}
|
||||
kind="forecast"
|
||||
projectedAmount={event.projectedAmount}
|
||||
title={title}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
const metadata = [
|
||||
date,
|
||||
event.dateKind === "registry"
|
||||
@@ -40,7 +62,7 @@ const BrokerageEventCard: FC<BrokerageEventCardProps> = (props) => {
|
||||
title={[t(`events.type.${event.type}`), event.displayName].join(" · ")}
|
||||
tone="neutral"
|
||||
value={projectedAmount}
|
||||
valueLabel={t("events.projectedAmount")}
|
||||
valueLabel={t("payout.forecast")}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user