Skip to content

Commit

Permalink
chore: #1997 update the routing and app title for the developer portal (
Browse files Browse the repository at this point in the history
  • Loading branch information
NghiaPham authored Jul 15, 2020
1 parent 55813fa commit a6b2262
Show file tree
Hide file tree
Showing 24 changed files with 94 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports[`DeveloperAppDetail should match a snapshot 1`] = `
Array [
Object {
"key": "developerAppDetailRoute",
"pathname": "/developer/apps/:appid",
"pathname": "/apps/:appid",
},
]
}
Expand All @@ -34,7 +34,7 @@ exports[`DeveloperAppDetail should match a snapshot 1`] = `
Object {
"hash": "",
"key": "developerAppDetailRoute",
"pathname": "/developer/apps/:appid",
"pathname": "/apps/:appid",
"search": "",
},
],
Expand All @@ -47,7 +47,7 @@ exports[`DeveloperAppDetail should match a snapshot 1`] = `
"location": Object {
"hash": "",
"key": "developerAppDetailRoute",
"pathname": "/developer/apps/:appid",
"pathname": "/apps/:appid",
"search": "",
},
"push": [Function],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports[`ManageApp should match snapshot 1`] = `
Array [
Object {
"key": "developerAppDetailRoute",
"pathname": "/developer/apps/:appid",
"pathname": "/apps/:appid",
},
]
}
Expand All @@ -34,7 +34,7 @@ exports[`ManageApp should match snapshot 1`] = `
Object {
"hash": "",
"key": "developerAppDetailRoute",
"pathname": "/developer/apps/:appid",
"pathname": "/apps/:appid",
"search": "",
},
],
Expand All @@ -47,7 +47,7 @@ exports[`ManageApp should match snapshot 1`] = `
"location": Object {
"hash": "",
"key": "developerAppDetailRoute",
"pathname": "/developer/apps/:appid",
"pathname": "/apps/:appid",
"search": "",
},
"push": [Function],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('AppContent', () => {
const spyOpenUrl = jest.spyOn(window, 'open')
const fn = handleOpenAppPreview(appId)
fn()
expect(spyOpenUrl).toBeCalledWith('developer/apps/appId/preview', '_blank')
expect(spyOpenUrl).toBeCalledWith('/apps/appId/preview', '_blank')
})
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react'
import routes from '@/constants/routes'
import dayjs from 'dayjs'
import { Dispatch } from 'redux'
import { GET_ALL_PAGE_SIZE } from '@/constants/paginator'
Expand Down Expand Up @@ -54,7 +55,7 @@ export const handleUninstallSuccess = ({
}

export const handleOpenAppPreview = (appId: string) => () => {
const url = `developer/apps/${appId}/preview`
const url = routes.APP_PREVIEW.replace(':appId', appId)
window.open(url, '_blank')
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports[`Login should match a snapshot 1`] = `
Array [
Object {
"key": "developerHomeRoute",
"pathname": "/developer/apps",
"pathname": "/apps",
},
]
}
Expand All @@ -34,7 +34,7 @@ exports[`Login should match a snapshot 1`] = `
Object {
"hash": "",
"key": "developerHomeRoute",
"pathname": "/developer/apps",
"pathname": "/apps",
"search": "",
},
],
Expand All @@ -47,7 +47,7 @@ exports[`Login should match a snapshot 1`] = `
"location": Object {
"hash": "",
"key": "developerHomeRoute",
"pathname": "/developer/apps",
"pathname": "/apps",
"search": "",
},
"push": [Function],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exports[`Authentication renderClientModal should match snapshot 1`] = `
</span>
<span>
<Link
to="/developer/desktop"
to="/desktop"
>
Desktop
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,10 @@ describe('Authentication', () => {
})
describe('onMarketplaceButtonClick', () => {
it('should run correctly', () => {
const fn = onMarketplaceButtonClick(history)
fn()
expect(history.replace).toBeCalledWith(Routes.DEVELOPER)
jest.spyOn(window, 'open')
onMarketplaceButtonClick()
expect(window.open).toBeCalledWith(window.reapit.config.marketplaceUrl, '_self')
;(window.open as jest.Mock).mockReset()
})
})
describe('onRegisterButtonClick', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ export const onRegisterButtonClick = (history: History) => {
}
}

export const onMarketplaceButtonClick = (history: History) => {
return () => {
history.replace(Routes.DEVELOPER)
}
export const onMarketplaceButtonClick = () => {
window.open(window.reapit.config.marketplaceUrl, '_self')
}

export const onLogoutButtonClick = (dispatch: Dispatch) => {
Expand Down Expand Up @@ -77,7 +75,7 @@ export const renderDeveloperModal = (history, dispatch) => {
footerItems={
<>
<Button onClick={onRegisterButtonClick(history)}>Register</Button>
<Button onClick={onMarketplaceButtonClick(history)}>Marketplace</Button>
<Button onClick={onMarketplaceButtonClick}>Marketplace</Button>
<Button onClick={onLogoutButtonClick(dispatch)}>Logout</Button>
</>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ exports[`DeveloperDesktopPage should match snapshot 1`] = `
To learn more about what’s possible with the Desktop API, please visit the
<a
href="/developer/api-docs/api/desktop-api"
href="/api-docs/api/desktop-api"
rel="noreferrer"
target="_blank"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ exports[`DeveloperSubmitApp should match a snapshot when pendingRevisions = true
"entries": Array [
Object {
"hash": "",
"pathname": "/developer/apps/undefined",
"pathname": "/apps/undefined",
"search": "",
"state": undefined,
},
Expand All @@ -108,7 +108,7 @@ exports[`DeveloperSubmitApp should match a snapshot when pendingRevisions = true
"listen": [Function],
"location": Object {
"hash": "",
"pathname": "/developer/apps/undefined",
"pathname": "/apps/undefined",
"search": "",
"state": undefined,
},
Expand All @@ -119,12 +119,12 @@ exports[`DeveloperSubmitApp should match a snapshot when pendingRevisions = true
>
<Component>
<Redirect
to="/developer/apps/undefined"
to="/apps/undefined"
>
<Lifecycle
onMount={[Function]}
onUpdate={[Function]}
to="/developer/apps/undefined"
to="/apps/undefined"
/>
</Redirect>
</Component>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ describe('DeveloperSubmitApp', () => {
const fn = handleOpenAppPreview(params)
fn()
expect(spyLocalStorageSetItem).toBeCalledWith('developer-preview-app', expected)
expect(spyOpenUrl).toBeCalledWith('developer/apps/appId/preview', '_blank')
expect(spyOpenUrl).toBeCalledWith('/apps/appId/preview', '_blank')
})
})

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react'
import routes from '@/constants/routes'
import { Redirect } from 'react-router-dom'
import { History } from 'history'
import { useHistory, useParams } from 'react-router'
Expand Down Expand Up @@ -293,7 +294,7 @@ export const handleOpenAppPreview = ({
media,
}

const url = `developer/apps/${appId}/preview`
const url = routes.APP_PREVIEW.replace(':appId', appId)
localStorage.setItem('developer-preview-app', JSON.stringify(appDetailState))
window.open(url, '_blank')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ exports[`Login should match a snapshot 1`] = `
Array [
Object {
"key": "loginRoute",
"pathname": "/developer/login",
"pathname": "/login",
},
]
}
Expand All @@ -34,7 +34,7 @@ exports[`Login should match a snapshot 1`] = `
Object {
"hash": "",
"key": "loginRoute",
"pathname": "/developer/login",
"pathname": "/login",
"search": "",
},
],
Expand All @@ -47,7 +47,7 @@ exports[`Login should match a snapshot 1`] = `
"location": Object {
"hash": "",
"key": "loginRoute",
"pathname": "/developer/login",
"pathname": "/login",
"search": "",
},
"push": [Function],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,14 +513,14 @@ exports[`Register should match a snapshot 1`] = `
>
Already have an account?
<Link
to="/developer/login"
to="/login"
>
<LinkAnchor
href="/developer/login"
href="/login"
navigate={[Function]}
>
<a
href="/developer/login"
href="/login"
onClick={[Function]}
>
Login
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ exports[`Tabs should match a snapshot 1`] = `
"active": false,
"displayText": "Profile",
"onTabClick": [Function],
"tabIdentifier": "/developer/settings/",
"tabIdentifier": "/settings/",
},
Object {
"active": false,
"displayText": "Organisation",
"onTabClick": [Function],
"tabIdentifier": "/developer/settings/organisation",
"tabIdentifier": "/settings/organisation",
},
Object {
"active": false,
"displayText": "Billing",
"onTabClick": [Function],
"tabIdentifier": "/developer/settings/billing",
"tabIdentifier": "/settings/billing",
},
]
}
Expand All @@ -45,12 +45,12 @@ exports[`Tabs should match a snapshot 1`] = `
<ul>
<li
className=""
key="/developer/settings/"
key="/settings/"
>
<a
aria-controls="/developer/settings/"
aria-controls="/settings/"
aria-selected={false}
id="/developer/settings/"
id="/settings/"
onClick={[Function]}
role="tab"
>
Expand All @@ -59,12 +59,12 @@ exports[`Tabs should match a snapshot 1`] = `
</li>
<li
className=""
key="/developer/settings/organisation"
key="/settings/organisation"
>
<a
aria-controls="/developer/settings/organisation"
aria-controls="/settings/organisation"
aria-selected={false}
id="/developer/settings/organisation"
id="/settings/organisation"
onClick={[Function]}
role="tab"
>
Expand All @@ -73,12 +73,12 @@ exports[`Tabs should match a snapshot 1`] = `
</li>
<li
className=""
key="/developer/settings/billing"
key="/settings/billing"
>
<a
aria-controls="/developer/settings/billing"
aria-controls="/settings/billing"
aria-selected={false}
id="/developer/settings/billing"
id="/settings/billing"
onClick={[Function]}
role="tab"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ exports[`WebhookTestModalBody WebhookTestModalBody should match snapshot 1`] = `
<a
className={[Function]}
href="/developer/api-docs/api/webhooks#testing"
href="/api-docs/api/webhooks#testing"
rel="noopener noreferrer"
target="_blank"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ exports[`DeveloperWebHooks should match a snapshot 1`] = `
This system is designed to flexibly work with how your application is built and deployed. If you wish, you can set up a single endpoint to catch all topics for all customers. Alternatively, you may wish to set up a different webhook subscription per topic or per customer. For more information about Webhooks, please see our
<a
className={[Function]}
href="/developer/api-docs/api/webhooks"
href="/api-docs/api/webhooks"
rel="noopener noreferrer"
target="_blank"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports[`ErrorContent should match snapshot 1`] = `
It looks as though you already have a subscription in place for the Developer Edition of Agency Cloud. If you have not received your email with instructions on how to download, please let us know using the live chat feature on the 
<a
className={[Function]}
href="https://marketplace.reapit.cloud/developer/help"
href="/help"
rel="noopener noreferrer"
target="_blank"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import * as React from 'react'
import { Button, SubTitleH6, ModalHeader, ModalBody, ModalFooter, ModalProps } from '@reapit/elements'
import linkStyles from '@/styles/elements/link.scss?mod'
import developerEditionStyles from '@/styles/blocks/developer-edition-modal.scss?mod'

const HELP_PAGE_LINK = 'https://marketplace.reapit.cloud/developer/help'
import routes from '@/constants/routes'

export type ErrorContentProps = Pick<ModalProps, 'afterClose'>

Expand All @@ -17,7 +16,7 @@ export const ErrorContent: React.FC<ErrorContentProps> = ({ afterClose }) => {
It looks as though you already have a subscription in place for the Developer Edition of Agency Cloud. If
you have not received your email with instructions on how to download, please let us know using the live
chat feature on the&nbsp;
<a className={linkStyles.link} target="_blank" rel="noopener noreferrer" href={HELP_PAGE_LINK}>
<a className={linkStyles.link} target="_blank" rel="noopener noreferrer" href={routes.HELP}>
&apos;Help&apos;
</a>
&nbsp;page.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exports[`StepBeforeYouStart should match snapshot 1`] = `
<React.Fragment>
<a
className="button is-white is-primary"
href="/developer/api-docs/developer-portal"
href="/api-docs/developer-portal"
rel="noreferrer"
target="_blank"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import routes from '@/constants/routes'

export const HelpLinks = {
WHATS_NEW: '/developer/api-docs/whats-new',
WHATS_NEW: `${routes.API_DOCS}/whats-new`,
BUG_REPORT:
'https://github.com/reapit/foundations/issues/new?assignees=&labels=bug%2C+needs-triage&template=bug_report.md&title=',
API_REQUEST:
Expand Down
Loading

0 comments on commit a6b2262

Please sign in to comment.