From ac87e801235d167e0ccee677b48e77b726849781 Mon Sep 17 00:00:00 2001 From: undefined Date: Sun, 12 Jul 2020 22:09:14 +0700 Subject: [PATCH] chore: #1997 add redirect modal for legacy routes - marketplace --- .../handle-legacy-routes-modal.tsx | 36 +++++++++++++++++++ .../pages/handle-legacy-routes/index.ts | 1 + packages/marketplace/src/constants/routes.ts | 1 + packages/marketplace/src/core/index.tsx | 1 + packages/marketplace/src/core/router.tsx | 9 +++++ packages/marketplace/src/types/global.d.ts | 1 + 6 files changed, 49 insertions(+) create mode 100644 packages/marketplace/src/components/pages/handle-legacy-routes/handle-legacy-routes-modal.tsx create mode 100644 packages/marketplace/src/components/pages/handle-legacy-routes/index.ts diff --git a/packages/marketplace/src/components/pages/handle-legacy-routes/handle-legacy-routes-modal.tsx b/packages/marketplace/src/components/pages/handle-legacy-routes/handle-legacy-routes-modal.tsx new file mode 100644 index 0000000000..f3ea706f2e --- /dev/null +++ b/packages/marketplace/src/components/pages/handle-legacy-routes/handle-legacy-routes-modal.tsx @@ -0,0 +1,36 @@ +import routes from '@/constants/routes' +import { history } from '@/core/router' +import React from 'react' +import { Button, Modal } from '@reapit/elements' + +export const handleBtnBackToMarketplace = () => { + history.push(routes.APPS) +} + +export const handleBtnGoTherNow = () => { + window.open(window.reapit.config.developerPortalUrl, '_self') +} + +const HandleLegacyRoutesModal: React.FC<{}> = () => { + return ( + + + + + } + > + The developer portal has permanently moved to https://developers.reapit.com Please remove any bookmarks to this + page and in future visit the developer portal direct. Thankyou. + + ) +} + +export default HandleLegacyRoutesModal diff --git a/packages/marketplace/src/components/pages/handle-legacy-routes/index.ts b/packages/marketplace/src/components/pages/handle-legacy-routes/index.ts new file mode 100644 index 0000000000..a3e1f22cc8 --- /dev/null +++ b/packages/marketplace/src/components/pages/handle-legacy-routes/index.ts @@ -0,0 +1 @@ +export { default } from './handle-legacy-routes-modal' diff --git a/packages/marketplace/src/constants/routes.ts b/packages/marketplace/src/constants/routes.ts index 5e9a1f0c47..2d6aa1356f 100644 --- a/packages/marketplace/src/constants/routes.ts +++ b/packages/marketplace/src/constants/routes.ts @@ -13,6 +13,7 @@ const Routes = { HELP: '/help', LOGIN: '/login', FOUR_O_FOUR: '/404', + DEVELOPER_ROUTES: '/developer/*', } export const developerRoutes = { diff --git a/packages/marketplace/src/core/index.tsx b/packages/marketplace/src/core/index.tsx index 37a6e3c7ac..f03646b85f 100644 --- a/packages/marketplace/src/core/index.tsx +++ b/packages/marketplace/src/core/index.tsx @@ -32,6 +32,7 @@ window.reapit = { developerEditionDownloadUrl: '', urlSchemeUrl: '', apiDocDesktop: '', + developerPortalUrl: '', }, } diff --git a/packages/marketplace/src/core/router.tsx b/packages/marketplace/src/core/router.tsx index a5cc597c39..7e7cce3ad1 100644 --- a/packages/marketplace/src/core/router.tsx +++ b/packages/marketplace/src/core/router.tsx @@ -18,6 +18,7 @@ const InstalledApps = React.lazy(() => catchChunkError(() => import('../componen const Setting = React.lazy(() => catchChunkError(() => import('../components/pages/settings'))) const AppsManagement = React.lazy(() => catchChunkError(() => import('../components/pages/app-management'))) const Help = React.lazy(() => catchChunkError(() => import('../components/pages/help'))) +const HandleLegacyRoutes = React.lazy(() => catchChunkError(() => import('../components/pages/handle-legacy-routes'))) const Router = () => { return ( @@ -28,6 +29,14 @@ const Router = () => { } /> } /> + + + + + + + + diff --git a/packages/marketplace/src/types/global.d.ts b/packages/marketplace/src/types/global.d.ts index 5790c9bd8a..ec884362b7 100644 --- a/packages/marketplace/src/types/global.d.ts +++ b/packages/marketplace/src/types/global.d.ts @@ -17,6 +17,7 @@ export type Config = { developerEditionDownloadUrl: string urlSchemeUrl: string apiDocDesktop: string + developerPortalUrl: string } declare global {