diff --git a/apps/governance/src/app.tsx b/apps/governance/src/app.tsx index 0bc19395e..39f77bd65 100644 --- a/apps/governance/src/app.tsx +++ b/apps/governance/src/app.tsx @@ -106,6 +106,7 @@ const Web3Container = ({ useEthWithdrawApprovalsManager(); return null; }; + const [connectors, initializeConnectors] = useWeb3ConnectStore((store) => [ store.connectors, store.initialize, @@ -239,6 +240,9 @@ const AppContainer = () => { store.setDialogOpen, ]); + // Hacky skip all the loading & web3 init for geo restricted users + const isRestricted = document?.location?.pathname?.includes('/restricted'); + useEffect(() => { if (ENV.dsn && telemetryOn === 'true') { Sentry.init({ @@ -304,6 +308,14 @@ const AppContainer = () => { } }, [GIT_COMMIT_HASH, GIT_BRANCH, VEGA_ENV, telemetryOn]); + if (isRestricted) { + return ( + + + + ); + } + return ( diff --git a/apps/governance/src/i18n/translations/dev.json b/apps/governance/src/i18n/translations/dev.json index 66cf0a013..34374ad90 100644 --- a/apps/governance/src/i18n/translations/dev.json +++ b/apps/governance/src/i18n/translations/dev.json @@ -9,6 +9,7 @@ "pageTitleRedemptionTranche": "Redeem from Tranche", "pageTitleTranches": "Vesting tranches", "pageTitle404": "Page not found", + "pageTitle451": "451 unavailable", "pageTitleNotPermitted": "Can not proceed!", "pageTitleDisassociate": "Disassociate $VEGA tokens from a Vega key", "pageTitleProposals": "Proposals", diff --git a/apps/governance/src/routes/restricted/index.tsx b/apps/governance/src/routes/restricted/index.tsx new file mode 100644 index 000000000..f26fea629 --- /dev/null +++ b/apps/governance/src/routes/restricted/index.tsx @@ -0,0 +1,112 @@ +import { useTranslation } from 'react-i18next'; +import { useDocumentTitle } from '../../hooks/use-document-title'; +import type { RouteChildProps } from '..'; +import { BackgroundVideo } from '@vegaprotocol/ui-toolkit'; +import classNames from 'classnames'; + +const Restricted = ({ name }: RouteChildProps) => { + useDocumentTitle(name); + const { t } = useTranslation(); + const errorMessage = + 'Due to uncertainty about the legal and regulatory status of the content hosted on this site, it is not available to visitors in your jurisdiction.'; + + return ( +
+ +
+
+
{GHOST}
+

+ {t('pageTitle451')} +

+
+
+ {errorMessage} +
+
+
+ ); +}; + +const GHOST = ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); + +export default Restricted; diff --git a/apps/governance/src/routes/router-config.tsx b/apps/governance/src/routes/router-config.tsx index 90de63f6b..50eb347f9 100644 --- a/apps/governance/src/routes/router-config.tsx +++ b/apps/governance/src/routes/router-config.tsx @@ -4,6 +4,7 @@ import Home from './token'; import NotFound from './not-found'; import NotPermitted from './not-permitted'; import Routes from './routes'; +import Restricted from './restricted'; const LazyTranches = React.lazy( () => @@ -361,8 +362,13 @@ const routerConfig = [ element: , }, { - path: '*', + path: Routes.RESTRICTED, // Not lazy as loaded when a user first hits the site + element: , + }, + { + path: '*', + // Also not lazy as loaded when a user first hits the site element: , }, ...redirects, diff --git a/apps/governance/src/routes/routes.ts b/apps/governance/src/routes/routes.ts index df73ecdb1..edc18dcb7 100644 --- a/apps/governance/src/routes/routes.ts +++ b/apps/governance/src/routes/routes.ts @@ -7,6 +7,7 @@ const Routes = { PROPOSALS_REJECTED: '/proposals/rejected', PROTOCOL_UPGRADES: '/protocol-upgrades', NOT_PERMITTED: '/not-permitted', + RESTRICTED: '/restricted', NOT_FOUND: '/not-found', CONTRACTS: '/contracts', TOKEN: '/token', @@ -33,6 +34,10 @@ export const TOP_LEVEL_ROUTES = [ name: 'Rewards', path: Routes.REWARDS, }, + { + name: 'Restricted', + path: Routes.RESTRICTED, + }, ]; export const TOKEN_DROPDOWN_ROUTES = [