Skip to content

Commit

Permalink
chore: #228 feedbacks fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuong Vu committed Sep 3, 2020
1 parent d4dc8a9 commit d36f78f
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 16 deletions.
9 changes: 5 additions & 4 deletions packages/react-app-scaffolder/app/templates/_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"appEnv": "local",
"sentryDns": "",
"connectClientId": "<%= clientId %>",
"connectUserPoolId": "eu-west-2_hbt0B7yys",
"connectUserPoolId": "",
"googleAnalyticsKey": "",
"connectOAuthUrl": "https://dev.connect.reapit.cloud",
"platformApiUrl": "https://dev.platform.reapit.cloud",
"graphqlUri": "https://b97ovghsoa.execute-api.eu-west-2.amazonaws.com/dev/graphql"
"connectOAuthUrl": "",
"platformApiUrl": "",
"graphqlUri": "",
"marketplaceUrl": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"sentryDns": "",
"googleAnalyticsKey": "",
"connectClientId": "",
"connectUserPoolId": "eu-west-2_hbt0B7yys",
"connectOAuthUrl": "https://dev.connect.reapit.cloud",
"platformApiUrl": "https://dev.platform.reapit.cloud",
"graphqlUri": "https://b97ovghsoa.execute-api.eu-west-2.amazonaws.com/dev/graphql"
"connectUserPoolId": "",
"connectOAuthUrl": "",
"platformApiUrl": "",
"graphqlUri": "",
"marketplaceUrl": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ const props = {
children: Component,
}

jest.mock('@reapit/elements', () => ({
notification: {
error: jest.fn(),
},
}))

describe('ErrorBoundary', () => {
it('should match a snapshot when no error', () => {
expect(shallow(<ErrorBoundary {...props} />)).toMatchSnapshot()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import * as React from 'react'
import errorMessages from '@/constants/error-messages'
import { notification } from '@reapit/elements'

export interface ErrorState {
hasFailed: boolean
Expand All @@ -23,7 +25,7 @@ export class ErrorBoundary extends React.Component<ErrorProps, ErrorState> {
}

componentDidCatch(error: Error, info: React.ErrorInfo) {
console.error('ERROR BOUNDARY CAUGHT', error.message, info)
notification.error({ message: errorMessages.DEFAULT_COMPONENT_ERROR, placement: 'bottomRight' })
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@ export const generateMenuConfig = (
}
}

export const callbackAppClick = () =>
(window.location.href =
window.location.href.includes('dev') || window.location.href.includes('localhost')
? 'https://dev.marketplace.reapit.cloud/installed'
: 'https://marketplace.reapit.cloud/installed')
export const callbackAppClick = () => {
window.location.href = window.reapit.config.marketplaceUrl
}

export type MenuProps = RouteComponentProps

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const errorMessages = {
DEFAULT_COMPONENT_ERROR: 'Something went wrong with this component',
}

export default errorMessages
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* istanbul ignore file */
import * as Sentry from '@sentry/browser'
import React from 'react'
import { render } from 'react-dom'
Expand All @@ -17,6 +18,7 @@ window.reapit = {
connectOAuthUrl: '',
platformApiUrl: '',
graphqlUri: '',
marketplaceUrl: '',
},
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* istanbul ignore file */
import * as React from 'react'
import { Route, Router as BrowserRouter, Switch, Redirect } from 'react-router-dom'
import { createBrowserHistory } from 'history'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type Config = {
connectOAuthUrl: string
platformApiUrl: string
graphqlUri: string
marketplaceUrl: string
}

declare global {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ window.reapit = {
connectUserPoolId: '',
googleAnalyticsKey: '',
connectOAuthUrl: '',
connectUserPoolId: '',
platformApiUrl: '',
graphqlUri: '',
marketplaceUrl: '',
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export type Config = {
googleAnalyticsKey: string
connectOAuthUrl: string
platformApiUrl: string
graphqlUri: string
marketplaceUrl: string
}

declare global {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ window.reapit = {
connectUserPoolId: '',
googleAnalyticsKey: '',
connectOAuthUrl: '',
connectUserPoolId: '',
platformApiUrl: '',
graphqlUri: '',
marketplaceUrl: '',
},
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export type Config = {
googleAnalyticsKey: string
connectOAuthUrl: string
platformApiUrl: string
graphqlUri: string
marketplaceUrl: string
}

declare global {
Expand Down

0 comments on commit d36f78f

Please sign in to comment.