1
- import React from "react" ;
1
+ import React , { useMemo } from "react" ;
2
2
import Section from "@/components/sections/communities/_partials/Section" ;
3
3
import TeamChallengeCard from "@/components/cards/TeamChallenge" ;
4
4
import { useSelector } from "@/hooks/useTypedSelector" ;
@@ -22,48 +22,51 @@ interface CardData {
22
22
export default function TeamChallenge ( ) : JSX . Element {
23
23
const challenge = useSelector ( ( state ) => state . challenges . current ) ;
24
24
25
- const TeamChallengeData : CardData [ ] = challenge ?. isHackathon
26
- ? [
27
- {
28
- index : 1 ,
29
- title : "Form your team" ,
30
- text : "Open Telegram group and find your teammates to complete the challenge with you" ,
31
- } ,
32
- {
33
- index : 2 ,
34
- title : "Confirm your team" ,
35
- text : "Make sure your teammates accept notification to confirm your team" ,
36
- } ,
37
- {
38
- index : 3 ,
39
- title : "Submit!" ,
40
- text : "Once you have completed the challenge, only one person needs to submit it at the end of this page" ,
41
- } ,
42
- ]
43
- : [
44
- {
45
- index : 1 ,
46
- title : "Form your team" ,
47
- text : "Open discord channel #teams and find your teammates to complete the challenge with you" ,
48
- } ,
49
- {
50
- index : 2 ,
51
- title : "Confirm your team" ,
52
- text : "Make sure your teammates accept notification to confirm your team" ,
53
- } ,
54
- {
55
- index : 3 ,
56
- title : "Submit!" ,
57
- text : "Once you have completed the challenge, only one person needs to submit it at the end of this page" ,
58
- } ,
59
- ] ;
25
+ const hackathonChallengeSteps : CardData [ ] = [
26
+ {
27
+ index : 1 ,
28
+ title : "Form your team" ,
29
+ text : "Open Telegram group and find your teammates to complete the challenge with you" ,
30
+ } ,
31
+ {
32
+ index : 2 ,
33
+ title : "Confirm your team" ,
34
+ text : "Make sure your teammates accept notification to confirm your team" ,
35
+ } ,
36
+ {
37
+ index : 3 ,
38
+ title : "Submit!" ,
39
+ text : "Once you have completed the challenge, only one person needs to submit it at the end of this page" ,
40
+ } ,
41
+ ] ;
42
+ const teamChallengeSteps : CardData [ ] = [
43
+ {
44
+ index : 1 ,
45
+ title : "Form your team" ,
46
+ text : "Open discord channel #teams and find your teammates to complete the challenge with you" ,
47
+ } ,
48
+ {
49
+ index : 2 ,
50
+ title : "Confirm your team" ,
51
+ text : "Make sure your teammates accept notification to confirm your team" ,
52
+ } ,
53
+ {
54
+ index : 3 ,
55
+ title : "Submit!" ,
56
+ text : "Once you have completed the challenge, only one person needs to submit it at the end of this page" ,
57
+ } ,
58
+ ] ;
59
+
60
+ const steps : CardData [ ] = useMemo ( ( ) => {
61
+ return challenge ?. isTeamChallenge ? hackathonChallengeSteps : teamChallengeSteps ;
62
+ } , [ challenge ?. isTeamChallenge ] ) ;
60
63
61
64
return (
62
65
< Section title = "Team Challenge" >
63
66
< div className = "text-base font-normal text-slate-700 pt-8 pb-7 md:w-182.5" > To complete the team challenge, you need to follow these steps:</ div >
64
67
< div className = "md:flex flex-row gap-20 md:divide-y-0 divide-y divide-gray-900 divide-dotted space-y-5 md:space-y-0 space-x-0" >
65
- { TeamChallengeData . map ( ( card ) => (
66
- < TeamChallengeCard key = { `TeamChallenge-card-data-${ card . index } ` } index = { card . index } title = { card . title } text = { card . text } />
68
+ { steps . map ( ( step ) => (
69
+ < TeamChallengeCard key = { `TeamChallenge-card-data-${ step . index } ` } index = { step . index } title = { step . title } text = { step . text } />
67
70
) ) }
68
71
</ div >
69
72
</ Section >
0 commit comments