Skip to content

A local-first personal finance app

Modified transaction edit button on mobile to display "Add New Split" (#4536)

tempizd4b37baa4da5
diff --git a/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx b/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx
index e46f0f0693..ec20530193 100644
--- a/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx
+++ b/packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx
@@ -176,11 +176,11 @@ function Footer({
onEditField,
}) {
const [transaction, ...childTransactions] = transactions;
+ const emptySplitTransaction = childTransactions.find(t => t.amount === 0);
const onClickRemainingSplit = () => {
if (childTransactions.length === 0) {
onSplit(transaction.id);
} else {
- const emptySplitTransaction = childTransactions.find(t => t.amount === 0);
if (!emptySplitTransaction) {
onAddSplit(transaction.id);
} else {
@@ -216,11 +216,29 @@ function Footer({
marginLeft: 6,
}}
>
- Amount left:{' '}
- {integerToCurrency(
- transaction.amount > 0
- ? transaction.error.difference
- : -transaction.error.difference,
+ {!emptySplitTransaction ? (
+ <Trans>
+ Add new split -{' '}
+ {{
+ amount: integerToCurrency(
+ transaction.amount > 0
+ ? transaction.error.difference
+ : -transaction.error.difference,
+ ),
+ }}{' '}
+ left
+ </Trans>
+ ) : (
+ <Trans>
+ Amount left:{' '}
+ {{
+ amount: integerToCurrency(
+ transaction.amount > 0
+ ? transaction.error.difference
+ : -transaction.error.difference,
+ ),
+ }}
+ </Trans>
)}
</Text>
</Button>
@@ -272,7 +290,7 @@ function Footer({
marginLeft: 6,
}}
>
- Save changes
+ <Trans>Save changes</Trans>
</Text>
</Button>
)}
diff --git a/upcoming-release-notes/4536.md b/upcoming-release-notes/4536.md
new file mode 100644
index 0000000000..88b6ba46da
--- /dev/null
+++ b/upcoming-release-notes/4536.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [tempiz]
+---
+
+Mobile transaction edit button will display "Add New Split" when there are no empty splits.
\ No newline at end of file