Skip to content

Commit 0f9ada5

Browse files
committed
Run format & lint
1 parent 663a8a8 commit 0f9ada5

File tree

3 files changed

+72
-59
lines changed

3 files changed

+72
-59
lines changed

src/components/Countdown.tsx

Lines changed: 68 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,78 @@
1-
import React, { useState, useEffect } from 'react';
1+
import React, { useState, useEffect } from 'react'
2+
3+
interface TimeLeft {
4+
days?: string
5+
hours?: string
6+
minutes?: string
7+
seconds?: string
8+
}
29

310
const Countdown: React.FC = () => {
4-
const calculateTimeLeft = () => {
5-
const targetDate = new Date(new Date().getFullYear(), 5, 1); // June 1st
6-
const now = new Date();
7-
const difference = targetDate.getTime() - now.getTime();
8-
9-
let timeLeft: { days?: string; hours?: string; minutes?: string; seconds?: string } = {};
10-
11-
if (difference > 0) {
12-
timeLeft = {
13-
days: Math.floor(difference / (1000 * 60 * 60 * 24)).toString().padStart(2, '0'),
14-
hours: Math.floor((difference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
15-
.toString()
16-
.padStart(2, '0'),
17-
minutes: Math.floor((difference % (1000 * 60 * 60)) / (1000 * 60))
18-
.toString()
19-
.padStart(2, '0'),
20-
seconds: Math.floor((difference % (1000 * 60)) / 1000)
21-
.toString()
22-
.padStart(2, '0'),
23-
};
24-
}
25-
26-
return timeLeft;
27-
};
11+
const calculateTimeLeft = (): TimeLeft => {
12+
const targetDate = new Date(new Date().getFullYear(), 5, 1) // June 1st
13+
const now = new Date()
14+
const difference = targetDate.getTime() - now.getTime()
2815

29-
const [timeLeft, setTimeLeft] = useState(calculateTimeLeft());
30-
const [isMounted, setIsMounted] = useState(false);
16+
let timeLeft: TimeLeft = {}
3117

32-
useEffect(() => {
33-
setIsMounted(true);
34-
const timer = setInterval(() => {
35-
setTimeLeft(calculateTimeLeft());
36-
}, 1000);
18+
if (difference > 0) {
19+
timeLeft = {
20+
days: Math.floor(difference / (1000 * 60 * 60 * 24))
21+
.toString()
22+
.padStart(2, '0'),
23+
hours: Math.floor(
24+
(difference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60),
25+
)
26+
.toString()
27+
.padStart(2, '0'),
28+
minutes: Math.floor((difference % (1000 * 60 * 60)) / (1000 * 60))
29+
.toString()
30+
.padStart(2, '0'),
31+
seconds: Math.floor((difference % (1000 * 60)) / 1000)
32+
.toString()
33+
.padStart(2, '0'),
34+
}
35+
}
3736

38-
return () => clearInterval(timer);
39-
}, []);
37+
return timeLeft
38+
}
4039

41-
if (!isMounted) {
42-
return null;
43-
}
40+
const [timeLeft, setTimeLeft] = useState<TimeLeft>(calculateTimeLeft())
41+
const [isMounted, setIsMounted] = useState(false)
4442

45-
if (timeLeft.seconds === undefined) {
46-
return null;
43+
useEffect(() => {
44+
setIsMounted(true)
45+
const timer = setInterval(() => {
46+
setTimeLeft(calculateTimeLeft())
47+
}, 1000)
48+
49+
return () => {
50+
clearInterval(timer)
4751
}
52+
}, [])
53+
54+
if (!isMounted) {
55+
return null
56+
}
57+
58+
if (timeLeft.seconds === undefined) {
59+
return null
60+
}
4861

49-
return (
50-
<div className='px-6 pb-6'>
51-
<p
52-
className='cursor-default'
53-
title="Using Client smart contract is available only for new applications. Select Contract as allocation type to start using it"
54-
>
55-
Direct client allocation will be deprecated in{' '}
56-
<span className="inline-block text-center" style={{width: '90px'}}>
57-
{timeLeft.days}:{timeLeft.hours}:{timeLeft.minutes}:{timeLeft.seconds}
58-
</span>
59-
. Start using the Client smart contract today.
60-
</p>
61-
</div>
62-
);
63-
};
62+
return (
63+
<div className="px-6 pb-6">
64+
<p
65+
className="cursor-default"
66+
title="Using Client smart contract is available only for new applications. Select Contract as allocation type to start using it"
67+
>
68+
Direct client allocation will be deprecated in{' '}
69+
<span className="inline-block text-center" style={{ width: '90px' }}>
70+
{timeLeft.days}:{timeLeft.hours}:{timeLeft.minutes}:{timeLeft.seconds}
71+
</span>
72+
. Start using the Client smart contract today.
73+
</p>
74+
</div>
75+
)
76+
}
6477

65-
export default Countdown;
78+
export default Countdown

src/components/cards/AppInfoCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ const AppInfoCard: React.FC<ComponentProps> = ({
10461046
/>
10471047
)}
10481048
</CardContent>
1049-
<Countdown/>
1049+
<Countdown />
10501050
<div>
10511051
<CardFooter className="flex flex-row items-center border-t pt-4 pb-2 mt-4 justify-between gap-3">
10521052
<div className="flex gap-2 pb-4">

src/components/cards/dialogs/allowedSps/AllowedSps.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export const AllowedSPs: React.FC<ComponentProps> = ({
222222
<Spinner />
223223
</div>
224224
) : null}
225-
<FormControl fullWidth>
225+
<FormControl fullWidth>
226226
<InputLabel>Max Deviation</InputLabel>
227227
<OutlinedInput
228228
id="outlined-controlled"
@@ -232,10 +232,10 @@ export const AllowedSPs: React.FC<ComponentProps> = ({
232232
label="Max Deviation"
233233
value={maxDeviationInPercentage ?? ''}
234234
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
235-
setMaxDeviationInPercentage(event.target.value)
235+
setMaxDeviationInPercentage(event.target.value)
236236
}}
237237
/>
238-
</FormControl>
238+
</FormControl>
239239
<div className="flex flex-col space-y-4 my-8">
240240
<div>SP count: {data.length}</div>
241241
{data.map((item, index) => (

0 commit comments

Comments
 (0)