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:
@@ -11,10 +11,11 @@ import {
|
||||
formatSnapshotTime,
|
||||
instrumentLogoUrl,
|
||||
} from "@/shared/lib";
|
||||
import { PayoutCard } from "@/shared/ui";
|
||||
|
||||
import type { BrokerageOperation } from "../api/useBrokerageOperations";
|
||||
|
||||
import { operationLabelKey, paymentPresentation } from "../model/display";
|
||||
import { isIncomePayment, operationLabelKey, paymentPresentation } from "../model/display";
|
||||
|
||||
type LedgerEntryRowProps = {
|
||||
operation: BrokerageOperation;
|
||||
@@ -75,6 +76,28 @@ const LedgerEntryRow: FC<LedgerEntryRowProps> = (props) => {
|
||||
}
|
||||
else details = undefined;
|
||||
|
||||
if (isIncomePayment(operation)) {
|
||||
const extraMetadata = [
|
||||
instrument,
|
||||
props.withDetails ? null : operation.account?.name,
|
||||
].filter(Boolean).join(" · ");
|
||||
|
||||
return (
|
||||
<PayoutCard
|
||||
details={details}
|
||||
extraMetadata={extraMetadata}
|
||||
imageSrc={instrumentLogoUrl(operation.logoName)}
|
||||
initial={(instrument.trim()[0] ?? "?").toUpperCase()}
|
||||
kind="executed"
|
||||
occurredAt={formatSnapshotTime(operation.occurredAt)}
|
||||
payment={operation.payment}
|
||||
title={operation.description || t(operationLabelKey(operation.type))}
|
||||
typeLabel={t(paymentPresentation(operation).label)}
|
||||
wrap={props.wrap}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<EntryCard
|
||||
details={details}
|
||||
|
||||
Reference in New Issue
Block a user