Skip to content

Commit 83a0135

Browse files
authored
Merge pull request #6889 from topcoder-platform/develop
PROD - FIx when currency endpoint down / Add 'i' to Dice ID switch
2 parents caccd93 + f9b7fe8 commit 83a0135

File tree

3 files changed

+77
-22
lines changed

3 files changed

+77
-22
lines changed

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

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import _ from 'lodash';
44
import { config } from 'topcoder-react-utils';
55
import QRCode from 'react-qr-code';
66
import { SettingBannerV2 as Collapse } from 'components/Settings/SettingsBanner';
7+
import Tooltip from 'components/Tooltip';
78
import MfaImage from 'assets/images/account/security/mfa.svg';
89
import DiceLogo from 'assets/images/account/security/dicelogo.png';
910
import DiceLogoBig from 'assets/images/account/security/dicelogobig.png';
1011
import GooglePlay from 'assets/images/account/security/google-play.png';
1112
import AppleStore from 'assets/images/account/security/apple-store.svg';
1213
import UnsuccessfulIcon from 'assets/images/account/security/unsuccessful.svg';
14+
import TooltipInfo from 'assets/images/tooltip-info.svg';
1315
import Modal from './Modal';
1416
import VerificationListener from './VerificationListener';
1517

@@ -25,6 +27,12 @@ export default function Security({
2527
const [connVerifyCounter, setConnVerifyCounter] = useState(0);
2628
const [isVerificationProcessing, setIsVerificationProcessing] = useState(false);
2729
const diceVerifyUrl = config.DICE_VERIFY_URL;
30+
31+
const diceTip = (
32+
<div styleName="tctooltiptext">
33+
<p>Please reach out to support@topcoder.com for deactivating Dice ID</p>
34+
</div>
35+
);
2836
const useInterval = (callback, delay) => {
2937
const savedCallback = useRef();
3038

@@ -359,7 +367,7 @@ export default function Security({
359367
</div>
360368
<div styleName="info">
361369
<div styleName="info-first-line">
362-
DICE ID Authenticator App
370+
<span>DICE ID Authenticator App</span>
363371
</div>
364372
<div styleName="info-second-line dice-info">
365373
DICE ID authentication application
@@ -370,22 +378,31 @@ export default function Security({
370378
</div>
371379
{diceChecked
372380
? (
373-
<div className="onoffswitch" styleName="dice-switch">
374-
<input
375-
type="checkbox"
376-
name="pre-onoffswitch-dice"
377-
id="pre-onoffswitch-dice"
378-
value="diceEnabled"
379-
checked
380-
onChange={() => { }}
381-
className="onoffswitch-checkbox"
382-
disabled
383-
/>
384-
<label htmlFor="pre-onoffswitch-dice" className="onoffswitch-label" styleName="disabled-toggle">
385-
<span className="onoffswitch-inner" />
386-
<span className="onoffswitch-switch" />
387-
<input type="hidden" />
388-
</label>
381+
<div styleName="dice-switch">
382+
<div className="onoffswitch">
383+
<input
384+
type="checkbox"
385+
name="pre-onoffswitch-dice"
386+
id="pre-onoffswitch-dice"
387+
value="diceEnabled"
388+
checked
389+
onChange={() => { }}
390+
className="onoffswitch-checkbox"
391+
disabled
392+
/>
393+
<label htmlFor="pre-onoffswitch-dice" className="onoffswitch-label" styleName="disabled-toggle">
394+
<span className="onoffswitch-inner" />
395+
<span className="onoffswitch-switch" />
396+
<input type="hidden" />
397+
</label>
398+
</div>
399+
<Tooltip
400+
id="DICE-ID-Authenticator-App-tip"
401+
content={diceTip}
402+
trigger={['hover', 'focus']}
403+
>
404+
<TooltipInfo />
405+
</Tooltip>
389406
</div>
390407
)
391408
: (

src/shared/components/Settings/Account/Security/styles.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@
137137
}
138138

139139
.dice-switch {
140+
display: flex;
141+
align-items: center;
142+
140143
@media (max-width: #{$screen-md - 1px}) {
141144
display: none;
142145
}
@@ -280,3 +283,18 @@
280283
color: #767676;
281284
margin-top: auto;
282285
}
286+
287+
.tctooltiptext {
288+
background: $tooltip-gray;
289+
color: $tc-white;
290+
border-radius: 8px;
291+
padding: 10px;
292+
293+
p {
294+
@include roboto-medium;
295+
296+
font-weight: 400;
297+
font-size: 14px;
298+
line-height: 22px;
299+
}
300+
}

src/shared/services/money.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ async function updateCache() {
3636
fx.rates = cache.rates;
3737
}
3838

39-
updateCache();
39+
try {
40+
updateCache();
41+
} catch (error) {
42+
// exchange-rates failed, reason: socket hang up
43+
}
4044

4145
/**
4246
* Converts specified amount of money to another currency.
@@ -48,7 +52,11 @@ updateCache();
4852
* operations necessary to update the cached currency rates.
4953
*/
5054
export async function convert(amount, to, from = 'USD') {
51-
await updateCache();
55+
try {
56+
await updateCache();
57+
} catch (error) {
58+
// exchange-rates failed, reason: socket hang up
59+
}
5260
return fx.convert(amount, { from, to });
5361
}
5462

@@ -63,7 +71,11 @@ export async function convert(amount, to, from = 'USD') {
6371
* @return {Number}
6472
*/
6573
export function convertNow(amount, to, from = 'USD') {
66-
updateCache();
74+
try {
75+
updateCache();
76+
} catch (error) {
77+
// exchange-rates failed, reason: socket hang up
78+
}
6779
return fx.convert(amount, { from, to });
6880
}
6981

@@ -72,7 +84,11 @@ export function convertNow(amount, to, from = 'USD') {
7284
* @return {Promise}
7385
*/
7486
export async function getRates() {
75-
await updateCache();
87+
try {
88+
await updateCache();
89+
} catch (error) {
90+
// exchange-rates failed, reason: socket hang up
91+
}
7692
return _.cloneDeep(cache);
7793
}
7894

@@ -81,6 +97,10 @@ export async function getRates() {
8197
* @return {Promise}
8298
*/
8399
export function getRatesNow() {
84-
updateCache();
100+
try {
101+
updateCache();
102+
} catch (error) {
103+
// exchange-rates failed, reason: socket hang up
104+
}
85105
return _.cloneDeep(cache);
86106
}

0 commit comments

Comments
 (0)