Skip to content

Commit c7eb141

Browse files
author
Itzik Grossman
committed
Fixed a couple of minor bugs & linear logo
1 parent 862f0dd commit c7eb141

File tree

5 files changed

+48
-62
lines changed

5 files changed

+48
-62
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module.exports = {
55
},
66
plugins: ['@typescript-eslint', 'react-hooks'],
77
rules: {
8+
curly: 'error',
89
'require-await': 'off',
910
},
1011
};
Lines changed: 1 addition & 8 deletions
Loading

src/blockchain-bridge/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
export const sleep = duration => new Promise(res => setTimeout(res, duration));
22

3-
export const networkToDisplay = (name: string) => {
3+
export const networkToDisplay = (name?: string) => {
4+
if (!name) {
5+
return '';
6+
}
47
switch (name.toLowerCase().trim()) {
58
case 'binancesmartchain':
69
return 'Binance Smart Chain';

src/pages/Exchange/HealthPopup.tsx

Lines changed: 37 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import React from 'react'
1+
import React from 'react';
22
import { Button, List, Popup } from 'semantic-ui-react';
33
import { HealthStatusDetailed, Signer, signerToString, SignerTypes } from './utils';
44

55
function timeDifference(current, previous) {
6-
76
var msPerMinute = 60 * 1000;
87
var msPerHour = msPerMinute * 60;
98
var msPerDay = msPerHour * 24;
@@ -13,65 +12,50 @@ function timeDifference(current, previous) {
1312
var elapsed = current - previous;
1413

1514
if (elapsed < msPerMinute) {
16-
return Math.round(elapsed/1000) + ' seconds ago';
17-
}
18-
19-
else if (elapsed < msPerHour) {
20-
return Math.round(elapsed/msPerMinute) + ' minutes ago';
21-
}
22-
23-
else if (elapsed < msPerDay ) {
24-
return Math.round(elapsed/msPerHour ) + ' hours ago';
25-
}
26-
27-
else if (elapsed < msPerMonth) {
28-
return Math.round(elapsed/msPerDay) + ' days ago';
29-
}
30-
31-
else if (elapsed < msPerYear) {
32-
return Math.round(elapsed/msPerMonth) + ' months ago';
33-
}
34-
35-
else {
36-
return Math.round(elapsed/msPerYear ) + ' years ago';
15+
return Math.round(elapsed / 1000) + ' seconds ago';
16+
} else if (elapsed < msPerHour) {
17+
return Math.round(elapsed / msPerMinute) + ' minutes ago';
18+
} else if (elapsed < msPerDay) {
19+
return Math.round(elapsed / msPerHour) + ' hours ago';
20+
} else if (elapsed < msPerMonth) {
21+
return Math.round(elapsed / msPerDay) + ' days ago';
22+
} else if (elapsed < msPerYear) {
23+
return Math.round(elapsed / msPerMonth) + ' months ago';
24+
} else {
25+
return Math.round(elapsed / msPerYear) + ' years ago';
3726
}
3827
}
3928

40-
const HealthDetails = (props: {health: HealthStatusDetailed}) => {
41-
let x =[];
29+
const HealthDetails = (props: { health: HealthStatusDetailed }) => {
30+
let x = [];
4231

43-
SignerTypes.forEach(
44-
(signer) => {
45-
x.push(
46-
<List.Item>
47-
<List.Icon name="circle" color={props.health[signer]?.status ? "green" : "red"} />
48-
<List.Content>
49-
<List.Header as="a">{signerToString(signer)}</List.Header>
50-
{props.health[signer]?.time ?
32+
SignerTypes.forEach(signer => {
33+
x.push(
34+
<List.Item key={signer}>
35+
<List.Icon name="circle" color={props.health[signer]?.status ? 'green' : 'red'} />
36+
<List.Content>
37+
<List.Header as="a">{signerToString(signer)}</List.Header>
38+
{props.health[signer]?.time ? (
5139
<List.Description as="a">Updated {timeDifference(Date.now(), props.health[signer].time)}</List.Description>
52-
: null}
53-
</List.Content>
54-
</List.Item>
55-
);
56-
}
57-
);
40+
) : null}
41+
</List.Content>
42+
</List.Item>,
43+
);
44+
});
5845

59-
return (<List divided relaxed>
60-
{x}
61-
</List>);
62-
}
63-
64-
const HealthPopup = (props) => {
46+
return (
47+
<List divided relaxed>
48+
{x}
49+
</List>
50+
);
51+
};
6552

53+
const HealthPopup = props => {
6654
if (!props.health) {
67-
return <></>
55+
return <></>;
6856
}
6957

70-
return (
71-
<Popup content={HealthDetails(props)} trigger={props.children}>
72-
73-
</Popup>
74-
);
75-
}
58+
return <Popup content={HealthDetails(props)} trigger={props.children}></Popup>;
59+
};
7660

77-
export default HealthPopup
61+
export default HealthPopup;

src/stores/Tokens.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ export class Tokens extends ListStoreConstructor<ITokenInfo> {
2020
},
2121
});
2222
}
23+
24+
getTokenBySymbol(symbol: string): ITokenInfo {
25+
return this.allData.find(token => token.display_props.symbol.toLowerCase() === symbol.toLowerCase());
26+
}
27+
2328
//
2429
@computed get totalLockedUSD() {
2530
return this.allData.reduce((acc, v) => acc + Number(v.totalLockedUSD), 0);

0 commit comments

Comments
 (0)