Skip to content

Commit 282b89c

Browse files
LieutenantRogerfikzzzyyoutionshivam-51
authored
[Bug Bash] Fixes I (#5826)
* Enable Clear Date Input (#5809) * Validate Non Valid Input Characters (#5810) * ci:deploying * fix: issue #5807 (#5811) * fix: issue #5802 (#5812) * fix: issue #5796 (#5813) * fix: #5798 (#5814) * fix:5798-2 * fix: test * fix: issue #5800 (#5816) * fix: issue #5786 (#5815) * fix: issue #5802 (#5823) * deploying ca-branch * revert ci Co-authored-by: M Fikri A <81801960+fikzzzy@users.noreply.github.com> Co-authored-by: yoution <yoution@users.noreply.github.com> Co-authored-by: Shivam Kumar Singh <shivamhere247@gmail.com>
1 parent f30d652 commit 282b89c

File tree

13 files changed

+92
-69
lines changed

13 files changed

+92
-69
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ workflows:
342342
filters:
343343
branches:
344344
only:
345-
- free
345+
- develop
346346
# This is alternate dev env for parallel testing
347347
- "build-test":
348348
context : org-global

__tests__/shared/components/Settings/Account/__snapshots__/index.jsx.snap

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ exports[`renders account setting page correctly 1`] = `
1010
<SideBar
1111
icons={
1212
Object {
13-
"linked accounts": <LinkedAccountIcon
14-
height="30"
15-
viewBox="0 0 30 30"
16-
width="30"
17-
xmlns="http://www.w3.org/2000/svg"
18-
/>,
1913
"my account": <MyAccountIcon
2014
height="30"
2115
viewBox="0 0 30 30"
@@ -27,7 +21,6 @@ exports[`renders account setting page correctly 1`] = `
2721
names={
2822
Array [
2923
"my account",
30-
"linked account",
3124
]
3225
}
3326
/>

__tests__/shared/components/Settings/Account/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const settingsUI = {
1212
TABS: {
1313
ACCOUNT: {
1414
MYACCOUNT: 'my account',
15-
LINKEDACCOUNT: 'linked account',
15+
// LINKEDACCOUNT: 'linked account',
1616
},
1717
},
1818
};

src/shared/components/Settings/Account/LinkedAccount/AddWebLink.jsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default class AddWebLink extends React.Component {
1313
super(props);
1414
this.state = {
1515
webLink: '',
16+
webLinkEmpty: false,
1617
};
1718

1819
this.onUpdateWebLink = this.onUpdateWebLink.bind(this);
@@ -32,6 +33,11 @@ export default class AddWebLink extends React.Component {
3233
// Set web link
3334
onUpdateWebLink(e) {
3435
e.preventDefault();
36+
if (e.target.value) {
37+
this.setState({
38+
webLinkEmpty: false,
39+
});
40+
}
3541
this.setState({ webLink: e.target.value });
3642
}
3743

@@ -62,6 +68,11 @@ export default class AddWebLink extends React.Component {
6268
tokenV3,
6369
} = this.props;
6470
const { webLink } = this.state;
71+
if (!webLink) {
72+
this.setState({
73+
webLinkEmpty: true,
74+
});
75+
}
6576
if (webLink && this.isWebLinkValid() && !this.webLinkExist()) {
6677
addWebLink(handle, tokenV3, webLink);
6778
}
@@ -82,7 +93,7 @@ export default class AddWebLink extends React.Component {
8293
}
8394

8495
render() {
85-
const { webLink } = this.state;
96+
const { webLink, webLinkEmpty } = this.state;
8697

8798
const webLinkValid = this.isWebLinkValid();
8899
const webLinkExist = this.webLinkExist();
@@ -172,6 +183,15 @@ export default class AddWebLink extends React.Component {
172183
onKeyDown={this.onAddWebLink}
173184
required
174185
/>
186+
{
187+
webLinkEmpty && (
188+
<div styleName="form-input-error">
189+
<p>
190+
Please Enter External Link
191+
</p>
192+
</div>
193+
)
194+
}
175195
{
176196
!webLinkValid && !webLinkExist
177197
&& (

src/shared/components/Settings/Account/LinkedAccount/index.jsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,13 @@ export default class LinkedAccount extends React.Component {
105105
if (!linkedAccounts.length) {
106106
const providers = _.omit(externalAccountsData, ['userId', 'updatedAt', 'createdAt', 'createdBy', 'updatedBy']);
107107

108-
_.forEach(_.keys(providers), (p) => {
109-
if (providers[p]) {
110-
linkedAccounts.push({ providerType: p });
111-
}
112-
});
108+
if (_.keys(_.omitBy(providers, _.isNil)).length > 1) {
109+
_.forEach(_.keys(providers), (p) => {
110+
if (providers[p]) {
111+
linkedAccounts.push({ providerType: p });
112+
}
113+
});
114+
}
113115
}
114116
_.forEach(linkedAccounts, (linkedAccount) => {
115117
const providerType = linkedAccount.providerType || linkedAccount.provider;

src/shared/components/Settings/Account/index.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import _ from 'lodash';
88

99
import Accordion from 'components/Settings/Accordion';
1010
import MyAccountIcon from 'assets/images/account/sideicons/myaccount.svg';
11-
import LinkedAccountIcon from 'assets/images/account/sideicons/linkedaccount.svg';
11+
// import LinkedAccountIcon from 'assets/images/account/sideicons/linkedaccount.svg';
1212
import ErrorWrapper from 'components/Settings/ErrorWrapper';
1313
import SideBar from '../SideBar';
1414
import ComingSoon from '../ComingSoon';
1515
import MyAccount from './MyAccount';
16-
import LinkedAccount from './LinkedAccount';
16+
// import LinkedAccount from './LinkedAccount';
1717
import { SCREEN_SIZE } from '../constants';
1818
import './styles.scss';
1919

@@ -74,14 +74,14 @@ export default class Account extends React.Component {
7474
const currentTab = this.tablink || settingsUI.currentAccountTab;
7575
const icons = {
7676
'my account': <MyAccountIcon />,
77-
'linked accounts': <LinkedAccountIcon />,
77+
// 'linked accounts': <LinkedAccountIcon />,
7878
};
7979
const renderTabContent = (tab) => {
8080
switch (tab) {
8181
case 'my account':
8282
return <MyAccount {...this.props} />;
83-
case 'linked accounts':
84-
return <LinkedAccount {...this.props} />;
83+
// case 'linked accounts':
84+
// return <LinkedAccount {...this.props} />;
8585
default:
8686
return <ComingSoon />;
8787
}

src/shared/components/Settings/Profile/BasicInfo/index.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,10 @@ export default class BasicInfo extends ConsentComponent {
255255
case 'streetAddr2':
256256
newBasicInfo.addresses[0][e.target.name] = e.target.value;
257257
break;
258+
case 'firstName':
259+
case 'lastName':
260+
newBasicInfo[e.target.name] = e.target.value.replace(/[^a-zA-Z0-9,.]/g, '');
261+
break;
258262
default:
259263
newBasicInfo[e.target.name] = e.target.value;
260264
}

src/shared/components/Settings/Profile/Education/index.jsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,10 @@ export default class Education extends ConsentComponent {
181181
}
182182

183183
onUpdateDate(date, timePeriod) {
184-
if (date) {
185-
const { newEducation: oldEducation } = this.state;
186-
const newEducation = { ...oldEducation };
187-
newEducation[timePeriod] = date;
188-
this.setState({ newEducation, isSubmit: false });
189-
}
184+
const { newEducation: oldEducation } = this.state;
185+
const newEducation = { ...oldEducation };
186+
newEducation[timePeriod] = date || '';
187+
this.setState({ newEducation, isSubmit: false });
190188
}
191189

192190
/**
@@ -530,6 +528,7 @@ export default class Education extends ConsentComponent {
530528
<div styleName="field col-2">
531529
<DatePicker
532530
readOnly
531+
showClearDate
533532
numberOfMonths={1}
534533
isOutsideRange={moment().subtract(1, 'd')}
535534
date={newEducation.timePeriodFrom}
@@ -559,6 +558,7 @@ export default class Education extends ConsentComponent {
559558
newEducation.graduated ? (
560559
<DatePicker
561560
readOnly
561+
showClearDate
562562
numberOfMonths={1}
563563
isOutsideRange={moment().subtract(1, 'd')}
564564
date={newEducation.timePeriodTo}
@@ -569,6 +569,7 @@ export default class Education extends ConsentComponent {
569569
) : (
570570
<DatePicker
571571
readOnly
572+
showClearDate
572573
numberOfMonths={1}
573574
date={newEducation.timePeriodTo}
574575
id="date-to1"

src/shared/components/Settings/Profile/Education/styles.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ $checkbox-bg-selected: $tc-dark-blue;
1313
flex-direction: column;
1414
align-items: left;
1515

16+
:global {
17+
.SingleDatePickerInput {
18+
&__showClearDate {
19+
padding-right: 0;
20+
}
21+
22+
&_clearDate {
23+
padding: 8px 10px;
24+
top: 20px;
25+
background: transparent;
26+
}
27+
}
28+
}
29+
1630
@include upto-sm {
1731
padding-bottom: 0;
1832
}

src/shared/components/Settings/Profile/Hobby/index.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export default class Hobby extends ConsentComponent {
137137
}
138138
this.setState({
139139
showConfirmation: false,
140+
isEdit: false,
140141
indexNo: null,
141142
isSubmit: false,
142143
});

src/shared/components/Settings/Profile/Work/index.jsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,6 @@ export default class Work extends ConsentComponent {
8181
endDateInvalid: false,
8282
endDateDisabled: false,
8383
endDateInvalidMsg: '',
84-
newWork: {
85-
company: '',
86-
position: '',
87-
cityTown: '',
88-
timePeriodFrom: '',
89-
timePeriodTo: '',
90-
industry: '',
91-
working: false,
92-
},
9384
});
9485
}
9586

src/shared/components/Settings/Tools/Devices/index.jsx

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -84,46 +84,43 @@ export default class Devices extends ConsentComponent {
8484
*/
8585
onHandleAddDevice(e) {
8686
e.preventDefault();
87-
const { newDevice, deviceTrait, isEdit } = this.state;
87+
const { newDevice, deviceTrait } = this.state;
8888
const { clearDeviceState } = this.props;
8989
this.setState({ isSubmit: true });
9090
if (this.onCheckFormValue(newDevice)) {
9191
return;
9292
}
93-
if (!isEdit) {
94-
const deviceItems = deviceTrait.traits
95-
? deviceTrait.traits.data.slice() : [];
96-
let exist = false;
97-
// eslint-disable-next-line no-restricted-syntax
98-
for (const item of deviceItems) {
99-
if (item.deviceType === newDevice.deviceType
100-
&& item.manufacturer === newDevice.manufacturer
101-
&& item.model === newDevice.model
102-
&& item.operatingSystem === newDevice.operatingSystem) {
103-
exist = true;
104-
break;
105-
}
106-
}
107-
if (exist === true) {
108-
const empty = {
109-
deviceType: '',
110-
manufacturer: '',
111-
model: '',
112-
operatingSystem: '',
113-
};
114-
this.setState({
115-
newDevice: empty,
116-
isEdit: false,
117-
indexNo: null,
118-
isSubmit: false,
119-
});
120-
clearDeviceState();
121-
setImmediate(() => {
122-
toastr.error('Looks like you\'ve already entered this device.');
123-
});
124-
return;
93+
const deviceItems = deviceTrait.traits
94+
? deviceTrait.traits.data.slice() : [];
95+
let exist = false;
96+
// eslint-disable-next-line no-restricted-syntax
97+
for (const item of deviceItems) {
98+
if (item.deviceType === newDevice.deviceType
99+
&& item.manufacturer === newDevice.manufacturer
100+
&& item.model === newDevice.model) {
101+
exist = true;
102+
break;
125103
}
126104
}
105+
if (exist === true) {
106+
const empty = {
107+
deviceType: '',
108+
manufacturer: '',
109+
model: '',
110+
operatingSystem: '',
111+
};
112+
this.setState({
113+
newDevice: empty,
114+
isEdit: false,
115+
indexNo: null,
116+
isSubmit: false,
117+
});
118+
clearDeviceState();
119+
setImmediate(() => {
120+
toastr.error('Looks like you\'ve already entered this device.');
121+
});
122+
return;
123+
}
127124
this.showConsent(this.onAddDevice.bind(this));
128125
}
129126

src/shared/reducers/page/ui/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const TABS = {
2525
},
2626
ACCOUNT: {
2727
MYACCOUNT: 'my account',
28-
LINKEDACCOUNT: 'linked accounts',
28+
// LINKEDACCOUNT: 'linked accounts',
2929
},
3030
};
3131

0 commit comments

Comments
 (0)