Skip to content

A local-first personal finance app

Mobile: To Budget inconsistency (#1540)

shall0passac055dc2e07b
diff --git a/packages/desktop-client/src/components/modals/BudgetSummary.js b/packages/desktop-client/src/components/modals/BudgetSummary.js
index 4e78e8881d..80d7c4fb45 100644
--- a/packages/desktop-client/src/components/modals/BudgetSummary.js
+++ b/packages/desktop-client/src/components/modals/BudgetSummary.js
@@ -13,9 +13,31 @@ import format from '../spreadsheet/format';
import NamespaceContext from '../spreadsheet/NamespaceContext';
import useSheetValue from '../spreadsheet/useSheetValue';
+function ToBudget({ toBudget }) {
+ let budgetAmount = useSheetValue(toBudget);
+ return (
+ <View style={{ alignItems: 'center', marginBottom: 15 }}>
+ <Text style={styles.text}>
+ {budgetAmount < 0 ? 'Overbudget:' : 'To budget:'}
+ </Text>
+ <Text
+ style={[
+ styles.text,
+ {
+ fontWeight: '600',
+ fontSize: 22,
+ color: budgetAmount < 0 ? colors.r4 : colors.n1,
+ },
+ ]}
+ >
+ {format(budgetAmount, 'financial')}
+ </Text>
+ </View>
+ );
+}
+
function BudgetSummary({ month, modalProps }) {
const prevMonthName = monthUtils.format(monthUtils.prevMonth(month), 'MMM');
- const budgetAmount = useSheetValue(rolloverBudget.toBudget);
return (
<Modal title="Budget Details" {...modalProps} animate>
@@ -74,23 +96,7 @@ function BudgetSummary({ month, modalProps }) {
</View>
</View>
- <View style={{ alignItems: 'center', marginBottom: 15 }}>
- <Text style={styles.text}>
- {budgetAmount < 0 ? 'Overbudget:' : 'To budget:'}
- </Text>
- <Text
- style={[
- styles.text,
- {
- fontWeight: '600',
- fontSize: 22,
- color: budgetAmount < 0 ? colors.r4 : colors.n1,
- },
- ]}
- >
- {format(budgetAmount, 'financial')}
- </Text>
- </View>
+ <ToBudget toBudget={rolloverBudget.toBudget} />
<View
style={{
diff --git a/upcoming-release-notes/1540.md b/upcoming-release-notes/1540.md
new file mode 100644
index 0000000000..2f7d7c4ae6
--- /dev/null
+++ b/upcoming-release-notes/1540.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [shall0pass]
+---
+
+Mobile: Show the correct To Budget amount on Budget Summary