Skip to content

A local-first personal finance app

Use ± symbol for 'between' schedule amounts and improve tooltip text (#8222)

Tom Mills19cea1aaff53
diff --git a/packages/desktop-client/src/components/schedules/SchedulesTable.tsx b/packages/desktop-client/src/components/schedules/SchedulesTable.tsx
index e85f85e421..a1c24dd3d1 100644
--- a/packages/desktop-client/src/components/schedules/SchedulesTable.tsx
+++ b/packages/desktop-client/src/components/schedules/SchedulesTable.tsx
@@ -138,8 +138,21 @@ export function ScheduleAmountCell({
const num = getScheduledAmount(amount);
const currencyAmount = format(Math.abs(num || 0), 'financial');
- const isApprox = op === 'isapprox' || op === 'isbetween';
-
+ const isApprox = op === 'isapprox';
+ const isBetween = op === 'isbetween';
+ let cellText = '';
+ if (isApprox) {
+ cellText = t('Approximately {{currencyAmount}}', {
+ currencyAmount,
+ });
+ } else if (isBetween && typeof amount != 'number') {
+ cellText = t('{{currency1}} to {{currency2}}', {
+ currency1: format(Math.abs(amount.num1 || 0), 'financial'),
+ currency2: format(Math.abs(amount.num2 || 0), 'financial'),
+ });
+ } else {
+ cellText = currencyAmount;
+ }
return (
<Cell
width={100}
@@ -160,15 +173,24 @@ export function ScheduleAmountCell({
lineHeight: '1em',
marginRight: 10,
}}
- title={
- isApprox
- ? t('Approximately {{currencyAmount}}', { currencyAmount })
- : currencyAmount
- }
+ title={cellText}
>
~
</View>
)}
+ {isBetween && (
+ <View
+ style={{
+ textAlign: 'left',
+ color: theme.pageTextSubdued,
+ lineHeight: '1em',
+ marginRight: 10,
+ }}
+ title={cellText}
+ >
+ ±
+ </View>
+ )}
<FinancialText
style={{
flex: 1,
@@ -177,11 +199,7 @@ export function ScheduleAmountCell({
overflow: 'hidden',
textOverflow: 'ellipsis',
}}
- title={
- isApprox
- ? t('Approximately {{currencyAmount}}', { currencyAmount })
- : currencyAmount
- }
+ title={cellText}
>
<PrivacyFilter>
{num > 0 ? `+${currencyAmount}` : `${currencyAmount}`}
@@ -349,12 +367,14 @@ export function SchedulesTable({
const payee = payees.find(p => schedule._payee === p.id);
const account = accounts.find(a => schedule._account === a.id);
const amount = getScheduledAmount(schedule._amount);
- const amountStr =
- (schedule._amountOp === 'isapprox' || schedule._amountOp === 'isbetween'
- ? '~'
- : '') +
- (amount > 0 ? '+' : '') +
- format(Math.abs(amount || 0), 'financial');
+ let amountStr = '';
+ if (schedule._amountOp === 'isbetween') {
+ amountStr = '±';
+ } else if (schedule._amountOp === 'isapprox') {
+ amountStr = '~';
+ }
+ amountStr +=
+ (amount > 0 ? '+' : '') + format(Math.abs(amount || 0), 'financial');
const dateStr = schedule.next_date
? monthUtilFormat(schedule.next_date, dateFormat)
: null;
diff --git a/upcoming-release-notes/between-amount-symbol-tooltip.md b/upcoming-release-notes/between-amount-symbol-tooltip.md
new file mode 100644
index 0000000000..b38817d8df
--- /dev/null
+++ b/upcoming-release-notes/between-amount-symbol-tooltip.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [tjmills-dev]
+---
+
+Use ± symbol for 'between' amount schedules and improve tooltip wording.