diff --git a/packages/desktop-client/src/components/Modals.tsx b/packages/desktop-client/src/components/Modals.tsx index ebec57e5e4be0da398a90781dfe9fba5507bc7a6..5974ec0e2fbcbb703968ba8932395d554012332a 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 29c3875b80b3b4a874319558c32f41158323b1b2..1418fa7bda7993de21f655341c8a7f0ec376e973 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 1caacd4a6360ce33c24484665b7653ee990dedfd..df9faa27422f4500d11ef9b24090a0b9405c23e0 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 6a1368b5a4b8a0a3e16c34f941e99f10abf195c4..42e24a0b80980a0e68ce3b9a643667ddc509d019 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 2e2b79181f3fd01ba895c1b1b64515b6fdea3099..5d2c704f88ab49ae3c4469d19aca6b8b80889bef 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 a4ed59ebe8ad4f965fe213d02f549c4350a5abab..e5bc05b8df6d12b2df5be6a5efb15100c4e46a79 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 e29c45964d6950a957631d595811af392fe87687..803e950035099523fb201db698b8e0a50be249a4 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 daacc77931a44bfaef8b28ff74d51eb13f619e17..6fb4c8007753faac4ec00dfafcd11d9eedc570c1 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 c577ab7f8d220c0d968857f2df070df1306a4aba..994717e1beaeb351b5676fd37f0352fb7810e7c9 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 3a3b55e6029641beff55a6d261e9a2dfe828f1f5..4bc9414cf10d8f80a0e198ed2d4eb3c33f03dbf8 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 fe57fd6781d993146b0745f0f2b8a48255fa301e..010676c758f82d70fc1d3bca4ee79cd8d0c8159e 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 367e3ad0076134d5efb2a3b9ed72b30d0b35348c..292e6c2cb3bd2db11c8add8e8746ffbd567d6b96 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 9e3b4cfc9b11098c22f68d3d92d18e9d07fae7f9..3a5c699b498d46c513a26a97ee05491df7dd4b05 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 97a8f9ff6772e325b323433532388fa5fc3618a8..6c625005ccbc5ebbdf17a949fa5d111228b1bb75 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 76516325466031d8522d5cbea4d4344d9ae02cf8..2bed713f0ff27d21943d0981dff3f2a6b6613232 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 ec368be342f15017e49cccc7b50dbbae80afbd88..bab96140e80374152956f07c7ec816d459945017 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 c03ecd5c2a1a6c75e2a41f0628ae9338c19161ab..d16acc205411bf4f13ecb6c796d2ce77152080c5 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 2c8bcd0b5891ebcb31cb2cc39c48a71b63890006..58a0e4260cdba149fd11fddd6fdc8c78f2d5ef87 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 89f4b33479920b18254bb9fe4a0183b247fa45ca..d6a02c33e37088ea1586b3d78994727ae353696f 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 ecbb1e30ec71ac8e17a0e41f107f8b87b2340da9..daf55a0d6cc30adea2cec4a61a328b1cfbaed572 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 be61c267f6c74e0d0b4d9cdb08bc9ebf42e73ded..9ba6686ac0e404e618d1eea25c6dceb1373f45ef 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 60950dda1432113757dc412613593405764dcbd0..c6251c12aeb7c10f63e3d85974af07f08989a585 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 be9f5384821a1f0149e97bd3cbadba887818d1bd..0000000000000000000000000000000000000000 --- 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 0000000000000000000000000000000000000000..8564fd99d632541ec3d23c35421aa7e818786524 --- /dev/null +++ b/upcoming-release-notes/2298.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [joel-jeremy] +--- + +Remove modals.d.ts file