Skip to content

Commit

Permalink
refactor react-router 2
Browse files Browse the repository at this point in the history
  • Loading branch information
pingustar committed Jan 17, 2024
1 parent 0738739 commit d5eb67e
Show file tree
Hide file tree
Showing 22 changed files with 540 additions and 339 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"@sentry/vite-plugin": "^0.7.2",
"@tanstack/react-query": "^4.14.5",
"@tanstack/react-query-devtools": "^4.14.5",
"@tanstack/react-router": "^1.4.6",
"@tanstack/react-router": "^1.4.9",
"@tanstack/react-table": "^8.9.3",
"@tanstack/react-virtual": "^3.0.0-beta.30",
"@tanstack/router-devtools": "^1.4.6",
"@tanstack/router-devtools": "^1.4.9",
"@testing-library/dom": "^7.21.4",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0",
Expand All @@ -45,7 +45,7 @@
"@web3-react/types": "8.2.2",
"@web3-react/walletconnect-v2": "^8.5.0",
"autoprefixer": "^10.4.12",
"axios": "^1.1.3",
"axios": "1.6.0",
"body-scroll-lock": "^4.0.0-beta.0",
"buffer": "^6.0.3",
"class-variance-authority": "^0.2.4",
Expand Down Expand Up @@ -86,7 +86,7 @@
"typescript": "^4.4.2",
"ua-parser-js": "^1.0.35",
"use-async-effect": "^2.2.7",
"vite": "^4.4.9",
"vite": "5.0.5",
"vite-plugin-rewrite-all": "^1.0.1",
"vite-plugin-svgr": "^2.4.0",
"vite-tsconfig-paths": "^4.2.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReactElement, useMemo } from 'react';
import { Link, PathNames } from 'libs/routing';
import { externalLinks } from 'libs/routing/routes';
import { externalLinks } from 'libs/routing';
import { useFiatCurrency } from 'hooks/useFiatCurrency';
import { MenuItemActions } from './useMenuContext';
import { ReactComponent as IconX } from 'assets/logos/x.svg';
Expand Down
3 changes: 1 addition & 2 deletions src/components/core/menu/mainMenu/MainMenuTradeSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ReactComponent as IconSwitch } from 'assets/icons/switch.svg';
import { Button } from 'components/common/button';
import { Token } from 'libs/tokens';
import { useNavigate } from 'libs/routing';
import { PathNames } from 'libs/routing';
import { carbonEvents } from 'services/events';

type Props = {
Expand All @@ -16,7 +15,7 @@ export const MainMenuTradeSwitch: FC<Props> = ({ baseToken, quoteToken }) => {

const onClick = () => {
navigate({
to: PathNames.trade,
to: '/trade',
search: { base: quoteToken.address, quote: baseToken.address },
});
carbonEvents.trade.tradePairSwap({
Expand Down
105 changes: 0 additions & 105 deletions src/components/strategies/create/BuySellBlock/BugetSection.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/strategies/create/BuySellBlock/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { FullOutcome } from 'components/strategies/FullOutcome';
import { BuySellHeader } from './Header';
import { m } from 'libs/motion';
import { items } from '../variants';
import { BudgetSection } from './BugetSection';
import { BudgetSection } from './BudgetSection';

Check failure on line 19 in src/components/strategies/create/BuySellBlock/index.tsx

View workflow job for this annotation

GitHub Actions / Build (20.x)

Cannot find module './BudgetSection' or its corresponding type declarations.

type Props = {
base: Token;
Expand Down
3 changes: 1 addition & 2 deletions src/components/strategies/create/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
StrategySettings,
} from 'components/strategies/create/types';
import { QueryKey } from 'libs/queries';
import { PathNames } from 'libs/routing';
import { OrderCreate } from 'components/strategies/create/useOrder';
import { carbonEvents } from 'services/events';
import { Dispatch, SetStateAction } from 'react';
Expand Down Expand Up @@ -116,7 +115,7 @@ export const handleTxStatusAndRedirectToOverview = (
) => {
setIsProcessing(true);
setTimeout(() => {
navigate?.({ to: PathNames.strategies });
navigate?.({ to: '/', params: {} });
setIsProcessing(false);
}, ONE_AND_A_HALF_SECONDS_IN_MS);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC } from 'react';
import { Tooltip } from 'components/common/tooltip/Tooltip';
import { externalLinks } from 'libs/routing/routes';
import { externalLinks } from 'libs/routing';
import { Link } from 'libs/routing';
import { ReactComponent as IconLink } from 'assets/icons/link.svg';
import { ReactComponent as IconTooltip } from 'assets/icons/tooltip.svg';
Expand Down
2 changes: 1 addition & 1 deletion src/components/trade/useTradeTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const useTradeTokens = () => {
const quoteToken = getTokenById(search.quote);

const goToPair = (base: string, quote: string, replace?: boolean) =>
navigate({ to: PathNames.trade, search: { base, quote }, replace });
navigate({ to: '/trade', search: { base, quote }, replace });

const isTokenError =
(search.base && !baseToken) || (search.base && !quoteToken);
Expand Down
16 changes: 16 additions & 0 deletions src/libs/routing/externalLinks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export const externalLinks = {
blog: 'http://blog.carbondefi.xyz',
faq: 'https://faq.carbondefi.xyz/',
analytics: 'http://analytics.carbondefi.xyz',
x: 'https://x.com/carbondefixyz',
youtube: 'https://www.youtube.com/c/BancorProtocol',
discord: 'https://discord.gg/bancor',
telegram: 'https://t.me/CarbonDeFixyz',
techDocs: 'https://docs.carbondefi.xyz/',
litePaper: 'https://carbondefi.xyz/litepaper',
whitepaper: 'https://carbondefi.xyz/whitepaper',
simulatorRepo: 'https://github.com/bancorprotocol/carbon-simulator',
interactiveSim: 'https://simulator.carbondefi.xyz/',
duneDashboard: 'https://dune.com/bancor/carbon-by-bancor',
roiLearnMore: 'https://faq.carbondefi.xyz/strategy-roi-and-apr',
};
1 change: 1 addition & 0 deletions src/libs/routing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ export {
} from '@tanstack/react-router';
export { Link } from 'libs/routing/Link';
export { Outlet } from '@tanstack/react-router';
export { externalLinks } from 'libs/routing/externalLinks';
Loading

0 comments on commit d5eb67e

Please sign in to comment.