@@ -6,8 +6,8 @@ import { Challenge } from "@/types/course";
6
6
import Link from "next/link" ;
7
7
import RelatedContent from "./RelatedContent" ;
8
8
import Badges from "./Badges" ;
9
- import { useEffect , useMemo , useState } from "react" ;
10
- import { useTranslation } from "react -i18next" ;
9
+ import { useMemo } from "react" ;
10
+ import { useTranslation } from "next -i18next" ;
11
11
12
12
/**
13
13
* `ChallengeCard` is a function component that renders a card
@@ -25,16 +25,12 @@ interface ChallengeCardProps {
25
25
}
26
26
export default function ChallengeCard ( { data, community, isCourseEnd } : ChallengeCardProps ) {
27
27
const { t } = useTranslation ( ) ;
28
- const [ prize , setPrize ] = useState ( "" ) ;
29
28
30
29
const link = `/communities/${ community . slug } /challenges/${ data . id } ` ;
31
30
const expiresAt = useMemo ( ( ) => ( data . expiresAt ? new Date ( data . expiresAt ) . toLocaleDateString ( ) : null ) , [ data . expiresAt ] ) ;
32
31
const reward = isCourseEnd ? data ?. rewards ?. find ( ( reward ) => reward . type === "SUBMISSION" ) : data ?. reward ;
33
32
const totalReward = data ?. rewards ?. reduce ( ( acc , reward ) => ( acc += Number ( reward . amount ) ) , 0 ) ;
34
33
35
- useEffect ( ( ) => {
36
- setPrize ( `${ community ?. slug === "celo" ? "NFT" : "" } ${ t ( "communities.overview.challenge.certificate" ) } ` ) ;
37
- } , [ community , t ] ) ;
38
34
return (
39
35
< div className = "border-solid border border-gray-200 bg-gray-50 rounded-3xl mb-5 group text-gray-700" >
40
36
< div className = "border-solid border-b border-gray-300 bg-white rounded-3xl sm:p-8 sm:pb-6 w-full p-6" >
@@ -51,7 +47,9 @@ export default function ChallengeCard({ data, community, isCourseEnd }: Challeng
51
47
< Certificate size = "medium" name = { community . slug } />
52
48
< div className = "md:pl-2 max-w-max" >
53
49
< div className = "flex text-sm text-gray-700" >
54
- < span className = "block font-medium pr-1" > { prize } </ span >
50
+ < span className = "block font-medium pr-1" >
51
+ { community ?. slug === "celo" && "NFT" } { t ( "communities.overview.challenge.certificate" ) }
52
+ </ span >
55
53
</ div >
56
54
< div className = "text-gray-400 text-xs font-normal" > Upon successful completion</ div >
57
55
</ div >
0 commit comments