Mobile: To Budget inconsistency (#1540)

* rearrangement

* release note
This commit is contained in:
shall0pass
2023-08-18 15:39:22 -05:00
committed by GitHub
parent 32cc86ec99
commit ac055dc2e0
2 changed files with 30 additions and 18 deletions

View File

@@ -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={{

View File

@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [shall0pass]
---
Mobile: Show the correct To Budget amount on Budget Summary