1
1
import React from "react" ;
2
2
import styled from "styled-components" ;
3
3
4
+ import Skeleton from "react-loading-skeleton" ;
5
+
4
6
import { useOptionsContext , useFundingContext } from "hooks/useClassicAppealContext" ;
5
7
6
8
import HowItWorks from "components/HowItWorks" ;
7
9
import Appeal from "components/Popup/MiniGuides/Appeal" ;
8
10
9
11
import OptionCard from "./OptionCard" ;
10
-
11
- import { AppealHeader , StyledTitle } from "." ;
12
+ import { AppealHeader , StyledTitle } from "./index" ;
12
13
13
14
const OptionsContainer = styled . div `
14
15
display: grid;
@@ -26,7 +27,7 @@ const AppealHistory: React.FC<IAppealHistory> = ({ isAppealMiniGuideOpen, toggle
26
27
const options = useOptionsContext ( ) ;
27
28
const { winningChoice, paidFees, fundedChoices } = useFundingContext ( ) ;
28
29
29
- return (
30
+ return options && options . length > 2 ? (
30
31
< div >
31
32
< AppealHeader >
32
33
< StyledTitle > Appeal Results - Last Round</ StyledTitle >
@@ -37,24 +38,20 @@ const AppealHistory: React.FC<IAppealHistory> = ({ isAppealMiniGuideOpen, toggle
37
38
/>
38
39
</ AppealHeader >
39
40
< OptionsContainer >
40
- { options ? (
41
- options . map ( ( option , index ) => {
42
- return (
43
- < OptionCard
44
- key = { option + index }
45
- text = { option }
46
- winner = { index . toString ( ) === winningChoice }
47
- funding = { BigInt ( paidFees ?. [ index ] ?? "0" ) }
48
- required = { fundedChoices ?. includes ( index . toString ( ) ) ? BigInt ( paidFees ?. [ index ] ?? "0" ) : undefined }
49
- canBeSelected = { false }
50
- />
51
- ) ;
52
- } )
53
- ) : (
54
- < h2 > Not in appeal period</ h2 >
55
- ) }
41
+ { options . map ( ( option , index ) => (
42
+ < OptionCard
43
+ key = { option + index }
44
+ text = { option }
45
+ winner = { index . toString ( ) === winningChoice }
46
+ funding = { BigInt ( paidFees ?. [ index ] ?? "0" ) }
47
+ required = { fundedChoices ?. includes ( index . toString ( ) ) ? BigInt ( paidFees ?. [ index ] ?? "0" ) : undefined }
48
+ canBeSelected = { false }
49
+ />
50
+ ) ) }
56
51
</ OptionsContainer >
57
52
</ div >
53
+ ) : (
54
+ < Skeleton />
58
55
) ;
59
56
} ;
60
57
export default AppealHistory ;
0 commit comments