Skip to content

Commit

Permalink
Fix: add missing transfers label
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis committed Jan 20, 2024
1 parent 69c55ed commit d676533
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ function CustomTooltip({ active, payload, isConcise }: CustomTooltipProps) {
</strong>
}
/>
{data.transfers !== 0 && (
<AlignedText
left="Transfers:"
right={
<PrivacyFilter>
{amountToCurrency(data.transfers)}
</PrivacyFilter>
}
/>
)}
<AlignedText
left="Balance:"
right={
Expand All @@ -96,6 +106,7 @@ type CashFlowGraphProps = {
expenses: { x: Date; y: number }[];
income: { x: Date; y: number }[];
balances: { x: Date; y: number }[];
transfers: { x: Date; y: number }[];
};
isConcise: boolean;
};
Expand All @@ -108,6 +119,7 @@ export function CashFlowGraph({ graphData, isConcise }: CashFlowGraphProps) {
expenses: row.y,
income: graphData.income[idx].y,
balance: graphData.balances[idx].y,
transfers: graphData.transfers[idx].y,
}));

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ function recalculate(data, start, end, isConcise) {

res.income.push({ x, y: integerToAmount(income) });
res.expenses.push({ x, y: integerToAmount(expense) });
res.transfers.push({
x,
y: integerToAmount(creditTransfers + debitTransfers),
});
res.balances.push({
x,
y: integerToAmount(balance),
Expand All @@ -188,7 +192,7 @@ function recalculate(data, start, end, isConcise) {
});
return res;
},
{ expenses: [], income: [], balances: [] },
{ expenses: [], income: [], transfers: [], balances: [] },
);

const { balances } = graphData;
Expand Down

0 comments on commit d676533

Please sign in to comment.