Skip to content
Snippets Groups Projects
Unverified Commit fe70ecb6 authored by Fran González's avatar Fran González Committed by GitHub
Browse files

Fixes #3089: Dismiss pop-over on budget action (#3092)

* Fix no dismissal on budget action

* Add release notes file

* Correct tag

* Remove unnecessary callback

* Linting

* Apply same strategy on reportcomponents

* Rename to onMenuAction
parent 5c0bee60
No related branches found
No related tags found
No related merge requests found
......@@ -163,6 +163,12 @@ export const CategoryMonth = memo(function CategoryMonth({
const [balanceMenuOpen, setBalanceMenuOpen] = useState(false);
const triggerBalanceMenuRef = useRef(null);
const onMenuAction = (...args: Parameters<typeof onBudgetAction>) => {
onBudgetAction(...args);
setBalanceMenuOpen(false);
setMenuOpen(false);
};
return (
<View
style={{
......@@ -225,10 +231,9 @@ export const CategoryMonth = memo(function CategoryMonth({
>
<BudgetMenu
onCopyLastMonthAverage={() => {
onBudgetAction?.(month, 'copy-single-last', {
onMenuAction(month, 'copy-single-last', {
category: category.id,
});
setMenuOpen(false);
}}
onSetMonthsAverage={numberOfMonths => {
if (
......@@ -239,16 +244,14 @@ export const CategoryMonth = memo(function CategoryMonth({
return;
}
onBudgetAction?.(month, `set-single-${numberOfMonths}-avg`, {
onMenuAction(month, `set-single-${numberOfMonths}-avg`, {
category: category.id,
});
setMenuOpen(false);
}}
onApplyBudgetTemplate={() => {
onBudgetAction?.(month, 'apply-single-category-template', {
onMenuAction(month, 'apply-single-category-template', {
category: category.id,
});
setMenuOpen(false);
}}
/>
</Popover>
......@@ -351,11 +354,10 @@ export const CategoryMonth = memo(function CategoryMonth({
<BalanceMenu
categoryId={category.id}
onCarryover={carryover => {
onBudgetAction?.(month, 'carryover', {
onMenuAction(month, 'carryover', {
category: category.id,
flag: carryover,
});
setBalanceMenuOpen(false);
}}
/>
</Popover>
......
......@@ -158,6 +158,11 @@ export const ExpenseCategoryMonth = memo(function ExpenseCategoryMonth({
const [balanceMenuOpen, setBalanceMenuOpen] = useState(false);
const [hover, setHover] = useState(false);
const onMenuAction = (...args: Parameters<typeof onBudgetAction>) => {
onBudgetAction(...args);
setBudgetMenuOpen(false);
};
return (
<View
style={{
......@@ -221,7 +226,7 @@ export const ExpenseCategoryMonth = memo(function ExpenseCategoryMonth({
>
<BudgetMenu
onCopyLastMonthAverage={() => {
onBudgetAction?.(month, 'copy-single-last', {
onMenuAction(month, 'copy-single-last', {
category: category.id,
});
}}
......@@ -234,12 +239,12 @@ export const ExpenseCategoryMonth = memo(function ExpenseCategoryMonth({
return;
}
onBudgetAction?.(month, `set-single-${numberOfMonths}-avg`, {
onMenuAction(month, `set-single-${numberOfMonths}-avg`, {
category: category.id,
});
}}
onApplyBudgetTemplate={() => {
onBudgetAction?.(month, 'apply-single-category-template', {
onMenuAction(month, 'apply-single-category-template', {
category: category.id,
});
}}
......
---
category: Bugfix
authors: [sleepyfran]
---
Correctly dismiss pop-over when using the copy last month's budget feature
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment