From f4d80fad92c1d5e5e69879dbf68ee637efa88f54 Mon Sep 17 00:00:00 2001 From: Joel Jeremy Marquez <joeljeremy.marquez@gmail.com> Date: Fri, 2 Feb 2024 17:56:23 -0800 Subject: [PATCH] [Maintenance] Remove modals.d.ts (#2298) * Remove modals.d.ts * Release notes * Fix typecheck * Fix lint error --- packages/desktop-client/src/components/Modals.tsx | 11 ++++++++++- .../src/components/manager/DeleteFile.tsx | 2 +- .../desktop-client/src/components/manager/Import.tsx | 2 +- .../src/components/modals/CategoryGroupMenu.tsx | 2 +- .../src/components/modals/CategoryMenu.tsx | 2 +- .../src/components/modals/CloseAccount.tsx | 2 +- .../src/components/modals/ConfirmCategoryDelete.tsx | 2 +- .../src/components/modals/ConfirmTransactionEdit.tsx | 2 +- .../src/components/modals/CreateAccount.tsx | 2 +- .../src/components/modals/CreateEncryptionKey.tsx | 2 +- .../src/components/modals/CreateLocalAccount.tsx | 2 +- .../src/components/modals/FixEncryptionKey.tsx | 2 +- .../src/components/modals/GoCardlessExternalMsg.tsx | 2 +- .../src/components/modals/ManageRulesModal.tsx | 2 +- .../desktop-client/src/components/modals/Notes.tsx | 2 +- .../src/components/modals/PlaidExternalMsg.tsx | 2 +- .../src/components/modals/ReportBudgetSummary.tsx | 2 +- .../src/components/modals/RolloverBudgetSummary.tsx | 2 +- .../src/components/modals/SingleInput.tsx | 2 +- .../src/components/modals/SwitchBudgetType.tsx | 2 +- .../src/components/schedules/DiscoverSchedules.tsx | 2 +- .../src/components/schedules/ScheduleLink.tsx | 2 +- packages/desktop-client/src/types/modals.d.ts | 10 ---------- upcoming-release-notes/2298.md | 6 ++++++ 24 files changed, 37 insertions(+), 32 deletions(-) delete mode 100644 packages/desktop-client/src/types/modals.d.ts create mode 100644 upcoming-release-notes/2298.md diff --git a/packages/desktop-client/src/components/Modals.tsx b/packages/desktop-client/src/components/Modals.tsx index ebec57e5e..5974ec0e2 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.tsx index 29c3875b8..1418fa7bd 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.tsx index 1caacd4a6..df9faa274 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.tsx index 6a1368b5a..42e24a0b8 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.tsx index 2e2b79181..5d2c704f8 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.tsx index a4ed59ebe..e5bc05b8d 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.tsx index e29c45964..803e95003 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.tsx index daacc7793..6fb4c8007 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-ignore import 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.tsx index c577ab7f8..994717e1b 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.tsx index 3a3b55e60..4bc9414cf 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.tsx index fe57fd678..010676c75 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.tsx index 367e3ad00..292e6c2cb 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.tsx index 9e3b4cfc9..3a5c699b4 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.tsx index 97a8f9ff6..6c625005c 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.tsx index 765163254..2bed713f0 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.tsx index ec368be34..bab96140e 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.tsx index c03ecd5c2..d16acc205 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.tsx index 2c8bcd0b5..58a0e4260 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.tsx index 89f4b3347..d6a02c33e 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.tsx index ecbb1e30e..daf55a0d6 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.tsx index be61c267f..9ba6686ac 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.tsx index 60950dda1..c6251c12a 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.ts deleted file mode 100644 index be9f53848..000000000 --- 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.md new file mode 100644 index 000000000..8564fd99d --- /dev/null +++ b/upcoming-release-notes/2298.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [joel-jeremy] +--- + +Remove modals.d.ts file -- GitLab