mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 17:47:00 -05:00
Set inital focus on category when covering overspending (#7012)
* Set inital focus on category when covering overspending * Fixup: Make sure that the amount is set * Unused import * Fix bug where typing an amount and pressing enter uses previous value --------- Co-authored-by: Dagur Ammendrup <dagurp@vivaldi.com>
This commit is contained in:
committed by
GitHub
parent
ce890faeeb
commit
6460af3de4
@@ -3,7 +3,6 @@ import { Form } from 'react-aria-components';
|
||||
import { Trans, useTranslation } from 'react-i18next';
|
||||
|
||||
import { Button } from '@actual-app/components/button';
|
||||
import { InitialFocus } from '@actual-app/components/initial-focus';
|
||||
import { Input } from '@actual-app/components/input';
|
||||
import { styles } from '@actual-app/components/styles';
|
||||
import { View } from '@actual-app/components/view';
|
||||
@@ -53,7 +52,7 @@ export function CoverMenu({
|
||||
}, [categoryId, showToBeBudgeted, originalCategoryGroups]);
|
||||
|
||||
const _initialAmount = integerToCurrency(Math.abs(initialAmount ?? 0));
|
||||
const [amount, setAmount] = useState<string | null>(null);
|
||||
const [amount, setAmount] = useState<string>(_initialAmount);
|
||||
|
||||
function _onSubmit() {
|
||||
const parsedAmount = evalArithmetic(amount || '');
|
||||
@@ -75,13 +74,12 @@ export function CoverMenu({
|
||||
<Trans>Cover this amount:</Trans>
|
||||
</View>
|
||||
<View>
|
||||
<InitialFocus>
|
||||
<Input
|
||||
defaultValue={_initialAmount}
|
||||
onUpdate={setAmount}
|
||||
style={styles.tnum}
|
||||
/>
|
||||
</InitialFocus>
|
||||
<Input
|
||||
defaultValue={_initialAmount}
|
||||
onUpdate={setAmount}
|
||||
onChangeValue={setAmount}
|
||||
style={styles.tnum}
|
||||
/>
|
||||
</View>
|
||||
<View style={{ margin: '10px 0 5px 0' }}>
|
||||
<Trans>From:</Trans>
|
||||
@@ -90,6 +88,7 @@ export function CoverMenu({
|
||||
<CategoryAutocomplete
|
||||
categoryGroups={filteredCategoryGroups}
|
||||
value={null}
|
||||
focused
|
||||
openOnFocus
|
||||
onSelect={(id: string | undefined) => setFromCategoryId(id || null)}
|
||||
inputProps={{
|
||||
|
||||
6
upcoming-release-notes/7012.md
Normal file
6
upcoming-release-notes/7012.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Enhancements
|
||||
authors: [Dagur]
|
||||
---
|
||||
|
||||
When covering overspending the initial focus should be on the category, not the amount.
|
||||
Reference in New Issue
Block a user