Handle base route for hashrouter/browserrouter

This commit is contained in:
jaredvu 2024-01-31 09:23:24 -08:00
parent 693a8f72d8
commit 1f6c129c7c
No known key found for this signature in database
GPG Key ID: B9FE2F3F0A5D523C
3 changed files with 6 additions and 5 deletions

View File

@ -35,6 +35,7 @@ export enum MobileSettingsRoute {
Network = 'network',
}
export const BASE_ROUTE = import.meta.env.VITE_ROUTER_TYPE === 'hash' ? '/#' : '';
export const TRADE_ROUTE = `${AppRoute.Trade}/:market`;
export const PORTFOLIO_ROUTE = `${AppRoute.Portfolio}/:subroute`;
export const HISTORY_ROUTE = `${AppRoute.Portfolio}/${PortfolioRoute.History}/:subroute`;

View File

@ -2,7 +2,7 @@ import { useState } from 'react';
import styled, { AnyStyledComponent } from 'styled-components';
import { ButtonAction } from '@/constants/buttons';
import { AppRoute } from '@/constants/routes';
import { AppRoute, BASE_ROUTE } from '@/constants/routes';
import { STRING_KEYS } from '@/constants/localization';
import { useStringGetter } from '@/hooks';
import breakpoints from '@/styles/breakpoints';
@ -40,7 +40,7 @@ export const NewMarketAgreementDialog = ({ acceptTerms, setIsOpen }: ElementProp
</Styled.Link>
),
TERMS_OF_USE: (
<Styled.Link href={`/#${AppRoute.Terms}`}>
<Styled.Link href={`${BASE_ROUTE}${AppRoute.Terms}`}>
{stringGetter({ key: STRING_KEYS.TERMS_OF_USE })}
</Styled.Link>
),

View File

@ -2,7 +2,7 @@ import styled, { type AnyStyledComponent } from 'styled-components';
import { useAccounts, useStringGetter } from '@/hooks';
import { AppRoute } from '@/constants/routes';
import { AppRoute, BASE_ROUTE } from '@/constants/routes';
import { STRING_KEYS } from '@/constants/localization';
import { ButtonAction } from '@/constants/buttons';
@ -34,12 +34,12 @@ export const AcknowledgeTerms = ({ onClose, onContinue }: ElementProps) => {
key: STRING_KEYS.TOS_TITLE,
params: {
TERMS_LINK: (
<Styled.Link href={`/#${AppRoute.Terms}`}>
<Styled.Link href={`${BASE_ROUTE}${AppRoute.Terms}`}>
{stringGetter({ key: STRING_KEYS.TERMS_OF_USE })}
</Styled.Link>
),
PRIVACY_POLICY_LINK: (
<Styled.Link href={`/#${AppRoute.Privacy}`}>
<Styled.Link href={`${BASE_ROUTE}${AppRoute.Privacy}`}>
{stringGetter({ key: STRING_KEYS.PRIVACY_POLICY })}
</Styled.Link>
),