Skip to content

A local-first personal finance app

Merge branch 'master' into reorg-sidebar

Tom Frenchd43c0361d310
diff --cc packages/desktop-client/src/components/FinancesApp.js
index 8bd87edc00,eccbab12ae..bdc6f44822
--- a/packages/desktop-client/src/components/FinancesApp.js
+++ b/packages/desktop-client/src/components/FinancesApp.js
@@@ -1,42 -1,41 +1,43 @@@
import React, { useMemo } from 'react';
- import { Router, Route, Redirect, Switch, useLocation } from 'react-router-dom';
- import { createBrowserHistory } from 'history';
- import { connect } from 'react-redux';
import { DndProvider } from 'react-dnd';
import Backend from 'react-dnd-html5-backend';
+ import { connect } from 'react-redux';
+ import { Router, Route, Redirect, Switch, useLocation } from 'react-router-dom';
+
+ import { createBrowserHistory } from 'history';
import hotkeys from 'hotkeys-js';
+
import * as actions from 'loot-core/src/client/actions';
+ import { AccountsProvider } from 'loot-core/src/client/data-hooks/accounts';
+ import { PayeesProvider } from 'loot-core/src/client/data-hooks/payees';
import { SpreadsheetProvider } from 'loot-core/src/client/SpreadsheetProvider';
import checkForUpgradeNotifications from 'loot-core/src/client/upgrade-notifications';
- import { colors } from 'loot-design/src/style';
- import { View } from 'loot-design/src/components/common';
- import { BudgetMonthCountProvider } from 'loot-design/src/components/budget/BudgetMonthCountContext';
import * as undo from 'loot-core/src/platform/client/undo';
- import { PayeesProvider } from 'loot-core/src/client/data-hooks/payees';
- import { AccountsProvider } from 'loot-core/src/client/data-hooks/accounts';
- import { getLocationState } from '../util/location-state';
- import { makeLocationState } from '../util/location-state';
- import { PageTypeProvider } from './Page';
- import { ActiveLocationProvider } from './ActiveLocation';
- import BankSyncStatus from './BankSyncStatus';
+ import { BudgetMonthCountProvider } from 'loot-design/src/components/budget/BudgetMonthCountContext';
+ import { View } from 'loot-design/src/components/common';
+ import { colors } from 'loot-design/src/style';
- import Titlebar, { TitlebarProvider } from './Titlebar';
- import FloatableSidebar, { SidebarProvider } from './FloatableSidebar';
+ import { getLocationState, makeLocationState } from '../util/location-state';
import Account from './accounts/Account';
+ import { ActiveLocationProvider } from './ActiveLocation';
+ import BankSyncStatus from './BankSyncStatus';
import Budget from './budget';
+ import FloatableSidebar, { SidebarProvider } from './FloatableSidebar';
+ import GlobalKeys from './GlobalKeys';
++import { ManageRulesPage } from './ManageRulesPage';
+ import Modals from './Modals';
+ import Notifications from './Notifications';
+ import { PageTypeProvider } from './Page';
++import { ManagePayeesPage } from './payees/ManagePayeesPage';
import Reports from './reports';
import Schedules from './schedules';
+ import DiscoverSchedules from './schedules/DiscoverSchedules';
import EditSchedule from './schedules/EditSchedule';
import LinkSchedule from './schedules/LinkSchedule';
- import DiscoverSchedules from './schedules/DiscoverSchedules';
import PostsOfflineNotification from './schedules/PostsOfflineNotification';
- import FixSplitsTool from './tools/FixSplitsTool';
import Settings from './Settings';
- import Modals from './Modals';
- import Notifications from './Notifications';
- import GlobalKeys from './GlobalKeys';
- import { ManageRulesPage } from './ManageRulesPage';
- import { ManagePayeesPage } from './payees/ManagePayeesPage';
+ import Titlebar, { TitlebarProvider } from './Titlebar';
+ import FixSplitsTool from './tools/FixSplitsTool';
// import Debugger from './Debugger';
function URLBar() {
diff --cc packages/desktop-client/src/components/ManageRules.js
index 29d88b17a9,7a31188142..f3616284d0
--- a/packages/desktop-client/src/components/ManageRules.js
+++ b/packages/desktop-client/src/components/ManageRules.js
@@@ -28,20 -40,9 +40,11 @@@ import useSelected,
useSelectedItems,
SelectedProvider
} from 'loot-design/src/components/useSelected';
- import { integerToCurrency } from 'loot-core/src/shared/util';
- import { send } from 'loot-core/src/platform/client/fetch';
- import { pushModal } from 'loot-core/src/client/actions/modals';
- import { mapField, friendlyOp } from 'loot-core/src/shared/rules';
- import ArrowRight from 'loot-design/src/svg/RightArrow2';
import { colors } from 'loot-design/src/style';
- import { getMonthYearFormat } from 'loot-core/src/shared/months';
- import {
- extractScheduleConds,
- getRecurringDescription
- } from 'loot-core/src/shared/schedules';
- import { getPayeesById } from 'loot-core/src/client/reducers/queries';
+ import ArrowRight from 'loot-design/src/svg/RightArrow2';
+
+import { Page } from './Page';
+
let SchedulesQuery = liveQueryContext(q('schedules').select('*'));
export function Value({
diff --cc packages/desktop-client/src/components/ManageRulesPage.js
index 664468b7ea,0000000000..e1ebfbfc40
mode 100644,000000..100644
--- a/packages/desktop-client/src/components/ManageRulesPage.js
+++ b/packages/desktop-client/src/components/ManageRulesPage.js
@@@ -1,11 -1,0 +1,12 @@@
+import React from 'react';
++
+import ManageRules from './ManageRules';
+import { Page } from './Page';
+
+export function ManageRulesPage() {
+ return (
+ <Page title="Rules">
+ <ManageRules />
+ </Page>
+ );
+}
diff --cc packages/desktop-client/src/components/Modals.js
index 72677d0d0d,2dc967f42c..008778629e
--- a/packages/desktop-client/src/components/Modals.js
+++ b/packages/desktop-client/src/components/Modals.js
@@@ -1,29 -1,31 +1,30 @@@
import React from 'react';
- import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { Route, Switch } from 'react-router-dom';
- import { createLocation } from 'history';
+
import Component from '@reactions/component';
+ import { createLocation } from 'history';
+ import { bindActionCreators } from 'redux';
+
import * as actions from 'loot-core/src/client/actions';
import { send, listen, unlisten } from 'loot-core/src/platform/client/fetch';
-
- import CreateLocalAccount from 'loot-design/src/components/modals/CreateLocalAccount';
import CloseAccount from 'loot-design/src/components/modals/CloseAccount';
- import SelectLinkedAccounts from 'loot-design/src/components/modals/SelectLinkedAccounts';
import ConfigureLinkedAccounts from 'loot-design/src/components/modals/ConfigureLinkedAccounts';
+ import CreateLocalAccount from 'loot-design/src/components/modals/CreateLocalAccount';
+ import EditField from 'loot-design/src/components/modals/EditField';
+ import ImportTransactions from 'loot-design/src/components/modals/ImportTransactions';
import LoadBackup from 'loot-design/src/components/modals/LoadBackup';
import PlaidExternalMsg from 'loot-design/src/components/modals/PlaidExternalMsg';
- import ImportTransactions from 'loot-design/src/components/modals/ImportTransactions';
- import EditField from 'loot-design/src/components/modals/EditField';
+ import SelectLinkedAccounts from 'loot-design/src/components/modals/SelectLinkedAccounts';
+
+ import ConfirmCategoryDelete from './modals/ConfirmCategoryDelete';
import CreateAccount from './modals/CreateAccount';
- import ManagePayeesWithData from './payees/ManagePayeesWithData';
- import ManageRulesModal from './modals/ManageRulesModal';
+ import CreateEncryptionKey from './modals/CreateEncryptionKey';
import EditRule from './modals/EditRule';
+ import FixEncryptionKey from './modals/FixEncryptionKey';
-import ManageRules from './modals/ManageRules';
++import ManageRulesModal from './modals/ManageRulesModal';
import MergeUnusedPayees from './modals/MergeUnusedPayees';
- import ConfirmCategoryDelete from './modals/ConfirmCategoryDelete';
import WelcomeScreen from './modals/WelcomeScreen';
- import CreateEncryptionKey from './modals/CreateEncryptionKey';
- import FixEncryptionKey from './modals/FixEncryptionKey';
-import ManagePayeesWithData from './payees/ManagePayeesWithData';
function Modals({
history,
diff --cc packages/desktop-client/src/components/accounts/Filters.js
index 3847f75a17,d366dd6cfd..0899e51232
--- a/packages/desktop-client/src/components/accounts/Filters.js
+++ b/packages/desktop-client/src/components/accounts/Filters.js
@@@ -28,11 -20,22 +20,22 @@@ import
FIELD_TYPES,
TYPE_INFO
} from 'loot-core/src/shared/rules';
+ import { titleFirst } from 'loot-core/src/shared/util';
+ import {
+ View,
+ Text,
+ Tooltip,
+ Stack,
+ Button,
+ Menu,
+ CustomSelect
+ } from 'loot-design/src/components/common';
+ import { colors } from 'loot-design/src/style';
import DeleteIcon from 'loot-design/src/svg/Delete';
import SettingsSliderAlternate from 'loot-design/src/svg/v2/SettingsSliderAlternate';
- import { colors } from 'loot-design/src/style';
- import GenericInput from '../util/GenericInput';
+
-import { Value } from '../modals/ManageRules';
+import { Value } from '../ManageRules';
+ import GenericInput from '../util/GenericInput';
let filterFields = [
'date',
diff --cc packages/desktop-client/src/components/accounts/TransactionList.js
index 69a8c0055b,8e2f16ba00..078130d7e9
--- a/packages/desktop-client/src/components/accounts/TransactionList.js
+++ b/packages/desktop-client/src/components/accounts/TransactionList.js
@@@ -1,5 -1,7 +1,8 @@@
import React, { useRef, useEffect, useCallback, useLayoutEffect } from 'react';
import { useDispatch } from 'react-redux';
++import { useHistory } from 'react-router';
+
+ import { send } from 'loot-core/src/platform/client/fetch';
import {
splitTransaction,
updateTransaction,
diff --cc packages/desktop-client/src/components/modals/ManageRulesModal.js
index 2b915f71b5,0000000000..d0409b6f3b
mode 100644,000000..100644
--- a/packages/desktop-client/src/components/modals/ManageRulesModal.js
+++ b/packages/desktop-client/src/components/modals/ManageRulesModal.js
@@@ -1,25 -1,0 +1,27 @@@
- import { Modal } from 'loot-design/src/components/common';
+import React, { useState } from 'react';
++
++import { Modal } from 'loot-design/src/components/common';
++
+import ManageRules from '../ManageRules';
+
+export default function ManageRulesModal({ modalProps, payeeId }) {
+ let [loading, setLoading] = useState(true);
+ if (process.env.NODE_ENV === 'development') {
+ if (location.pathname !== '/payees') {
+ throw new Error(
+ `Possibly invalid use of ManageRulesModal, add the current url '${location.pathname}' to the allowlist if you're confident the modal can never appear on top of the '/rules' page.`
+ );
+ }
+ }
+ return (
+ <Modal
+ title="Rules"
+ padding={0}
+ loading={loading}
+ {...modalProps}
+ style={[modalProps.style, { flex: 1, maxWidth: '90%', maxHeight: '90%' }]}
+ >
+ {() => <ManageRules isModal payeeId={payeeId} setLoading={setLoading} />}
+ </Modal>
+ );
+}
diff --cc packages/desktop-client/src/components/payees/ManagePayeesPage.js
index e0237051bb,0000000000..9c28b86010
mode 100644,000000..100644
--- a/packages/desktop-client/src/components/payees/ManagePayeesPage.js
+++ b/packages/desktop-client/src/components/payees/ManagePayeesPage.js
@@@ -1,19 -1,0 +1,20 @@@
+import React from 'react';
- import ManagePayeesWithData from './ManagePayeesWithData';
- import { Page } from '../Page';
+import { useLocation } from 'react-router';
+
++import { Page } from '../Page';
++import ManagePayeesWithData from './ManagePayeesWithData';
++
+export function ManagePayeesPage() {
+ let location = useLocation();
+ return (
+ <Page title="Payees">
+ <ManagePayeesWithData
+ initialSelectedIds={
+ location.state && location.state.selectedPayee
+ ? [location.state.selectedPayee]
+ : null
+ }
+ />
+ </Page>
+ );
+}
diff --cc packages/desktop-client/src/components/payees/ManagePayeesWithData.js
index e3e2f1a5b7,2b7c56619d..ade382cb11
--- a/packages/desktop-client/src/components/payees/ManagePayeesWithData.js
+++ b/packages/desktop-client/src/components/payees/ManagePayeesWithData.js
@@@ -1,12 -1,14 +1,13 @@@
import React, { useState, useEffect, useRef } from 'react';
import { connect } from 'react-redux';
+
import * as actions from 'loot-core/src/client/actions';
- import * as undo from 'loot-core/src/platform/client/undo';
import { send, listen } from 'loot-core/src/platform/client/fetch';
- import { ManagePayees } from 'loot-design/src/components/payees';
+ import * as undo from 'loot-core/src/platform/client/undo';
import { applyChanges } from 'loot-core/src/shared/util';
+ import { ManagePayees } from 'loot-design/src/components/payees';
function ManagePayeesWithData({
- history,
modalProps,
initialSelectedIds,
lastUndoState,
diff --cc packages/loot-design/src/components/payees.js
index 7a4e36d096,009f8f91f1..35d5a75eaf
--- a/packages/loot-design/src/components/payees.js
+++ b/packages/loot-design/src/components/payees.js
@@@ -17,13 -28,8 +28,9 @@@ import
Tooltip,
Menu
} from './common';
- import memoizeOne from 'memoize-one';
- import Component from '@reactions/component';
- import { groupById } from 'loot-core/src/shared/util';
- import { colors } from '../style';
import {
Table,
+ TableHeader,
Row,
Cell,
InputCell,
diff --cc packages/loot-design/src/components/sidebar.js
index 9cbe691db1,48fdac0992..7043803dad
--- a/packages/loot-design/src/components/sidebar.js
+++ b/packages/loot-design/src/components/sidebar.js
@@@ -1,7 -1,22 +1,29 @@@
-import React, { useState, useMemo } from 'react';
+import React, { useState, useMemo, useCallback, useEffect } from 'react';
++import { RectButton } from 'react-native-gesture-handler';
import { useDispatch } from 'react-redux';
++import { useLocation } from 'react-router';
import { withRouter } from 'react-router-dom';
+
import { css } from 'glamor';
+
+ import { closeBudget } from 'loot-core/src/client/actions/budgets';
+ import { pushModal } from 'loot-core/src/client/actions/modals';
+ import Platform from 'loot-core/src/client/platform';
+ import PiggyBank from 'loot-design/src/svg/v1/PiggyBank';
+
+ import { styles, colors } from '../style';
+ import Add from '../svg/v1/Add';
++import CheveronDown from '../svg/v1/CheveronDown';
++import CheveronUp from '../svg/v1/CheveronUp';
+ import Cog from '../svg/v1/Cog';
+ import DotsHorizontalTriple from '../svg/v1/DotsHorizontalTriple';
+ import Reports from '../svg/v1/Reports';
++import StoreFrontIcon from '../svg/v1/StoreFront';
++import TuningIcon from '../svg/v1/Tuning';
+ import Wallet from '../svg/v1/Wallet';
++import Wrench from '../svg/v1/Wrench';
+ import ArrowButtonLeft1 from '../svg/v2/ArrowButtonLeft1';
+ import CalendarIcon from '../svg/v2/Calendar';
import {
View,
Block,