Skip to content

Commit

Permalink
chore: #1997 render handle legacy routes (route with login type prefix)
Browse files Browse the repository at this point in the history
  • Loading branch information
undefined committed Jul 13, 2020
1 parent ac87e80 commit 07ad818
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`AppContent AppContent - should match snapshoot 1`] = `
<HandleLegacyRoutesModal>
<Component
footerItems={
<React.Fragment>
<Unknown
onClick={[Function]}
type="button"
variant="primary"
>
Go there now
</Unknown>
<Unknown
onClick={[Function]}
type="button"
variant="primary"
>
Back to Marketplace
</Unknown>
</React.Fragment>
}
tapOutsideToDissmiss={false}
title="Looking for the developer portal?"
visible={true}
/>
</HandleLegacyRoutesModal>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'
import { mount } from 'enzyme'
import HandleLegacyRoutesModal from '../handle-legacy-routes-modal'

describe('AppContent', () => {
test('AppContent - should match snapshoot', () => {
expect(mount(<HandleLegacyRoutesModal />)).toMatchSnapshot()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ export const handleBtnBackToMarketplace = () => {
}

export const handleBtnGoTherNow = () => {
console.log(window.reapit.config.developerPortalUrl)

window.open(window.reapit.config.developerPortalUrl, '_self')
}

const HandleLegacyRoutesModal: React.FC<{}> = () => {
return (
<Modal
visible
tapOutsideToDissmiss={false}
title="Looking for the developer portal?"
footerItems={
<>
Expand All @@ -27,8 +30,11 @@ const HandleLegacyRoutesModal: React.FC<{}> = () => {
</>
}
>
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.
<>
The developer portal has permanently moved to{' '}
<a href={window.reapit.config.developerPortalUrl}>{window.reapit.config.developerPortalUrl}</a> Please remove
any bookmarks to this page and in future visit the developer portal direct. Thankyou.
</>
</Modal>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,40 @@ exports[`Router should match a snapshot 1`] = `
path="/404"
render={[Function]}
/>
<Component
path="/client"
showMenu={false}
>
<Component
allow="CLIENT"
component={
Object {
"$$typeof": Symbol(react.lazy),
"_ctor": [Function],
"_result": null,
"_status": -1,
}
}
path="*"
/>
</Component>
<Component
path="/developer"
showMenu={false}
>
<Component
allow="DEVELOPER"
component={
Object {
"$$typeof": Symbol(react.lazy),
"_ctor": [Function],
"_result": null,
"_status": -1,
}
}
path="*"
/>
</Component>
<Component
path="/"
>
Expand Down
8 changes: 6 additions & 2 deletions packages/marketplace/src/core/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ const Router = () => {
<Route path={Routes.LOGIN} exact render={() => <Login />} />
<Route path={Routes.FOUR_O_FOUR} exact render={() => <Info infoType="404" />} />

<PrivateRouteWrapper showMenu={false} path="/client">
<PrivateRoute allow="CLIENT" path="*" component={HandleLegacyRoutes} />
<PrivateRouteWrapper showMenu={false} path="/admin">
<PrivateRoute allow="ADMIN" path="/*" component={HandleLegacyRoutes} />
</PrivateRouteWrapper>

<PrivateRouteWrapper showMenu={false} path="/cient">
<PrivateRoute allow="CLIENT" path="/*" component={HandleLegacyRoutes} />
</PrivateRouteWrapper>

<PrivateRouteWrapper showMenu={false} path="/developer">
Expand Down

0 comments on commit 07ad818

Please sign in to comment.