A local-first personal finance app
[Maintenance] Remove modals.d.ts (#2298)
Joel Jeremy Marquezf4d80fad92c1
diff --git a/packages/desktop-client/src/components/Modals.tsx b/packages/desktop-client/src/components/Modals.tsxindex ebec57e5e4..5974ec0e2f 100644--- a/packages/desktop-client/src/components/Modals.tsx+++ b/packages/desktop-client/src/components/Modals.tsx@@ -3,12 +3,12 @@ import React, { useEffect } from 'react';import { useSelector } from 'react-redux';import { useLocation } from 'react-router-dom';+import { type PopModalAction } from 'loot-core/src/client/state-types/modals';import { send } from 'loot-core/src/platform/client/fetch';import { useActions } from '../hooks/useActions';import { useCategories } from '../hooks/useCategories';import { useSyncServerStatus } from '../hooks/useSyncServerStatus';-import { type CommonModalProps } from '../types/modals';import { CategoryGroupMenu } from './modals/CategoryGroupMenu';import { CategoryMenu } from './modals/CategoryMenu';@@ -40,6 +40,15 @@ import { PostsOfflineNotification } from './schedules/PostsOfflineNotification';import { ScheduleDetails } from './schedules/ScheduleDetails';import { ScheduleLink } from './schedules/ScheduleLink';+export type CommonModalProps = {+ onClose: () => PopModalAction;+ onBack: () => PopModalAction;+ showBack: boolean;+ isCurrent: boolean;+ isHidden: boolean;+ stackIndex: number;+};+export function Modals() {const modalStack = useSelector(state => state.modals.modalStack);const isHidden = useSelector(state => state.modals.isHidden);diff --git a/packages/desktop-client/src/components/manager/DeleteFile.tsx b/packages/desktop-client/src/components/manager/DeleteFile.tsxindex 29c3875b80..1418fa7bda 100644--- a/packages/desktop-client/src/components/manager/DeleteFile.tsx+++ b/packages/desktop-client/src/components/manager/DeleteFile.tsx@@ -4,11 +4,11 @@ import { type File } from 'loot-core/src/types/file';import { type BoundActions } from '../../hooks/useActions';import { theme } from '../../style';-import { type CommonModalProps } from '../../types/modals';import { ButtonWithLoading } from '../common/Button';import { Modal } from '../common/Modal';import { Text } from '../common/Text';import { View } from '../common/View';+import { type CommonModalProps } from '../Modals';type DeleteFileProps = {modalProps: CommonModalProps;diff --git a/packages/desktop-client/src/components/manager/Import.tsx b/packages/desktop-client/src/components/manager/Import.tsxindex 1caacd4a63..df9faa2742 100644--- a/packages/desktop-client/src/components/manager/Import.tsx+++ b/packages/desktop-client/src/components/manager/Import.tsx@@ -2,12 +2,12 @@ import React, { useState } from 'react';import { type BoundActions } from '../../hooks/useActions';import { styles, theme } from '../../style';-import { type CommonModalProps } from '../../types/modals';import { Block } from '../common/Block';import { Button } from '../common/Button';import { Modal } from '../common/Modal';import { Text } from '../common/Text';import { View } from '../common/View';+import { type CommonModalProps } from '../Modals';function getErrorMessage(error: 'not-ynab4' | boolean) {switch (error) {diff --git a/packages/desktop-client/src/components/modals/CategoryGroupMenu.tsx b/packages/desktop-client/src/components/modals/CategoryGroupMenu.tsxindex 6a1368b5a4..42e24a0b80 100644--- a/packages/desktop-client/src/components/modals/CategoryGroupMenu.tsx+++ b/packages/desktop-client/src/components/modals/CategoryGroupMenu.tsx@@ -9,11 +9,11 @@ import { useCategories } from '../../hooks/useCategories';import { SvgDotsHorizontalTriple, SvgAdd, SvgTrash } from '../../icons/v1';import { SvgNotesPaper, SvgViewHide, SvgViewShow } from '../../icons/v2';import { type CSSProperties, styles, theme } from '../../style';-import { type CommonModalProps } from '../../types/modals';import { Button } from '../common/Button';import { Menu } from '../common/Menu';import { Modal } from '../common/Modal';import { View } from '../common/View';+import { type CommonModalProps } from '../Modals';import { Notes } from '../Notes';import { Tooltip } from '../tooltips';diff --git a/packages/desktop-client/src/components/modals/CategoryMenu.tsx b/packages/desktop-client/src/components/modals/CategoryMenu.tsxindex 2e2b79181f..5d2c704f88 100644--- a/packages/desktop-client/src/components/modals/CategoryMenu.tsx+++ b/packages/desktop-client/src/components/modals/CategoryMenu.tsx@@ -9,11 +9,11 @@ import { useCategories } from '../../hooks/useCategories';import { SvgDotsHorizontalTriple, SvgTrash } from '../../icons/v1';import { SvgNotesPaper, SvgViewHide, SvgViewShow } from '../../icons/v2';import { type CSSProperties, styles, theme } from '../../style';-import { type CommonModalProps } from '../../types/modals';import { Button } from '../common/Button';import { Menu } from '../common/Menu';import { Modal } from '../common/Modal';import { View } from '../common/View';+import { type CommonModalProps } from '../Modals';import { Notes } from '../Notes';import { Tooltip } from '../tooltips';diff --git a/packages/desktop-client/src/components/modals/CloseAccount.tsx b/packages/desktop-client/src/components/modals/CloseAccount.tsxindex a4ed59ebe8..e5bc05b8df 100644--- a/packages/desktop-client/src/components/modals/CloseAccount.tsx+++ b/packages/desktop-client/src/components/modals/CloseAccount.tsx@@ -9,7 +9,6 @@ import {import { type BoundActions } from '../../hooks/useActions';import { theme } from '../../style';-import { type CommonModalProps } from '../../types/modals';import { AccountAutocomplete } from '../autocomplete/AccountAutocomplete';import { CategoryAutocomplete } from '../autocomplete/CategoryAutocomplete';import { Button } from '../common/Button';@@ -19,6 +18,7 @@ import { Modal } from '../common/Modal';import { Paragraph } from '../common/Paragraph';import { Text } from '../common/Text';import { View } from '../common/View';+import { type CommonModalProps } from '../Modals';function needsCategory(account: AccountEntity,diff --git a/packages/desktop-client/src/components/modals/ConfirmCategoryDelete.tsx b/packages/desktop-client/src/components/modals/ConfirmCategoryDelete.tsxindex e29c45964d..803e950035 100644--- a/packages/desktop-client/src/components/modals/ConfirmCategoryDelete.tsx+++ b/packages/desktop-client/src/components/modals/ConfirmCategoryDelete.tsx@@ -4,13 +4,13 @@ import React, { useState } from 'react';import { type CategoryGroupEntity } from 'loot-core/src/types/models';import { theme } from '../../style';-import { type CommonModalProps } from '../../types/modals';import { CategoryAutocomplete } from '../autocomplete/CategoryAutocomplete';import { Block } from '../common/Block';import { Button } from '../common/Button';import { Modal } from '../common/Modal';import { Text } from '../common/Text';import { View } from '../common/View';+import { type CommonModalProps } from '../Modals';type ConfirmCategoryDeleteProps = {modalProps: CommonModalProps;diff --git a/packages/desktop-client/src/components/modals/ConfirmTransactionEdit.tsx b/packages/desktop-client/src/components/modals/ConfirmTransactionEdit.tsxindex daacc77931..6fb4c80077 100644--- a/packages/desktop-client/src/components/modals/ConfirmTransactionEdit.tsx+++ b/packages/desktop-client/src/components/modals/ConfirmTransactionEdit.tsx@@ -1,11 +1,11 @@// @ts-strict-ignoreimport React from 'react';-import { type CommonModalProps } from '../../types/modals';import { Block } from '../common/Block';import { Button } from '../common/Button';import { Modal } from '../common/Modal';import { View } from '../common/View';+import { type CommonModalProps } from '../Modals';type ConfirmTransactionEditProps = {modalProps: Partial<CommonModalProps>;diff --git a/packages/desktop-client/src/components/modals/CreateAccount.tsx b/packages/desktop-client/src/components/modals/CreateAccount.tsxindex c577ab7f8d..994717e1be 100644--- a/packages/desktop-client/src/components/modals/CreateAccount.tsx+++ b/packages/desktop-client/src/components/modals/CreateAccount.tsx@@ -10,13 +10,13 @@ import { useGoCardlessStatus } from '../../hooks/useGoCardlessStatus';import { useSimpleFinStatus } from '../../hooks/useSimpleFinStatus';import { type SyncServerStatus } from '../../hooks/useSyncServerStatus';import { theme } from '../../style';-import { type CommonModalProps } from '../../types/modals';import { Button, ButtonWithLoading } from '../common/Button';import { ExternalLink } from '../common/ExternalLink';import { Modal } from '../common/Modal';import { Paragraph } from '../common/Paragraph';import { Text } from '../common/Text';import { View } from '../common/View';+import { type CommonModalProps } from '../Modals';type CreateAccountProps = {modalProps: CommonModalProps;diff --git a/packages/desktop-client/src/components/modals/CreateEncryptionKey.tsx b/packages/desktop-client/src/components/modals/CreateEncryptionKey.tsxindex 3a3b55e602..4bc9414cf1 100644--- a/packages/desktop-client/src/components/modals/CreateEncryptionKey.tsx+++ b/packages/desktop-client/src/components/modals/CreateEncryptionKey.tsx@@ -8,7 +8,6 @@ import { getCreateKeyError } from 'loot-core/src/shared/errors';import { type BoundActions } from '../../hooks/useActions';import { theme } from '../../style';-import { type CommonModalProps } from '../../types/modals';import { ButtonWithLoading } from '../common/Button';import { ExternalLink } from '../common/ExternalLink';import { InitialFocus } from '../common/InitialFocus';@@ -17,6 +16,7 @@ import { Modal, ModalButtons } from '../common/Modal';import { Paragraph } from '../common/Paragraph';import { Text } from '../common/Text';import { View } from '../common/View';+import { type CommonModalProps } from '../Modals';type CreateEncryptionKeyProps = {modalProps: CommonModalProps;diff --git a/packages/desktop-client/src/components/modals/CreateLocalAccount.tsx b/packages/desktop-client/src/components/modals/CreateLocalAccount.tsxindex fe57fd6781..010676c758 100644--- a/packages/desktop-client/src/components/modals/CreateLocalAccount.tsx+++ b/packages/desktop-client/src/components/modals/CreateLocalAccount.tsx@@ -6,7 +6,6 @@ import { toRelaxedNumber } from 'loot-core/src/shared/util';import { type BoundActions } from '../../hooks/useActions';import { useNavigate } from '../../hooks/useNavigate';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';@@ -17,6 +16,7 @@ import { Modal, ModalButtons } from '../common/Modal';import { Text } from '../common/Text';import { View } from '../common/View';import { Checkbox } from '../forms';+import { type CommonModalProps } from '../Modals';type CreateLocalAccountProps = {modalProps: CommonModalProps;diff --git a/packages/desktop-client/src/components/modals/FixEncryptionKey.tsx b/packages/desktop-client/src/components/modals/FixEncryptionKey.tsxindex 367e3ad007..292e6c2cb3 100644--- a/packages/desktop-client/src/components/modals/FixEncryptionKey.tsx+++ b/packages/desktop-client/src/components/modals/FixEncryptionKey.tsx@@ -7,7 +7,6 @@ import { getTestKeyError } from 'loot-core/src/shared/errors';import { type BoundActions } from '../../hooks/useActions';import { theme } from '../../style';-import { type CommonModalProps } from '../../types/modals';import { Button, ButtonWithLoading } from '../common/Button';import { ExternalLink } from '../common/ExternalLink';import { InitialFocus } from '../common/InitialFocus';@@ -16,6 +15,7 @@ import { Modal, ModalButtons } from '../common/Modal';import { Paragraph } from '../common/Paragraph';import { Text } from '../common/Text';import { View } from '../common/View';+import { type CommonModalProps } from '../Modals';type FixEncryptionKeyProps = {modalProps: CommonModalProps;diff --git a/packages/desktop-client/src/components/modals/GoCardlessExternalMsg.tsx b/packages/desktop-client/src/components/modals/GoCardlessExternalMsg.tsxindex 9e3b4cfc9b..3a5c699b49 100644--- a/packages/desktop-client/src/components/modals/GoCardlessExternalMsg.tsx+++ b/packages/desktop-client/src/components/modals/GoCardlessExternalMsg.tsx@@ -13,7 +13,6 @@ import { useGoCardlessStatus } from '../../hooks/useGoCardlessStatus';import { AnimatedLoading } from '../../icons/AnimatedLoading';import { SvgDotsHorizontalTriple } from '../../icons/v1';import { theme } from '../../style';-import { type CommonModalProps } from '../../types/modals';import { Error, Warning } from '../alerts';import { Autocomplete } from '../autocomplete/Autocomplete';import { Button } from '../common/Button';@@ -24,6 +23,7 @@ import { Modal } from '../common/Modal';import { Paragraph } from '../common/Paragraph';import { View } from '../common/View';import { FormField, FormLabel } from '../forms';+import { type CommonModalProps } from '../Modals';import { Tooltip } from '../tooltips';import { COUNTRY_OPTIONS } from './countries';diff --git a/packages/desktop-client/src/components/modals/ManageRulesModal.tsx b/packages/desktop-client/src/components/modals/ManageRulesModal.tsxindex 97a8f9ff67..6c625005cc 100644--- a/packages/desktop-client/src/components/modals/ManageRulesModal.tsx+++ b/packages/desktop-client/src/components/modals/ManageRulesModal.tsx@@ -4,9 +4,9 @@ import { useLocation } from 'react-router-dom';import { isNonProductionEnvironment } from 'loot-core/src/shared/environment';-import { type CommonModalProps } from '../../types/modals';import { Modal } from '../common/Modal';import { ManageRules } from '../ManageRules';+import { type CommonModalProps } from '../Modals';type ManageRulesModalProps = {modalProps: CommonModalProps;diff --git a/packages/desktop-client/src/components/modals/Notes.tsx b/packages/desktop-client/src/components/modals/Notes.tsxindex 7651632546..2bed713f0f 100644--- a/packages/desktop-client/src/components/modals/Notes.tsx+++ b/packages/desktop-client/src/components/modals/Notes.tsx@@ -5,10 +5,10 @@ import { useLiveQuery } from 'loot-core/src/client/query-hooks';import { q } from 'loot-core/src/shared/query';import { SvgCheck } from '../../icons/v2';-import { type CommonModalProps } from '../../types/modals';import { Button } from '../common/Button';import { Modal } from '../common/Modal';import { View } from '../common/View';+import { type CommonModalProps } from '../Modals';import { Notes as NotesComponent } from '../Notes';type NotesProps = {diff --git a/packages/desktop-client/src/components/modals/PlaidExternalMsg.tsx b/packages/desktop-client/src/components/modals/PlaidExternalMsg.tsxindex ec368be342..bab96140e8 100644--- a/packages/desktop-client/src/components/modals/PlaidExternalMsg.tsx+++ b/packages/desktop-client/src/components/modals/PlaidExternalMsg.tsx@@ -3,13 +3,13 @@ import React, { useState, useRef } from 'react';import { AnimatedLoading } from '../../icons/AnimatedLoading';import { theme } from '../../style';-import { type CommonModalProps } from '../../types/modals';import { Error } from '../alerts';import { Button } from '../common/Button';import { Modal, ModalButtons } from '../common/Modal';import { Paragraph } from '../common/Paragraph';import { Text } from '../common/Text';import { View } from '../common/View';+import { type CommonModalProps } from '../Modals';function renderError(error) {return (diff --git a/packages/desktop-client/src/components/modals/ReportBudgetSummary.tsx b/packages/desktop-client/src/components/modals/ReportBudgetSummary.tsxindex c03ecd5c2a..d16acc2054 100644--- a/packages/desktop-client/src/components/modals/ReportBudgetSummary.tsx+++ b/packages/desktop-client/src/components/modals/ReportBudgetSummary.tsx@@ -4,12 +4,12 @@ import { sheetForMonth } from 'loot-core/src/shared/months';import * as monthUtils from 'loot-core/src/shared/months';import { styles } from '../../style';-import { type CommonModalProps } from '../../types/modals';import { ExpenseTotal } from '../budget/report/budgetsummary/ExpenseTotal';import { IncomeTotal } from '../budget/report/budgetsummary/IncomeTotal';import { Saved } from '../budget/report/budgetsummary/Saved';import { Modal } from '../common/Modal';import { Stack } from '../common/Stack';+import { type CommonModalProps } from '../Modals';import { NamespaceContext } from '../spreadsheet/NamespaceContext';type ReportBudgetSummaryProps = {diff --git a/packages/desktop-client/src/components/modals/RolloverBudgetSummary.tsx b/packages/desktop-client/src/components/modals/RolloverBudgetSummary.tsxindex 2c8bcd0b58..58a0e4260c 100644--- a/packages/desktop-client/src/components/modals/RolloverBudgetSummary.tsx+++ b/packages/desktop-client/src/components/modals/RolloverBudgetSummary.tsx@@ -3,10 +3,10 @@ import React from 'react';import { format, sheetForMonth, prevMonth } from 'loot-core/src/shared/months';import { styles } from '../../style';-import { type CommonModalProps } from '../../types/modals';import { ToBudget } from '../budget/rollover/budgetsummary/ToBudget';import { TotalsList } from '../budget/rollover/budgetsummary/TotalsList';import { Modal } from '../common/Modal';+import { type CommonModalProps } from '../Modals';import { NamespaceContext } from '../spreadsheet/NamespaceContext';type RolloverBudgetSummaryProps = {diff --git a/packages/desktop-client/src/components/modals/SingleInput.tsx b/packages/desktop-client/src/components/modals/SingleInput.tsxindex 89f4b33479..d6a02c33e3 100644--- a/packages/desktop-client/src/components/modals/SingleInput.tsx+++ b/packages/desktop-client/src/components/modals/SingleInput.tsx@@ -2,13 +2,13 @@import React, { useState } from 'react';import { styles } from '../../style';-import { type CommonModalProps } from '../../types/modals';import { Button } from '../common/Button';import { FormError } from '../common/FormError';import { InitialFocus } from '../common/InitialFocus';import { Input } from '../common/Input';import { Modal } from '../common/Modal';import { View } from '../common/View';+import { type CommonModalProps } from '../Modals';type SingleInputProps = {modalProps: Partial<CommonModalProps>;diff --git a/packages/desktop-client/src/components/modals/SwitchBudgetType.tsx b/packages/desktop-client/src/components/modals/SwitchBudgetType.tsxindex ecbb1e30ec..daf55a0d6c 100644--- a/packages/desktop-client/src/components/modals/SwitchBudgetType.tsx+++ b/packages/desktop-client/src/components/modals/SwitchBudgetType.tsx@@ -2,12 +2,12 @@import React from 'react';import { useSelector } from 'react-redux';-import { type CommonModalProps } from '../../types/modals';import { Button } from '../common/Button';import { ExternalLink } from '../common/ExternalLink';import { Modal } from '../common/Modal';import { Paragraph } from '../common/Paragraph';import { Text } from '../common/Text';+import { type CommonModalProps } from '../Modals';type SwitchBudgetTypeProps = {modalProps: CommonModalProps;diff --git a/packages/desktop-client/src/components/schedules/DiscoverSchedules.tsx b/packages/desktop-client/src/components/schedules/DiscoverSchedules.tsxindex be61c267f6..9ba6686ac0 100644--- a/packages/desktop-client/src/components/schedules/DiscoverSchedules.tsx+++ b/packages/desktop-client/src/components/schedules/DiscoverSchedules.tsx@@ -17,12 +17,12 @@ import {} from '../../hooks/useSelected';import { useSendPlatformRequest } from '../../hooks/useSendPlatformRequest';import { theme } from '../../style';-import type { CommonModalProps } from '../../types/modals';import { ButtonWithLoading } from '../common/Button';import { Modal } from '../common/Modal';import { Paragraph } from '../common/Paragraph';import { Stack } from '../common/Stack';import { View } from '../common/View';+import { type CommonModalProps } from '../Modals';import { Table, TableHeader, Row, Field, SelectCell } from '../table';import { DisplayId } from '../util/DisplayId';diff --git a/packages/desktop-client/src/components/schedules/ScheduleLink.tsx b/packages/desktop-client/src/components/schedules/ScheduleLink.tsxindex 60950dda14..c6251c12ae 100644--- a/packages/desktop-client/src/components/schedules/ScheduleLink.tsx+++ b/packages/desktop-client/src/components/schedules/ScheduleLink.tsx@@ -6,11 +6,11 @@ import { send } from 'loot-core/src/platform/client/fetch';import { type Query } from 'loot-core/src/shared/query';import { type BoundActions } from '../../hooks/useActions';-import { type CommonModalProps } from '../../types/modals';import { Modal } from '../common/Modal';import { Search } from '../common/Search';import { Text } from '../common/Text';import { View } from '../common/View';+import { type CommonModalProps } from '../Modals';import { ROW_HEIGHT, SchedulesTable } from './SchedulesTable';diff --git a/packages/desktop-client/src/types/modals.d.ts b/packages/desktop-client/src/types/modals.d.tsdeleted file mode 100644index be9f538482..0000000000--- a/packages/desktop-client/src/types/modals.d.ts+++ /dev/null@@ -1,10 +0,0 @@-import { type PopModalAction } from 'loot-core/src/client/state-types/modals';--export type CommonModalProps = {- onClose: () => PopModalAction;- onBack: () => PopModalAction;- showBack: boolean;- isCurrent: boolean;- isHidden: boolean;- stackIndex: number;-};diff --git a/upcoming-release-notes/2298.md b/upcoming-release-notes/2298.mdnew file mode 100644index 0000000000..8564fd99d6--- /dev/null+++ b/upcoming-release-notes/2298.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [joel-jeremy]+---++Remove modals.d.ts file