Skip to content

[WIP] Move loot-core/client/modals code over to desktop-client package #4819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: loot-core-client-budgets-to-desktop-client
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/desktop-client/src/app/appSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
type PayloadAction,
} from '@reduxjs/toolkit';

import { pushModal } from 'loot-core/client/modals/modalsSlice';
import { loadPrefs } from 'loot-core/client/prefs/prefsSlice';
import { createAppAsyncThunk } from 'loot-core/client/redux';
import { send } from 'loot-core/platform/client/fetch';
Expand All @@ -13,6 +12,7 @@ import { type AccountEntity } from 'loot-core/types/models';
import { type AtLeastOne } from 'loot-core/types/util';

import { syncAccounts } from '../accounts/accountsSlice';
import { pushModal } from '../modals/modalsSlice';

const sliceName = 'app';

Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/budgets/budgetsSlice.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createSlice, type PayloadAction } from '@reduxjs/toolkit';
import { t } from 'i18next';

import { closeModal, pushModal } from 'loot-core/client/modals/modalsSlice';
import { loadGlobalPrefs, loadPrefs } from 'loot-core/client/prefs/prefsSlice';
import { createAppAsyncThunk } from 'loot-core/client/redux';
import { signOut } from 'loot-core/client/users/usersSlice';
Expand All @@ -13,6 +12,7 @@ import { type File } from 'loot-core/types/file';
import { type Handlers } from 'loot-core/types/handlers';

import { resetApp, setAppState } from '../app/appSlice';
import { closeModal, pushModal } from '../modals/modalsSlice';

const sliceName = 'budgets';

Expand Down
3 changes: 1 addition & 2 deletions packages/desktop-client/src/components/HelpMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import { Popover } from '@actual-app/components/popover';
import { SpaceBetween } from '@actual-app/components/space-between';
import { useToggle } from 'usehooks-ts';

import { pushModal } from 'loot-core/client/modals/modalsSlice';

import { useFeatureFlag } from '../hooks/useFeatureFlag';
import { pushModal } from '../modals/modalsSlice';
import { useDispatch } from '../redux';

const getPageDocs = (page: string) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/ManageRules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';

import { useSchedules } from 'loot-core/client/data-hooks/schedules';
import { pushModal } from 'loot-core/client/modals/modalsSlice';
import { initiallyLoadPayees } from 'loot-core/client/queries/queriesSlice';
import { send } from 'loot-core/platform/client/fetch';
import * as undo from 'loot-core/platform/client/undo';
Expand All @@ -30,6 +29,7 @@ import { useAccounts } from '../hooks/useAccounts';
import { useCategories } from '../hooks/useCategories';
import { usePayees } from '../hooks/usePayees';
import { useSelected, SelectedProvider } from '../hooks/useSelected';
import { pushModal } from '../modals/modalsSlice';
import { useDispatch } from '../redux';

import { InfiniteScrollWrapper } from './common/InfiniteScrollWrapper';
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/Modals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import React, { useEffect } from 'react';
import { useLocation } from 'react-router-dom';

import { closeModal } from 'loot-core/client/modals/modalsSlice';
import { send } from 'loot-core/platform/client/fetch';
import * as monthUtils from 'loot-core/shared/months';

import { useMetadataPref } from '../hooks/useMetadataPref';
import { useModalState } from '../hooks/useModalState';
import { closeModal } from '../modals/modalsSlice';
import { useDispatch } from '../redux';

import { EditSyncAccount } from './banksync/EditSyncAccount';
Expand Down
10 changes: 5 additions & 5 deletions packages/desktop-client/src/components/accounts/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ import {
SchedulesProvider,
accountSchedulesQuery,
} from 'loot-core/client/data-hooks/schedules';
import {
openAccountCloseModal,
pushModal,
replaceModal,
} from 'loot-core/client/modals/modalsSlice';
import { addNotification } from 'loot-core/client/notifications/notificationsSlice';
import * as queries from 'loot-core/client/queries';
import {
Expand Down Expand Up @@ -84,6 +79,11 @@ import {
} from '../../hooks/useSplitsExpanded';
import { useSyncedPref } from '../../hooks/useSyncedPref';
import { useTransactionBatchActions } from '../../hooks/useTransactionBatchActions';
import {
openAccountCloseModal,
pushModal,
replaceModal,
} from '../../modals/modalsSlice';
import { useSelector, useDispatch } from '../../redux';
import { type SavedFilter } from '../filters/SavedFilterMenuButton';
import { TransactionList } from '../transactions/TransactionList';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { Text } from '@actual-app/components/text';
import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';

import { pushModal } from 'loot-core/client/modals/modalsSlice';
import { addNotification } from 'loot-core/client/notifications/notificationsSlice';
import { send } from 'loot-core/platform/client/fetch';
import * as undo from 'loot-core/platform/client/undo';
Expand All @@ -28,6 +27,7 @@ import {
} from 'loot-core/types/models';

import { useMetadataPref } from '../../../hooks/useMetadataPref';
import { pushModal } from '../../../modals/modalsSlice';
import { useDispatch } from '../../../redux';
import { InfiniteScrollWrapper } from '../../common/InfiniteScrollWrapper';
import { Link } from '../../common/Link';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import { Text } from '@actual-app/components/text';
import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';

import { pushModal } from 'loot-core/client/modals/modalsSlice';
import { addNotification } from 'loot-core/client/notifications/notificationsSlice';
import { signOut } from 'loot-core/client/users/usersSlice';
import { send } from 'loot-core/platform/client/fetch';
import * as undo from 'loot-core/platform/client/undo';
import { type NewUserEntity, type UserEntity } from 'loot-core/types/models';

import { SelectedProvider, useSelected } from '../../../hooks/useSelected';
import { pushModal } from '../../../modals/modalsSlice';
import { useDispatch } from '../../../redux';
import { InfiniteScrollWrapper } from '../../common/InfiniteScrollWrapper';
import { Link } from '../../common/Link';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { Tooltip } from '@actual-app/components/tooltip';
import { View } from '@actual-app/components/view';

import { useTransactions } from 'loot-core/client/data-hooks/transactions';
import { pushModal } from 'loot-core/client/modals/modalsSlice';
import {
defaultMappings,
type Mappings,
Expand All @@ -25,6 +24,7 @@ import {

import { unlinkAccount } from '../../accounts/accountsSlice';
import { useSyncedPref } from '../../hooks/useSyncedPref';
import { pushModal } from '../../modals/modalsSlice';
import { useDispatch } from '../../redux';
import { Modal, ModalCloseButton, ModalHeader } from '../common/Modal';
import { CheckboxOption } from '../modals/ImportTransactionsModal/CheckboxOption';
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/banksync/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { useResponsive } from '@actual-app/components/hooks/useResponsive';
import { Text } from '@actual-app/components/text';
import { View } from '@actual-app/components/view';

import { pushModal } from 'loot-core/client/modals/modalsSlice';
import {
type BankSyncProviders,
type AccountEntity,
} from 'loot-core/types/models';

import { useAccounts } from '../../hooks/useAccounts';
import { useGlobalPref } from '../../hooks/useGlobalPref';
import { pushModal } from '../../modals/modalsSlice';
import { useDispatch } from '../../redux';
import { MOBILE_NAV_HEIGHT } from '../mobile/MobileNavTabs';
import { Page } from '../Page';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { Button } from '@actual-app/components/button';
import { SvgChartPie } from '@actual-app/components/icons/v1';
import { theme } from '@actual-app/components/theme';

import { pushModal } from 'loot-core/client/modals/modalsSlice';
import { type Template } from 'loot-core/server/budget/types/templates';

import { useFeatureFlag } from '../../../hooks/useFeatureFlag';
import { pushModal } from '../../../modals/modalsSlice';
import { useDispatch } from '../../../redux';

type CategoryAutomationButtonProps = {
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/budget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useTranslation } from 'react-i18next';
import { styles } from '@actual-app/components/styles';
import { View } from '@actual-app/components/view';

import { pushModal } from 'loot-core/client/modals/modalsSlice';
import { addNotification } from 'loot-core/client/notifications/notificationsSlice';
import {
applyBudgetAction,
Expand All @@ -28,6 +27,7 @@ import { useGlobalPref } from '../../hooks/useGlobalPref';
import { useLocalPref } from '../../hooks/useLocalPref';
import { useNavigate } from '../../hooks/useNavigate';
import { useSyncedPref } from '../../hooks/useSyncedPref';
import { pushModal } from '../../modals/modalsSlice';
import { useDispatch } from '../../redux';
import { NamespaceContext } from '../spreadsheet/NamespaceContext';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import { Tooltip } from '@actual-app/components/tooltip';
import { View } from '@actual-app/components/view';
import { css } from '@emotion/css';

import { pushModal } from 'loot-core/client/modals/modalsSlice';
import { getUserData } from 'loot-core/client/users/usersSlice';
import {
isElectron,
Expand All @@ -60,6 +59,7 @@ import {
} from '../../budgets/budgetsSlice';
import { useInitialMount } from '../../hooks/useInitialMount';
import { useMetadataPref } from '../../hooks/useMetadataPref';
import { pushModal } from '../../modals/modalsSlice';
import { useSelector, useDispatch } from '../../redux';
import { useMultiuserEnabled } from '../ServerContext';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import { Text } from '@actual-app/components/text';
import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';

import { pushModal } from 'loot-core/client/modals/modalsSlice';

import { createBudget } from '../../budgets/budgetsSlice';
import { pushModal } from '../../modals/modalsSlice';
import { useDispatch } from '../../redux';
import { Link } from '../common/Link';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ import {
useTransactions,
useTransactionsSearch,
} from 'loot-core/client/data-hooks/transactions';
import {
collapseModals,
openAccountCloseModal,
pushModal,
} from 'loot-core/client/modals/modalsSlice';
import * as queries from 'loot-core/client/queries';
import {
markAccountRead,
Expand All @@ -45,6 +40,11 @@ import { useAccountPreviewTransactions } from '../../../hooks/useAccountPreviewT
import { useDateFormat } from '../../../hooks/useDateFormat';
import { useFailedAccounts } from '../../../hooks/useFailedAccounts';
import { useNavigate } from '../../../hooks/useNavigate';
import {
collapseModals,
openAccountCloseModal,
pushModal,
} from '../../../modals/modalsSlice';
import { useSelector, useDispatch } from '../../../redux';
import { MobilePageHeader, Page } from '../../Page';
import { MobileBackButton } from '../MobileBackButton';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';
import { css } from '@emotion/css';

import { replaceModal } from 'loot-core/client/modals/modalsSlice';
import * as queries from 'loot-core/client/queries';
import { type AccountEntity } from 'loot-core/types/models';

Expand All @@ -38,6 +37,7 @@ import { useFailedAccounts } from '../../../hooks/useFailedAccounts';
import { useLocalPref } from '../../../hooks/useLocalPref';
import { useNavigate } from '../../../hooks/useNavigate';
import { useSyncedPref } from '../../../hooks/useSyncedPref';
import { replaceModal } from '../../../modals/modalsSlice';
import { useDispatch, useSelector } from '../../../redux';
import { makeAmountFullStyle } from '../../budget/util';
import { MobilePageHeader, Page } from '../../Page';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import { Text } from '@actual-app/components/text';
import { View } from '@actual-app/components/view';
import { AutoTextSize } from 'auto-text-size';

import { pushModal } from 'loot-core/client/modals/modalsSlice';
import { integerToCurrency } from 'loot-core/shared/util';
import { type CategoryEntity } from 'loot-core/types/models';

import { useNotes } from '../../../hooks/useNotes';
import { useSyncedPref } from '../../../hooks/useSyncedPref';
import { useUndo } from '../../../hooks/useUndo';
import { pushModal } from '../../../modals/modalsSlice';
import { useDispatch } from '../../../redux';
import { makeAmountGrey } from '../../budget/util';
import { PrivacyFilter } from '../../PrivacyFilter';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { View } from '@actual-app/components/view';
import { AutoTextSize } from 'auto-text-size';
import memoizeOne from 'memoize-one';

import { collapseModals, pushModal } from 'loot-core/client/modals/modalsSlice';
import {
envelopeBudget,
trackingBudget,
Expand All @@ -47,6 +46,7 @@ import { useNavigate } from '../../../hooks/useNavigate';
import { usePrevious } from '../../../hooks/usePrevious';
import { useSyncedPref } from '../../../hooks/useSyncedPref';
import { useUndo } from '../../../hooks/useUndo';
import { collapseModals, pushModal } from '../../../modals/modalsSlice';
import { useDispatch } from '../../../redux';
import { MobilePageHeader, Page } from '../../Page';
import { PrivacyFilter } from '../../PrivacyFilter';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';
import { AutoTextSize } from 'auto-text-size';

import { collapseModals, pushModal } from 'loot-core/client/modals/modalsSlice';
import { envelopeBudget, trackingBudget } from 'loot-core/client/queries';
import * as monthUtils from 'loot-core/shared/months';
import { groupById, integerToCurrency } from 'loot-core/shared/util';
Expand All @@ -24,6 +23,7 @@ import { useFeatureFlag } from '../../../hooks/useFeatureFlag';
import { useNavigate } from '../../../hooks/useNavigate';
import { useSyncedPref } from '../../../hooks/useSyncedPref';
import { useUndo } from '../../../hooks/useUndo';
import { collapseModals, pushModal } from '../../../modals/modalsSlice';
import { useDispatch } from '../../../redux';
import { BalanceWithCarryover } from '../../budget/BalanceWithCarryover';
import { makeAmountGrey, makeBalanceAmountStyle } from '../../budget/util';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { AnimatedLoading } from '@actual-app/components/icons/AnimatedLoading';
import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';

import { collapseModals, pushModal } from 'loot-core/client/modals/modalsSlice';
import {
applyBudgetAction,
createCategory,
Expand All @@ -24,6 +23,7 @@ import { useCategories } from '../../../hooks/useCategories';
import { useLocale } from '../../../hooks/useLocale';
import { useLocalPref } from '../../../hooks/useLocalPref';
import { useSyncedPref } from '../../../hooks/useSyncedPref';
import { collapseModals, pushModal } from '../../../modals/modalsSlice';
import { useDispatch } from '../../../redux';
import { prewarmMonth } from '../../budget/util';
import { NamespaceContext } from '../../spreadsheet/NamespaceContext';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
isValid as isValidDate,
} from 'date-fns';

import { pushModal } from 'loot-core/client/modals/modalsSlice';
import * as Platform from 'loot-core/client/platform';
import { setLastTransaction } from 'loot-core/client/queries/queriesSlice';
import { runQuery } from 'loot-core/client/query-helpers';
Expand Down Expand Up @@ -66,6 +65,7 @@ import {
SingleActiveEditFormProvider,
useSingleActiveEditForm,
} from '../../../hooks/useSingleActiveEditForm';
import { pushModal } from '../../../modals/modalsSlice';
import { useSelector, useDispatch } from '../../../redux';
import { MobilePageHeader, Page } from '../../Page';
import { AmountInput } from '../../util/AmountInput';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { useResponsive } from '@actual-app/components/hooks/useResponsive';
import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';

import { type Modal as ModalType } from 'loot-core/client/modals/modalsSlice';

import { type Modal as ModalType } from '../../modals/modalsSlice';
import { AccountAutocomplete } from '../autocomplete/AccountAutocomplete';
import {
ModalCloseButton,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import { styles } from '@actual-app/components/styles';
import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';

import { type Modal as ModalType } from 'loot-core/client/modals/modalsSlice';
import { type AccountEntity } from 'loot-core/types/models';

import { useAccount } from '../../hooks/useAccount';
import { useAccounts } from '../../hooks/useAccounts';
import { useNotes } from '../../hooks/useNotes';
import { type Modal as ModalType } from '../../modals/modalsSlice';
import {
Modal,
ModalCloseButton,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import { Menu } from '@actual-app/components/menu';
import { styles } from '@actual-app/components/styles';
import { theme } from '@actual-app/components/theme';

import { type Modal as ModalType } from 'loot-core/client/modals/modalsSlice';

import { useLocalPref } from '../../hooks/useLocalPref';
import { type Modal as ModalType } from '../../modals/modalsSlice';
import { Modal, ModalCloseButton, ModalHeader } from '../common/Modal';

type BudgetPageMenuModalProps = Extract<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { useResponsive } from '@actual-app/components/hooks/useResponsive';
import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';

import { type Modal as ModalType } from 'loot-core/client/modals/modalsSlice';
import * as monthUtils from 'loot-core/shared/months';

import { type Modal as ModalType } from '../../modals/modalsSlice';
import { CategoryAutocomplete } from '../autocomplete/CategoryAutocomplete';
import {
ModalCloseButton,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ import { styles } from '@actual-app/components/styles';
import { theme } from '@actual-app/components/theme';
import { View } from '@actual-app/components/view';

import { type Modal as ModalType } from 'loot-core/client/modals/modalsSlice';

import { useCategories } from '../../hooks/useCategories';
import { useNotes } from '../../hooks/useNotes';
import { type Modal as ModalType } from '../../modals/modalsSlice';
import {
Modal,
ModalCloseButton,
Expand Down
Loading
Loading