11import React from "react" ;
22import styled from "styled-components" ;
33
4+ import Skeleton from "react-loading-skeleton" ;
5+
46import { useOptionsContext , useFundingContext } from "hooks/useClassicAppealContext" ;
57
68import HowItWorks from "components/HowItWorks" ;
79import Appeal from "components/Popup/MiniGuides/Appeal" ;
810
911import OptionCard from "./OptionCard" ;
10-
11- import { AppealHeader , StyledTitle } from "." ;
12+ import { AppealHeader , StyledTitle } from "./index" ;
1213
1314const OptionsContainer = styled . div `
1415 display: grid;
@@ -26,7 +27,7 @@ const AppealHistory: React.FC<IAppealHistory> = ({ isAppealMiniGuideOpen, toggle
2627 const options = useOptionsContext ( ) ;
2728 const { winningChoice, paidFees, fundedChoices } = useFundingContext ( ) ;
2829
29- return (
30+ return options && options . length > 2 ? (
3031 < div >
3132 < AppealHeader >
3233 < StyledTitle > Appeal Results - Last Round</ StyledTitle >
@@ -37,24 +38,20 @@ const AppealHistory: React.FC<IAppealHistory> = ({ isAppealMiniGuideOpen, toggle
3738 />
3839 </ AppealHeader >
3940 < 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+ ) ) }
5651 </ OptionsContainer >
5752 </ div >
53+ ) : (
54+ < Skeleton />
5855 ) ;
5956} ;
6057export default AppealHistory ;
0 commit comments