Skip to content

Commit b5785ab

Browse files
committed
update(app): improve quality of code; strictly follow lint warnings
1 parent fd29d38 commit b5785ab

File tree

13 files changed

+5400
-8134
lines changed

13 files changed

+5400
-8134
lines changed

package-lock.json

Lines changed: 5281 additions & 7996 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,41 @@
88
"private": true,
99
"main": "public/main.ts",
1010
"dependencies": {
11-
"@loadable/component": "^5.10.1",
11+
"@loadable/component": "^5.10.2",
1212
"@m3-moretv/react-code-input": "^1.1.6",
13-
"@types/classnames": "^2.2.8",
14-
"@types/jest": "24.0.11",
15-
"@types/loadable__component": "^5.9.0",
16-
"@types/node": "11.13.4",
17-
"@types/react": "16.8.13",
18-
"@types/react-dom": "16.8.4",
13+
"@types/classnames": "^2.2.9",
14+
"@types/jest": "^24.0.17",
15+
"@types/loadable__component": "^5.10.0",
16+
"@types/node": "^12.7.0",
17+
"@types/react": "^16.8.24",
18+
"@types/react-dom": "^16.8.5",
1919
"@types/react-flag-icon-css": "^1.0.2",
20-
"@types/react-virtualized": "^9.21.3",
21-
"@types/recharts": "^1.1.19",
22-
"@types/styled-components": "^4.1.14",
23-
"@types/yup": "^0.26.13",
24-
"antd": "^3.20.6",
20+
"@types/react-virtualized": "^9.21.4",
21+
"@types/recharts": "^1.1.20",
22+
"@types/styled-components": "^4.1.18",
23+
"@types/yup": "^0.26.22",
24+
"antd": "^3.21.2",
2525
"apollo-boost": "^0.4.3",
2626
"classnames": "^2.2.6",
27-
"concurrently": "^4.1.0",
28-
"electron": "^4.1.4",
29-
"electron-builder": "^20.39.0",
27+
"concurrently": "^4.1.1",
28+
"electron": "^6.0.1",
29+
"electron-builder": "^21.2.0",
3030
"electron-is-dev": "^1.1.0",
31-
"formik": "^1.5.4",
32-
"graphql": "^14.2.1",
31+
"formik": "^1.5.8",
32+
"graphql": "^14.4.2",
3333
"moment": "^2.24.0",
3434
"p-min-delay": "^3.1.0",
3535
"react": "^16.8.6",
3636
"react-apollo": "^3.0.0",
3737
"react-dom": "^16.8.6",
3838
"react-flag-icon-css": "^1.0.25",
39-
"react-router-dom": "^5.0.0",
40-
"react-scripts": "2.1.8",
39+
"react-router-dom": "^5.0.1",
40+
"react-scripts": "^3.0.1",
4141
"react-virtualized": "^9.21.1",
4242
"recharts": "^1.6.2",
43-
"styled-components": "^4.2.0",
44-
"typescript": "3.4.3",
45-
"wait-on": "^3.2.0",
43+
"styled-components": "^4.3.2",
44+
"typescript": "^3.4.5",
45+
"wait-on": "^3.3.0",
4646
"yup": "^0.27.0"
4747
},
4848
"scripts": {
@@ -62,8 +62,8 @@
6262
"not op_mini all"
6363
],
6464
"devDependencies": {
65-
"@types/react-router-dom": "^4.3.3",
65+
"@types/react-router-dom": "^4.3.4",
6666
"cross-env": "^5.2.0",
67-
"tslint": "^5.15.0"
67+
"tslint": "^5.18.0"
6868
}
6969
}

src/components/forms/user/QuizForm.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ const CustomRadioGroup = ({ options, selectAnswer, answer, isLoading }: ICustomR
8484
};
8585

8686
class QuizForm extends React.PureComponent<IQuizFormProps> {
87-
constructor(props: IQuizFormProps) {
88-
super(props);
89-
}
90-
9187
componentDidMount() {
9288
const { history, currentIndex } = this.props;
9389
const { answers, setAnswers } = this.context;

src/components/forms/user/validations.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const NewPasswordSchema = Yup.object().shape({
3232
.required('Password can\'t be blank'),
3333
confirmPassword: Yup.string()
3434
.min(6, 'Must be at least 6 characters')
35-
.oneOf([Yup.ref('password'), null], 'Passwords must match')
35+
.oneOf([Yup.ref('password')], 'Passwords must match')
3636
.required('Password confirmation can\'t be blank'),
3737
});
3838

src/components/layout/AppLayout.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@ import { Layout, Icon, Affix } from 'antd';
44
import { useUserContextValue } from '../../contexts/UserContext';
55
import { useSidenavContextValue } from '../../contexts/SidenavContext';
66
import AccountVerifier from '../../HOC/AccountVerifier';
7-
8-
const { Content } = Layout;
9-
107
import AppSideNav from './AppSidenav';
118
import MarketsDropdown from './MarketsDropdown';
129

13-
const { Header } = Layout;
10+
const { Content, Header } = Layout;
1411

1512
interface IAppLayoutProps {
1613
requireAuth: boolean,

src/components/layout/AppSidenav.tsx

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -163,36 +163,34 @@ class AppSidenav extends React.PureComponent<RouteComponentProps, { collapsedWid
163163
</span>
164164
}
165165
>
166-
{groups.map(({ title, items }: INavGroup) => {
167-
return (
168-
<ItemGroup title={title} key={`group-${slugify(title)}`}>
169-
{items.map((item: INavRoute) => {
170-
const {
171-
label: itemLabel,
172-
path: itemPath,
173-
externalLink: itemExternalLink,
174-
} = item;
175-
const itemKey = slugify(itemLabel);
176-
return (
177-
<Menu.Item
178-
key={itemKey}
179-
onClick={() => {
180-
if (itemExternalLink) {
181-
window.open(itemExternalLink, '_blank');
182-
} else {
183-
this.changeRoute({ itemKey, subMenuKey }, itemPath);
184-
}
185-
}}
186-
>
187-
<MenuItemWrapper collapsed={collapsed} label={itemLabel}>
188-
<span>{itemLabel}</span>
189-
</MenuItemWrapper>
190-
</Menu.Item>
191-
);
192-
})}
193-
</ItemGroup>
194-
);
195-
})}
166+
{groups.map(({ title, items }: INavGroup) => (
167+
<ItemGroup title={title} key={`group-${slugify(title)}`}>
168+
{items.map((item: INavRoute) => {
169+
const {
170+
label: itemLabel,
171+
path: itemPath,
172+
externalLink: itemExternalLink,
173+
} = item;
174+
const itemKey = slugify(itemLabel);
175+
return (
176+
<Menu.Item
177+
key={itemKey}
178+
onClick={() => {
179+
if (itemExternalLink) {
180+
window.open(itemExternalLink, '_blank');
181+
} else {
182+
this.changeRoute({ itemKey, subMenuKey }, itemPath);
183+
}
184+
}}
185+
>
186+
<MenuItemWrapper collapsed={collapsed} label={itemLabel}>
187+
<span>{itemLabel}</span>
188+
</MenuItemWrapper>
189+
</Menu.Item>
190+
);
191+
})}
192+
</ItemGroup>
193+
))}
196194
</SubMenu>
197195
);
198196
}

src/components/layout/AppUserMenu.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ class AppUserMenu extends React.PureComponent<IAppUserMenuProps, {}> {
138138
deleteAuthToken();
139139
deleteSidenavState();
140140
setSelectedKeys({ itemKey: 'dashboard' });
141+
localStorage.removeItem('dashboard_interval');
141142
history.replace('/login');
142143
}
143144

src/components/layout/MarketsDropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class MarketsDropdown extends React.Component<{}, { visibility: boolean }> {
9595
onVisibleChange={this.handleVisibleChange}
9696
placement="bottomRight"
9797
>
98-
<a className="ant-dropdown-link" href="#" title="Market">
98+
<a className="ant-dropdown-link" href="#!" title="Market">
9999
<FlagIcon className="mr-2" size="lg" code={countryCode.toLowerCase()} />
100100
<span className="d-none d-sm-inline">{label}</span>
101101
<Icon className="ml-2" type="down" />

src/components/pages/register/FreeAndTrial.tsx

Lines changed: 52 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { ReactNode } from 'react';
2-
import { Query, graphql } from 'react-apollo';
2+
import { Query } from 'react-apollo';
33
import { Redirect } from 'react-router-dom';
44
import styled from 'styled-components';
55
import { Link, RouteComponentProps } from 'react-router-dom';
@@ -10,7 +10,6 @@ import PageSpinner from '../../spinners/PageSpinner';
1010
import AccountVerifier from '../../../HOC/AccountVerifier';
1111
import logoLight from '../../../assets/images/logo-light.png';
1212
import { AFFILIATE } from '../../../apollo/queries/affiliate';
13-
import { SEND_ONBOARDING_CODE } from '../../../apollo/mutations/user';
1413

1514
const { Title, Paragraph } = Typography;
1615

@@ -76,64 +75,57 @@ const StyledDiv = styled.div`
7675
padding: 24px 12px;
7776
`;
7877

79-
class FreeAndTrial extends React.Component<RouteComponentProps<{ affiliateId: string }>> {
80-
constructor(props: RouteComponentProps<{ affiliateId: string }>) {
81-
super(props);
82-
}
83-
84-
render() {
85-
const { match: { params } } = this.props;
86-
const { affiliateId } = params;
87-
let affiliatePlan: string | ReactNode | undefined;
78+
const FreeAndTrial = ({ match: { params } }: RouteComponentProps<{ affiliateId: string }>) => {
79+
const { affiliateId } = params;
80+
let affiliatePlan: string | ReactNode | undefined;
8881

89-
return (
90-
<Query<IQueryData, IQueryVariables>
91-
query={AFFILIATE}
92-
variables={{ affiliateId }}
93-
skip={!affiliateId}
94-
>
95-
{({ loading, data, error }) => {
96-
if (error) {
97-
return <Redirect to="/login?error=affiliateId" />;
98-
}
99-
if (data && !loading) {
100-
const { affiliate: { plan } } = data;
101-
affiliatePlan = <span style={{ textTransform: 'capitalize' }}>{plan} Trial</span>;
102-
}
103-
const titleText = (affiliateId && affiliatePlan) || loading ?
104-
affiliatePlan : 'Start with your free REITScreener account';
105-
return (
106-
<PageSpinner loading={loading}>
107-
<FreeAndTrialWrapper>
108-
<StyledDiv>
109-
<StyledBrandLogo draggable={false} src={logoLight} alt="REITScreener" />
110-
<Card>
111-
<Row className="root-row" type="flex">
112-
<Col xs={24} className="root-col">
113-
<Title level={3}>{titleText}</Title>
114-
</Col>
115-
<Col xs={24} className="root-col">
116-
<RegistrationForm
117-
affiliateId={affiliateId}
118-
/>
119-
<Paragraph>
120-
By registering you agree with the<br/>
121-
<Link to="/terms-and-conditions">Terms and Conditions</Link>
122-
</Paragraph>
123-
<Paragraph>
124-
Already have an account? <Link to="/login">Sign in</Link>
125-
</Paragraph>
126-
</Col>
127-
</Row>
128-
</Card>
129-
</StyledDiv>
130-
</FreeAndTrialWrapper>
131-
</PageSpinner>
132-
);
133-
}}
134-
</Query>
135-
);
136-
}
137-
}
82+
return (
83+
<Query<IQueryData, IQueryVariables>
84+
query={AFFILIATE}
85+
variables={{ affiliateId }}
86+
skip={!affiliateId}
87+
>
88+
{({ loading, data, error }) => {
89+
if (error) {
90+
return <Redirect to="/login?error=affiliateId" />;
91+
}
92+
if (data && !loading) {
93+
const { affiliate: { plan } } = data;
94+
affiliatePlan = <span style={{ textTransform: 'capitalize' }}>{plan} Trial</span>;
95+
}
96+
const titleText = (affiliateId && affiliatePlan) || loading ?
97+
affiliatePlan : 'Start with your free REITScreener account';
98+
return (
99+
<PageSpinner loading={loading}>
100+
<FreeAndTrialWrapper>
101+
<StyledDiv>
102+
<StyledBrandLogo draggable={false} src={logoLight} alt="REITScreener" />
103+
<Card>
104+
<Row className="root-row" type="flex">
105+
<Col xs={24} className="root-col">
106+
<Title level={3}>{titleText}</Title>
107+
</Col>
108+
<Col xs={24} className="root-col">
109+
<RegistrationForm
110+
affiliateId={affiliateId}
111+
/>
112+
<Paragraph>
113+
By registering you agree with the<br/>
114+
<Link to="/terms-and-conditions">Terms and Conditions</Link>
115+
</Paragraph>
116+
<Paragraph>
117+
Already have an account? <Link to="/login">Sign in</Link>
118+
</Paragraph>
119+
</Col>
120+
</Row>
121+
</Card>
122+
</StyledDiv>
123+
</FreeAndTrialWrapper>
124+
</PageSpinner>
125+
);
126+
}}
127+
</Query>
128+
);
129+
};
138130

139131
export default AccountVerifier(FreeAndTrial, true);

src/components/pages/register/Quiz.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { graphql, withApollo, WithApolloClient } from 'react-apollo';
2+
import { withApollo, WithApolloClient } from 'react-apollo';
33
import styled from 'styled-components';
44
import { Link, Switch, Route, Redirect } from 'react-router-dom';
55
import { Row, Col, Typography, Button, message } from 'antd';
@@ -14,10 +14,6 @@ import { ASSESS_ONBOARDING_SCORE } from '../../../apollo/mutations/user';
1414

1515
const { Title } = Typography;
1616

17-
interface IQuizProps {
18-
assessOnboardingScore: any,
19-
}
20-
2117
interface IQuizStates {
2218
isLoading: boolean,
2319
error: string | null,
@@ -131,7 +127,8 @@ class Quiz extends React.PureComponent<WithApolloClient<{}>, IQuizStates> {
131127
<Title level={4} className="text-center">
132128
Let’s get to know you better – it won’t take more than a minute&nbsp;
133129
and it will help you (and us!) figure out where you are in your&nbsp;
134-
investing journey and what’s your ideal next step.👍
130+
investing journey and what’s your ideal next step.&nbsp;
131+
<span role="img" aria-label="thumbs-up">👍</span>
135132
</Title>
136133
<Link to="/register/quiz/1">
137134
<StyledButton type="primary" size="large">

0 commit comments

Comments
 (0)