Skip to content

Commit

Permalink
Remove react-router references Correct window checking 2
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzubov committed Feb 9, 2020
1 parent 2ade3a7 commit 79da9f4
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PopoverContent } from "components/popover/popover-content";
import { StatisticItemList } from "components/statistic-item-list/statistic-item-list";
import StatisticItem from "components/statistic-item/statistic-item";
import { StatisticItemContainerBlock } from "components/statistic-item/statistic-item-container.block";
import { WALLET_TOTAL_PAGE_ROUTE } from "pages/wallet/wallet.routes";
import { WALLET_TOTAL_PAGE_ROUTE } from "pages/wallet/wallet.paths";
import React from "react";
import { useTranslation } from "react-i18next";
import { formatCurrencyValue } from "utils/formatter";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import GVButton, { GV_BTN_SIZE } from "components/gv-button";
import { CloseIcon } from "components/icon/close-icon";
import Link from "components/link/link";
import { useToLink } from "components/link/link.helper";
import { KYC_ROUTE } from "components/profile/profile.constants";
import Crashable from "decorators/crashable";
Expand All @@ -14,7 +15,6 @@ import * as React from "react";
import { useCallback, useState } from "react";
import { useTranslation } from "react-i18next";
import NumberFormat from "react-number-format";
import { Link } from "react-router-dom";
import { formatCurrencyValue, formatValue } from "utils/formatter";

import CalculatorLevelLine from "../components/calculator-level-line/calculator-level-line";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import authActions from "actions/auth-actions";
import { fetchProfileHeaderInfoAction } from "components/header/actions/header-actions";
import { Push } from "components/link/link";
import { SETTINGS_ROUTE } from "components/profile/profile.constants";
import { push } from "connected-react-router";
import { ChangePasswordViewModel } from "gv-api-web";
import { alertMessageActions } from "modules/alert-message/actions/alert-message-actions";
import authApi from "services/api-client/auth-api";
Expand All @@ -18,7 +18,7 @@ export const changePassword = (body: ChangePasswordViewModel) => (
.then((response: string) => {
authService.storeToken(response);
dispatch(authActions.updateTokenAction(true));
dispatch(push(SETTINGS_ROUTE));
Push(SETTINGS_ROUTE);
dispatch(fetchProfileHeaderInfoAction());
dispatch(
alertMessageActions.success("auth.password-change.success-alert", true)
Expand Down
21 changes: 0 additions & 21 deletions packages/social-trader/src/pages/dashboard/dashboard.routes.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
import { push } from "connected-react-router";
import Router from "next/router";
import { Dispatch } from "redux";
import {
FUND_DETAILS_ROUTE,
FUNDS_ROUTE,
FUNDS_SLUG_URL_PARAM_NAME
} from "routes/funds.routes";
import getParams from "utils/get-params";
import { FUNDS_ROUTE } from "routes/funds.routes";

export const redirectToFund = () => (dispatch: Dispatch) => {
const fundSlugUrl = getParams(Router.pathname, FUND_DETAILS_ROUTE)[
FUNDS_SLUG_URL_PARAM_NAME
];
dispatch(push(`${FUNDS_ROUTE}/${fundSlugUrl}`));
export const redirectToFund = (id: string) => {
Router.replace(`${FUNDS_ROUTE}/${id}`);
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ImgPeople2 from "pages/landing-page/images/slider/people-2.svg";
import ImgPeople3 from "pages/landing-page/images/slider/people-3.svg";
import ImgPeopleBg from "pages/landing-page/images/slider/people-bg.svg";
import { REFERRAL_PROGRAM_ROUTE } from "pages/landing-page/static-data/nav-links";
import { WALLET_TOTAL_PAGE_ROUTE } from "pages/wallet/wallet.routes";
import { WALLET_TOTAL_PAGE_ROUTE } from "pages/wallet/wallet.paths";

const CREATE_ACCOUNT_BROKER_ROUTE =
"create-account?broker=Genesis%20Markets%20Demo";
Expand Down
38 changes: 0 additions & 38 deletions packages/social-trader/src/pages/profile/profile.routes.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
composeWalletCurrencyUrl,
WALLET_CURRENCY_FOLDER_ROUTE,
WALLET_TOTAL_PAGE_NAME
} from "pages/wallet/wallet.routes";
} from "pages/wallet/wallet.paths";
import React from "react";
import { useTranslation } from "react-i18next";
import NumberFormat from "react-number-format";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { HORIZONTAL_POPOVER_POS } from "components/popover/popover";
import Tooltip from "components/tooltip/tooltip";
import { TooltipContent } from "components/tooltip/tooltip-content";
import { WalletData } from "gv-api-web";
import { WALLET_TOTAL_PAGE_ROUTE } from "pages/wallet/wallet.paths";
import React from "react";
import { useTranslation } from "react-i18next";

import useHashTab from "../../services/hashTab.hook";
import { WALLET_TOTAL_PAGE_ROUTE } from "../../wallet.routes";
import AllDepositsWithdrawalsRow from "./wallet-deposits-withdrawals/all-deposits-withdrawals-row";
import WalletDepositsWithdrawals from "./wallet-deposits-withdrawals/wallet-deposits-withdrawals";
import { WALLET_TOTAL_DEPOSITS_WITHDRAWALS_COLUMNS } from "./wallet-deposits-withdrawals/wallet-deposits-withdrawals.constants";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ import { useToLink } from "components/link/link.helper";
import { HORIZONTAL_POPOVER_POS } from "components/popover/popover";
import Tooltip from "components/tooltip/tooltip";
import { TooltipContent } from "components/tooltip/tooltip-content";
import {
composeWalletCurrencyUrl,
WALLET_CURRENCY_FOLDER_ROUTE
} from "pages/wallet/wallet.paths";
import React from "react";
import { useTranslation } from "react-i18next";
import { CurrencyEnum } from "utils/types";

import useHashTab from "../../services/hashTab.hook";
import {
composeWalletCurrencyUrl,
WALLET_CURRENCY_FOLDER_ROUTE
} from "../../wallet.routes";
import DepositsWithdrawalsRow from "./wallet-deposits-withdrawals/deposits-withdrawals-row";
import WalletDepositsWithdrawals from "./wallet-deposits-withdrawals/wallet-deposits-withdrawals";
import { WALLET_DEPOSITS_WITHDRAWALS_COLUMNS } from "./wallet-deposits-withdrawals/wallet-deposits-withdrawals.constants";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import * as React from "react";
import { useTranslation } from "react-i18next";
import { compose } from "redux";

import { WalletRouteProps } from "../wallet.routes";
import WalletBalanceElements from "./wallet-balance/wallet-balance-elements";
import WalletSettingsContainer from "./wallet-settings/wallet-settings-container";
import WalletTablesTotal from "./wallet-tables/wallet-tables-total";

const _WalletTotal: React.FC<Props & WalletRouteProps> = ({ data: wallet }) => {
const _WalletTotal: React.FC<Props> = ({ data: wallet }) => {
const [t] = useTranslation();
return (
<Page title={t("wallet-page.title")}>
Expand Down
13 changes: 13 additions & 0 deletions packages/social-trader/src/pages/wallet/wallet.paths.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { composeUrl } from "utils/compose-url";

export const WALLET_TOTAL_PAGE_NAME = "wallet";
export const WALLET_TOTAL_PAGE_ROUTE = `/${WALLET_TOTAL_PAGE_NAME}`;
export const CURRENCY_SLUG = ":currency";
export const WALLET_CURRENCY_PAGE_ROUTE = `${WALLET_TOTAL_PAGE_ROUTE}/${CURRENCY_SLUG}`;

export const WALLET_CURRENCY_FOLDER_ROUTE = `${WALLET_TOTAL_PAGE_ROUTE}/[id]`;

export const composeWalletCurrencyUrl = composeUrl(
WALLET_CURRENCY_PAGE_ROUTE,
CURRENCY_SLUG
);
34 changes: 0 additions & 34 deletions packages/social-trader/src/pages/wallet/wallet.routes.tsx
Original file line number Diff line number Diff line change
@@ -1,57 +1,23 @@
import NotFoundPage from "components/not-found/not-found";
import * as React from "react";
import { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
import { RouteComponentProps } from "react-router";
import { Route, Switch } from "react-router-dom";
import { currencySelector } from "reducers/account-settings-reducer";
import { composeUrl } from "utils/compose-url";

import WalletCurrencyContainer from "./components/wallet-currency.container";
import WalletTotalContainer from "./components/wallet-total-container";
import { fetchWallets } from "./services/wallet.services";

export const WALLET_TOTAL_PAGE_NAME = "wallet";
export const WALLET_TOTAL_PAGE_ROUTE = `/${WALLET_TOTAL_PAGE_NAME}`;
export const CURRENCY_SLUG = ":currency";
export const WALLET_CURRENCY_PAGE_ROUTE = `${WALLET_TOTAL_PAGE_ROUTE}/${CURRENCY_SLUG}`;

export const WALLET_CURRENCY_FOLDER_ROUTE = `${WALLET_TOTAL_PAGE_ROUTE}/[id]`;

export const composeWalletCurrencyUrl = composeUrl(
WALLET_CURRENCY_PAGE_ROUTE,
CURRENCY_SLUG
);

interface DispatchProps {
fetchWallets(): void;
}

interface RouteProps {}

export interface WalletRouteProps extends RouteComponentProps<RouteProps> {}

const _WalletRoutes: React.FC<DispatchProps> = () => {
const currency = useSelector(currencySelector);
const dispatch = useDispatch();
useEffect(() => {
dispatch(fetchWallets(currency));
}, [currency]);
return (
<Switch>
<Route
exact
path={WALLET_TOTAL_PAGE_ROUTE}
component={WalletTotalContainer}
/>
<Route
path={WALLET_CURRENCY_PAGE_ROUTE}
component={WalletCurrencyContainer}
/>
<Route component={NotFoundPage} />
</Switch>
);
};

const WalletRoutes = React.memo(_WalletRoutes);
export default WalletRoutes;
6 changes: 0 additions & 6 deletions packages/social-trader/src/reducers/root-reducer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// import { connectRouter } from "connected-react-router";
import {
globalSearchReducer,
GlobalSearchState
Expand Down Expand Up @@ -77,7 +76,6 @@ export const sharedRootReducers = {
fundDetails: fundDetailsReducer,
followDetails: followDetailsReducer,
programDetails: programDetailsReducer,
// router: connectRouter(history),
platformData: platformReducer,
followsData: followsReducer,
programsData: programsReducer,
Expand All @@ -95,9 +93,7 @@ export const sharedRootReducers = {
followNotifications: followNotificationsReducer,
programNotifications: programNotificationsReducer,
fundNotifications: fundNotificationsReducer,
// manager: managerReducer,
wallet: walletReducer,
// copyTradingAccounts: CopyTradingAccountsReducer, TODO
accountSettings: accountSettingsReducer,
ui: uiReducer
};
Expand All @@ -124,10 +120,8 @@ export type RootState = Readonly<{
programNotifications: ProgramNotificationsState;
fundNotifications: FundNotificationsState;
authData: AuthState;
// // router: RouterState;
alertMessages: AlertMessagesState;
accountSettings: AccountSettingsState;
wallet: WalletState;
// copyTradingAccounts: CopyTradingAccountsState;
ui: IUiState;
}>;
11 changes: 0 additions & 11 deletions packages/social-trader/src/reducers/router-reducer.d.ts

This file was deleted.

13 changes: 0 additions & 13 deletions packages/social-trader/src/utils/get-params.ts

This file was deleted.

0 comments on commit 79da9f4

Please sign in to comment.