-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Mobile] Category budget actions modal (#2501)
* Update autocomplete types * Remote optional type * Improve SingleInputModal * Fix lint error * Category budget modals * Cleanup + release notes * Cleanup * Fix typecheck errors * Update useMergedRefs * Fix lint error * Fix typecheck error * VRT updates * Focus amount on mount * Fix errors * Open modal on budget amount click * Updates * Remove unused props + updates * Fix lint error * Close budget menu modal on enter * Delete comment Co-authored-by: Matiss Janis Aboltins <[email protected]> * Update release notes --------- Co-authored-by: Matiss Janis Aboltins <[email protected]>
- Loading branch information
1 parent
2d188b3
commit e500cba
Showing
36 changed files
with
800 additions
and
358 deletions.
There are no files selected for viewing
Binary file modified
BIN
+0 Bytes
(100%)
...apshots/Mobile-creates-a-transaction-from-accounts-id-page-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+53 Bytes
(100%)
...apshots/Mobile-creates-a-transaction-from-accounts-id-page-2-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-9 Bytes
(100%)
...s-snapshots/Mobile-creates-a-transaction-via-footer-button-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+43 Bytes
(100%)
...s-snapshots/Mobile-creates-a-transaction-via-footer-button-2-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-53 Bytes
(100%)
...s-snapshots/Mobile-creates-a-transaction-via-footer-button-3-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-12 Bytes
(100%)
...s-snapshots/Mobile-creates-a-transaction-via-footer-button-4-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
packages/desktop-client/src/components/budget/report/BudgetMenu.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import React, { type ComponentPropsWithoutRef } from 'react'; | ||
|
||
import { useFeatureFlag } from '../../../hooks/useFeatureFlag'; | ||
import { Menu } from '../../common/Menu'; | ||
|
||
type BudgetMenuProps = Omit< | ||
ComponentPropsWithoutRef<typeof Menu>, | ||
'onMenuSelect' | 'items' | ||
> & { | ||
onCopyLastMonthAverage: () => void; | ||
onSetMonthsAverage: (numberOfMonths: number) => void; | ||
onApplyBudgetTemplate: () => void; | ||
}; | ||
export function BudgetMenu({ | ||
onCopyLastMonthAverage, | ||
onSetMonthsAverage, | ||
onApplyBudgetTemplate, | ||
...props | ||
}: BudgetMenuProps) { | ||
const isGoalTemplatesEnabled = useFeatureFlag('goalTemplatesEnabled'); | ||
const onMenuSelect = (name: string) => { | ||
switch (name) { | ||
case 'copy-single-last': | ||
onCopyLastMonthAverage?.(); | ||
break; | ||
case 'set-single-3-avg': | ||
onSetMonthsAverage?.(3); | ||
break; | ||
case 'set-single-6-avg': | ||
onSetMonthsAverage?.(6); | ||
break; | ||
case 'set-single-12-avg': | ||
onSetMonthsAverage?.(12); | ||
break; | ||
case 'apply-single-category-template': | ||
onApplyBudgetTemplate?.(); | ||
break; | ||
default: | ||
throw new Error(`Unrecognized menu item: ${name}`); | ||
} | ||
}; | ||
|
||
return ( | ||
<Menu | ||
{...props} | ||
onMenuSelect={onMenuSelect} | ||
items={[ | ||
{ | ||
name: 'copy-single-last', | ||
text: 'Copy last month’s budget', | ||
}, | ||
{ | ||
name: 'set-single-3-avg', | ||
text: 'Set to 3 month average', | ||
}, | ||
{ | ||
name: 'set-single-6-avg', | ||
text: 'Set to 6 month average', | ||
}, | ||
{ | ||
name: 'set-single-12-avg', | ||
text: 'Set to yearly average', | ||
}, | ||
...(isGoalTemplatesEnabled | ||
? [ | ||
{ | ||
name: 'apply-single-category-template', | ||
text: 'Apply budget template', | ||
}, | ||
] | ||
: []), | ||
]} | ||
/> | ||
); | ||
} |
Oops, something went wrong.