From c381f24f90ce3cfd549f440658d2ec70758c34d4 Mon Sep 17 00:00:00 2001 From: M Fikri A <81801960+fikzzzy@users.noreply.github.com> Date: Tue, 16 Nov 2021 22:22:43 +0700 Subject: [PATCH 01/54] Enable Clear Date Input (#5809) --- .../Settings/Profile/Education/index.jsx | 13 +++++++------ .../Settings/Profile/Education/styles.scss | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/shared/components/Settings/Profile/Education/index.jsx b/src/shared/components/Settings/Profile/Education/index.jsx index ffc9d7cecb..7df00f3408 100644 --- a/src/shared/components/Settings/Profile/Education/index.jsx +++ b/src/shared/components/Settings/Profile/Education/index.jsx @@ -181,12 +181,10 @@ export default class Education extends ConsentComponent { } onUpdateDate(date, timePeriod) { - if (date) { - const { newEducation: oldEducation } = this.state; - const newEducation = { ...oldEducation }; - newEducation[timePeriod] = date; - this.setState({ newEducation, isSubmit: false }); - } + const { newEducation: oldEducation } = this.state; + const newEducation = { ...oldEducation }; + newEducation[timePeriod] = date || ''; + this.setState({ newEducation, isSubmit: false }); } /** @@ -530,6 +528,7 @@ export default class Education extends ConsentComponent {
Date: Tue, 16 Nov 2021 23:20:08 +0700 Subject: [PATCH 02/54] Validate Non Valid Input Characters (#5810) --- src/shared/components/Settings/Profile/BasicInfo/index.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/shared/components/Settings/Profile/BasicInfo/index.jsx b/src/shared/components/Settings/Profile/BasicInfo/index.jsx index aa7e8c9711..9e96db632c 100644 --- a/src/shared/components/Settings/Profile/BasicInfo/index.jsx +++ b/src/shared/components/Settings/Profile/BasicInfo/index.jsx @@ -255,6 +255,10 @@ export default class BasicInfo extends ConsentComponent { case 'streetAddr2': newBasicInfo.addresses[0][e.target.name] = e.target.value; break; + case 'firstName': + case 'lastName': + newBasicInfo[e.target.name] = e.target.value.replace(/[^a-zA-Z0-9,.]/g, ''); + break; default: newBasicInfo[e.target.name] = e.target.value; } From 70dc4cfb5c91e552fbdb608868f77b3c65b42b3a Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Wed, 17 Nov 2021 00:23:02 +0800 Subject: [PATCH 03/54] ci:deploying --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 88aca8cf49..f887d76e39 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -343,6 +343,7 @@ workflows: branches: only: - develop + - ca-profile-bug-bash # This is alternate dev env for parallel testing - "build-test": context : org-global From 82552a8d3076206ba4203084de065eaef1954ea9 Mon Sep 17 00:00:00 2001 From: yoution Date: Wed, 17 Nov 2021 21:18:11 +0800 Subject: [PATCH 04/54] fix: issue #5807 (#5811) --- .../Settings/Account/LinkedAccount/index.jsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/shared/components/Settings/Account/LinkedAccount/index.jsx b/src/shared/components/Settings/Account/LinkedAccount/index.jsx index 216fd9f908..4c7008cd88 100644 --- a/src/shared/components/Settings/Account/LinkedAccount/index.jsx +++ b/src/shared/components/Settings/Account/LinkedAccount/index.jsx @@ -105,11 +105,13 @@ export default class LinkedAccount extends React.Component { if (!linkedAccounts.length) { const providers = _.omit(externalAccountsData, ['userId', 'updatedAt', 'createdAt', 'createdBy', 'updatedBy']); - _.forEach(_.keys(providers), (p) => { - if (providers[p]) { - linkedAccounts.push({ providerType: p }); - } - }); + if (_.keys(_.omitBy(providers, _.isNil)).length > 1) { + _.forEach(_.keys(providers), (p) => { + if (providers[p]) { + linkedAccounts.push({ providerType: p }); + } + }); + } } _.forEach(linkedAccounts, (linkedAccount) => { const providerType = linkedAccount.providerType || linkedAccount.provider; From 665a38513ea0d14943b9d0e70ffcce370eb82040 Mon Sep 17 00:00:00 2001 From: yoution Date: Wed, 17 Nov 2021 21:24:43 +0800 Subject: [PATCH 05/54] fix: issue #5802 (#5812) --- .../Settings/Tools/Devices/index.jsx | 64 +++++++++---------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/src/shared/components/Settings/Tools/Devices/index.jsx b/src/shared/components/Settings/Tools/Devices/index.jsx index 4e86b1302b..ff3ab7da46 100644 --- a/src/shared/components/Settings/Tools/Devices/index.jsx +++ b/src/shared/components/Settings/Tools/Devices/index.jsx @@ -84,46 +84,44 @@ export default class Devices extends ConsentComponent { */ onHandleAddDevice(e) { e.preventDefault(); - const { newDevice, deviceTrait, isEdit } = this.state; + const { newDevice, deviceTrait } = this.state; const { clearDeviceState } = this.props; this.setState({ isSubmit: true }); if (this.onCheckFormValue(newDevice)) { return; } - if (!isEdit) { - const deviceItems = deviceTrait.traits - ? deviceTrait.traits.data.slice() : []; - let exist = false; - // eslint-disable-next-line no-restricted-syntax - for (const item of deviceItems) { - if (item.deviceType === newDevice.deviceType - && item.manufacturer === newDevice.manufacturer - && item.model === newDevice.model - && item.operatingSystem === newDevice.operatingSystem) { - exist = true; - break; - } - } - if (exist === true) { - const empty = { - deviceType: '', - manufacturer: '', - model: '', - operatingSystem: '', - }; - this.setState({ - newDevice: empty, - isEdit: false, - indexNo: null, - isSubmit: false, - }); - clearDeviceState(); - setImmediate(() => { - toastr.error('Looks like you\'ve already entered this device.'); - }); - return; + const deviceItems = deviceTrait.traits + ? deviceTrait.traits.data.slice() : []; + let exist = false; + // eslint-disable-next-line no-restricted-syntax + for (const item of deviceItems) { + if (item.deviceType === newDevice.deviceType + && item.manufacturer === newDevice.manufacturer + && item.model === newDevice.model + && item.operatingSystem === newDevice.operatingSystem) { + exist = true; + break; } } + if (exist === true) { + const empty = { + deviceType: '', + manufacturer: '', + model: '', + operatingSystem: '', + }; + this.setState({ + newDevice: empty, + isEdit: false, + indexNo: null, + isSubmit: false, + }); + clearDeviceState(); + setImmediate(() => { + toastr.error('Looks like you\'ve already entered this device.'); + }); + return; + } this.showConsent(this.onAddDevice.bind(this)); } From b72fc3be422ab926beaa988b37dec7137e2386ae Mon Sep 17 00:00:00 2001 From: yoution Date: Wed, 17 Nov 2021 21:29:41 +0800 Subject: [PATCH 06/54] fix: issue #5796 (#5813) --- src/shared/components/Settings/Profile/Work/index.jsx | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/shared/components/Settings/Profile/Work/index.jsx b/src/shared/components/Settings/Profile/Work/index.jsx index 0bbfa631bf..bbff9e769d 100644 --- a/src/shared/components/Settings/Profile/Work/index.jsx +++ b/src/shared/components/Settings/Profile/Work/index.jsx @@ -81,15 +81,6 @@ export default class Work extends ConsentComponent { endDateInvalid: false, endDateDisabled: false, endDateInvalidMsg: '', - newWork: { - company: '', - position: '', - cityTown: '', - timePeriodFrom: '', - timePeriodTo: '', - industry: '', - working: false, - }, }); } From 9f349ca916e42249e10883709ebf02ce667eb242 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Singh Date: Thu, 18 Nov 2021 17:25:38 +0530 Subject: [PATCH 07/54] fix: #5798 (#5814) --- .../Settings/Account/__snapshots__/index.jsx.snap | 7 ------- __tests__/shared/components/Settings/Account/index.jsx | 2 +- src/shared/components/Settings/Account/index.jsx | 4 ++-- src/shared/reducers/page/ui/settings.js | 2 +- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/__tests__/shared/components/Settings/Account/__snapshots__/index.jsx.snap b/__tests__/shared/components/Settings/Account/__snapshots__/index.jsx.snap index a893682b08..706a373936 100644 --- a/__tests__/shared/components/Settings/Account/__snapshots__/index.jsx.snap +++ b/__tests__/shared/components/Settings/Account/__snapshots__/index.jsx.snap @@ -10,12 +10,6 @@ exports[`renders account setting page correctly 1`] = ` , "my account": diff --git a/__tests__/shared/components/Settings/Account/index.jsx b/__tests__/shared/components/Settings/Account/index.jsx index ab7a1d2bc0..0bd72d407d 100644 --- a/__tests__/shared/components/Settings/Account/index.jsx +++ b/__tests__/shared/components/Settings/Account/index.jsx @@ -12,7 +12,7 @@ const settingsUI = { TABS: { ACCOUNT: { MYACCOUNT: 'my account', - LINKEDACCOUNT: 'linked account', + // LINKEDACCOUNT: 'linked account', }, }, }; diff --git a/src/shared/components/Settings/Account/index.jsx b/src/shared/components/Settings/Account/index.jsx index 123dd15e55..e738b8ee3b 100644 --- a/src/shared/components/Settings/Account/index.jsx +++ b/src/shared/components/Settings/Account/index.jsx @@ -8,7 +8,7 @@ import _ from 'lodash'; import Accordion from 'components/Settings/Accordion'; import MyAccountIcon from 'assets/images/account/sideicons/myaccount.svg'; -import LinkedAccountIcon from 'assets/images/account/sideicons/linkedaccount.svg'; +// import LinkedAccountIcon from 'assets/images/account/sideicons/linkedaccount.svg'; import ErrorWrapper from 'components/Settings/ErrorWrapper'; import SideBar from '../SideBar'; import ComingSoon from '../ComingSoon'; @@ -74,7 +74,7 @@ export default class Account extends React.Component { const currentTab = this.tablink || settingsUI.currentAccountTab; const icons = { 'my account': , - 'linked accounts': , + // 'linked accounts': , }; const renderTabContent = (tab) => { switch (tab) { diff --git a/src/shared/reducers/page/ui/settings.js b/src/shared/reducers/page/ui/settings.js index 16d69c61f0..b0440eaed7 100644 --- a/src/shared/reducers/page/ui/settings.js +++ b/src/shared/reducers/page/ui/settings.js @@ -25,7 +25,7 @@ const TABS = { }, ACCOUNT: { MYACCOUNT: 'my account', - LINKEDACCOUNT: 'linked accounts', + // LINKEDACCOUNT: 'linked accounts', }, }; From 2aa8c517b1eb3ba66e2d300b2d891a9dd3a36a1a Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Thu, 18 Nov 2021 19:58:02 +0800 Subject: [PATCH 08/54] fix:5798-2 --- src/shared/components/Settings/Account/index.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/components/Settings/Account/index.jsx b/src/shared/components/Settings/Account/index.jsx index e738b8ee3b..b8a94d7489 100644 --- a/src/shared/components/Settings/Account/index.jsx +++ b/src/shared/components/Settings/Account/index.jsx @@ -80,8 +80,8 @@ export default class Account extends React.Component { switch (tab) { case 'my account': return ; - case 'linked accounts': - return ; + // case 'linked accounts': + // return ; default: return ; } From 1d5a5759fa0f40339541b6a9ebfe1268576929f0 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Thu, 18 Nov 2021 20:07:29 +0800 Subject: [PATCH 09/54] fix: test --- src/shared/components/Settings/Account/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/components/Settings/Account/index.jsx b/src/shared/components/Settings/Account/index.jsx index b8a94d7489..003f736c75 100644 --- a/src/shared/components/Settings/Account/index.jsx +++ b/src/shared/components/Settings/Account/index.jsx @@ -13,7 +13,7 @@ import ErrorWrapper from 'components/Settings/ErrorWrapper'; import SideBar from '../SideBar'; import ComingSoon from '../ComingSoon'; import MyAccount from './MyAccount'; -import LinkedAccount from './LinkedAccount'; +// import LinkedAccount from './LinkedAccount'; import { SCREEN_SIZE } from '../constants'; import './styles.scss'; From d6c1225b5cd8c038842a16a9dae8befaa2f4596c Mon Sep 17 00:00:00 2001 From: yoution Date: Thu, 18 Nov 2021 20:17:13 +0800 Subject: [PATCH 10/54] fix: issue #5800 (#5816) --- .../Account/LinkedAccount/AddWebLink.jsx | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/shared/components/Settings/Account/LinkedAccount/AddWebLink.jsx b/src/shared/components/Settings/Account/LinkedAccount/AddWebLink.jsx index 168581561d..d807114ece 100644 --- a/src/shared/components/Settings/Account/LinkedAccount/AddWebLink.jsx +++ b/src/shared/components/Settings/Account/LinkedAccount/AddWebLink.jsx @@ -13,6 +13,7 @@ export default class AddWebLink extends React.Component { super(props); this.state = { webLink: '', + webLinkEmpty: false, }; this.onUpdateWebLink = this.onUpdateWebLink.bind(this); @@ -32,6 +33,11 @@ export default class AddWebLink extends React.Component { // Set web link onUpdateWebLink(e) { e.preventDefault(); + if (e.target.value) { + this.setState({ + webLinkEmpty: false, + }); + } this.setState({ webLink: e.target.value }); } @@ -62,6 +68,11 @@ export default class AddWebLink extends React.Component { tokenV3, } = this.props; const { webLink } = this.state; + if (!webLink) { + this.setState({ + webLinkEmpty: true, + }); + } if (webLink && this.isWebLinkValid() && !this.webLinkExist()) { addWebLink(handle, tokenV3, webLink); } @@ -82,7 +93,7 @@ export default class AddWebLink extends React.Component { } render() { - const { webLink } = this.state; + const { webLink, webLinkEmpty } = this.state; const webLinkValid = this.isWebLinkValid(); const webLinkExist = this.webLinkExist(); @@ -172,6 +183,15 @@ export default class AddWebLink extends React.Component { onKeyDown={this.onAddWebLink} required /> + { + webLinkEmpty && ( +
+

+ Please Enter External Link +

+
+ ) + } { !webLinkValid && !webLinkExist && ( From 8b4dc0baba3f7a22b47bda2c0ac9aabf993472a2 Mon Sep 17 00:00:00 2001 From: yoution Date: Thu, 18 Nov 2021 20:22:19 +0800 Subject: [PATCH 11/54] fix: issue #5786 (#5815) --- src/shared/components/Settings/Profile/Hobby/index.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shared/components/Settings/Profile/Hobby/index.jsx b/src/shared/components/Settings/Profile/Hobby/index.jsx index a8f700fa30..a3b8ccd2f0 100644 --- a/src/shared/components/Settings/Profile/Hobby/index.jsx +++ b/src/shared/components/Settings/Profile/Hobby/index.jsx @@ -137,6 +137,7 @@ export default class Hobby extends ConsentComponent { } this.setState({ showConfirmation: false, + isEdit: false, indexNo: null, isSubmit: false, }); From aa9e173b767f43e9e9ba9744c29454856d2508d8 Mon Sep 17 00:00:00 2001 From: yoution Date: Sat, 20 Nov 2021 00:00:48 +0800 Subject: [PATCH 12/54] fix: issue #5802 (#5823) --- src/shared/components/Settings/Tools/Devices/index.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/shared/components/Settings/Tools/Devices/index.jsx b/src/shared/components/Settings/Tools/Devices/index.jsx index ff3ab7da46..2f2721ba8b 100644 --- a/src/shared/components/Settings/Tools/Devices/index.jsx +++ b/src/shared/components/Settings/Tools/Devices/index.jsx @@ -97,8 +97,7 @@ export default class Devices extends ConsentComponent { for (const item of deviceItems) { if (item.deviceType === newDevice.deviceType && item.manufacturer === newDevice.manufacturer - && item.model === newDevice.model - && item.operatingSystem === newDevice.operatingSystem) { + && item.model === newDevice.model) { exist = true; break; } From 33edc06ccaa1477058358d6451e5458fafa14728 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Sat, 20 Nov 2021 00:31:56 +0800 Subject: [PATCH 13/54] deploying ca-branch --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 349c4c5d3c..41c8261eab 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -343,6 +343,7 @@ workflows: branches: only: - develop + - ca-profile-bug-bash # This is alternate dev env for parallel testing - "build-test": context : org-global From a74ef9290edd11212847af76e4ce5b8b5906e033 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Sat, 20 Nov 2021 00:33:12 +0800 Subject: [PATCH 14/54] revert ci --- .circleci/config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 41c8261eab..349c4c5d3c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -343,7 +343,6 @@ workflows: branches: only: - develop - - ca-profile-bug-bash # This is alternate dev env for parallel testing - "build-test": context : org-global From 22885f3106fa204af84865fe1aafaa7fb8abac0d Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Mon, 22 Nov 2021 13:34:59 +0800 Subject: [PATCH 15/54] revert device checking --- src/shared/components/Settings/Tools/Devices/index.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shared/components/Settings/Tools/Devices/index.jsx b/src/shared/components/Settings/Tools/Devices/index.jsx index 2f2721ba8b..ff3ab7da46 100644 --- a/src/shared/components/Settings/Tools/Devices/index.jsx +++ b/src/shared/components/Settings/Tools/Devices/index.jsx @@ -97,7 +97,8 @@ export default class Devices extends ConsentComponent { for (const item of deviceItems) { if (item.deviceType === newDevice.deviceType && item.manufacturer === newDevice.manufacturer - && item.model === newDevice.model) { + && item.model === newDevice.model + && item.operatingSystem === newDevice.operatingSystem) { exist = true; break; } From 8f982db953bd24af58e5174fe2a55efb42b0f603 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Mon, 22 Nov 2021 20:46:05 +0800 Subject: [PATCH 16/54] patch: 5783 --- src/shared/components/Settings/Profile/BasicInfo/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/components/Settings/Profile/BasicInfo/index.jsx b/src/shared/components/Settings/Profile/BasicInfo/index.jsx index 9e96db632c..7ba68ea5d0 100644 --- a/src/shared/components/Settings/Profile/BasicInfo/index.jsx +++ b/src/shared/components/Settings/Profile/BasicInfo/index.jsx @@ -257,7 +257,7 @@ export default class BasicInfo extends ConsentComponent { break; case 'firstName': case 'lastName': - newBasicInfo[e.target.name] = e.target.value.replace(/[^a-zA-Z0-9,.]/g, ''); + newBasicInfo[e.target.name] = e.target.value.replace(/[^a-zA-Z0-9,.\-\ ]/g, ''); break; default: newBasicInfo[e.target.name] = e.target.value; From ceb5df6e1681e45454ec57448f28dffdcf230cc7 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Mon, 22 Nov 2021 21:09:43 +0800 Subject: [PATCH 17/54] fix: test --- src/shared/components/Settings/Profile/BasicInfo/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/components/Settings/Profile/BasicInfo/index.jsx b/src/shared/components/Settings/Profile/BasicInfo/index.jsx index 7ba68ea5d0..1240cc2184 100644 --- a/src/shared/components/Settings/Profile/BasicInfo/index.jsx +++ b/src/shared/components/Settings/Profile/BasicInfo/index.jsx @@ -257,7 +257,7 @@ export default class BasicInfo extends ConsentComponent { break; case 'firstName': case 'lastName': - newBasicInfo[e.target.name] = e.target.value.replace(/[^a-zA-Z0-9,.\-\ ]/g, ''); + newBasicInfo[e.target.name] = e.target.value.replace(/[^a-zA-Z0-9,. -]/g, ''); break; default: newBasicInfo[e.target.name] = e.target.value; From d51680deba888690b6cbbacd36a7c759370b983c Mon Sep 17 00:00:00 2001 From: Shivam Kumar Singh Date: Mon, 22 Nov 2021 20:52:54 +0530 Subject: [PATCH 18/54] fix: #5781 (#5824) --- .../components/Settings/Profile/BasicInfo/index.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/shared/components/Settings/Profile/BasicInfo/index.jsx b/src/shared/components/Settings/Profile/BasicInfo/index.jsx index 1240cc2184..71fc42e99e 100644 --- a/src/shared/components/Settings/Profile/BasicInfo/index.jsx +++ b/src/shared/components/Settings/Profile/BasicInfo/index.jsx @@ -41,6 +41,7 @@ export default class BasicInfo extends ConsentComponent { const { userTraits } = props; this.state = { + componentMounted: false, inputChanged: false, formInvalid: false, basicInfoTrait: this.loadBasicInfoTraits(userTraits), @@ -81,6 +82,9 @@ export default class BasicInfo extends ConsentComponent { const { basicInfoTrait } = this.state; const basicInfo = basicInfoTrait.traits ? basicInfoTrait.traits.data[0] : {}; this.processBasicInfo(basicInfo); + this.setState({ + componentMounted: true, + }); } componentWillReceiveProps(nextProps) { @@ -461,6 +465,7 @@ export default class BasicInfo extends ConsentComponent { const { newBasicInfo, inputChanged, + componentMounted, } = this.state; const canModifyTrait = !this.props.traitRequestCount; @@ -501,7 +506,7 @@ export default class BasicInfo extends ConsentComponent {
* Required - +
@@ -514,7 +519,7 @@ export default class BasicInfo extends ConsentComponent {
* Required - +
From 529ade40709cc4dba6808ead1e06942834c434fe Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Tue, 23 Nov 2021 13:08:26 +0800 Subject: [PATCH 19/54] ci:deploying bug bash to test --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 349c4c5d3c..01df8e0e32 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -349,7 +349,7 @@ workflows: filters: branches: only: - - free + - ca-profile-bug-bash # This is alternate dev env for parallel testing - "build-qa": context : org-global From 345942928c2f900ce0ebd54ca6a1f57b8b1b7b7f Mon Sep 17 00:00:00 2001 From: Shivam Kumar Singh Date: Fri, 26 Nov 2021 23:38:52 +0530 Subject: [PATCH 20/54] fix: #5795 (#5837) --- .../Profile/BasicInfo/ImageInput/index.jsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/shared/components/Settings/Profile/BasicInfo/ImageInput/index.jsx b/src/shared/components/Settings/Profile/BasicInfo/ImageInput/index.jsx index d147282733..dfeb6cace0 100644 --- a/src/shared/components/Settings/Profile/BasicInfo/ImageInput/index.jsx +++ b/src/shared/components/Settings/Profile/BasicInfo/ImageInput/index.jsx @@ -25,6 +25,7 @@ export default class ImageInput extends React.Component { this.state = { newBasicInfo: {}, isImageOversize: false, + isImageFile: true, }; } @@ -72,6 +73,13 @@ export default class ImageInput extends React.Component { if (file === undefined) { return; } + const allowedTypes = ['image/png', 'image/jpg', 'image/jpeg']; + if (!allowedTypes.includes(file.type)) { + this.setState({ + isImageFile: false, + }); + return; + } if (file.size > 2 * 1024 * 1024) { // If file size is greater than 2 MB, show error message this.setState({ @@ -81,6 +89,7 @@ export default class ImageInput extends React.Component { } this.setState({ isImageOversize: false, + isImageFile: true, }); uploadPhotoInit(); loadImage.parseMetaData(file, (data) => { @@ -126,7 +135,7 @@ export default class ImageInput extends React.Component { deletingPhoto, } = profileState; - const { newBasicInfo, isImageOversize } = this.state; + const { newBasicInfo, isImageOversize, isImageFile } = this.state; return (
@@ -157,7 +166,8 @@ export default class ImageInput extends React.Component {
- {isImageOversize &&
Please select an image smaller than 2MB
} + {!isImageFile &&
Please select jpg, jpeg or png image files only
} + {isImageFile && isImageOversize &&
Please select an image smaller than 2MB
} ); } From 91da96b188d969bf4eaa065d6a02b7cae0dadd71 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Mon, 29 Nov 2021 20:56:48 +0800 Subject: [PATCH 21/54] refix --- .../Settings/Profile/BasicInfo/index.jsx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/shared/components/Settings/Profile/BasicInfo/index.jsx b/src/shared/components/Settings/Profile/BasicInfo/index.jsx index 71fc42e99e..1818e9d80a 100644 --- a/src/shared/components/Settings/Profile/BasicInfo/index.jsx +++ b/src/shared/components/Settings/Profile/BasicInfo/index.jsx @@ -41,15 +41,14 @@ export default class BasicInfo extends ConsentComponent { const { userTraits } = props; this.state = { - componentMounted: false, inputChanged: false, formInvalid: false, basicInfoTrait: this.loadBasicInfoTraits(userTraits), personalizationTrait: this.loadPersonalizationTrait(userTraits), newBasicInfo: { handle: '', - firstName: '', - lastName: '', + firstName: null, + lastName: null, gender: '', ethnicBackground: null, shortBio: '', @@ -82,9 +81,6 @@ export default class BasicInfo extends ConsentComponent { const { basicInfoTrait } = this.state; const basicInfo = basicInfoTrait.traits ? basicInfoTrait.traits.data[0] : {}; this.processBasicInfo(basicInfo); - this.setState({ - componentMounted: true, - }); } componentWillReceiveProps(nextProps) { @@ -381,6 +377,8 @@ export default class BasicInfo extends ConsentComponent { } if (_.has(value, 'firstName')) { newBasicInfo.firstName = value.firstName; + } else { + newBasicInfo.firstName = ''; } if (_.has(value, 'gender')) { newBasicInfo.gender = value.gender; @@ -394,6 +392,8 @@ export default class BasicInfo extends ConsentComponent { } if (_.has(value, 'lastName')) { newBasicInfo.lastName = value.lastName; + } else { + newBasicInfo.lastName = ''; } if (_.has(value, 'primaryInterestInTopcoder')) { newBasicInfo.primaryInterestInTopcoder = value.primaryInterestInTopcoder; @@ -465,7 +465,6 @@ export default class BasicInfo extends ConsentComponent { const { newBasicInfo, inputChanged, - componentMounted, } = this.state; const canModifyTrait = !this.props.traitRequestCount; @@ -506,7 +505,7 @@ export default class BasicInfo extends ConsentComponent {
* Required - +
@@ -519,7 +518,7 @@ export default class BasicInfo extends ConsentComponent {
* Required - +
From 7c72a2bce89fb22ba061aea38d034b4437366df6 Mon Sep 17 00:00:00 2001 From: C Dharmateja Date: Wed, 1 Dec 2021 19:52:26 +0530 Subject: [PATCH 22/54] fix: safely parse input value for regex --- src/shared/components/InputSelect/index.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shared/components/InputSelect/index.jsx b/src/shared/components/InputSelect/index.jsx index a91c088093..98e8b5355d 100644 --- a/src/shared/components/InputSelect/index.jsx +++ b/src/shared/components/InputSelect/index.jsx @@ -139,9 +139,10 @@ export default class InputSelect extends Component { filterVal, } = this.state; + const escapeRegExp = stringToGoIntoTheRegex => stringToGoIntoTheRegex.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); let fiterList = options; if (filterVal) { - const REG = new RegExp(filterVal, 'i'); + const REG = new RegExp(escapeRegExp(filterVal), 'i'); fiterList = filter(options, o => REG.test(o[labelKey])); } const list = map(fiterList, o => ( From 044b68adeeaa33c4f66c1d3e3a21e879da18e2d4 Mon Sep 17 00:00:00 2001 From: gets0ul Date: Wed, 1 Dec 2021 21:43:09 +0700 Subject: [PATCH 23/54] fix: issue #5885 (#5894) --- .../Settings/Tools/Subscriptions/index.jsx | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/shared/components/Settings/Tools/Subscriptions/index.jsx b/src/shared/components/Settings/Tools/Subscriptions/index.jsx index b4691b4cd9..1f18fde6bd 100644 --- a/src/shared/components/Settings/Tools/Subscriptions/index.jsx +++ b/src/shared/components/Settings/Tools/Subscriptions/index.jsx @@ -328,7 +328,18 @@ export default class Subscription extends ConsentComponent {
* Required - + e.key === 'Enter' && e.preventDefault()} + required + /> { isSubmit && ( @@ -380,7 +391,18 @@ export default class Subscription extends ConsentComponent { * Required - + e.key === 'Enter' && e.preventDefault()} + required + /> { isSubmit && ( From 52fd7a6b24d00a2239b1b08077059ff4103f48be Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Wed, 1 Dec 2021 23:03:41 +0800 Subject: [PATCH 24/54] update lint --- src/shared/components/InputSelect/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/components/InputSelect/index.jsx b/src/shared/components/InputSelect/index.jsx index 98e8b5355d..40a2d2a1e6 100644 --- a/src/shared/components/InputSelect/index.jsx +++ b/src/shared/components/InputSelect/index.jsx @@ -139,7 +139,7 @@ export default class InputSelect extends Component { filterVal, } = this.state; - const escapeRegExp = stringToGoIntoTheRegex => stringToGoIntoTheRegex.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); + const escapeRegExp = stringToGoIntoTheRegex => stringToGoIntoTheRegex.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); /* eslint-disable-line no-useless-escape */ let fiterList = options; if (filterVal) { const REG = new RegExp(escapeRegExp(filterVal), 'i'); From 5346e4db5b950bdb0e4f5becdb3f7cd498ec12cf Mon Sep 17 00:00:00 2001 From: C DHARMATEJA Date: Wed, 1 Dec 2021 20:42:00 +0530 Subject: [PATCH 25/54] fix: click on input down arrow (#5895) --- src/shared/components/InputSelect/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/components/InputSelect/index.jsx b/src/shared/components/InputSelect/index.jsx index 40a2d2a1e6..de895d4482 100644 --- a/src/shared/components/InputSelect/index.jsx +++ b/src/shared/components/InputSelect/index.jsx @@ -111,7 +111,7 @@ export default class InputSelect extends Component { let i = 0; let node = e.target; const REG = new RegExp(_id); - while (node && i < 5) { + while (node && i < 20) { if (REG.test(node.className)) { return true; } From 9624b4624a980cfb3691a8b0ee604e2cf38a1d99 Mon Sep 17 00:00:00 2001 From: gets0ul Date: Wed, 1 Dec 2021 22:23:01 +0700 Subject: [PATCH 26/54] fix: issue #5874 - keep the order of existing languages after done editing (#5896) --- src/shared/components/Settings/Profile/Language/index.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/shared/components/Settings/Profile/Language/index.jsx b/src/shared/components/Settings/Profile/Language/index.jsx index 57ba250dc9..cb1539f5e8 100644 --- a/src/shared/components/Settings/Profile/Language/index.jsx +++ b/src/shared/components/Settings/Profile/Language/index.jsx @@ -244,11 +244,11 @@ export default class Language extends ConsentComponent { const newLanguageTrait = _.cloneDeep(languageTrait); if (isEdit) { - newLanguageTrait.traits.data.splice(indexNo, 1); + newLanguageTrait.traits.data.splice(indexNo, 1, language); + } else { + newLanguageTrait.traits.data.push(language); } - newLanguageTrait.traits.data.push(language); - updateUserTrait(handle, 'languages', newLanguageTrait.traits.data, tokenV3); } else { const newLanguages = []; From 5aaf3696f80ad98cf82a534a79a1e6cbc9d6c4d8 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Thu, 2 Dec 2021 01:04:15 +0800 Subject: [PATCH 27/54] update: 5877 --- src/shared/components/Settings/Tools/ServiceProviders/index.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shared/components/Settings/Tools/ServiceProviders/index.jsx b/src/shared/components/Settings/Tools/ServiceProviders/index.jsx index ced86d9d34..84352a6129 100644 --- a/src/shared/components/Settings/Tools/ServiceProviders/index.jsx +++ b/src/shared/components/Settings/Tools/ServiceProviders/index.jsx @@ -161,6 +161,7 @@ export default class ServiceProviders extends ConsentComponent { } this.setState({ showConfirmation: false, + isEdit: false, indexNo: null, formInvalid: false, isSubmit: false, From f4fca8c4b3ff97869c83722f40782f1f913eb3e8 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Thu, 2 Dec 2021 01:10:48 +0800 Subject: [PATCH 28/54] update: 5875 --- src/shared/components/Settings/Profile/Work/index.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/shared/components/Settings/Profile/Work/index.jsx b/src/shared/components/Settings/Profile/Work/index.jsx index bbff9e769d..b72cbef88e 100644 --- a/src/shared/components/Settings/Profile/Work/index.jsx +++ b/src/shared/components/Settings/Profile/Work/index.jsx @@ -174,6 +174,16 @@ export default class Work extends ConsentComponent { this.setState({ showConfirmation: false, + newWork: { + company: '', + position: '', + cityTown: '', + timePeriodFrom: '', + timePeriodTo: '', + industry: '', + working: false, + }, + isEdit: false, indexNo: null, isSubmit: false, formInvalid: false, From 978245ea0e5f5c483236af62a9e9a49d3100de92 Mon Sep 17 00:00:00 2001 From: gets0ul Date: Thu, 2 Dec 2021 00:15:22 +0700 Subject: [PATCH 29/54] Issue #5878 (#5893) * fix: issue #5878 * fix: lint tab error --- src/shared/components/Settings/Tools/Software/index.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shared/components/Settings/Tools/Software/index.jsx b/src/shared/components/Settings/Tools/Software/index.jsx index a1bc02e312..5e74d4c44b 100644 --- a/src/shared/components/Settings/Tools/Software/index.jsx +++ b/src/shared/components/Settings/Tools/Software/index.jsx @@ -147,6 +147,7 @@ export default class Software extends ConsentComponent { showConfirmation: false, indexNo: null, isSubmit: false, + isEdit: false, formInvalid: false, }); } From 36d36a7e3f32b1ca8a4459b4b10a2109646e84d6 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Thu, 2 Dec 2021 01:24:09 +0800 Subject: [PATCH 30/54] update: 5899 --- src/shared/components/Settings/Tools/Subscriptions/index.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/shared/components/Settings/Tools/Subscriptions/index.jsx b/src/shared/components/Settings/Tools/Subscriptions/index.jsx index 1f18fde6bd..8cdd86eaad 100644 --- a/src/shared/components/Settings/Tools/Subscriptions/index.jsx +++ b/src/shared/components/Settings/Tools/Subscriptions/index.jsx @@ -153,6 +153,7 @@ export default class Subscription extends ConsentComponent { showConfirmation: false, indexNo: null, formInvalid: false, + isEdit: false, isSubmit: false, }); } From 4ee7fb5264f1de3556dfad62acc45abd88a6910b Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Thu, 2 Dec 2021 01:36:13 +0800 Subject: [PATCH 31/54] update: 5868 --- src/shared/components/Settings/Account/MyAccount/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/components/Settings/Account/MyAccount/index.jsx b/src/shared/components/Settings/Account/MyAccount/index.jsx index b7e688ba22..21f0adeecb 100644 --- a/src/shared/components/Settings/Account/MyAccount/index.jsx +++ b/src/shared/components/Settings/Account/MyAccount/index.jsx @@ -585,7 +585,7 @@ export default class MyAccount extends ConsentComponent {
{ - get(profileState, 'credential.hasPassword', false) === false && ( + get(profileState, 'credential.hasPassword') === false && (
Since you joined Topcoder using your <SSO Service> account, any email updates will need to be handled by logging in to From a054043da1b3b8839c89523511e99e3659ca78d6 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Thu, 2 Dec 2021 01:48:03 +0800 Subject: [PATCH 32/54] update: 5867 --- src/shared/components/InputSelect/index.jsx | 5 ++++- src/shared/components/Settings/Tools/Devices/index.jsx | 8 ++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/shared/components/InputSelect/index.jsx b/src/shared/components/InputSelect/index.jsx index de895d4482..bd43cbbdcc 100644 --- a/src/shared/components/InputSelect/index.jsx +++ b/src/shared/components/InputSelect/index.jsx @@ -131,6 +131,7 @@ export default class InputSelect extends Component { placeholder, labelKey, options, + onKeyPress, } = this.props; const { @@ -172,7 +173,7 @@ export default class InputSelect extends Component {
- +
{list} @@ -196,6 +197,7 @@ InputSelect.defaultProps = { isLoading: false, onChange: () => {}, onLoadMore: () => {}, + onKeyPress: () => {}, }; InputSelect.propTypes = { @@ -206,6 +208,7 @@ InputSelect.propTypes = { placeholder: PT.string, onChange: PT.func, onLoadMore: PT.func, + onKeyPress: PT.func, hasMore: PT.bool, isLoading: PT.bool, disabled: PT.bool, diff --git a/src/shared/components/Settings/Tools/Devices/index.jsx b/src/shared/components/Settings/Tools/Devices/index.jsx index ff3ab7da46..d941f5bbb4 100644 --- a/src/shared/components/Settings/Tools/Devices/index.jsx +++ b/src/shared/components/Settings/Tools/Devices/index.jsx @@ -516,6 +516,7 @@ export default class Devices extends ConsentComponent { valueKey="name" labelKey="name" disabled={!canModifyTrait} + onKeyPress={e => e.key === 'Enter' && e.preventDefault()} /> { isSubmit && ( @@ -541,6 +542,7 @@ export default class Devices extends ConsentComponent { valueKey="name" labelKey="name" disabled={!canModifyTrait} + onKeyPress={e => e.key === 'Enter' && e.preventDefault()} />
@@ -564,6 +566,7 @@ export default class Devices extends ConsentComponent { isLoading={isModelsLoading} hasMore={hasMoreModels} disabled={!canModifyTrait} + onKeyPress={e => e.key === 'Enter' && e.preventDefault()} />
@@ -587,6 +590,7 @@ export default class Devices extends ConsentComponent { isLoading={isOsesLoading} onLoadMore={this.onLoadMoreOses} disabled={!canModifyTrait} + onKeyPress={e => e.key === 'Enter' && e.preventDefault()} /> @@ -651,6 +655,7 @@ export default class Devices extends ConsentComponent { valueKey="name" labelKey="name" disabled={!canModifyTrait} + onKeyPress={e => e.key === 'Enter' && e.preventDefault()} /> { isSubmit && ( @@ -672,6 +677,7 @@ export default class Devices extends ConsentComponent { valueKey="name" labelKey="name" disabled={!canModifyTrait} + onKeyPress={e => e.key === 'Enter' && e.preventDefault()} /> @@ -693,6 +699,7 @@ export default class Devices extends ConsentComponent { isLoading={isModelsLoading} hasMore={hasMoreModels} disabled={!canModifyTrait} + onKeyPress={e => e.key === 'Enter' && e.preventDefault()} />
@@ -712,6 +719,7 @@ export default class Devices extends ConsentComponent { isLoading={isOsesLoading} onLoadMore={this.onLoadMoreOses} disabled={!canModifyTrait} + onKeyPress={e => e.key === 'Enter' && e.preventDefault()} />
From 9f6dbda32e54b6f22c59de9bf5004d446fd61920 Mon Sep 17 00:00:00 2001 From: C DHARMATEJA Date: Wed, 1 Dec 2021 23:24:54 +0530 Subject: [PATCH 33/54] fix: make select clearable for spoken and written languages (#5898) --- .../Settings/Profile/Language/index.jsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/shared/components/Settings/Profile/Language/index.jsx b/src/shared/components/Settings/Profile/Language/index.jsx index cb1539f5e8..c61fa0b13a 100644 --- a/src/shared/components/Settings/Profile/Language/index.jsx +++ b/src/shared/components/Settings/Profile/Language/index.jsx @@ -441,7 +441,13 @@ export default class Language extends ConsentComponent { { + if (option) { + this.onUpdateSelect(option); + } else { + this.onUpdateSelect({ key: 'writtenLevel', name: '' }); + } + }} value={newLanguage.writtenLevel} placeholder="Written level" labelKey="name" From bfba9d73cfe527402ee09a2b81d3da80b21a2676 Mon Sep 17 00:00:00 2001 From: M Fikri A Date: Thu, 2 Dec 2021 17:42:51 +0700 Subject: [PATCH 34/54] Enable to Clear Date --- .../components/Settings/Profile/Work/index.jsx | 18 ++++++++++++------ .../Settings/Profile/Work/styles.scss | 14 ++++++++++++++ .../challenge-listing/Filters/DatePicker.jsx | 5 ++++- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/shared/components/Settings/Profile/Work/index.jsx b/src/shared/components/Settings/Profile/Work/index.jsx index 0bbfa631bf..e3c47c2b3a 100644 --- a/src/shared/components/Settings/Profile/Work/index.jsx +++ b/src/shared/components/Settings/Profile/Work/index.jsx @@ -148,12 +148,10 @@ export default class Work extends ConsentComponent { } onUpdateDate(date, timePeriod) { - if (date) { - const { newWork: oldWork } = this.state; - const newWork = { ...oldWork }; - newWork[timePeriod] = date; - this.setState({ newWork, isSubmit: false }); - } + const { newWork: oldWork } = this.state; + const newWork = { ...oldWork }; + newWork[timePeriod] = date; + this.setState({ newWork, isSubmit: false }); } /** @@ -491,11 +489,13 @@ export default class Work extends ConsentComponent {
this.onUpdateDate(date, 'timePeriodFrom')} + onClearDate={date => this.onUpdateDate('', 'timePeriodFrom')} placeholder="dd/mm/yyyy" /> { @@ -518,12 +518,14 @@ export default class Work extends ConsentComponent {
this.onUpdateDate(date, 'timePeriodTo')} + onClearDate={date => this.onUpdateDate('', 'timePeriodTo')} placeholder="dd/mm/yyyy" /> { @@ -642,11 +644,13 @@ export default class Work extends ConsentComponent { this.onUpdateDate(date, 'timePeriodFrom')} + onClearDate={date => this.onUpdateDate('', 'timePeriodFrom')} placeholder="dd/mm/yyyy" /> { @@ -665,12 +669,14 @@ export default class Work extends ConsentComponent { this.onUpdateDate(date, 'timePeriodTo')} + onClearDate={date => this.onUpdateDate('', 'timePeriodTo')} placeholder="dd/mm/yyyy" /> { diff --git a/src/shared/components/Settings/Profile/Work/styles.scss b/src/shared/components/Settings/Profile/Work/styles.scss index 937adc83e5..a8e9a790f5 100644 --- a/src/shared/components/Settings/Profile/Work/styles.scss +++ b/src/shared/components/Settings/Profile/Work/styles.scss @@ -349,6 +349,20 @@ label { display: none; } } + + :global { + .SingleDatePickerInput_clearDate { + height: 35px; + width: 35px; + display: flex; + align-items: center; + top: calc(50% - 5px); + } + + .SingleDatePickerInput__showClearDate { + padding-right: 0; + } + } } .button-container { diff --git a/src/shared/components/challenge-listing/Filters/DatePicker.jsx b/src/shared/components/challenge-listing/Filters/DatePicker.jsx index deec2ef21e..724b3e163b 100644 --- a/src/shared/components/challenge-listing/Filters/DatePicker.jsx +++ b/src/shared/components/challenge-listing/Filters/DatePicker.jsx @@ -12,6 +12,7 @@ import './_fix_SingleDatePicker.css'; const propTypes = { autoFocus: PropTypes.bool, + showClearDate: PropTypes.bool, allowFutureYear: PropTypes.bool, ...omit({}, [ @@ -25,6 +26,7 @@ const propTypes = { const defaultProps = { autoFocus: false, allowFutureYear: false, + showClearDate: false, }; class DatePicker extends React.Component { @@ -53,7 +55,7 @@ class DatePicker extends React.Component { render() { const { focused, allowFutureYear } = this.state; const { - id, date, onDateChange, isOutsideRange, + id, date, onDateChange, isOutsideRange, showClearDate, } = this.props; const props = omit(this.props, [ @@ -75,6 +77,7 @@ class DatePicker extends React.Component { focused={focused} onDateChange={onDateChange} onFocusChange={this.onFocusChange} + showClearDate={showClearDate} renderMonthElement={({ month, onMonthSelect, onYearSelect }) => (
From ce0eb0f63a9917ebb9de5b8c87ff597cea2731aa Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Thu, 2 Dec 2021 23:09:27 +0800 Subject: [PATCH 35/54] update lint --- src/shared/components/Settings/Profile/Work/index.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shared/components/Settings/Profile/Work/index.jsx b/src/shared/components/Settings/Profile/Work/index.jsx index 274099d68f..5ec1e52cc7 100644 --- a/src/shared/components/Settings/Profile/Work/index.jsx +++ b/src/shared/components/Settings/Profile/Work/index.jsx @@ -496,7 +496,7 @@ export default class Work extends ConsentComponent { date={newWork.timePeriodFrom} id="date-from1" onDateChange={date => this.onUpdateDate(date, 'timePeriodFrom')} - onClearDate={date => this.onUpdateDate('', 'timePeriodFrom')} + onClearDate={date => this.onUpdateDate('', 'timePeriodFrom')} // eslint-disable-line no-unused-vars placeholder="dd/mm/yyyy" /> { @@ -526,7 +526,7 @@ export default class Work extends ConsentComponent { date={newWork.timePeriodTo} id="date-to1" onDateChange={date => this.onUpdateDate(date, 'timePeriodTo')} - onClearDate={date => this.onUpdateDate('', 'timePeriodTo')} + onClearDate={date => this.onUpdateDate('', 'timePeriodTo')} // eslint-disable-line no-unused-vars placeholder="dd/mm/yyyy" /> { @@ -651,7 +651,7 @@ export default class Work extends ConsentComponent { date={newWork.timePeriodFrom} id="date-from2" onDateChange={date => this.onUpdateDate(date, 'timePeriodFrom')} - onClearDate={date => this.onUpdateDate('', 'timePeriodFrom')} + onClearDate={date => this.onUpdateDate('', 'timePeriodFrom')} // eslint-disable-line no-unused-vars placeholder="dd/mm/yyyy" /> { @@ -677,7 +677,7 @@ export default class Work extends ConsentComponent { date={newWork.timePeriodTo} id="date-to2" onDateChange={date => this.onUpdateDate(date, 'timePeriodTo')} - onClearDate={date => this.onUpdateDate('', 'timePeriodTo')} + onClearDate={date => this.onUpdateDate('', 'timePeriodTo')} // eslint-disable-line no-unused-vars placeholder="dd/mm/yyyy" /> { From a80ecf36481a1883c01870c63989196fecc001a1 Mon Sep 17 00:00:00 2001 From: Shivam Kumar Singh Date: Fri, 3 Dec 2021 19:17:40 +0530 Subject: [PATCH 36/54] fix: #5886 (#5901) --- src/shared/components/Settings/Tools/Software/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/components/Settings/Tools/Software/index.jsx b/src/shared/components/Settings/Tools/Software/index.jsx index 5e74d4c44b..68374bba0e 100644 --- a/src/shared/components/Settings/Tools/Software/index.jsx +++ b/src/shared/components/Settings/Tools/Software/index.jsx @@ -381,7 +381,7 @@ export default class Software extends ConsentComponent { { isSubmit && ( - + ) }
From 7f46f4b4bb3a1d2d1fa74666f2cd8c53e44bf1b2 Mon Sep 17 00:00:00 2001 From: LieutenantRoger Date: Fri, 3 Dec 2021 21:52:56 +0800 Subject: [PATCH 37/54] refine --- src/shared/components/Settings/Tools/Software/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/components/Settings/Tools/Software/index.jsx b/src/shared/components/Settings/Tools/Software/index.jsx index 68374bba0e..1433ab74d3 100644 --- a/src/shared/components/Settings/Tools/Software/index.jsx +++ b/src/shared/components/Settings/Tools/Software/index.jsx @@ -381,7 +381,7 @@ export default class Software extends ConsentComponent { { isSubmit && ( - + ) }
From b521370b3ca9e48b9565ab91c65e8c686d6037b9 Mon Sep 17 00:00:00 2001 From: Kiril Kartunov Date: Fri, 3 Dec 2021 16:34:21 +0200 Subject: [PATCH 38/54] theme update --- src/shared/actions/mmLeaderboard.js | 14 +- .../components/MMatchLeaderboard/index.jsx | 100 +++++++++-- .../components/MMatchLeaderboard/style.scss | 161 ++++++++++++++++++ 3 files changed, 263 insertions(+), 12 deletions(-) diff --git a/src/shared/actions/mmLeaderboard.js b/src/shared/actions/mmLeaderboard.js index 4f838d4126..d3e66a5a15 100644 --- a/src/shared/actions/mmLeaderboard.js +++ b/src/shared/actions/mmLeaderboard.js @@ -1,7 +1,8 @@ -import { redux } from 'topcoder-react-utils'; +import { redux, config } from 'topcoder-react-utils'; import Service from 'services/mmLeaderboard'; import _ from 'lodash'; + /** * Fetch init */ @@ -39,6 +40,17 @@ async function getMMLeaderboardDone(id) { rank: i + 1, score: r.score % 1 ? Number(r.score).toFixed(5) : r.score, })); + // Fetch member photos for top 3 + const results = await Promise.all( + _.take(data, 3).map(d => fetch(`${config.API.V5}/members/${d.createdBy}`)), + ); + const memberData = await Promise.all(results.map(r => r.json())); + // merge with data + // eslint-disable-next-line array-callback-return + memberData.map((member, indx) => { + data[indx].photoUrl = member.photoURL; + data[indx].ratingColor = member.maxRating && member.maxRating.ratingColor; + }); } return { id, diff --git a/src/shared/components/MMatchLeaderboard/index.jsx b/src/shared/components/MMatchLeaderboard/index.jsx index b2e3196944..a1b83062bd 100644 --- a/src/shared/components/MMatchLeaderboard/index.jsx +++ b/src/shared/components/MMatchLeaderboard/index.jsx @@ -21,9 +21,15 @@ import PT from 'prop-types'; import _ from 'lodash'; import React, { Component } from 'react'; import { fixStyle } from 'utils/contentful'; +import { getRatingColor } from 'utils/tc'; import cn from 'classnames'; import { Scrollbars } from 'react-custom-scrollbars'; -import './style.scss'; +import { config } from 'topcoder-react-utils'; +import { PrimaryButton } from 'topcoder-react-ui-kit'; +import tc from 'components/buttons/themed/tc.scss'; +import defaultStyles from './style.scss'; + +const DEFAULT_AVATAR_URL = 'https://images.ctfassets.net/b5f1djy59z3a/4PTwZVSf3W7qgs9WssqbVa/4c51312671a4b9acbdfd7f5e22320b62/default_avatar.svg'; export default class MMLeaderboard extends Component { constructor(props) { @@ -46,6 +52,8 @@ export default class MMLeaderboard extends Component { tableHeight, tableWidth, headerIndexCol, + theme, + challengeId, } = this.props; let { @@ -76,6 +84,73 @@ export default class MMLeaderboard extends Component { } const renderData = () => { + if (data.length && theme && theme === 'Podium') { + return ( +
+
+
+ {_.take(data, 2).map((member, indx) => ( +
+
+ {`Avatar +
{member.rank}
+
+
+ {member.createdBy} +

{member.score}

+
+
+ ))} +
+
+
+ {`Avatar +
{data[2].rank}
+
+
+ {data[2].createdBy} +

{data[2].score}

+
+
+
+
+
+ {_.slice(data, 3, 7).map(member => ( +
+ {member.rank}.  + {member.createdBy} + {member.score} +
+ ))} +
+ { + data.length > 7 && ( +
+ {_.slice(data, 7, 10).map(member => ( +
+ {member.rank}.  + {member.createdBy} + {member.score} +
+ ))} + { + data.length > 10 && ( + + See Full Leaderbord + + )} +
+ )} +
+
+ ); + } if (property) { if (data.length > 0 && data[0][property]) { if (typeof data[0][property] === 'string') { @@ -107,17 +182,17 @@ export default class MMLeaderboard extends Component { const header = cols => ( - { countRows && ({headerIndexCol}) } + { countRows && ({headerIndexCol}) } { cols.map((c) => { const name = c.headerName; const { styles } = c; return name ? ( - -
+ +
{ name }