Skip to content
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

refactor: move modals and routers to separate directories #69

Merged
merged 4 commits into from
Dec 24, 2023
Merged
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
8 changes: 5 additions & 3 deletions src/extension/apps/background/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import React, { FC, useEffect } from 'react';
import { useDispatch } from 'react-redux';

// components
import EnableModal from '@extension/components/EnableModal';
import LoadingPage from '@extension/components/LoadingPage';
import SignTxnsModal from '@extension/components/SignTxnsModal';
import SignBytesModal from '@extension/components/SignBytesModal';

// features
import { fetchAccountsFromStorageThunk } from '@extension/features/accounts';
Expand All @@ -19,6 +16,11 @@ import { fetchSessionsThunk } from '@extension/features/sessions';
import { fetchSettings } from '@extension/features/settings';
import { closeCurrentWindowThunk } from '@extension/features/system';

// modals
import EnableModal from '@extension/modals/EnableModal';
import SignTxnsModal from '@extension/modals/SignTxnsModal';
import SignBytesModal from '@extension/modals/SignBytesModal';

// selectors
import { useSelectSelectedNetwork } from '@extension/selectors';

Expand Down
8 changes: 4 additions & 4 deletions src/extension/apps/main/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ import {
setSideBar,
} from '@extension/features/system';

// pages
import AccountRouter from '@extension/pages/AccountRouter';
import AddAccountRouter from '@extension/pages/MainAddAccountRouter';
import SettingsRouter from '@extension/pages/SettingsRouter';
// routers
import AccountRouter from '@extension/routers/AccountRouter';
import AddAccountRouter from '@extension/routers/MainAddAccountRouter';
import SettingsRouter from '@extension/routers/SettingsRouter';

// types
import { IAppProps, IAppThunkDispatch, IMainRootState } from '@extension/types';
Expand Down
18 changes: 10 additions & 8 deletions src/extension/apps/main/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,7 @@ import { useDispatch } from 'react-redux';
import { NavigateFunction, Outlet, useNavigate } from 'react-router-dom';

// components
import AddAssetModal from '@extension/components/AddAssetModal';
import ConfirmModal from '@extension/components/ConfirmModal';
import EnableModal from '@extension/components/EnableModal';
import ErrorModal from '@extension/components/ErrorModal';
import MainLayout from '@extension/components/MainLayout';
import SendAssetModal from '@extension/components/SendAssetModal';
import SignBytesModal from '@extension/components/SignBytesModal';
import SignTxnsModal from '@extension/components/SignTxnsModal';
import WalletConnectModal from '@extension/components/WalletConnectModal';

// features
import { reset as resetAddAsset } from '@extension/features/add-asset';
Expand Down Expand Up @@ -45,6 +37,16 @@ import useOnNetworkConnectivity from '@extension/hooks/useOnNetworkConnectivity'
import useOnNewAssets from '@extension/hooks/useOnNewAssets';
import useNotifications from '@extension/hooks/useNotifications';

// modals
import AddAssetModal from '@extension/modals/AddAssetModal';
import ConfirmModal from '@extension/modals/ConfirmModal';
import EnableModal from '@extension/modals/EnableModal';
import ErrorModal from '@extension/modals/ErrorModal';
import SendAssetModal from '@extension/modals/SendAssetModal';
import SignBytesModal from '@extension/modals/SignBytesModal';
import SignTxnsModal from '@extension/modals/SignTxnsModal';
import WalletConnectModal from '@extension/modals/WalletConnectModal';

// selectors
import {
useSelectAccounts,
Expand Down
4 changes: 3 additions & 1 deletion src/extension/apps/registration/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import { reducer as systemReducer } from '@extension/features/system';
// pages
import CreatePasswordPage from '@extension/pages/CreatePasswordPage';
import GetStartedPage from '@extension/pages/GetStartedPage';
import RegistrationAddAccountRouter from '@extension/pages/RegistrationAddAccountRouter';

// routers
import RegistrationAddAccountRouter from '@extension/routers/RegistrationAddAccountRouter';

// types
import { IAppProps, IRegistrationRootState } from '@extension/types';
Expand Down
6 changes: 3 additions & 3 deletions src/extension/apps/registration/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import React, { FC, useEffect } from 'react';
import { useDispatch } from 'react-redux';
import { NavigateFunction, Outlet, useNavigate } from 'react-router-dom';

// components
import ErrorModal from '@extension/components/ErrorModal';

// features
import { setError, setNavigate } from '@extension/features/system';
import { fetchSettings } from '@extension/features/settings';

// modals
import ErrorModal from '@extension/modals//ErrorModal';

// types
import { IAppThunkDispatch } from '@extension/types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { Trans, useTranslation } from 'react-i18next';
import { IoEye, IoEyeOff } from 'react-icons/io5';

// components
import DocumentModal from '@extension/components/DocumentModal';
import IconButton from '@extension/components/IconButton';
import StrengthMeter from '@extension/components/StrengthMeter';

Expand All @@ -24,6 +23,9 @@ import usePrimaryColor from '@extension/hooks/usePrimaryColor';
import usePrimaryColorScheme from '@extension/hooks/usePrimaryColorScheme';
import useSubTextColor from '@extension/hooks/useSubTextColor';

// modals
import DocumentModal from '@extension/modals//DocumentModal';

// utils
import { validate } from './utils';

Expand Down
5 changes: 3 additions & 2 deletions src/extension/pages/AccountPage/AccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import {

// components
import ActivityTab from '@extension/components/ActivityTab';
import AddAssetModal from '@extension/components/AddAssetModal';
import AccountNftsTab from '@extension/components/AccountNftsTab';
import AssetsTab from '@extension/components/AssetsTab';
import CopyIconButton from '@extension/components/CopyIconButton';
Expand All @@ -49,7 +48,6 @@ import NetworkSelect, {
import NativeBalance, {
NativeBalanceSkeleton,
} from '@extension/components/NativeBalance';
import ShareAddressModal from '@extension/components/ShareAddressModal';

// constants
import { ADD_ACCOUNT_ROUTE, ACCOUNTS_ROUTE } from '@extension/constants';
Expand All @@ -67,6 +65,9 @@ import useDefaultTextColor from '@extension/hooks/useDefaultTextColor';
import usePrimaryColorScheme from '@extension/hooks/usePrimaryColorScheme';
import useSubTextColor from '@extension/hooks/useSubTextColor';

// modals
import ShareAddressModal from '@extension/modals//ShareAddressModal';

// selectors
import {
useSelectAccountByAddress,
Expand Down
4 changes: 3 additions & 1 deletion src/extension/pages/AssetPage/AssetPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import CopyIconButton from '@extension/components/CopyIconButton';
import LoadingPage from '@extension/components/LoadingPage';
import OpenTabIconButton from '@extension/components/OpenTabIconButton';
import PageHeader from '@extension/components/PageHeader';
import ShareAddressModal from '@extension/components/ShareAddressModal';

// constants
import { ACCOUNTS_ROUTE } from '@extension/constants';
Expand All @@ -36,6 +35,9 @@ import useSubTextColor from '@extension/hooks/useSubTextColor';
import useTextBackgroundColor from '@extension/hooks/useTextBackgroundColor';
import useAssetPage from './hooks/useAssetPage';

// modals
import ShareAddressModal from '@extension/modals//ShareAddressModal';

// selectors
import {
useSelectFetchingStandardAssets,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { useDispatch } from 'react-redux';

// components
import Button from '@extension/components/Button';
import ConfirmPasswordModal from '@extension/components/ConfirmPasswordModal';
import CreatePasswordInput, {
validate,
} from '@extension/components/CreatePasswordInput';
Expand All @@ -26,6 +25,9 @@ import { create as createNotification } from '@extension/features/notifications'
import useChangePassword from '@extension/hooks/useChangePassword';
import useSubTextColor from '@extension/hooks/useSubTextColor';

// modals
import ConfirmPasswordModal from '@extension/modals//ConfirmPasswordModal';

// types
import { IAppThunkDispatch } from '@extension/types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { useDispatch } from 'react-redux';
// components
import Button from '@extension/components/Button';
import EmptyState from '@extension/components/EmptyState';
import ManageSessionModal from '@extension/components/ManageSessionModal';
import PageHeader from '@extension/components/PageHeader';
import SettingsSessionItem from '@extension/components/SettingsSessionItem';

Expand All @@ -33,6 +32,9 @@ import {
import useSubTextColor from '@extension/hooks/useSubTextColor';
import useDefaultTextColor from '@extension/hooks/useDefaultTextColor';

// modals
import ManageSessionModal from '@extension/modals/ManageSessionModal';

// selectors
import {
useSelectFetchingSessions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import React, { FC, useEffect, useState } from 'react';
import { useDispatch } from 'react-redux';
import { NavigateFunction, Route, Routes, useNavigate } from 'react-router-dom';

// components
import ConfirmPasswordModal from '@extension/components/ConfirmPasswordModal';

// constants
import {
ACCOUNTS_ROUTE,
Expand All @@ -18,6 +15,9 @@ import {
updateAccountsThunk,
} from '@extension/features/accounts';

// modals
import ConfirmPasswordModal from '@extension/modals//ConfirmPasswordModal';

// pages
import AccountSetupPage from '@extension/pages/AccountSetupPage';
import CreateNewAccountPage from '@extension/pages/CreateNewAccountPage';
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@
"@extension/features/system": ["src/extension/features/system"],
"@extension/fonts/*": ["src/extension/fonts/*"],
"@extension/hooks/*": ["src/extension/hooks/*"],
"@extension/modals/*": ["src/extension/modals/*"],
"@extension/pages/*": ["src/extension/pages/*"],
"@extension/routers/*": ["src/extension/routers/*"],
"@extension/selectors": ["src/extension/selectors"],
"@extension/services": ["src/extension/services"],
"@extension/styles/*": ["src/external/styles/*"],
Expand Down
2 changes: 2 additions & 0 deletions webpack/utils/createCommonConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ export default function createCommonConfig(): Configuration {
),
['@extension/fonts']: resolve(extensionPath, 'fonts'),
['@extension/hooks']: resolve(extensionPath, 'hooks'),
['@extension/modals']: resolve(extensionPath, 'modals'),
['@extension/pages']: resolve(extensionPath, 'pages'),
['@extension/routers']: resolve(extensionPath, 'routers'),
['@extension/selectors']: resolve(extensionPath, 'selectors'),
['@extension/services']: resolve(extensionPath, 'services'),
['@extension/styles']: resolve(extensionPath, 'styles'),
Expand Down
Loading