feat: add repayment discounts and interactive net worth trends

Support positive repayment discounts and negative surcharges with exact decimal conversion. Add independent trend toggles, pointer and keyboard date inspection, tests and Chinese documentation.
This commit is contained in:
陈煜 committed 2026-10-04 22:25:32 +08:00
1 parent 096f1577c2
commit b2c22ca050
16 files changed
+505 -84

No files matched your search

+12
View File
@@ -1,4 +1,5 @@
import React, { useState } from 'react';
import { repaymentFee } from './repayment';
import { AccountPicker } from './AccountPicker';
import { QuickTransfer } from './QuickTransfer';
import { money, positionAmount, type Position } from './api';
@@ -14,6 +15,7 @@ export type QuickEntry = {
after?: string;
amount?: string;
received?: string;
fee?: string;
targetCurrency?: string;
date: string;
previousMonth?: string | null;
@@ -82,6 +84,15 @@ export function QuickJournal({
)}
</p>
)}
{entry.kind === 'transfer' && entry.fee && !/^-?0(?:\.0+)?$/.test(entry.fee) && (
<p>
{tr(entry.fee.startsWith('-') ? '优惠' : '手续费')} ·{' '}
{money(
entry.fee.startsWith('-') ? repaymentFee(entry.fee) : entry.fee,
entry.currency,
)}
</p>
)}
{entry.kind === 'mark' && (
<p>{tr(entry.month ? '已标记本月还款' : '已取消本月标记')}</p>
)}
@@ -154,6 +165,7 @@ export function QuickRepayment({
changeSource={() => setSourceId('')}
changeTarget={() => {}}
fixedTarget
repayment
actionLabel={tr('确认还款')}
submit={submit}
/>