Skip to content

Commit

Permalink
Focus amount on mount
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Apr 11, 2024
1 parent 7fc5e34 commit fb727b5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ export function ReportCategoryBudgetMenuModal({
onUpdateBudget?.(amountToInteger(amount));
};

useEffect(() => {

Check failure on line 46 in packages/desktop-client/src/components/modals/ReportCategoryBudgetMenuModal.tsx

View workflow job for this annotation

GitHub Actions / typecheck

Cannot find name 'useEffect'.
setAmountFocused(true);
}, []);

return (
<Modal
title={`Budget: ${category?.name}`}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, type ComponentPropsWithoutRef } from 'react';
import React, { useState, type ComponentPropsWithoutRef, useEffect } from 'react';

Check warning on line 1 in packages/desktop-client/src/components/modals/RolloverCategoryBudgetMenuModal.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `·useState,·type·ComponentPropsWithoutRef,·useEffect·` with `⏎··useState,⏎··type·ComponentPropsWithoutRef,⏎··useEffect,⏎`

import { rolloverBudget } from 'loot-core/client/queries';
import { amountToInteger, integerToAmount } from 'loot-core/shared/util';
Expand All @@ -11,6 +11,7 @@ import { View } from '../common/View';
import { FocusableAmountInput } from '../mobile/transactions/FocusableAmountInput';
import { type CommonModalProps } from '../Modals';
import { useSheetValue } from '../spreadsheet/useSheetValue';
import { useInitialMount } from '../../hooks/useInitialMount';

Check warning on line 14 in packages/desktop-client/src/components/modals/RolloverCategoryBudgetMenuModal.tsx

View workflow job for this annotation

GitHub Actions / lint

`../../hooks/useInitialMount` import should occur before import of `../../style`

Check warning on line 14 in packages/desktop-client/src/components/modals/RolloverCategoryBudgetMenuModal.tsx

View workflow job for this annotation

GitHub Actions / lint

'useInitialMount' is defined but never used. Allowed unused vars must match /^(_|React)/u

type RolloverCategoryBudgetMenuModalProps = ComponentPropsWithoutRef<
typeof CategoryBudgetMenu
Expand Down Expand Up @@ -43,6 +44,10 @@ export function RolloverCategoryBudgetMenuModal({
onUpdateBudget?.(amountToInteger(amount));
};

useEffect(() => {
setAmountFocused(true);
}, []);

return (
<Modal
title={`Budget: ${category?.name}`}
Expand Down

0 comments on commit fb727b5

Please sign in to comment.