A local-first personal finance app
Maintenance: BudgetSummary & CreateLocalAccount to tsx (#1768)
Michael Clarkefba86a72ddf
diff --git a/packages/desktop-client/src/components/autocomplete/Autocomplete.tsx b/packages/desktop-client/src/components/autocomplete/Autocomplete.tsxindex 8a903955df..f6ea70b82d 100644--- a/packages/desktop-client/src/components/autocomplete/Autocomplete.tsx+++ b/packages/desktop-client/src/components/autocomplete/Autocomplete.tsx@@ -164,7 +164,7 @@ type SingleAutocompleteProps = {openOnFocus?: boolean;getHighlightedIndex?: (suggestions) => number | null;highlightFirst?: boolean;- onUpdate: (id: unknown, value: string) => void;+ onUpdate?: (id: unknown, value: string) => void;strict?: boolean;onSelect: (id: unknown, value: string) => void;tableBehavior?: boolean;diff --git a/packages/desktop-client/src/components/common/InlineField.tsx b/packages/desktop-client/src/components/common/InlineField.tsxindex 285191ff87..0a31f19865 100644--- a/packages/desktop-client/src/components/common/InlineField.tsx+++ b/packages/desktop-client/src/components/common/InlineField.tsx@@ -8,7 +8,7 @@ type InlineFieldProps = {label: ReactNode;labelWidth?: number;children?: ReactNode;- width: number;+ width: number | string;style?: CSSProperties;};diff --git a/packages/desktop-client/src/components/modals/BudgetSummary.js b/packages/desktop-client/src/components/modals/BudgetSummary.tsxsimilarity index 86%rename from packages/desktop-client/src/components/modals/BudgetSummary.jsrename to packages/desktop-client/src/components/modals/BudgetSummary.tsxindex d4f3a82cba..34aa66fe13 100644--- a/packages/desktop-client/src/components/modals/BudgetSummary.js+++ b/packages/desktop-client/src/components/modals/BudgetSummary.tsx@@ -1,9 +1,10 @@import React from 'react';import { rolloverBudget } from 'loot-core/src/client/queries';-import * as monthUtils from 'loot-core/src/shared/months';+import { format, sheetForMonth, prevMonth } from 'loot-core/src/shared/months';import { theme, styles } from '../../style';+import { type CommonModalProps } from '../../types/modals';import Button from '../common/Button';import Modal from '../common/Modal';import Text from '../common/Text';@@ -35,13 +36,18 @@ function ToBudget({ toBudget }) {);}-function BudgetSummary({ month, modalProps }) {- const prevMonthName = monthUtils.format(monthUtils.prevMonth(month), 'MMM');+type BudgetSummaryProps = {+ modalProps: CommonModalProps;+ month: string;+};++function BudgetSummary({ month, modalProps }: BudgetSummaryProps) {+ const prevMonthName = format(prevMonth(month), 'MMM');return (- <Modal title="Budget Details" {...modalProps} animate>+ <Modal title="Budget Details" {...modalProps}>{() => (- <NamespaceContext.Provider value={monthUtils.sheetForMonth(month)}>+ <NamespaceContext.Provider value={sheetForMonth(month)}><Viewstyle={{flexDirection: 'row',diff --git a/packages/desktop-client/src/components/modals/CreateLocalAccount.js b/packages/desktop-client/src/components/modals/CreateLocalAccount.tsxsimilarity index 93%rename from packages/desktop-client/src/components/modals/CreateLocalAccount.jsrename to packages/desktop-client/src/components/modals/CreateLocalAccount.tsxindex 3a5e6d8449..349cc4a221 100644--- a/packages/desktop-client/src/components/modals/CreateLocalAccount.js+++ b/packages/desktop-client/src/components/modals/CreateLocalAccount.tsx@@ -3,7 +3,9 @@ import { useNavigate } from 'react-router-dom';import { toRelaxedNumber } from 'loot-core/src/shared/util';+import { type BoundActions } from '../../hooks/useActions';import { theme } from '../../style';+import { type CommonModalProps } from '../../types/modals';import Button from '../common/Button';import ExternalLink from '../common/ExternalLink';import FormError from '../common/FormError';@@ -14,7 +16,12 @@ import Modal, { ModalButtons } from '../common/Modal';import Text from '../common/Text';import View from '../common/View';-function CreateLocalAccount({ modalProps, actions }) {+type CreateLocalAccountProps = {+ modalProps: CommonModalProps;+ actions: BoundActions;+};++function CreateLocalAccount({ modalProps, actions }: CreateLocalAccountProps) {let navigate = useNavigate();let [name, setName] = useState('');let [offbudget, setOffbudget] = useState(false);@@ -26,7 +33,7 @@ function CreateLocalAccount({ modalProps, actions }) {let validateBalance = balance => !isNaN(parseFloat(balance));return (- <Modal title="Create Local Account" {...modalProps} showBack={false}>+ <Modal title="Create Local Account" {...modalProps}>{() => (<View><formdiff --git a/upcoming-release-notes/1768.md b/upcoming-release-notes/1768.mdnew file mode 100644index 0000000000..b8b0545a6a--- /dev/null+++ b/upcoming-release-notes/1768.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [MikesGlitch]+---++Convert BudgetSummary modal(mobile) and CreateLocalAccounts components to TypeScript.