A local-first personal finance app
Move loot-core/client/notifications code over to desktop-client package (#4820)
Joel Jeremy Marquez45ff94590b8b
diff --git a/packages/desktop-client/src/accounts/accountsSlice.ts b/packages/desktop-client/src/accounts/accountsSlice.tsindex 2f3ba99e8a..e8c393d976 100644--- a/packages/desktop-client/src/accounts/accountsSlice.ts+++ b/packages/desktop-client/src/accounts/accountsSlice.ts@@ -1,6 +1,5 @@import { createSlice, type PayloadAction } from '@reduxjs/toolkit';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';import {getAccounts,getPayees,@@ -19,6 +18,7 @@ import {} from 'loot-core/types/models';import { resetApp } from '../app/appSlice';+import { addNotification } from '../notifications/notificationsSlice';const sliceName = 'account';diff --git a/packages/desktop-client/src/components/App.tsx b/packages/desktop-client/src/components/App.tsxindex 91893e7af2..470a061fce 100644--- a/packages/desktop-client/src/components/App.tsx+++ b/packages/desktop-client/src/components/App.tsx@@ -14,7 +14,6 @@ import { BrowserRouter } from 'react-router-dom';import { styles } from '@actual-app/components/styles';import { View } from '@actual-app/components/view';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';import * as Platform from 'loot-core/client/platform';import { loadGlobalPrefs } from 'loot-core/client/prefs/prefsSlice';import { SpreadsheetProvider } from 'loot-core/client/SpreadsheetProvider';@@ -25,6 +24,7 @@ import { setAppState, sync } from '../app/appSlice';import { closeBudget, loadBudget } from '../budgets/budgetsSlice';import { handleGlobalEvents } from '../global-events';import { setI18NextLanguage } from '../i18n';+import { addNotification } from '../notifications/notificationsSlice';import { installPolyfills } from '../polyfills';import { useDispatch, useSelector, useStore } from '../redux';import { hasHiddenScrollbars, ThemeStyle, useTheme } from '../style';diff --git a/packages/desktop-client/src/components/FinancesApp.tsx b/packages/desktop-client/src/components/FinancesApp.tsxindex ee0e98bdb0..c9976a7016 100644--- a/packages/desktop-client/src/components/FinancesApp.tsx+++ b/packages/desktop-client/src/components/FinancesApp.tsx@@ -13,12 +13,12 @@ import { useResponsive } from '@actual-app/components/hooks/useResponsive';import { theme } from '@actual-app/components/theme';import { View } from '@actual-app/components/view';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';import * as undo from 'loot-core/platform/client/undo';import { sync } from '../app/appSlice';import { ProtectedRoute } from '../auth/ProtectedRoute';import { Permissions } from '../auth/types';+import { addNotification } from '../notifications/notificationsSlice';import { useSelector, useDispatch } from '../redux';import { getIsOutdated, getLatestVersion } from '../util/versions';diff --git a/packages/desktop-client/src/components/Notifications.tsx b/packages/desktop-client/src/components/Notifications.tsxindex 0f1c165c3f..e5e56971f9 100644--- a/packages/desktop-client/src/components/Notifications.tsx+++ b/packages/desktop-client/src/components/Notifications.tsx@@ -24,8 +24,7 @@ import { css } from '@emotion/css';import {removeNotification,type NotificationWithId,-} from 'loot-core/client/notifications/notificationsSlice';-+} from '../notifications/notificationsSlice';import { useSelector, useDispatch } from '../redux';import { Link } from './common/Link';diff --git a/packages/desktop-client/src/components/ServerContext.tsx b/packages/desktop-client/src/components/ServerContext.tsxindex 5dd17a4bb2..48e71ac23a 100644--- a/packages/desktop-client/src/components/ServerContext.tsx+++ b/packages/desktop-client/src/components/ServerContext.tsx@@ -9,10 +9,10 @@ import React, {import { t } from 'i18next';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';import { send } from 'loot-core/platform/client/fetch';import { type Handlers } from 'loot-core/types/handlers';+import { addNotification } from '../notifications/notificationsSlice';import { useDispatch } from '../redux';type LoginMethod = {diff --git a/packages/desktop-client/src/components/accounts/Account.tsx b/packages/desktop-client/src/components/accounts/Account.tsxindex 2f91b0a7b5..9fa601b345 100644--- a/packages/desktop-client/src/components/accounts/Account.tsx+++ b/packages/desktop-client/src/components/accounts/Account.tsx@@ -21,7 +21,6 @@ import {SchedulesProvider,accountSchedulesQuery,} from 'loot-core/client/data-hooks/schedules';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';import * as queries from 'loot-core/client/queries';import {createPayee,@@ -67,6 +66,7 @@ import {pushModal,replaceModal,} from '../../modals/modalsSlice';+import { addNotification } from '../../notifications/notificationsSlice';import { useSelector, useDispatch } from '../../redux';import { type SavedFilter } from '../filters/SavedFilterMenuButton';import { TransactionList } from '../transactions/TransactionList';diff --git a/packages/desktop-client/src/components/admin/UserAccess/UserAccess.tsx b/packages/desktop-client/src/components/admin/UserAccess/UserAccess.tsxindex 8cb9456cd1..532b0862bc 100644--- a/packages/desktop-client/src/components/admin/UserAccess/UserAccess.tsx+++ b/packages/desktop-client/src/components/admin/UserAccess/UserAccess.tsx@@ -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 { addNotification } from 'loot-core/client/notifications/notificationsSlice';import { send } from 'loot-core/platform/client/fetch';import * as undo from 'loot-core/platform/client/undo';import { type Handlers } from 'loot-core/types/handlers';@@ -27,6 +26,7 @@ import {} from 'loot-core/types/models';import { pushModal } from '../../../modals/modalsSlice';+import { addNotification } from '../../../notifications/notificationsSlice';import { useDispatch } from '../../../redux';import { InfiniteScrollWrapper } from '../../common/InfiniteScrollWrapper';import { Link } from '../../common/Link';diff --git a/packages/desktop-client/src/components/admin/UserAccess/UserAccessRow.tsx b/packages/desktop-client/src/components/admin/UserAccess/UserAccessRow.tsxindex c1828984b5..9fa46a0fbe 100644--- a/packages/desktop-client/src/components/admin/UserAccess/UserAccessRow.tsx+++ b/packages/desktop-client/src/components/admin/UserAccess/UserAccessRow.tsx@@ -5,12 +5,12 @@ import { useTranslation } from 'react-i18next';import { theme } from '@actual-app/components/theme';import { View } from '@actual-app/components/view';-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 { getUserAccessErrors } from 'loot-core/shared/errors';import { type UserAvailable } from 'loot-core/types/models';+import { addNotification } from '../../../notifications/notificationsSlice';import { useDispatch } from '../../../redux';import { Checkbox } from '../../forms';import { Row, Cell } from '../../table';diff --git a/packages/desktop-client/src/components/admin/UserDirectory/UserDirectory.tsx b/packages/desktop-client/src/components/admin/UserDirectory/UserDirectory.tsxindex a0e6774659..050786d27b 100644--- a/packages/desktop-client/src/components/admin/UserDirectory/UserDirectory.tsx+++ b/packages/desktop-client/src/components/admin/UserDirectory/UserDirectory.tsx@@ -16,13 +16,13 @@ import { Text } from '@actual-app/components/text';import { theme } from '@actual-app/components/theme';import { View } from '@actual-app/components/view';-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 { pushModal } from '../../../modals/modalsSlice';+import { addNotification } from '../../../notifications/notificationsSlice';import { useDispatch } from '../../../redux';import { InfiniteScrollWrapper } from '../../common/InfiniteScrollWrapper';import { Link } from '../../common/Link';diff --git a/packages/desktop-client/src/components/budget/index.tsx b/packages/desktop-client/src/components/budget/index.tsxindex 93982e7256..7077a5dfe6 100644--- a/packages/desktop-client/src/components/budget/index.tsx+++ b/packages/desktop-client/src/components/budget/index.tsx@@ -5,7 +5,6 @@ import { useTranslation } from 'react-i18next';import { styles } from '@actual-app/components/styles';import { View } from '@actual-app/components/view';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';import {applyBudgetAction,createCategory,@@ -23,6 +22,7 @@ import { send } from 'loot-core/platform/client/fetch';import * as monthUtils from 'loot-core/shared/months';import { pushModal } from '../../modals/modalsSlice';+import { addNotification } from '../../notifications/notificationsSlice';import { useDispatch } from '../../redux';import { NamespaceContext } from '../spreadsheet/NamespaceContext';diff --git a/packages/desktop-client/src/components/mobile/transactions/TransactionList.tsx b/packages/desktop-client/src/components/mobile/transactions/TransactionList.tsxindex cba1196114..25cbf5a8be 100644--- a/packages/desktop-client/src/components/mobile/transactions/TransactionList.tsx+++ b/packages/desktop-client/src/components/mobile/transactions/TransactionList.tsx@@ -29,7 +29,6 @@ import { Text } from '@actual-app/components/text';import { theme } from '@actual-app/components/theme';import { View } from '@actual-app/components/view';-import { setNotificationInset } from 'loot-core/client/notifications/notificationsSlice';import { validForTransfer } from 'loot-core/client/transfer';import * as monthUtils from 'loot-core/shared/months';import { isPreviewId } from 'loot-core/shared/transactions';@@ -39,6 +38,7 @@ import {type TransactionEntity,} from 'loot-core/types/models';+import { setNotificationInset } from '../../../notifications/notificationsSlice';import { useDispatch } from '../../../redux';import { useScrollListener } from '../../ScrollProvider';import { FloatingActionBar } from '../FloatingActionBar';diff --git a/packages/desktop-client/src/components/modals/CreateAccountModal.tsx b/packages/desktop-client/src/components/modals/CreateAccountModal.tsxindex 09b6d08395..100589d72a 100644--- a/packages/desktop-client/src/components/modals/CreateAccountModal.tsx+++ b/packages/desktop-client/src/components/modals/CreateAccountModal.tsx@@ -12,13 +12,13 @@ import { Text } from '@actual-app/components/text';import { theme } from '@actual-app/components/theme';import { View } from '@actual-app/components/view';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';import { send } from 'loot-core/platform/client/fetch';import { useAuth } from '../../auth/AuthProvider';import { Permissions } from '../../auth/types';import { authorizeBank } from '../../gocardless';import { type Modal as ModalType, pushModal } from '../../modals/modalsSlice';+import { addNotification } from '../../notifications/notificationsSlice';import { useDispatch } from '../../redux';import { Warning } from '../alerts';import { Link } from '../common/Link';diff --git a/packages/desktop-client/src/components/modals/EditAccess.tsx b/packages/desktop-client/src/components/modals/EditAccess.tsxindex 1cbb9d6ea1..8fd5c6244f 100644--- a/packages/desktop-client/src/components/modals/EditAccess.tsx+++ b/packages/desktop-client/src/components/modals/EditAccess.tsx@@ -9,12 +9,12 @@ import { Text } from '@actual-app/components/text';import { theme } from '@actual-app/components/theme';import { View } from '@actual-app/components/view';-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 { getUserAccessErrors } from 'loot-core/shared/errors';import { type Modal as ModalType, popModal } from '../../modals/modalsSlice';+import { addNotification } from '../../notifications/notificationsSlice';import { useDispatch } from '../../redux';import { Modal, ModalCloseButton, ModalHeader } from '../common/Modal';import { FormField, FormLabel } from '../forms';diff --git a/packages/desktop-client/src/components/modals/EditUser.tsx b/packages/desktop-client/src/components/modals/EditUser.tsxindex a42321dd7d..1cc8d7e0a2 100644--- a/packages/desktop-client/src/components/modals/EditUser.tsx+++ b/packages/desktop-client/src/components/modals/EditUser.tsx@@ -10,13 +10,13 @@ import { Text } from '@actual-app/components/text';import { theme } from '@actual-app/components/theme';import { View } from '@actual-app/components/view';-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 { PossibleRoles } from 'loot-core/shared/user';import { type NewUserEntity, type UserEntity } from 'loot-core/types/models';import { type Modal as ModalType, popModal } from '../../modals/modalsSlice';+import { addNotification } from '../../notifications/notificationsSlice';import { useDispatch } from '../../redux';import { Modal, ModalCloseButton, ModalHeader } from '../common/Modal';import { Checkbox, FormField, FormLabel } from '../forms';diff --git a/packages/desktop-client/src/components/modals/TransferOwnership.tsx b/packages/desktop-client/src/components/modals/TransferOwnership.tsxindex 175dc9924c..b6e826c193 100644--- a/packages/desktop-client/src/components/modals/TransferOwnership.tsx+++ b/packages/desktop-client/src/components/modals/TransferOwnership.tsx@@ -9,7 +9,6 @@ import { Text } from '@actual-app/components/text';import { theme } from '@actual-app/components/theme';import { View } from '@actual-app/components/view';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';import { send } from 'loot-core/platform/client/fetch';import { getUserAccessErrors } from 'loot-core/shared/errors';import { type Budget } from 'loot-core/types/budget';@@ -18,6 +17,7 @@ import { type Handlers } from 'loot-core/types/handlers';import { closeAndLoadBudget } from '../../budgets/budgetsSlice';import { type Modal as ModalType, popModal } from '../../modals/modalsSlice';+import { addNotification } from '../../notifications/notificationsSlice';import { useDispatch, useSelector } from '../../redux';import { Modal, ModalCloseButton, ModalHeader } from '../common/Modal';import { FormField, FormLabel } from '../forms';diff --git a/packages/desktop-client/src/components/modals/manager/ConfirmChangeDocumentDir.tsx b/packages/desktop-client/src/components/modals/manager/ConfirmChangeDocumentDir.tsxindex 598d1be0fa..92c81b9cbe 100644--- a/packages/desktop-client/src/components/modals/manager/ConfirmChangeDocumentDir.tsx+++ b/packages/desktop-client/src/components/modals/manager/ConfirmChangeDocumentDir.tsx@@ -7,8 +7,7 @@ import { Text } from '@actual-app/components/text';import { theme } from '@actual-app/components/theme';import { View } from '@actual-app/components/view';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';-+import { addNotification } from '../../../notifications/notificationsSlice';import { useDispatch } from '../../../redux';import { Information } from '../../alerts';import { Modal, ModalCloseButton, ModalHeader } from '../../common/Modal';diff --git a/packages/desktop-client/src/components/modals/manager/DuplicateFileModal.tsx b/packages/desktop-client/src/components/modals/manager/DuplicateFileModal.tsxindex 56cf8ab10c..cdc1dd7cb0 100644--- a/packages/desktop-client/src/components/modals/manager/DuplicateFileModal.tsx+++ b/packages/desktop-client/src/components/modals/manager/DuplicateFileModal.tsx@@ -10,11 +10,11 @@ import { Text } from '@actual-app/components/text';import { theme } from '@actual-app/components/theme';import { View } from '@actual-app/components/view';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';import { send } from 'loot-core/platform/client/fetch';import { duplicateBudget } from '../../../budgets/budgetsSlice';import { type Modal as ModalType } from '../../../modals/modalsSlice';+import { addNotification } from '../../../notifications/notificationsSlice';import { useDispatch } from '../../../redux';import {Modal,diff --git a/packages/desktop-client/src/components/reports/Overview.tsx b/packages/desktop-client/src/components/reports/Overview.tsxindex 718f9e4931..410c7ccf9a 100644--- a/packages/desktop-client/src/components/reports/Overview.tsx+++ b/packages/desktop-client/src/components/reports/Overview.tsx@@ -15,10 +15,6 @@ import { View } from '@actual-app/components/view';import { useDashboard } from 'loot-core/client/data-hooks/dashboard';import { useReports } from 'loot-core/client/data-hooks/reports';-import {- addNotification,- removeNotification,-} from 'loot-core/client/notifications/notificationsSlice';import { send } from 'loot-core/platform/client/fetch';import {type CustomReportWidget,@@ -27,6 +23,10 @@ import {type Widget,} from 'loot-core/types/models';+import {+ addNotification,+ removeNotification,+} from '../../notifications/notificationsSlice';import { useDispatch } from '../../redux';import { MOBILE_NAV_HEIGHT } from '../mobile/MobileNavTabs';import { MobilePageHeader, Page, PageHeader } from '../Page';diff --git a/packages/desktop-client/src/components/reports/reports/Calendar.tsx b/packages/desktop-client/src/components/reports/reports/Calendar.tsxindex 2af1c125c2..38ae987c2b 100644--- a/packages/desktop-client/src/components/reports/reports/Calendar.tsx+++ b/packages/desktop-client/src/components/reports/reports/Calendar.tsx@@ -28,7 +28,6 @@ import { format, parseISO } from 'date-fns';import { SchedulesProvider } from 'loot-core/client/data-hooks/schedules';import { useTransactions } from 'loot-core/client/data-hooks/transactions';import { useWidget } from 'loot-core/client/data-hooks/widget';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';import { send } from 'loot-core/platform/client/fetch';import * as monthUtils from 'loot-core/shared/months';import { q, type Query } from 'loot-core/shared/query';@@ -41,6 +40,7 @@ import {type TransactionEntity,} from 'loot-core/types/models';+import { addNotification } from '../../../notifications/notificationsSlice';import { useDispatch } from '../../../redux';import { EditablePageHeaderTitle } from '../../EditablePageHeaderTitle';import { MobileBackButton } from '../../mobile/MobileBackButton';diff --git a/packages/desktop-client/src/components/reports/reports/CashFlow.tsx b/packages/desktop-client/src/components/reports/reports/CashFlow.tsxindex a1d41c5d83..657dd252df 100644--- a/packages/desktop-client/src/components/reports/reports/CashFlow.tsx+++ b/packages/desktop-client/src/components/reports/reports/CashFlow.tsx@@ -13,7 +13,6 @@ import { View } from '@actual-app/components/view';import * as d from 'date-fns';import { useWidget } from 'loot-core/client/data-hooks/widget';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';import { send } from 'loot-core/platform/client/fetch';import * as monthUtils from 'loot-core/shared/months';import { integerToCurrency } from 'loot-core/shared/util';@@ -23,6 +22,7 @@ import {type TimeFrame,} from 'loot-core/types/models';+import { addNotification } from '../../../notifications/notificationsSlice';import { useDispatch } from '../../../redux';import { EditablePageHeaderTitle } from '../../EditablePageHeaderTitle';import { MobileBackButton } from '../../mobile/MobileBackButton';diff --git a/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsx b/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsxindex 5e6ff306ba..41646a8c7b 100644--- a/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsx+++ b/packages/desktop-client/src/components/reports/reports/CustomReportListCards.tsx@@ -8,12 +8,12 @@ import { theme } from '@actual-app/components/theme';import { Tooltip } from '@actual-app/components/tooltip';import { View } from '@actual-app/components/view';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';import { calculateHasWarning } from 'loot-core/client/reports';import { send, sendCatch } from 'loot-core/platform/client/fetch';import * as monthUtils from 'loot-core/shared/months';import { type CustomReportEntity } from 'loot-core/types/models';+import { addNotification } from '../../../notifications/notificationsSlice';import { useDispatch } from '../../../redux';import { DateRange } from '../DateRange';import { ReportCard } from '../ReportCard';diff --git a/packages/desktop-client/src/components/reports/reports/NetWorth.tsx b/packages/desktop-client/src/components/reports/reports/NetWorth.tsxindex f07c47f53e..e4233f1611 100644--- a/packages/desktop-client/src/components/reports/reports/NetWorth.tsx+++ b/packages/desktop-client/src/components/reports/reports/NetWorth.tsx@@ -11,12 +11,12 @@ import { View } from '@actual-app/components/view';import * as d from 'date-fns';import { useWidget } from 'loot-core/client/data-hooks/widget';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';import { send } from 'loot-core/platform/client/fetch';import * as monthUtils from 'loot-core/shared/months';import { integerToCurrency } from 'loot-core/shared/util';import { type TimeFrame, type NetWorthWidget } from 'loot-core/types/models';+import { addNotification } from '../../../notifications/notificationsSlice';import { useDispatch } from '../../../redux';import { EditablePageHeaderTitle } from '../../EditablePageHeaderTitle';import { MobileBackButton } from '../../mobile/MobileBackButton';diff --git a/packages/desktop-client/src/components/reports/reports/Spending.tsx b/packages/desktop-client/src/components/reports/reports/Spending.tsxindex 96b8f8eb72..2796492369 100644--- a/packages/desktop-client/src/components/reports/reports/Spending.tsx+++ b/packages/desktop-client/src/components/reports/reports/Spending.tsx@@ -17,7 +17,6 @@ import { View } from '@actual-app/components/view';import * as d from 'date-fns';import { useWidget } from 'loot-core/client/data-hooks/widget';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';import { send } from 'loot-core/platform/client/fetch';import * as monthUtils from 'loot-core/shared/months';import { amountToCurrency } from 'loot-core/shared/util';@@ -26,6 +25,7 @@ import {type RuleConditionEntity,} from 'loot-core/types/models';+import { addNotification } from '../../../notifications/notificationsSlice';import { useDispatch } from '../../../redux';import { EditablePageHeaderTitle } from '../../EditablePageHeaderTitle';import { AppliedFilters } from '../../filters/AppliedFilters';diff --git a/packages/desktop-client/src/components/reports/reports/Summary.tsx b/packages/desktop-client/src/components/reports/reports/Summary.tsxindex 3251d4a5da..ec3101da29 100644--- a/packages/desktop-client/src/components/reports/reports/Summary.tsx+++ b/packages/desktop-client/src/components/reports/reports/Summary.tsx@@ -16,7 +16,6 @@ import { View } from '@actual-app/components/view';import { parseISO } from 'date-fns';import { useWidget } from 'loot-core/client/data-hooks/widget';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';import { send } from 'loot-core/platform/client/fetch';import * as monthUtils from 'loot-core/shared/months';import { amountToCurrency } from 'loot-core/shared/util';@@ -26,6 +25,7 @@ import {type TimeFrame,} from 'loot-core/types/models';+import { addNotification } from '../../../notifications/notificationsSlice';import { useDispatch } from '../../../redux';import { EditablePageHeaderTitle } from '../../EditablePageHeaderTitle';import { AppliedFilters } from '../../filters/AppliedFilters';diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.jsx b/packages/desktop-client/src/components/transactions/TransactionsTable.jsxindex 17c8c94094..42fafddfcd 100644--- a/packages/desktop-client/src/components/transactions/TransactionsTable.jsx+++ b/packages/desktop-client/src/components/transactions/TransactionsTable.jsx@@ -42,7 +42,6 @@ import {} from 'date-fns';import { useCachedSchedules } from 'loot-core/client/data-hooks/schedules';-import { addNotification } from 'loot-core/client/notifications/notificationsSlice';import {getAccountsById,getPayeesById,@@ -69,6 +68,7 @@ import {} from 'loot-core/shared/util';import { pushModal } from '../../modals/modalsSlice';+import { addNotification } from '../../notifications/notificationsSlice';import { useDispatch } from '../../redux';import { AccountAutocomplete } from '../autocomplete/AccountAutocomplete';import { CategoryAutocomplete } from '../autocomplete/CategoryAutocomplete';diff --git a/packages/desktop-client/src/global-events.ts b/packages/desktop-client/src/global-events.tsindex 24beb2e1c0..e2abada55f 100644--- a/packages/desktop-client/src/global-events.ts+++ b/packages/desktop-client/src/global-events.ts@@ -1,8 +1,4 @@// @ts-strict-ignore-import {- addGenericErrorNotification,- addNotification,-} from 'loot-core/client/notifications/notificationsSlice';import { loadPrefs } from 'loot-core/client/prefs/prefsSlice';import {getAccounts,@@ -17,6 +13,10 @@ import * as undo from 'loot-core/platform/client/undo';import { setAppState } from './app/appSlice';import { closeBudgetUI } from './budgets/budgetsSlice';import { closeModal, pushModal, replaceModal } from './modals/modalsSlice';+import {+ addGenericErrorNotification,+ addNotification,+} from './notifications/notificationsSlice';export function handleGlobalEvents(store: AppStore) {const unlistenServerError = listen('server-error', () => {diff --git a/packages/desktop-client/src/hooks/useUndo.ts b/packages/desktop-client/src/hooks/useUndo.tsindex cbad9db58a..bf075a380e 100644--- a/packages/desktop-client/src/hooks/useUndo.ts+++ b/packages/desktop-client/src/hooks/useUndo.ts@@ -2,12 +2,12 @@ import { useCallback } from 'react';import { useResponsive } from '@actual-app/components/hooks/useResponsive';+import { redo, undo } from 'loot-core/client/undo';+import {addNotification,type Notification,-} from 'loot-core/client/notifications/notificationsSlice';-import { redo, undo } from 'loot-core/client/undo';-+} from '../notifications/notificationsSlice';import { useDispatch } from '../redux';type UndoActions = {diff --git a/packages/desktop-client/src/index.tsx b/packages/desktop-client/src/index.tsxindex a7588850ca..18a809c977 100644--- a/packages/desktop-client/src/index.tsx+++ b/packages/desktop-client/src/index.tsx@@ -13,7 +13,6 @@ import { Provider } from 'react-redux';import { bindActionCreators } from '@reduxjs/toolkit';import { createRoot } from 'react-dom/client';-import * as notificationsSlice from 'loot-core/client/notifications/notificationsSlice';import * as prefsSlice from 'loot-core/client/prefs/prefsSlice';import * as queriesSlice from 'loot-core/client/queries/queriesSlice';import { aqlQuery } from 'loot-core/client/query-helpers';@@ -33,6 +32,7 @@ import 'focus-visible';import { App } from './components/App';import { ServerProvider } from './components/ServerContext';import * as modalsSlice from './modals/modalsSlice';+import * as notificationsSlice from './notifications/notificationsSlice';const boundActions = bindActionCreators({diff --git a/packages/loot-core/src/client/notifications/notificationsSlice.ts b/packages/desktop-client/src/notifications/notificationsSlice.tssimilarity index 93%rename from packages/loot-core/src/client/notifications/notificationsSlice.tsrename to packages/desktop-client/src/notifications/notificationsSlice.tsindex 5c8c35bec9..b5304dbf33 100644--- a/packages/loot-core/src/client/notifications/notificationsSlice.ts+++ b/packages/desktop-client/src/notifications/notificationsSlice.ts@@ -1,10 +1,9 @@-// This is temporary until we move all loot-core/client over to desktop-client.-// eslint-disable-next-line no-restricted-imports-import { resetApp } from '@actual-app/web/src/app/appSlice';import { createSlice, type PayloadAction } from '@reduxjs/toolkit';import { t } from 'i18next';import { v4 as uuidv4 } from 'uuid';+import { resetApp } from '../app/appSlice';+const sliceName = 'notifications';export type Notification = {diff --git a/packages/loot-core/src/client/queries/queriesSlice.ts b/packages/loot-core/src/client/queries/queriesSlice.tsindex 84d2355cad..8c48eb68c0 100644--- a/packages/loot-core/src/client/queries/queriesSlice.ts+++ b/packages/loot-core/src/client/queries/queriesSlice.ts@@ -1,7 +1,12 @@// @ts-strict-ignore// This is temporary until we move all loot-core/client over to desktop-client.-// eslint-disable-next-line no-restricted-imports+/* eslint-disable no-restricted-imports */import { resetApp } from '@actual-app/web/src/app/appSlice';+import {+ addGenericErrorNotification,+ addNotification,+} from '@actual-app/web/src/notifications/notificationsSlice';+/* eslint-enable no-restricted-imports */import { createSlice, type PayloadAction } from '@reduxjs/toolkit';import { t } from 'i18next';import memoizeOne from 'memoize-one';@@ -15,10 +20,6 @@ import {type AccountEntity,type PayeeEntity,} from '../../types/models';-import {- addGenericErrorNotification,- addNotification,-} from '../notifications/notificationsSlice';import { createAppAsyncThunk } from '../redux';const sliceName = 'queries';diff --git a/packages/loot-core/src/client/shared-listeners.ts b/packages/loot-core/src/client/shared-listeners.tsindex d25bd8c212..a471f2caf1 100644--- a/packages/loot-core/src/client/shared-listeners.ts+++ b/packages/loot-core/src/client/shared-listeners.ts@@ -7,15 +7,15 @@ import {uploadBudget,} from '@actual-app/web/src/budgets/budgetsSlice';import { pushModal } from '@actual-app/web/src/modals/modalsSlice';+import {+ addNotification,+ type Notification,+} from '@actual-app/web/src/notifications/notificationsSlice';/* eslint-enable no-restricted-imports */import { t } from 'i18next';import { listen, send } from '../platform/client/fetch';-import {- addNotification,- type Notification,-} from './notifications/notificationsSlice';import { loadPrefs } from './prefs/prefsSlice';import { getAccounts, getCategories, getPayees } from './queries/queriesSlice';import { type AppStore } from './store';diff --git a/packages/loot-core/src/client/store/index.ts b/packages/loot-core/src/client/store/index.tsindex cbaf07216a..0f417c436a 100644--- a/packages/loot-core/src/client/store/index.ts+++ b/packages/loot-core/src/client/store/index.ts@@ -16,6 +16,11 @@ import {name as modalsSliceName,reducer as modalsSliceReducer,} from '@actual-app/web/src/modals/modalsSlice';+import {+ name as notificationsSliceName,+ reducer as notificationsSliceReducer,+ addNotification,+} from '@actual-app/web/src/notifications/notificationsSlice';/* eslint-enable no-restricted-imports */import {combineReducers,@@ -24,11 +29,6 @@ import {isRejected,} from '@reduxjs/toolkit';-import {- name as notificationsSliceName,- reducer as notificationsSliceReducer,- addNotification,-} from '../notifications/notificationsSlice';import {name as prefsSliceName,reducer as prefsSliceReducer,diff --git a/packages/loot-core/src/client/store/mock.ts b/packages/loot-core/src/client/store/mock.tsindex db06b75a59..bdd541c3d4 100644--- a/packages/loot-core/src/client/store/mock.ts+++ b/packages/loot-core/src/client/store/mock.ts@@ -17,13 +17,13 @@ import {name as modalsSliceName,reducer as modalsSliceReducer,} from '@actual-app/web/src/modals/modalsSlice';-/* eslint-enable */-import { configureStore, combineReducers } from '@reduxjs/toolkit';-import {name as notificationsSliceName,reducer as notificationsSliceReducer,-} from '../notifications/notificationsSlice';+} from '@actual-app/web/src/notifications/notificationsSlice';+/* eslint-enable */+import { configureStore, combineReducers } from '@reduxjs/toolkit';+import {name as prefsSliceName,reducer as prefsSliceReducer,diff --git a/packages/loot-core/src/server/budget/cleanup-template.ts b/packages/loot-core/src/server/budget/cleanup-template.tsindex 098e8778d5..741bbbf170 100644--- a/packages/loot-core/src/server/budget/cleanup-template.ts+++ b/packages/loot-core/src/server/budget/cleanup-template.ts@@ -1,11 +1,18 @@// @ts-strict-ignore-import { Notification } from '../../client/notifications/notificationsSlice';import * as monthUtils from '../../shared/months';import * as db from '../db';import { setBudget, getSheetValue, setGoal } from './actions';import { parse } from './cleanup-template.pegjs';+type Notification = {+ type?: 'message' | 'error' | 'warning' | undefined;+ pre?: string | undefined;+ title?: string | undefined;+ message: string;+ sticky?: boolean | undefined;+};+export function cleanupTemplate({ month }: { month: string }) {return processCleanup(month);}diff --git a/packages/loot-core/src/server/budget/goaltemplates.ts b/packages/loot-core/src/server/budget/goaltemplates.tsindex 74048d87de..291fb26676 100644--- a/packages/loot-core/src/server/budget/goaltemplates.ts+++ b/packages/loot-core/src/server/budget/goaltemplates.ts@@ -1,5 +1,4 @@// @ts-strict-ignore-import { Notification } from '../../client/notifications/notificationsSlice';import * as monthUtils from '../../shared/months';import * as db from '../db';import { batchMessages } from '../sync';@@ -8,6 +7,14 @@ import { isReflectBudget, getSheetValue, setGoal, setBudget } from './actions';import { CategoryTemplate } from './categoryTemplate';import { checkTemplates, storeTemplates } from './template-notes';+type Notification = {+ type?: 'message' | 'error' | 'warning' | undefined;+ pre?: string | undefined;+ title?: string | undefined;+ message: string;+ sticky?: boolean | undefined;+};+export async function applyTemplate({ month }): Promise<Notification> {await storeTemplates();const categoryTemplates = await getTemplates(null);diff --git a/packages/loot-core/src/server/budget/template-notes.ts b/packages/loot-core/src/server/budget/template-notes.tsindex 558ec4192a..faac45bf76 100644--- a/packages/loot-core/src/server/budget/template-notes.ts+++ b/packages/loot-core/src/server/budget/template-notes.ts@@ -1,4 +1,3 @@-import { Notification } from '../../client/notifications/notificationsSlice';import * as db from '../db';import { parse } from './goal-template.pegjs';@@ -10,6 +9,13 @@ import {} from './statements';import { Template } from './types/templates';+type Notification = {+ type?: 'message' | 'error' | 'warning' | undefined;+ pre?: string | undefined;+ message: string;+ sticky?: boolean | undefined;+};+export const TEMPLATE_PREFIX = '#template';export const GOAL_PREFIX = '#goal';diff --git a/upcoming-release-notes/4820.md b/upcoming-release-notes/4820.mdnew file mode 100644index 0000000000..81dafa2211--- /dev/null+++ b/upcoming-release-notes/4820.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [joel-jeremy]+---++Move loot-core/client/notifications code over to desktop-client package