feat(transactions): add live energy and estimated cost to transaction data

This commit is contained in:
2026-03-12 17:38:49 +08:00
parent f7ee298060
commit 88a80d2268
4 changed files with 110 additions and 19 deletions

View File

@@ -153,10 +153,32 @@ export default function TransactionsPage() {
{formatDuration(tx.startTimestamp, tx.stopTimestamp)}
</Table.Cell>
<Table.Cell className="tabular-nums">
{tx.energyWh != null ? (tx.energyWh / 1000).toFixed(3) : "—"}
{tx.energyWh != null ? (
(tx.energyWh / 1000).toFixed(3)
) : tx.liveEnergyWh != null ? (
<span className="inline-flex items-center gap-1">
{(tx.liveEnergyWh / 1000).toFixed(3)}
<span className="rounded bg-warning-soft px-1 py-0.5 text-[10px] font-semibold text-warning leading-none text-nowrap">
</span>
</span>
) : (
"—"
)}
</Table.Cell>
<Table.Cell className="tabular-nums">
{tx.chargeAmount != null ? `¥${(tx.chargeAmount / 100).toFixed(2)}` : "—"}
{tx.chargeAmount != null ? (
`¥${(tx.chargeAmount / 100).toFixed(2)}`
) : tx.estimatedCost != null ? (
<span className="inline-flex items-center gap-1">
¥{(tx.estimatedCost / 100).toFixed(2)}
<span className="rounded bg-warning-soft px-1 py-0.5 text-[10px] font-semibold text-warning leading-none text-nowrap">
</span>
</span>
) : (
"—"
)}
</Table.Cell>
<Table.Cell>
{tx.stopReason ? (