mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-30 18:49:32 -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 { Trans, useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { Button } from '@actual-app/components/button';
|
import { Button } from '@actual-app/components/button';
|
||||||
import { InitialFocus } from '@actual-app/components/initial-focus';
|
|
||||||
import { Input } from '@actual-app/components/input';
|
import { Input } from '@actual-app/components/input';
|
||||||
import { styles } from '@actual-app/components/styles';
|
import { styles } from '@actual-app/components/styles';
|
||||||
import { View } from '@actual-app/components/view';
|
import { View } from '@actual-app/components/view';
|
||||||
@@ -53,7 +52,7 @@ export function CoverMenu({
|
|||||||
}, [categoryId, showToBeBudgeted, originalCategoryGroups]);
|
}, [categoryId, showToBeBudgeted, originalCategoryGroups]);
|
||||||
|
|
||||||
const _initialAmount = integerToCurrency(Math.abs(initialAmount ?? 0));
|
const _initialAmount = integerToCurrency(Math.abs(initialAmount ?? 0));
|
||||||
const [amount, setAmount] = useState<string | null>(null);
|
const [amount, setAmount] = useState<string>(_initialAmount);
|
||||||
|
|
||||||
function _onSubmit() {
|
function _onSubmit() {
|
||||||
const parsedAmount = evalArithmetic(amount || '');
|
const parsedAmount = evalArithmetic(amount || '');
|
||||||
@@ -75,13 +74,12 @@ export function CoverMenu({
|
|||||||
<Trans>Cover this amount:</Trans>
|
<Trans>Cover this amount:</Trans>
|
||||||
</View>
|
</View>
|
||||||
<View>
|
<View>
|
||||||
<InitialFocus>
|
<Input
|
||||||
<Input
|
defaultValue={_initialAmount}
|
||||||
defaultValue={_initialAmount}
|
onUpdate={setAmount}
|
||||||
onUpdate={setAmount}
|
onChangeValue={setAmount}
|
||||||
style={styles.tnum}
|
style={styles.tnum}
|
||||||
/>
|
/>
|
||||||
</InitialFocus>
|
|
||||||
</View>
|
</View>
|
||||||
<View style={{ margin: '10px 0 5px 0' }}>
|
<View style={{ margin: '10px 0 5px 0' }}>
|
||||||
<Trans>From:</Trans>
|
<Trans>From:</Trans>
|
||||||
@@ -90,6 +88,7 @@ export function CoverMenu({
|
|||||||
<CategoryAutocomplete
|
<CategoryAutocomplete
|
||||||
categoryGroups={filteredCategoryGroups}
|
categoryGroups={filteredCategoryGroups}
|
||||||
value={null}
|
value={null}
|
||||||
|
focused
|
||||||
openOnFocus
|
openOnFocus
|
||||||
onSelect={(id: string | undefined) => setFromCategoryId(id || null)}
|
onSelect={(id: string | undefined) => setFromCategoryId(id || null)}
|
||||||
inputProps={{
|
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