@@ -2,6 +2,7 @@ import { useContractRead } from "wagmi"
2
2
import Sector3DAOPriority from '../../../abis/v1/Sector3DAOPriority.json'
3
3
import { useIsMounted } from "@/hooks/useIsMounted"
4
4
import Link from "next/link"
5
+ import { CircleStackIcon , ExclamationCircleIcon } from "@heroicons/react/24/outline"
5
6
6
7
export function EpochPreview ( { priorityAddress, currentEpochNumber, epochNumber } : any ) {
7
8
console . log ( 'EpochPreview' )
@@ -22,7 +23,15 @@ export function EpochPreview({ priorityAddress, currentEpochNumber, epochNumber
22
23
epochContributions = data
23
24
}
24
25
25
- if ( ! useIsMounted ( ) || isLoading ) {
26
+ const { data : isEpochFundedData , isError : isEpochFundedError , isLoading : isEpochFundedLoading } = useContractRead ( {
27
+ address : priorityAddress ,
28
+ abi : Sector3DAOPriority . abi ,
29
+ functionName : 'isEpochFunded' ,
30
+ args : [ epochNumber ]
31
+ } )
32
+ console . log ( 'isEpochFundedData:' , isEpochFundedData )
33
+
34
+ if ( ! useIsMounted ( ) || isLoading || isEpochFundedLoading ) {
26
35
return (
27
36
< span className = "inline-block h-4 w-4 animate-spin rounded-full border-4 border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite]" > </ span >
28
37
)
@@ -42,7 +51,19 @@ export function EpochPreview({ priorityAddress, currentEpochNumber, epochNumber
42
51
43
52
return (
44
53
< >
45
- < div className = 'text-gray-400 mt-4' > Contributions: { epochContributions . length } ({ epochHours } h)</ div >
54
+ { ( ( epochContributions . length > 0 ) && ( epochNumber != currentEpochNumber ) ) && (
55
+ ! isEpochFundedData ? (
56
+ < span className = 'float-right inline-flex bg-amber-900 text-amber-500 font-bold uppercase text-sm rounded-lg px-2 py-1' >
57
+ < ExclamationCircleIcon className = 'h-5 w-5' /> Not yet funded
58
+ </ span >
59
+ ) : (
60
+ < span className = 'float-right inline-flex bg-emerald-900 text-emerald-500 font-bold uppercase text-sm rounded-lg px-2 py-1' >
61
+ < CircleStackIcon className = 'h-5 w-5' /> Funded
62
+ </ span >
63
+ )
64
+ ) }
65
+
66
+ < div className = 'text-gray-400 mt-4' > Contributions: { epochContributions . length } (⏱️{ epochHours } h)</ div >
46
67
{ ( epochContributions . length > 0 ) && (
47
68
< >
48
69
< div >
0 commit comments