Skip to content

Commit

Permalink
Undo renames
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Jan 1, 2025
1 parent dd92cb3 commit b4055e8
Show file tree
Hide file tree
Showing 90 changed files with 225 additions and 244 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ module.exports = {
{
group: ['react-redux'],
importNames: ['useDispatch'],
message: 'Please use Actual’s useAppDispatch() hook instead.',
message: 'Please use Actual’s useDispatch() hook instead.',
},
],
},
Expand All @@ -501,7 +501,7 @@ module.exports = {
{
group: ['react-redux'],
importNames: ['useSelector'],
message: 'Please use Actual’s useAppSelector() hook instead.',
message: 'Please use Actual’s useSelector() hook instead.',
},
],
},
Expand Down
6 changes: 3 additions & 3 deletions packages/desktop-client/src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {

import { useMetadataPref } from '../hooks/useMetadataPref';
import { installPolyfills } from '../polyfills';
import { useAppDispatch } from '../redux';
import { useDispatch } from '../redux';
import { styles, hasHiddenScrollbars, ThemeStyle, useTheme } from '../style';
import { ExposeNavigate } from '../util/router-tools';

Expand All @@ -48,7 +48,7 @@ function AppInner() {
const [cloudFileId] = useMetadataPref('cloudFileId');
const { t } = useTranslation();
const { showBoundary: showErrorBoundary } = useErrorBoundary();
const dispatch = useAppDispatch();
const dispatch = useDispatch();

const maybeUpdate = async <T,>(cb?: () => T): Promise<T> => {
if (global.Actual.isUpdateReadyForDownload()) {
Expand Down Expand Up @@ -139,7 +139,7 @@ export function App() {
const [hiddenScrollbars, setHiddenScrollbars] = useState(
hasHiddenScrollbars(),
);
const dispatch = useAppDispatch();
const dispatch = useDispatch();

useEffect(() => {
function checkScrollbars() {
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/AppBackground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTransition, animated } from 'react-spring';
import { css } from '@emotion/css';

import { AnimatedLoading } from '../icons/AnimatedLoading';
import { useAppSelector } from '../redux';
import { useSelector } from '../redux';
import { theme } from '../style';

import { Background } from './Background';
Expand All @@ -16,7 +16,7 @@ type AppBackgroundProps = {
};

export function AppBackground({ isLoading }: AppBackgroundProps) {
const loadingText = useAppSelector(state => state.app.loadingText);
const loadingText = useSelector(state => state.app.loadingText);
const showLoading = isLoading || loadingText !== null;
const transitions = useTransition(loadingText, {
from: { opacity: 0, transform: 'translateY(-100px)' },
Expand Down
6 changes: 2 additions & 4 deletions packages/desktop-client/src/components/BankSyncStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ import React from 'react';
import { Trans } from 'react-i18next';
import { useTransition, animated } from 'react-spring';

import { useAppSelector } from '../redux';
import { useSelector } from '../redux';
import { theme, styles } from '../style';

import { AnimatedRefresh } from './AnimatedRefresh';
import { Text } from './common/Text';
import { View } from './common/View';

export function BankSyncStatus() {
const accountsSyncing = useAppSelector(
state => state.account.accountsSyncing,
);
const accountsSyncing = useSelector(state => state.account.accountsSyncing);
const accountsSyncingCount = accountsSyncing.length;
const count = accountsSyncingCount;

Expand Down
6 changes: 3 additions & 3 deletions packages/desktop-client/src/components/FinancesApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { useAccounts } from '../hooks/useAccounts';
import { useLocalPref } from '../hooks/useLocalPref';
import { useMetaThemeColor } from '../hooks/useMetaThemeColor';
import { useNavigate } from '../hooks/useNavigate';
import { useAppSelector, useAppDispatch } from '../redux';
import { useSelector, useDispatch } from '../redux';
import { theme } from '../style';
import { getIsOutdated, getLatestVersion } from '../util/versions';

Expand Down Expand Up @@ -80,11 +80,11 @@ export function FinancesApp() {
const { isNarrowWidth } = useResponsive();
useMetaThemeColor(isNarrowWidth ? theme.mobileViewTheme : null);

const dispatch = useAppDispatch();
const dispatch = useDispatch();
const { t } = useTranslation();

const accounts = useAccounts();
const accountsLoaded = useAppSelector(state => state.queries.accountsLoaded);
const accountsLoaded = useSelector(state => state.queries.accountsLoaded);

const [lastUsedVersion, setLastUsedVersion] = useLocalPref(
'flags.updateNotificationShownForVersion',
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/HelpMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { pushModal } from 'loot-core/client/actions/modals';

import { useFeatureFlag } from '../hooks/useFeatureFlag';
import { SvgHelp } from '../icons/v2/Help';
import { useAppDispatch } from '../redux';
import { useDispatch } from '../redux';

import { Button } from './common/Button2';
import { Menu } from './common/Menu';
Expand Down Expand Up @@ -52,7 +52,7 @@ export const HelpMenu = () => {
const [isMenuOpen, toggleMenuOpen, setMenuOpen] = useToggle();
const menuButtonRef = useRef(null);

const dispatch = useAppDispatch();
const dispatch = useDispatch();
const page = useLocation().pathname;

const handleItemSelect = (item: HelpMenuItem) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/desktop-client/src/components/LoggedInUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Trans, useTranslation } from 'react-i18next';
import { closeBudget, getUserData, signOut } from 'loot-core/client/actions';

import { useNavigate } from '../hooks/useNavigate';
import { useAppSelector, useAppDispatch } from '../redux';
import { useSelector, useDispatch } from '../redux';
import { theme, styles } from '../style';

import { Button } from './common/Button2';
Expand All @@ -26,9 +26,9 @@ export function LoggedInUser({
color,
}: LoggedInUserProps) {
const { t } = useTranslation();
const dispatch = useAppDispatch();
const dispatch = useDispatch();
const navigate = useNavigate();
const userData = useAppSelector(state => state.user.data);
const userData = useSelector(state => state.user.data);
const [loading, setLoading] = useState(true);
const [menuOpen, setMenuOpen] = useState(false);
const serverUrl = useServerURL();
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/ManageRules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { useAccounts } from '../hooks/useAccounts';
import { useCategories } from '../hooks/useCategories';
import { usePayees } from '../hooks/usePayees';
import { useSelected, SelectedProvider } from '../hooks/useSelected';
import { useAppDispatch } from '../redux';
import { useDispatch } from '../redux';
import { theme } from '../style';

import { Button } from './common/Button2';
Expand Down Expand Up @@ -113,7 +113,7 @@ export function ManageRules({
const [allRules, setAllRules] = useState([]);
const [page, setPage] = useState(0);
const [filter, setFilter] = useState('');
const dispatch = useAppDispatch();
const dispatch = useDispatch();

const { schedules = [] } = useSchedules({
query: useMemo(() => q('schedules').select('*'), []),
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/Modals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as monthUtils from 'loot-core/src/shared/months';

import { useMetadataPref } from '../hooks/useMetadataPref';
import { useModalState } from '../hooks/useModalState';
import { useAppDispatch } from '../redux';
import { useDispatch } from '../redux';

import { ModalTitle, ModalHeader } from './common/Modal';
import { AccountAutocompleteModal } from './modals/AccountAutocompleteModal';
Expand Down Expand Up @@ -73,7 +73,7 @@ import { NamespaceContext } from './spreadsheet/NamespaceContext';

export function Modals() {
const location = useLocation();
const dispatch = useAppDispatch();
const dispatch = useDispatch();
const { modalStack } = useModalState();
const [budgetId] = useMetadataPref('id');

Expand Down
10 changes: 4 additions & 6 deletions packages/desktop-client/src/components/Notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { NotificationWithId } from 'loot-core/src/client/state-types/notifi

import { AnimatedLoading } from '../icons/AnimatedLoading';
import { SvgDelete } from '../icons/v0';
import { useAppSelector, useAppDispatch } from '../redux';
import { useSelector, useDispatch } from '../redux';
import { styles, theme } from '../style';

import { Button, ButtonWithLoading } from './common/Button2';
Expand Down Expand Up @@ -262,12 +262,10 @@ function Notification({
}

export function Notifications({ style }: { style?: CSSProperties }) {
const dispatch = useAppDispatch();
const dispatch = useDispatch();
const { isNarrowWidth } = useResponsive();
const notifications = useAppSelector(
state => state.notifications.notifications,
);
const notificationInset = useAppSelector(state => state.notifications.inset);
const notifications = useSelector(state => state.notifications.notifications);
const notificationInset = useSelector(state => state.notifications.inset);
return (
<View
style={{
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/Titlebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
SvgViewHide,
SvgViewShow,
} from '../icons/v2';
import { useAppDispatch } from '../redux';
import { useDispatch } from '../redux';
import { theme, styles } from '../style';

import { AccountSyncCheck } from './accounts/AccountSyncCheck';
Expand Down Expand Up @@ -110,7 +110,7 @@ type SyncButtonProps = {
function SyncButton({ style, isMobile = false }: SyncButtonProps) {
const { t } = useTranslation();
const [cloudFileId] = useMetadataPref('cloudFileId');
const dispatch = useAppDispatch();
const dispatch = useDispatch();
const [syncing, setSyncing] = useState(false);
const [syncState, setSyncState] = useState<
null | 'offline' | 'local' | 'disabled' | 'error'
Expand Down
8 changes: 4 additions & 4 deletions packages/desktop-client/src/components/UpdateNotification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
import { setAppState, updateApp } from 'loot-core/client/actions';

import { SvgClose } from '../icons/v1';
import { useAppSelector, useAppDispatch } from '../redux';
import { useSelector, useDispatch } from '../redux';
import { theme } from '../style';

import { Button } from './common/Button2';
Expand All @@ -14,12 +14,12 @@ import { View } from './common/View';

export function UpdateNotification() {
const { t } = useTranslation();
const updateInfo = useAppSelector(state => state.app.updateInfo);
const showUpdateNotification = useAppSelector(
const updateInfo = useSelector(state => state.app.updateInfo);
const showUpdateNotification = useSelector(
state => state.app.showUpdateNotification,
);

const dispatch = useAppDispatch();
const dispatch = useDispatch();
const onRestart = () => {
dispatch(updateApp());
};
Expand Down
16 changes: 5 additions & 11 deletions packages/desktop-client/src/components/accounts/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ import {
} from '../../hooks/useSplitsExpanded';
import { useSyncedPref } from '../../hooks/useSyncedPref';
import { useTransactionBatchActions } from '../../hooks/useTransactionBatchActions';
import { useAppSelector } from '../../redux';
import { useSelector } from '../../redux';
import { styles, theme } from '../../style';
import { Button } from '../common/Button2';
import { Text } from '../common/Text';
Expand Down Expand Up @@ -1860,10 +1860,8 @@ export function Account() {
const location = useLocation();

const { grouped: categoryGroups } = useCategories();
const newTransactions = useAppSelector(
state => state.queries.newTransactions,
);
const matchedTransactions = useAppSelector(
const newTransactions = useSelector(state => state.queries.newTransactions);
const matchedTransactions = useSelector(
state => state.queries.matchedTransactions,
);
const accounts = useAccounts();
Expand All @@ -1884,12 +1882,8 @@ export function Account() {
const [showExtraBalances, setShowExtraBalances] = useSyncedPref(
`show-extra-balances-${params.id || 'all-accounts'}`,
);
const modalShowing = useAppSelector(
state => state.modals.modalStack.length > 0,
);
const accountsSyncing = useAppSelector(
state => state.account.accountsSyncing,
);
const modalShowing = useSelector(state => state.modals.modalStack.length > 0);
const accountsSyncing = useSelector(state => state.account.accountsSyncing);
const filterConditions = location?.state?.filterConditions || [];

const savedFiters = useFilters();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { authorizeBank } from '../../gocardless';
import { useAccounts } from '../../hooks/useAccounts';
import { useFailedAccounts } from '../../hooks/useFailedAccounts';
import { SvgExclamationOutline } from '../../icons/v1';
import { useAppDispatch } from '../../redux';
import { useDispatch } from '../../redux';
import { theme } from '../../style';
import { Button } from '../common/Button2';
import { Link } from '../common/Link';
Expand Down Expand Up @@ -84,7 +84,7 @@ function useErrorMessage() {
export function AccountSyncCheck() {
const accounts = useAccounts();
const failedAccounts = useFailedAccounts();
const dispatch = useAppDispatch();
const dispatch = useDispatch();
const { id } = useParams();
const [open, setOpen] = useState(false);
const triggerRef = useRef(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import { useAccounts } from '../../hooks/useAccounts';
import { useCommonPayees, usePayees } from '../../hooks/usePayees';
import { SvgAdd, SvgBookmark } from '../../icons/v1';
import { useAppDispatch } from '../../redux';
import { useDispatch } from '../../redux';
import { theme, styles } from '../../style';
import { Button } from '../common/Button';
import { TextOneLine } from '../common/TextOneLine';
Expand Down Expand Up @@ -320,7 +320,7 @@ export function PayeeAutocomplete({
return [{ id: 'new', favorite: 0, name: '' }, ...filteredSuggestions];
}, [commonPayees, payees, focusTransferPayees, accounts, hasPayeeInput]);

const dispatch = useAppDispatch();
const dispatch = useDispatch();

async function handleSelect(idOrIds, rawInputValue) {
if (!clearOnBlur) {
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/budget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { useGlobalPref } from '../../hooks/useGlobalPref';
import { useLocalPref } from '../../hooks/useLocalPref';
import { useNavigate } from '../../hooks/useNavigate';
import { useSyncedPref } from '../../hooks/useSyncedPref';
import { useAppDispatch } from '../../redux';
import { useDispatch } from '../../redux';
import { styles } from '../../style';
import { View } from '../common/View';
import { NamespaceContext } from '../spreadsheet/NamespaceContext';
Expand Down Expand Up @@ -67,7 +67,7 @@ function BudgetInner(props: BudgetInnerProps) {
const { t } = useTranslation();
const currentMonth = monthUtils.currentMonth();
const spreadsheet = useSpreadsheet();
const dispatch = useAppDispatch();
const dispatch = useDispatch();
const navigate = useNavigate();
const [summaryCollapsed, setSummaryCollapsedPref] = useLocalPref(
'budget.summaryCollapsed',
Expand Down
6 changes: 3 additions & 3 deletions packages/desktop-client/src/components/manager/BudgetList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
SvgFileDouble,
} from '../../icons/v1';
import { SvgCloudUnknown, SvgKey, SvgRefreshArrow } from '../../icons/v2';
import { useAppSelector, useAppDispatch } from '../../redux';
import { useSelector, useDispatch } from '../../redux';
import { styles, theme } from '../../style';
import { tokens } from '../../tokens';
import { Button } from '../common/Button2';
Expand Down Expand Up @@ -413,8 +413,8 @@ function BudgetListHeader({
}

export function BudgetList({ showHeader = true, quickSwitchMode = false }) {
const dispatch = useAppDispatch();
const allFiles = useAppSelector(state => state.budgets.allFiles || []);
const dispatch = useDispatch();
const allFiles = useSelector(state => state.budgets.allFiles || []);
const [id] = useMetadataPref('id');

// Remote files do not have the 'id' field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {

import { useGlobalPref } from '../../hooks/useGlobalPref';
import { useNavigate } from '../../hooks/useNavigate';
import { useAppDispatch } from '../../redux';
import { useDispatch } from '../../redux';
import { theme } from '../../style';
import { Button, ButtonWithLoading } from '../common/Button2';
import { BigInput } from '../common/Input';
Expand All @@ -23,7 +23,7 @@ import { Title } from './subscribe/common';

export function ConfigServer() {
const { t } = useTranslation();
const dispatch = useAppDispatch();
const dispatch = useDispatch();
const navigate = useNavigate();
const [url, setUrl] = useState('');
const currentUrl = useServerURL();
Expand Down
Loading

0 comments on commit b4055e8

Please sign in to comment.