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

Feat: Routing refactoring #1142

Merged
merged 8 commits into from
Oct 13, 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
6 changes: 3 additions & 3 deletions src/renderer/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ import { useUnit } from 'effector-react';
import { FallbackScreen } from '@renderer/components/common';
import { CreateWalletProvider } from '@renderer/widgets/CreateWallet';
import { walletModel } from '@renderer/entities/wallet';
import { ROUTES_CONFIG } from '@renderer/pages';
import { Paths } from '@renderer/shared/routes';
import {
ConfirmDialogProvider,
I18Provider,
MatrixProvider,
NetworkProvider,
GraphqlProvider,
MultisigChainProvider,
Paths,
routesConfig,
} from './providers';

const SPLASH_SCREEN_DELAY = 450;

export const App = () => {
const navigate = useNavigate();
const appRoutes = useRoutes(routesConfig);
const appRoutes = useRoutes(ROUTES_CONFIG);

const wallets = useUnit(walletModel.$wallets);
const isLoadingWallets = useUnit(walletModel.$isLoadingWallets);
Expand Down
1 change: 0 additions & 1 deletion src/renderer/app/providers/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './context';
export * from './routes';
3 changes: 0 additions & 3 deletions src/renderer/app/providers/routes/index.ts

This file was deleted.

59 changes: 0 additions & 59 deletions src/renderer/app/providers/routes/routesConfig.tsx

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions src/renderer/components/layout/PrimaryLayout/PrimaryLayout.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions src/renderer/components/layout/index.ts

This file was deleted.

3 changes: 1 addition & 2 deletions src/renderer/entities/asset/ui/AssetCard/AssetCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import { AssetBalance, AssetDetails, AssetIcon } from '@renderer/entities/asset'
import { useToggle } from '@renderer/shared/lib/hooks';
import { cnTw, KeyboardKey, totalAmount, transferableAmount } from '@renderer/shared/lib/utils';
import { useI18n } from '@renderer/app/providers';
import { Paths } from '../../../../app/providers/routes/paths';
import { createLink } from '../../../../app/providers/routes/utils';
import { Paths, createLink } from '@renderer/shared/routes';
import { ChainId, Asset, Balance } from '@renderer/shared/core';
// TODO: Move it to another layer https://app.clickup.com/t/8692tr8x0
import { TokenPrice } from '@renderer/entities/price/ui/TokenPrice';
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/entities/contact/ui/EmptyContactList.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useNavigate } from 'react-router-dom';

import { BodyText, Button, Icon } from '@renderer/shared/ui';
import { Paths, useI18n } from '@renderer/app/providers';
import { useI18n } from '@renderer/app/providers';
import { Paths } from '@renderer/shared/routes';

type Props = {
description?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useNavigate } from 'react-router-dom';

import { Paths, useI18n } from '@renderer/app/providers';
import { useI18n } from '@renderer/app/providers';
import { Paths } from '@renderer/shared/routes';
import { Button } from '@renderer/shared/ui';

export const CreateContactNavigation = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useNavigate } from 'react-router-dom';

import { createLink, Paths } from '@renderer/app/providers';
import { Paths, createLink } from '@renderer/shared/routes';
import { IconButton } from '@renderer/shared/ui';
import { Contact } from '@renderer/shared/core';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useUnit } from 'effector-react';

import { BodyText, CaptionText, FootnoteText, Icon, Identicon } from '@renderer/shared/ui';
import { WalletFiatBalance } from './WalletFiatBalance';
import { GroupIcons, GroupLabels } from '@renderer/components/layout/PrimaryLayout/Wallets/common/constants';
import { GroupIcons, GroupLabels } from '@renderer/features/wallets/WalletSelect/common/constants';
import { toAddress, SS58_DEFAULT_PREFIX } from '@renderer/shared/lib/utils';
import { useI18n } from '@renderer/app/providers';
import { ChainsRecord } from './common/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Disclosure } from '@headlessui/react';
import cn from 'classnames';

import { Icon, BodyText, CaptionText } from '@renderer/shared/ui';
import { GroupIcons, GroupLabels } from '@renderer/components/layout/PrimaryLayout/Wallets/common/constants';
import { GroupIcons, GroupLabels } from '@renderer/features/wallets/WalletSelect/common/constants';
import { useI18n } from '@renderer/app/providers';
import { cnTw } from '@renderer/shared/lib/utils';
import { WalletType, Wallet } from '@renderer/shared/core';
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/features/wallets/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { WalletMenu } from './WalletSelect/WalletMenu';
export { WalletCard } from './WalletSelect/WalletCard';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useNavigate } from 'react-router-dom';

import { Paths } from '@renderer/app/providers';
import { Paths } from '@renderer/shared/routes';
import { CreateContactModal } from '@renderer/widgets';

export const CreateContact = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/pages/AddressBook/EditContact/EditContact.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useNavigate } from 'react-router-dom';

import { Paths } from '@renderer/app/providers';
import { Paths } from '@renderer/shared/routes';
import { EditContactModal } from '@renderer/widgets';
import { EditRouteGuard } from '@renderer/features/contacts';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import {
getMultishardStructure,
getSelectableShards,
searchShards,
} from '@renderer/components/layout/PrimaryLayout/Wallets/common/utils';
} from '@renderer/features/wallets/WalletSelect/common/utils';
import {
ChainsRecord,
SelectableAccount,
SelectableShards,
} from '@renderer/components/layout/PrimaryLayout/Wallets/common/types';
} from '@renderer/features/wallets/WalletSelect/common/types';
import { AddressWithExplorers } from '@renderer/entities/wallet';
import { ChainTitle } from '@renderer/entities/chain';

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/pages/Assets/ReceiveAsset/ReceiveAsset.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useNavigate } from 'react-router-dom';

import { AssetRouteGuard } from '@renderer/features/assets';
import { Paths } from '@renderer/app/providers';
import { Paths } from '@renderer/shared/routes';
import { ReceiveAssetModal } from '@renderer/widgets';

export const ReceiveAsset = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/pages/Assets/SendAsset/SendAsset.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AssetRouteGuard } from '@renderer/features/assets';
import { Paths } from '@renderer/app/providers';
import { Paths } from '@renderer/shared/routes';
import { SendAssetModal } from '@renderer/widgets';

export const SendAsset = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/pages/Settings/Currency/Currency.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useNavigate } from 'react-router-dom';

import { CurrencyModal } from '@renderer/widgets';
import { Paths } from '@renderer/app/providers';
import { Paths } from '@renderer/shared/routes';

export const Currency = () => {
const navigate = useNavigate();
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/pages/Settings/Matrix/Matrix.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useNavigate } from 'react-router-dom';

import { MatrixLoginModal, MatrixInfoModal } from '@renderer/widgets/MatrixModal';
import { Paths, useMatrix } from '@renderer/app/providers';
import { useMatrix } from '@renderer/app/providers';
import { Paths } from '@renderer/shared/routes';

export const Matrix = () => {
const navigate = useNavigate();
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/pages/Settings/Networks/Networks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { Trans } from 'react-i18next';
import uniqBy from 'lodash/uniqBy';
import { useUnit } from 'effector-react';

import { useI18n, useNetworkContext, useConfirmContext, Paths } from '@renderer/app/providers';
import { useI18n, useNetworkContext, useConfirmContext } from '@renderer/app/providers';
import { Paths } from '@renderer/shared/routes';
import { BaseModal, SearchInput, BodyText, InfoLink, Icon } from '@renderer/shared/ui';
import { useToggle } from '@renderer/shared/lib/hooks';
import { ExtendedChain, chainsService } from '@renderer/entities/network';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { Link } from 'react-router-dom';
import { useUnit } from 'effector-react/effector-react.umd';

import { Icon, BodyText, Plate, FootnoteText, HelpText } from '@renderer/shared/ui';
import { useI18n, Paths } from '@renderer/app/providers';
import { useI18n } from '@renderer/app/providers';
import { Paths } from '@renderer/shared/routes';
import { cnTw } from '@renderer/shared/lib/utils';
import { currencyModel, priceProviderModel } from '@renderer/entities/price';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { render, screen } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';

import { MatrixAction } from './MatrixAction';
import { Paths } from '../../../../../app/providers/routes/paths';
import { Paths } from '@renderer/shared/routes';

jest.mock('@renderer/app/providers', () => ({
useI18n: jest.fn().mockReturnValue({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Link } from 'react-router-dom';

import { Icon, FootnoteText, Plate, BodyText, StatusLabel, HelpText } from '@renderer/shared/ui';
import { useI18n, useMatrix } from '@renderer/app/providers';
import { Paths } from '../../../../../app/providers/routes/paths';
import { Paths } from '@renderer/shared/routes';
import { cnTw } from '@renderer/shared/lib/utils';

export const MatrixAction = () => {
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/pages/Staking/Operations/Bond/Bond.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { useUnit } from 'effector-react';

import { DEFAULT_TRANSITION, getRelaychainAsset, toAddress } from '@renderer/shared/lib/utils';
import { ValidatorMap } from '@renderer/entities/staking';
import { Paths, useI18n, useNetworkContext } from '@renderer/app/providers';
import { useI18n, useNetworkContext } from '@renderer/app/providers';
import { Paths } from '@renderer/shared/routes';
import { Transaction, TransactionType, useTransaction } from '@renderer/entities/transaction';
import { Confirmation, NoAsset, Submit, Validators } from '../components';
import { useToggle } from '@renderer/shared/lib/hooks';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { useState, useEffect } from 'react';
import { Navigate, useNavigate, useParams, useSearchParams } from 'react-router-dom';
import { useUnit } from 'effector-react';

import { useI18n, useNetworkContext, Paths } from '@renderer/app/providers';
import { useI18n, useNetworkContext } from '@renderer/app/providers';
import { Paths } from '@renderer/shared/routes';
import { Transaction, TransactionType, useTransaction } from '@renderer/entities/transaction';
import { ValidatorMap } from '@renderer/entities/staking';
import { toAddress, getRelaychainAsset, DEFAULT_TRANSITION } from '@renderer/shared/lib/utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { Navigate, useNavigate, useParams, useSearchParams } from 'react-router-
import { useUnit } from 'effector-react';

import { toAddress, getRelaychainAsset, DEFAULT_TRANSITION } from '@renderer/shared/lib/utils';
import { useI18n, useNetworkContext, Paths } from '@renderer/app/providers';
import { useI18n, useNetworkContext } from '@renderer/app/providers';
import { Paths } from '@renderer/shared/routes';
import { Transaction, TransactionType, useTransaction } from '@renderer/entities/transaction';
import { Confirmation, Submit, NoAsset } from '../components';
import InitOperation, { DestinationResult } from './InitOperation/InitOperation';
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/pages/Staking/Operations/Redeem/Redeem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { useEffect, useState } from 'react';
import { Navigate, useNavigate, useParams, useSearchParams } from 'react-router-dom';
import { useUnit } from 'effector-react';

import { Paths, useI18n, useNetworkContext } from '@renderer/app/providers';
import { useI18n, useNetworkContext } from '@renderer/app/providers';
import { Paths } from '@renderer/shared/routes';
import { ChainId, HexString } from '@renderer/shared/core';
import { Transaction, TransactionType, useTransaction } from '@renderer/entities/transaction';
import type { Account } from '@renderer/shared/core';
Expand Down
Loading
Loading