diff --git a/public/configs/env.json b/public/configs/env.json index 857dd04..989e4d4 100644 --- a/public/configs/env.json +++ b/public/configs/env.json @@ -71,7 +71,19 @@ "tos": "https://dydx.exchange/v4-terms", "privacy": "https://dydx.exchange/privacy", "mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}", - "blogs": "https://www.dydx.foundation/blog" + "blogs": "https://www.dydx.foundation/blog", + "foundation": "https://www.dydx.foundation", + "help": "https://help.dydx.exchange/", + "initialMarginFractionLearnmore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes", + "reduceOnlyLearnmore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders", + "mintscanBase": "https://testnet.mintscan.io/dydx-testnet", + "documentation": "https://docs.dydx.exchange/", + "community": "https://discord.com/invite/dydx", + "governanceLearnmore": "https://help.dydx.exchange", + "stakingLearnmore": "https://help.dydx.exchange", + "keplrDashboard": "https://testnet.keplr.app/", + "accountExportLearnmore": "https://help.dydx.exchange", + "walletLearnmore": "https://www.dydx.academy/video/defi-wallet" }, "wallets": { "walletconnect": { @@ -130,7 +142,19 @@ "tos": "https://dydx.exchange/v4-terms", "privacy": "https://dydx.exchange/privacy", "mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}", - "blogs": "https://www.dydx.foundation/blog" + "blogs": "https://www.dydx.foundation/blog", + "foundation": "https://www.dydx.foundation", + "help": "https://help.dydx.exchange/", + "initialMarginFractionLearnmore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes", + "reduceOnlyLearnmore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders", + "mintscanBase": "https://testnet.mintscan.io/dydx-testnet", + "documentation": "https://docs.dydx.exchange/", + "community": "https://discord.com/invite/dydx", + "governanceLearnmore": "https://help.dydx.exchange", + "stakingLearnmore": "https://help.dydx.exchange", + "keplrDashboard": "https://testnet.keplr.app/", + "accountExportLearnmore": "https://help.dydx.exchange", + "walletLearnmore": "https://www.dydx.academy/video/defi-wallet" }, "wallets": { "walletconnect": { @@ -189,7 +213,19 @@ "tos": "https://dydx.exchange/v4-terms", "privacy": "https://dydx.exchange/privacy", "mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}", - "blogs": "https://www.dydx.foundation/blog" + "blogs": "https://www.dydx.foundation/blog", + "foundation": "https://www.dydx.foundation", + "help": "https://help.dydx.exchange/", + "initialMarginFractionLearnmore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes", + "reduceOnlyLearnmore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders", + "mintscanBase": "https://testnet.mintscan.io/dydx-testnet", + "documentation": "https://docs.dydx.exchange/", + "community": "https://discord.com/invite/dydx", + "governanceLearnmore": "https://help.dydx.exchange", + "stakingLearnmore": "https://help.dydx.exchange", + "keplrDashboard": "https://testnet.keplr.app/", + "accountExportLearnmore": "https://help.dydx.exchange", + "walletLearnmore": "https://www.dydx.academy/video/defi-wallet" }, "wallets": { "walletconnect": { @@ -248,7 +284,19 @@ "tos": "https://dydx.exchange/v4-terms", "privacy": "https://dydx.exchange/privacy", "mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}", - "blogs": "https://www.dydx.foundation/blog" + "blogs": "https://www.dydx.foundation/blog", + "foundation": "https://www.dydx.foundation", + "help": "https://help.dydx.exchange/", + "initialMarginFractionLearnmore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes", + "reduceOnlyLearnmore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders", + "mintscanBase": "https://testnet.mintscan.io/dydx-testnet", + "documentation": "https://docs.dydx.exchange/", + "community": "https://discord.com/invite/dydx", + "governanceLearnmore": "https://help.dydx.exchange", + "stakingLearnmore": "https://help.dydx.exchange", + "keplrDashboard": "https://testnet.keplr.app/", + "accountExportLearnmore": "https://help.dydx.exchange", + "walletLearnmore": "https://www.dydx.academy/video/defi-wallet" }, "wallets": { "walletconnect": { @@ -312,7 +360,16 @@ "community": "https://discord.com/invite/dydx", "feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform", "blogs": "https://www.dydx.foundation/blog", - "help": "https://help.dydx.exchange" + "help": "https://help.dydx.exchange", + "foundation": "https://www.dydx.foundation", + "initialMarginFractionLearnmore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes", + "reduceOnlyLearnmore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders", + "mintscanBase": "https://testnet.mintscan.io/dydx-testnet", + "governanceLearnmore": "https://help.dydx.exchange", + "stakingLearnmore": "https://help.dydx.exchange", + "keplrDashboard": "https://testnet.keplr.app/", + "accountExportLearnmore": "https://help.dydx.exchange", + "walletLearnmore": "https://www.dydx.academy/video/defi-wallet" }, "wallets": { "walletconnect": { @@ -376,7 +433,16 @@ "community": "https://discord.com/invite/dydx", "feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform", "blogs": "https://www.dydx.foundation/blog", - "help": "https://help.dydx.exchange" + "help": "https://help.dydx.exchange", + "foundation": "https://www.dydx.foundation", + "initialMarginFractionLearnmore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes", + "reduceOnlyLearnmore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders", + "mintscanBase": "https://testnet.mintscan.io/dydx-testnet", + "governanceLearnmore": "https://help.dydx.exchange", + "stakingLearnmore": "https://help.dydx.exchange", + "keplrDashboard": "https://testnet.keplr.app/", + "accountExportLearnmore": "https://help.dydx.exchange", + "walletLearnmore": "https://www.dydx.academy/video/defi-wallet" }, "wallets": { "walletconnect": { @@ -443,7 +509,17 @@ "documentation": "https://docs.dydx.exchange/", "community": "https://discord.com/invite/dydx", "feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform", - "blogs": "https://www.dydx.foundation/blog" + "blogs": "https://www.dydx.foundation/blog", + "foundation": "https://www.dydx.foundation", + "help": "https://help.dydx.exchange/", + "initialMarginFractionLearnmore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes", + "reduceOnlyLearnmore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders", + "mintscanBase": "https://testnet.mintscan.io/dydx-testnet", + "governanceLearnmore": "https://help.dydx.exchange", + "stakingLearnmore": "https://help.dydx.exchange", + "keplrDashboard": "https://testnet.keplr.app/", + "accountExportLearnmore": "https://help.dydx.exchange", + "walletLearnmore": "https://www.dydx.academy/video/defi-wallet" }, "wallets": { "walletconnect": { @@ -507,7 +583,17 @@ "documentation": "https://docs.dydx.exchange/", "community": "https://discord.com/invite/dydx", "feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform", - "blogs": "https://www.dydx.foundation/blog" + "blogs": "https://www.dydx.foundation/blog", + "foundation": "https://www.dydx.foundation", + "help": "https://help.dydx.exchange/", + "initialMarginFractionLearnmore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes", + "reduceOnlyLearnmore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders", + "mintscanBase": "https://testnet.mintscan.io/dydx-testnet", + "governanceLearnmore": "https://help.dydx.exchange", + "stakingLearnmore": "https://help.dydx.exchange", + "keplrDashboard": "https://testnet.keplr.app/", + "accountExportLearnmore": "https://help.dydx.exchange", + "walletLearnmore": "https://www.dydx.academy/video/defi-wallet" }, "wallets": { "walletconnect": { @@ -571,7 +657,17 @@ "documentation": "https://docs.dydx.exchange/", "community": "https://discord.com/invite/dydx", "feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform", - "blogs": "https://www.dydx.foundation/blog" + "blogs": "https://www.dydx.foundation/blog", + "foundation": "https://www.dydx.foundation", + "help": "https://help.dydx.exchange/", + "initialMarginFractionLearnmore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes", + "reduceOnlyLearnmore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders", + "mintscanBase": "https://testnet.mintscan.io/dydx-testnet", + "governanceLearnmore": "https://help.dydx.exchange", + "stakingLearnmore": "https://help.dydx.exchange", + "keplrDashboard": "https://testnet.keplr.app/", + "accountExportLearnmore": "https://help.dydx.exchange", + "walletLearnmore": "https://www.dydx.academy/video/defi-wallet" }, "wallets": { "walletconnect": { @@ -635,7 +731,17 @@ "documentation": "https://docs.dydx.exchange/", "community": "https://discord.com/invite/dydx", "feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform", - "blogs": "https://www.dydx.foundation/blog" + "blogs": "https://www.dydx.foundation/blog", + "foundation": "https://www.dydx.foundation", + "help": "https://help.dydx.exchange/", + "initialMarginFractionLearnmore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes", + "reduceOnlyLearnmore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders", + "mintscanBase": "https://testnet.mintscan.io/dydx-testnet", + "governanceLearnmore": "https://help.dydx.exchange", + "stakingLearnmore": "https://help.dydx.exchange", + "keplrDashboard": "https://testnet.keplr.app/", + "accountExportLearnmore": "https://help.dydx.exchange", + "walletLearnmore": "https://www.dydx.academy/video/defi-wallet" }, "wallets": { "walletconnect": { @@ -699,7 +805,17 @@ "documentation": "https://docs.dydx.exchange/", "community": "https://discord.com/invite/dydx", "feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform", - "blogs": "https://www.dydx.foundation/blog" + "blogs": "https://www.dydx.foundation/blog", + "foundation": "https://www.dydx.foundation", + "help": "https://help.dydx.exchange/", + "initialMarginFractionLearnmore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes", + "reduceOnlyLearnmore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders", + "mintscanBase": "https://testnet.mintscan.io/dydx-testnet", + "governanceLearnmore": "https://help.dydx.exchange", + "stakingLearnmore": "https://help.dydx.exchange", + "keplrDashboard": "https://testnet.keplr.app/", + "accountExportLearnmore": "https://help.dydx.exchange", + "walletLearnmore": "https://www.dydx.academy/video/defi-wallet" }, "wallets": { "walletconnect": { @@ -824,10 +940,20 @@ "privacy": "https://dydx.exchange/privacy", "statusPage": "https://status.v4testnet.dydx.exchange/", "mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}", - "documentation": "https://v4-teacher.vercel.app/", + "documentation": "https://docs.dydx.exchange/", "community": "https://discord.com/invite/dydx", "feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform", - "blogs": "https://www.dydx.foundation/blog" + "blogs": "https://www.dydx.foundation/blog", + "foundation": "https://www.dydx.foundation", + "help": "https://help.dydx.exchange/", + "initialMarginFractionLearnmore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes", + "reduceOnlyLearnmore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders", + "mintscanBase": "https://testnet.mintscan.io/dydx-testnet", + "governanceLearnmore": "https://help.dydx.exchange", + "stakingLearnmore": "https://help.dydx.exchange", + "keplrDashboard": "https://testnet.keplr.app/", + "accountExportLearnmore": "https://help.dydx.exchange", + "walletLearnmore": "https://www.dydx.academy/video/defi-wallet" }, "wallets": { "walletconnect": { @@ -888,11 +1014,20 @@ "tos": "[HTTP link to TOS]", "privacy": "[HTTP link to Privacy Policy]", "mintscan": "[HTTP link to Mintscan, with {tx_hash} placeholder]", - "documentation": "[HTTP link to documentation, can be null]", - "community": "[HTTP link to community, can be null]", + "mintscanBase": "[HTTP link to TOS mintsacn base url]", "feedback": "[HTTP link to feedback form, can be null]", "blogs": "[HTTP link to blogs, can be null]", - "help": "[HTTP link to help page, can be null]" + "foundation": "[HTTP link to foundation, can be null]", + "initialMarginFractionLearnmore": "[HTTP link to initial margin fraction learn more, can be null]", + "reduceOnlyLearnmore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders", + "documentation": "[HTTP link to documentation, can be null]", + "community": "[HTTP link to community, can be null]", + "help": "[HTTP link to help page, can be null]", + "governanceLearnmore": "[HTTP link to governance learn more, can be null]", + "stakingLearnmore": "[HTTP link to staking learn more, can be null]", + "keplrDashboard": "[HTTP link to keplr dashboard, can be null]", + "accountExportLearnmore": "[HTTP link to account export learn more, can be null]", + "walletLearnmore": "[HTTP link to wallet learn more, can be null]" }, "wallets": { "walletconnect": { diff --git a/src/components/WithTooltip.tsx b/src/components/WithTooltip.tsx index 71563c6..2d13808 100644 --- a/src/components/WithTooltip.tsx +++ b/src/components/WithTooltip.tsx @@ -4,7 +4,7 @@ import { Content, Portal, Provider, Root, Trigger, Arrow } from '@radix-ui/react import { tooltipStrings } from '@/constants/tooltips'; -import { useStringGetter } from '@/hooks'; +import { useStringGetter, useURLConfigs } from '@/hooks'; import { Icon, IconName } from '@/components/Icon'; @@ -38,6 +38,7 @@ export const WithTooltip = ({ slotTooltip, }: ElementProps & StyleProps) => { const stringGetter = useStringGetter(); + const urlConfigs = useURLConfigs(); const getTooltipStrings = tooltip && tooltipStrings[tooltip]; if (!getTooltipStrings && !tooltipString && !slotTooltip) return <>{children}; @@ -49,6 +50,7 @@ export const WithTooltip = ({ const { title, body } = getTooltipStrings({ stringGetter, stringParams, + urlConfigs, }); tooltipTitle = title; tooltipBody = body; diff --git a/src/constants/localization.ts b/src/constants/localization.ts index f9d1d4b..696e947 100644 --- a/src/constants/localization.ts +++ b/src/constants/localization.ts @@ -8,6 +8,8 @@ import { WARNINGS_STRING_KEYS, } from '@dydxprotocol/v4-localization'; +import { type LinksConfigs } from '@/hooks/useURLConfigs'; + export { TOOLTIP_STRING_KEYS } from '@dydxprotocol/v4-localization'; export enum SupportedLocales { @@ -79,9 +81,11 @@ export type TooltipStrings = { [key: string]: ({ stringGetter, stringParams, + urlConfigs, }: { stringGetter: StringGetterFunction; stringParams?: any; + urlConfigs?: LinksConfigs; }) => { title: string; body: string; diff --git a/src/constants/routes.ts b/src/constants/routes.ts index 23a2940..529efae 100644 --- a/src/constants/routes.ts +++ b/src/constants/routes.ts @@ -37,7 +37,3 @@ export const HISTORY_ROUTE = `${AppRoute.Portfolio}/${PortfolioRoute.History}/:s export const DEFAULT_TRADE_ROUTE = `${AppRoute.Trade}/${DEFAULT_MARKETID}`; export const SETTINGS_ROUTE = `${AppRoute.Settings}/*`; export const DEFAULT_DOCUMENT_TITLE = 'dYdX'; - -export enum ExternalLink { - Foundation = 'https://dydx.foundation', -} diff --git a/src/constants/tooltips/trade.ts b/src/constants/tooltips/trade.ts index f863f4f..df0125f 100644 --- a/src/constants/tooltips/trade.ts +++ b/src/constants/tooltips/trade.ts @@ -57,10 +57,10 @@ export const tradeTooltips: TooltipStrings = { title: stringGetter({ key: TOOLTIP_STRING_KEYS.INDEX_PRICE_TITLE }), body: stringGetter({ key: TOOLTIP_STRING_KEYS.INDEX_PRICE_BODY }), }), - 'initial-margin-fraction': ({ stringGetter }) => ({ + 'initial-margin-fraction': ({ stringGetter, urlConfigs }) => ({ title: stringGetter({ key: TOOLTIP_STRING_KEYS.INITIAL_MARGIN_FRACTION_TITLE }), body: stringGetter({ key: TOOLTIP_STRING_KEYS.INITIAL_MARGIN_FRACTION_BODY }), - learnMoreLink: 'https://help.dydx.exchange/articles/5232637-maximum-position-sizes', + learnMoreLink: urlConfigs?.initialMarginFractionLearnmore, }), 'initial-stop': ({ stringGetter }) => ({ title: stringGetter({ key: TOOLTIP_STRING_KEYS.INITIAL_STOP_TITLE }), @@ -146,10 +146,10 @@ export const tradeTooltips: TooltipStrings = { title: stringGetter({ key: TOOLTIP_STRING_KEYS.REALIZED_PNL_TITLE }), body: stringGetter({ key: TOOLTIP_STRING_KEYS.REALIZED_PNL_BODY }), }), - 'reduce-only': ({ stringGetter }) => ({ + 'reduce-only': ({ stringGetter, urlConfigs }) => ({ title: stringGetter({ key: TOOLTIP_STRING_KEYS.REDUCE_ONLY_TITLE }), body: stringGetter({ key: TOOLTIP_STRING_KEYS.REDUCE_ONLY_BODY }), - learnMoreLink: 'https://help.dydx.exchange/articles/6345793-reduce-only-orders', + learnMoreLink: urlConfigs?.reduceOnlyLearnmore, }), spread: () => ({ title: 'Spread', diff --git a/src/hooks/index.ts b/src/hooks/index.ts index c374d1c..c7cc2f0 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -22,6 +22,7 @@ import { useShouldShowFooter } from './useShouldShowFooter'; import { useSelectedNetwork } from './useSelectedNetwork'; import { useStringGetter } from './useStringGetter'; import { useSubaccount } from './useSubaccount'; +import { useURLConfigs } from './useURLConfigs'; export { useApiState, @@ -48,4 +49,5 @@ export { useSelectedNetwork, useStringGetter, useSubaccount, + useURLConfigs, }; diff --git a/src/hooks/useURLConfigs.ts b/src/hooks/useURLConfigs.ts new file mode 100644 index 0000000..317dac1 --- /dev/null +++ b/src/hooks/useURLConfigs.ts @@ -0,0 +1,50 @@ +import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks'; + +import { useSelectedNetwork } from '@/hooks'; + +const FALLBACK_URL = 'https://help.dydx.exchange/'; + +export interface LinksConfigs { + tos: string, + privacy: string, + mintscan: string, + mintscanBase: string, + feedback?: string, + help?: string, + blogs?: string, + foundation?: string, + initialMarginFractionLearnmore?: string, + reduceOnlyLearnmore?: string, + documentation?: string, + community?: string, + governanceLearnmore?: string, + stakingLearnmore?: string, + keplrDashboard?: string, + accountExportLearnmore?: string, + walletLearnmore?: string +} + +export const useURLConfigs = (): LinksConfigs => { + const { selectedNetwork } = useSelectedNetwork(); + const linksConfigs = ENVIRONMENT_CONFIG_MAP[selectedNetwork].links as LinksConfigs; + + return { + tos: linksConfigs.tos, + privacy: linksConfigs.privacy, + mintscan: linksConfigs.mintscan, + mintscanBase: linksConfigs.mintscanBase, + feedback: linksConfigs.feedback || FALLBACK_URL, + help: linksConfigs.help || FALLBACK_URL, + blogs: linksConfigs.blogs || FALLBACK_URL, + foundation: linksConfigs.foundation || FALLBACK_URL, + initialMarginFractionLearnmore: linksConfigs.initialMarginFractionLearnmore || FALLBACK_URL, + reduceOnlyLearnmore: linksConfigs.reduceOnlyLearnmore || FALLBACK_URL, + documentation: linksConfigs.documentation || FALLBACK_URL, + community: linksConfigs.community || FALLBACK_URL, + governanceLearnmore: linksConfigs.governanceLearnmore || FALLBACK_URL, + stakingLearnmore: linksConfigs.stakingLearnmore || FALLBACK_URL, + keplrDashboard: linksConfigs.keplrDashboard || FALLBACK_URL, + accountExportLearnmore: linksConfigs.accountExportLearnmore || FALLBACK_URL, + walletLearnmore: linksConfigs.walletLearnmore || FALLBACK_URL, + }; +}; diff --git a/src/layout/Header/HeaderDesktop.tsx b/src/layout/Header/HeaderDesktop.tsx index 3ceba10..6e4aeaf 100644 --- a/src/layout/Header/HeaderDesktop.tsx +++ b/src/layout/Header/HeaderDesktop.tsx @@ -8,7 +8,7 @@ import { STRING_KEYS } from '@/constants/localization'; import { AppRoute } from '@/constants/routes'; import { LogoShortIcon, BellStrokeIcon } from '@/icons'; -import { useTokenConfigs, useStringGetter } from '@/hooks'; +import { useTokenConfigs, useStringGetter, useURLConfigs } from '@/hooks'; import { Icon, IconName } from '@/components/Icon'; import { IconButton } from '@/components/IconButton'; @@ -28,6 +28,7 @@ import breakpoints from '@/styles/breakpoints'; export const HeaderDesktop = () => { const stringGetter = useStringGetter(); + const { documentation, community, mintscanBase } = useURLConfigs(); const dispatch = useDispatch(); const { chainTokenLabel } = useTokenConfigs(); @@ -63,19 +64,19 @@ export const HeaderDesktop = () => { value: 'DOCUMENTATION', slotBefore: , label: stringGetter({ key: STRING_KEYS.DOCUMENTATION }), - href: 'https://docs.dydx.exchange/', + href: documentation, }, { value: 'MINTSCAN', slotBefore: , label: stringGetter({ key: STRING_KEYS.MINTSCAN }), - href: 'https://testnet.mintscan.io/dydx-testnet', + href: mintscanBase, }, { value: 'COMMUNITY', slotBefore: , label: stringGetter({ key: STRING_KEYS.COMMUNITY }), - href: 'https://discord.gg/dydx', + href: community, }, { value: 'TERMS_OF_USE', diff --git a/src/pages/rewards/RewardsPage.tsx b/src/pages/rewards/RewardsPage.tsx index 86affbd..d379ed5 100644 --- a/src/pages/rewards/RewardsPage.tsx +++ b/src/pages/rewards/RewardsPage.tsx @@ -5,7 +5,7 @@ import { STRING_KEYS } from '@/constants/localization'; import { ButtonAction, ButtonSize } from '@/constants/buttons'; import { DialogTypes } from '@/constants/dialogs'; -import { useBreakpoints, useStringGetter } from '@/hooks'; +import { useBreakpoints, useStringGetter, useURLConfigs } from '@/hooks'; import { breakpoints } from '@/styles'; import { layoutMixins } from '@/styles/layoutMixins'; @@ -20,15 +20,10 @@ import { openDialog } from '@/state/dialogs'; import { DYDXBalancePanel } from './DYDXBalancePanel'; import { MigratePanel } from './MigratePanel'; -// TODO: consolidate help link urls to env variables -const GOVERNANCE_HELP_URL = 'https://help.dydx.exchange/'; -const STAKING_HELP_URL = - 'https://docs.dydx.community/dydx-chain-documentation/staking/how-to-stake'; - export const RewardsPage = () => { const dispatch = useDispatch(); const stringGetter = useStringGetter(); - + const { governanceLearnmore, stakingLearnmore } = useURLConfigs(); const { isTablet, isNotTablet } = useBreakpoints(); const panelArrow = ( @@ -58,7 +53,7 @@ export const RewardsPage = () => { > {stringGetter({ key: STRING_KEYS.GOVERNANCE_DESCRIPTION })} - e.stopPropagation()}> + e.stopPropagation()}> {stringGetter({ key: STRING_KEYS.LEARN_MORE })} → @@ -71,7 +66,7 @@ export const RewardsPage = () => { > {stringGetter({ key: STRING_KEYS.STAKING_DESCRIPTION })} - e.stopPropagation()}> + e.stopPropagation()}> {stringGetter({ key: STRING_KEYS.LEARN_MORE })} → diff --git a/src/views/dialogs/ExternalNavKeplrDialog.tsx b/src/views/dialogs/ExternalNavKeplrDialog.tsx index 02b6da2..d058a39 100644 --- a/src/views/dialogs/ExternalNavKeplrDialog.tsx +++ b/src/views/dialogs/ExternalNavKeplrDialog.tsx @@ -2,7 +2,7 @@ import styled, { type AnyStyledComponent } from 'styled-components'; import { ButtonAction, ButtonSize, ButtonType } from '@/constants/buttons'; import { STRING_KEYS } from '@/constants/localization'; -import { useBreakpoints, useStringGetter } from '@/hooks'; +import { useBreakpoints, useStringGetter, useURLConfigs } from '@/hooks'; import { Button } from '@/components/Button'; import { Dialog, DialogPlacement } from '@/components/Dialog'; @@ -15,12 +15,10 @@ type ElementProps = { setIsOpen: (open: boolean) => void; }; -// TODO: replace placeholder URL with real URLs when avaialble -const KEPLR_DASHBOARD_URL = 'https://testnet.keplr.app/'; -const HELP_URL = 'https://help.dydx.exchange/en/articles/2921366-how-do-i-create-an-account-or-sign-up'; - export const ExternalNavKeplrDialog = ({ setIsOpen }: ElementProps) => { const stringGetter = useStringGetter(); + const { keplrDashboard, accountExportLearnmore } = useURLConfigs(); + const { isTablet } = useBreakpoints(); return ( @@ -31,7 +29,7 @@ export const ExternalNavKeplrDialog = ({ setIsOpen }: ElementProps) => { placement={isTablet ? DialogPlacement.FullScreen : DialogPlacement.Default} > - + {stringGetter({ key: STRING_KEYS.NAVIGATE_TO_KEPLR, @@ -48,7 +46,7 @@ export const ExternalNavKeplrDialog = ({ setIsOpen }: ElementProps) => { /> - + {stringGetter({ key: STRING_KEYS.LEARN_TO_EXPORT, diff --git a/src/views/dialogs/HelpDialog.tsx b/src/views/dialogs/HelpDialog.tsx index e89f2c1..88181b1 100644 --- a/src/views/dialogs/HelpDialog.tsx +++ b/src/views/dialogs/HelpDialog.tsx @@ -2,10 +2,10 @@ import { useMemo } from 'react'; import styled, { AnyStyledComponent } from 'styled-components'; import { STRING_KEYS } from '@/constants/localization'; -import { useStringGetter } from '@/hooks'; -import { ChatIcon, FeedbackIcon, FileIcon, TerminalIcon } from '@/icons'; +import { useStringGetter, useURLConfigs } from '@/hooks'; import { ComboboxDialogMenu } from '@/components/ComboboxDialogMenu'; +import { Icon, IconName } from '@/components/Icon'; import { isTruthy } from '@/lib/isTruthy'; @@ -13,39 +13,24 @@ type ElementProps = { setIsOpen: (open: boolean) => void; }; -const HELP_LINKS = { - apiDocumentation: 'https://v4-teacher.vercel.app/', - helpCenter: null, - feedback: null, -}; - export const HelpDialog = ({ setIsOpen }: ElementProps) => { const stringGetter = useStringGetter(); + const { help: helpCenter, community } = useURLConfigs(); const HELP_ITEMS = useMemo( () => [ { group: 'help-items', items: [ - HELP_LINKS.helpCenter && { + helpCenter && { value: 'help-center', label: stringGetter({ key: STRING_KEYS.HELP_CENTER }), description: stringGetter({ key: STRING_KEYS.HELP_CENTER_DESCRIPTION }), onSelect: () => { - HELP_LINKS.helpCenter && globalThis.open(HELP_LINKS.helpCenter, '_blank'); + helpCenter && globalThis.open(helpCenter, '_blank'); setIsOpen(false); }, - slotBefore: , - }, - HELP_LINKS.apiDocumentation && { - value: 'api-documentation', - label: stringGetter({ key: STRING_KEYS.API_DOCUMENTATION }), - description: stringGetter({ key: STRING_KEYS.API_DOCUMENTATION_DESCRIPTION }), - onSelect: () => { - HELP_LINKS.apiDocumentation && globalThis.open(HELP_LINKS.apiDocumentation, '_blank'); - setIsOpen(false); - }, - slotBefore: , + slotBefore: , }, globalThis?.Intercom && { value: 'live-chat', @@ -55,22 +40,22 @@ export const HelpDialog = ({ setIsOpen }: ElementProps) => { globalThis.Intercom('show'); setIsOpen(false); }, - slotBefore: , + slotBefore: , }, - HELP_LINKS.feedback && { - value: 'feedback', - label: stringGetter({ key: STRING_KEYS.PROVIDE_FEEDBACK }), - description: stringGetter({ key: STRING_KEYS.PROVIDE_FEEDBACK_DESCRIPTION }), + community && { + value: 'community', + label: stringGetter({ key: STRING_KEYS.COMMUNITY }), + description: stringGetter({ key: STRING_KEYS.COMMUNITY_DESCRIPTION }), onSelect: () => { - HELP_LINKS.feedback && globalThis.open(HELP_LINKS.feedback, '_blank'); + community && globalThis.open(community, '_blank'); setIsOpen(false); }, - slotBefore: , + slotBefore: , }, ].filter(isTruthy), }, ], - [stringGetter] + [stringGetter, helpCenter, community] ); return ( diff --git a/src/views/dialogs/OnboardingDialog/ChooseWallet.tsx b/src/views/dialogs/OnboardingDialog/ChooseWallet.tsx index e6764e3..6c86307 100644 --- a/src/views/dialogs/OnboardingDialog/ChooseWallet.tsx +++ b/src/views/dialogs/OnboardingDialog/ChooseWallet.tsx @@ -13,16 +13,15 @@ import { Button } from '@/components/Button'; import { Icon } from '@/components/Icon'; import { Link } from '@/components/Link'; -import { useAccounts, useStringGetter } from '@/hooks'; +import { useAccounts, useStringGetter, useURLConfigs } from '@/hooks'; import { useDisplayedWallets } from '@/hooks/useDisplayedWallets'; import { breakpoints } from '@/styles'; import { layoutMixins } from '@/styles/layoutMixins'; -const aboutWalletsLink = `https://www.dydx.academy/video/defi-wallet`; - export const ChooseWallet = () => { const stringGetter = useStringGetter(); + const { walletLearnmore } = useURLConfigs(); const displayedWallets = useDisplayedWallets(); @@ -63,7 +62,7 @@ export const ChooseWallet = () => { - + {stringGetter({ key: STRING_KEYS.ABOUT_WALLETS })} diff --git a/src/views/menus/AccountMenu.tsx b/src/views/menus/AccountMenu.tsx index a91b013..2377f3b 100644 --- a/src/views/menus/AccountMenu.tsx +++ b/src/views/menus/AccountMenu.tsx @@ -15,6 +15,7 @@ import { useTokenConfigs, useStringGetter, useAccountBalance, + useURLConfigs, } from '@/hooks'; import { OnboardingTriggerButton } from '@/views/dialogs/OnboardingTriggerButton'; @@ -36,10 +37,9 @@ import { truncateAddress } from '@/lib/wallet'; import { layoutMixins } from '@/styles/layoutMixins'; import { headerMixins } from '@/styles/headerMixins'; -const explorerBaseUri = 'https://testnet.mintscan.io/dydx-testnet'; - export const AccountMenu = () => { const stringGetter = useStringGetter(); + const { mintscanBase } = useURLConfigs(); const { isTablet } = useBreakpoints(); const dispatch = useDispatch(); const onboardingState = useSelector(getOnboardingState); @@ -92,7 +92,7 @@ export const AccountMenu = () => { /> { // value: 'ViewInExplorer', // icon: , // label: stringGetter({ key: STRING_KEYS.OPEN_IN_ETHERSCAN }), - // onSelect: () => globalThis.open(`${explorerBaseUri}/address/${address}`), + // onSelect: () => globalThis.open(`${mintscanBase}/address/${address}`), // separator: true, // }, ...(onboardingState === OnboardingState.AccountConnected && hdKey