Skip to content

Commit 5c265ab

Browse files
refactor: resolve merge conflicts within a certificate
2 parents 9352b7d + 5b4f2d9 commit 5c265ab

File tree

16 files changed

+261
-206
lines changed

16 files changed

+261
-206
lines changed

public/img/certificates/icp-ai-web3-hackathon.svg

Lines changed: 12 additions & 12 deletions
Loading

public/locales/bg/common.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@
113113
"communities.overview.challenge.rewards": "Награди",
114114
"communities.overview.challenge.subtitle": "При успешно завършване",
115115
"communities.overview.challenge.expiry": "Срок на изтичане на предизвикателството:",
116+
"communities.overview.challenge.take.challenge": "Вземете предизвикателството",
117+
"communities.overview.challenge.see.challenge": "Вижте предизвикателството",
118+
"communities.overview.challenge.unlock.certificate": "Отключване с сертификат",
119+
"communities.overview.challenge.participate": "Участвайте в хакатони {{token}}",
120+
"communities.overview.challenge.for.certificate": "за сертификата",
121+
"communities.overview.challenge.for.feedback": "за всеки отзив",
122+
"communities.overview.challenge.learning.modules.included": "Включени образователни модули",
123+
"communities.overview.challenge.no.learning.modules": "Без включени образователни модули",
116124
"communities.overview.challenge.learning.title": "Следните учебни материали ще ви осигурят техническите умения, необходими за успешното справяне с предизвикателството.",
117125
"communities.overview.challenge.learning.start": "започнете сега",
118126
"communities.overview.challenge.team.setup.title": "Създайте вашия екип",
@@ -193,6 +201,7 @@
193201
"course.challenge.reward": "REWARD",
194202
"course.challenge.reward.description": "By completing the challenge in this course you can earn {{amount}} {{token}}",
195203
"course.challenge.reward.stable.description": "By completing the challenge in this course you can earn {{currency}}{{amount}} in {{token}}",
204+
"course.challenge.reward.certificate.description": "Завършете курса, за да получите сертификата и отключете нови възможности.",
196205
"course.scoreboard.button": "Load more",
197206
"learning-module.material.open.lesson": "Open Lesson",
198207
"learning-module.material.open.article": "Open Article",
@@ -314,8 +323,13 @@
314323
"referrals.empty-state.title": "No referrals yet",
315324
"referrals.empty-state.subtitle": "Once someone uses your referral code to signup, they will showup here",
316325
"referrals.joined": "Joined",
317-
"referrals.challenge-participation": "Participated in a challenge in",
318-
"referrals.submission.evaluation": "Submission evaluated",
326+
"referrals.challenge-participation": "Participated in a challenge",
327+
"referrals.challenge.evaluation.status.passed": "Успешно преминал",
328+
"referrals.challenge.evaluation.status.failed": "Не премина",
329+
"referrals.challenge.evaluation..status.pending": "Участвал в",
330+
"referrals.challenge.evaluation.pending": "Изчаква оценка ...",
331+
"referrals.submission.evaluation": "Прегледан принос",
332+
"referrals.submission.challenge": "предизвикателство",
319333
"referrals.submission.points": "points",
320334
"referrals.reward.text": "You earned the referral reward",
321335
"submissions.empty-state.title": "No submissions yet.",

public/locales/en/common.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@
119119
"communities.overview.challenge.certificate": "Certificate",
120120
"communities.overview.challenge.subtitle": "Upon successful completion",
121121
"communities.overview.challenge.expiry": "Challenge expiry date:",
122+
"communities.overview.challenge.take.challenge":"Take the challenge",
123+
"communities.overview.challenge.see.challenge": "See the challenge",
124+
"communities.overview.challenge.for.certificate":"for the certificate",
125+
"communities.overview.challenge.for.feedback":"for every feedback",
126+
"communities.overview.challenge.unlock.certificate":"Unlock with Certificate",
127+
"communities.overview.challenge.participate":"Participate in {{token}} hackathons",
128+
"communities.overview.challenge.learning.modules.included": "Learning modules included",
129+
"communities.overview.challenge.no.learning.modules":"No learning modules included",
122130
"communities.overview.challenge.learning.title": "The following learning materials will equip you with the technical expertise required to successfully address the challenge.",
123131
"communities.overview.challenge.learning.start": "Start now",
124132
"communities.overview.challenge.team.setup.title": "Form your team",
@@ -195,6 +203,7 @@
195203
"course.challenge.reward": "REWARD",
196204
"course.challenge.reward.description": "By completing the challenge in this course you can earn {{amount}} {{token}}",
197205
"course.challenge.reward.stable.description": "By completing the challenge in this course you can earn {{currency}}{{amount}} in {{token}}",
206+
"course.challenge.reward.certificate.description":"Complete the course to achieve the certificate and unlock new opportunities",
198207
"course.challenge.certificate": "CERTIFICATE",
199208
"course.challenge.certificate.description": "By completing the challenge in this course you can earn a certificate.",
200209
"course.scoreboard.button": "Load more",
@@ -344,7 +353,12 @@
344353
"referrals.empty-state.subtitle": "Once someone uses your referral code to signup, they will showup here",
345354
"referrals.joined": "Joined",
346355
"referrals.challenge-participation": "Participated in a challenge in",
356+
"referrals.challenge.evaluation.status.passed": "Successfully passed",
357+
"referrals.challenge.evaluation.status.failed": "Did not pass",
358+
"referrals.challenge.evaluation.status.pending": "Participated in",
359+
"referrals.challenge.evaluation.pending": "Pending evaluation ...",
347360
"referrals.submission.evaluation": "Submission evaluated",
361+
"referrals.submission.challenge": "challenge",
348362
"referrals.submission.points": "points",
349363
"referrals.reward.text": "You earned the referral reward",
350364
"submissions.empty-state.title": "No submissions yet.",

public/locales/es/common.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@
118118
"communities.overview.challenge.certificate": "Certificate",
119119
"communities.overview.challenge.subtitle": "Al completar con éxito",
120120
"communities.overview.challenge.expiry": "Fecha de vencimiento del desafío:",
121+
"communities.overview.challenge.take.challenge": "Toma el desafío",
122+
"communities.overview.challenge.see.challenge": "Ver el desafío",
123+
"communities.overview.challenge.unlock.certificate": "Desbloquear con certificado",
124+
"communities.overview.challenge.participate": "Participa en hackatones {{token}}",
125+
"communities.overview.challenge.for.certificate": "para el certificado",
126+
"communities.overview.challenge.for.feedback": "para cada retroalimentación",
127+
"communities.overview.challenge.learning.modules.included": "Módulos de aprendizaje incluidos",
128+
"communities.overview.challenge.no.learning.modules": "No se incluyen módulos de aprendizaje",
121129
"communities.overview.challenge.learning.title": "Los siguientes materiales de aprendizaje le proporcionarán la experiencia técnica necesaria para abordar con éxito el desafío.",
122130
"communities.overview.challenge.learning.start": "Comenzar ahora",
123131
"communities.overview.challenge.team.setup.title": "Forma tu equipo",
@@ -195,6 +203,7 @@
195203
"course.challenge.reward": "RECOMPENSA",
196204
"course.challenge.reward.description": "Completando este reto de este curso puede asegurarse la cantidad de {{amount}} {{token}}",
197205
"course.challenge.reward.stable.description": "Completando este reto de este curso puede asegurarse {{currency}}{{amount}} en {{token}}",
206+
"course.challenge.reward.certificate.description": "Completa el curso para obtener el certificado y desbloquear nuevas oportunidades.",
198207
"course.scoreboard.button": "Cargar más",
199208
"learning-module.material.open.lesson": "Abrir lección",
200209
"learning-module.material.open.article": "Abrir artículo",
@@ -315,7 +324,12 @@
315324
"referrals.empty-state.title": "No hay recomendaciones",
316325
"referrals.joined": "Registro completo",
317326
"referrals.challenge-participation": "Participó en un reto en",
327+
"referrals.challenge.evaluation.status.passed": "Successfully passed",
328+
"referrals.challenge.evaluation.status.failed": "No pasó",
329+
"referrals.challenge.evaluation.status.pending": "Participó en",
330+
"referrals.challenge.evaluation.pending": "Pendiente de evaluación ...",
318331
"referrals.submission.evaluation": "Propuestas evaluadas",
332+
"referrals.submission.challenge": "desafío",
319333
"referrals.submission.points": "puntos",
320334
"referrals.reward.text": "Ha ganado una recompensa por recomendación",
321335
"submissions.empty-state.title": "No hay propuestas todavía.",

public/locales/hr/common.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,14 @@
166166
"communities.overview.challenge.subtitle": "Nakon uspješnog završetka",
167167
"communities.overview.challenge.certificate": "Certificate",
168168
"communities.overview.challenge.expiry": "Datum isteka izazova:",
169+
"communities.overview.challenge.take.challenges": "Prihvati izazov",
170+
"communities.overview.challenge.see.challenge": "Pogledaj izazov",
171+
"communities.overview.challenge.unlock.certificate": "Otključajte s certifikatom",
172+
"communities.overview.challenge.participate": "Sudjelujte na ${token} hakatonima",
173+
"communities.overview.challenge.for.certificate": "za certifikat",
174+
"communities.overview.challenge.for.feedback": "za svaki povratni odgovor",
175+
"communities.overview.challenge.learning.modules.included": "Uključeni moduli učenja",
176+
"communities.overview.challenge.no.learning.modules": "Nema uključenih modula učenja",
169177
"communities.overview.challenge.learning.title": "Sljedeći materijali za učenje opskrbit će vas tehničkim stručnostima potrebnim za uspješno rješavanje izazova.",
170178
"communities.overview.challenge.learning.start": "Počnite sada",
171179
"communities.overview.challenge.team.setup.title": "Sastavite svoj tim",
@@ -193,6 +201,7 @@
193201
"course.challenge.reward": "REWARD",
194202
"course.challenge.reward.description": "By completing the challenge in this course you can earn {{amount}} {{token}}",
195203
"course.challenge.reward.stable.description": "By completing the challenge in this course you can earn {{currency}}{{amount}} in {{token}}",
204+
"course.challenge.reward.certificate.description": "Završite tečaj kako biste dobili certifikat i otključali nove prilike",
196205
"course.scoreboard.button": "Load more",
197206
"learning-module.material.open.lesson": "Open Lesson",
198207
"learning-module.material.open.article": "Otvori članak",
@@ -315,7 +324,12 @@
315324
"referrals.empty-state.subtitle": "Once someone uses your referral code to signup, they will showup here",
316325
"referrals.joined": "Joined",
317326
"referrals.challenge-participation": "Participated in a challenge in",
318-
"referrals.submission.evaluation": "Submission evaluated",
327+
"referrals.challenge.evaluation.status.passed": "Successfully passed",
328+
"referrals.challenge.evaluation.status.failed": "Nije prošao",
329+
"referrals.challenge.evaluation.status.pending": "Sudjelovao u",
330+
"referrals.challenge.evaluation.pending": "Na čekanju evaluacije ...",
331+
"referrals.submission.evaluation": "Ocijenjen prilog",
332+
"referrals.submission.challenge": "izazov",
319333
"referrals.submission.points": "points",
320334
"referrals.reward.text": "You earned the referral reward",
321335
"submissions.empty-state.title": "No submissions yet.",

src/components/cards/Referral.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Avatar from "@/components/ui/Avatar";
2-
import { Reward as IReward } from "@/types/course";
3-
import { Community } from "@/types/community";
2+
import { Referral as TReferral } from "@/types/community";
43
import RewardBadge from "../badges/RewardBadge";
54
import { useTranslation } from "next-i18next";
65
import { ReactElement } from "react";
@@ -16,11 +15,7 @@ import { useDispatch } from "@/hooks/useTypedDispatch";
1615
*/
1716

1817
interface ReferralProps {
19-
referral: {
20-
title?: string;
21-
community: Community;
22-
reward: IReward;
23-
};
18+
referral: TReferral;
2419
}
2520

2621
/**
Lines changed: 32 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import Certificate from "@/components/ui/Certificate";
2-
import Coin from "@/components/ui/Coin";
31
import ArrowButton from "@/components/ui/button/Arrow";
42
import { Community } from "@/types/community";
53
import { Challenge } from "@/types/course";
64
import Link from "next/link";
7-
import RelatedContent from "./RelatedContent";
85
import Badges from "./Badges";
96
import { useMemo } from "react";
107
import { useTranslation } from "next-i18next";
11-
import { shortenNumber } from "@/utilities";
8+
import Image from "next/image";
9+
import RewardCertificate from "./RewardCertificate";
1210

1311
/**
1412
* `ChallengeCard` is a function component that renders a card
@@ -26,86 +24,52 @@ interface ChallengeCardProps {
2624
}
2725
export default function ChallengeCard({ data, community, isCourseEnd }: ChallengeCardProps) {
2826
const { t } = useTranslation();
29-
3027
const link = `/communities/${community.slug}/challenges/${data.id}`;
3128
const expiresAt = useMemo(() => (data.expiresAt ? new Date(data.expiresAt).toLocaleDateString() : null), [data.expiresAt]);
3229
const reward = isCourseEnd ? data?.rewards?.find((reward) => reward.type === "SUBMISSION") : data?.reward;
33-
const amount = shortenNumber(data?.rewards?.reduce((acc, reward) => (acc += Number(reward.amount)), 0));
30+
const learningModulesCount = data?.learningModules?.length || 0;
3431

3532
return (
36-
<div className="border-solid border border-gray-200 bg-gray-50 rounded-3xl mb-5 group text-gray-700">
37-
<div className="border-solid border-b border-gray-300 bg-white rounded-3xl sm:p-8 sm:pb-6 w-full p-6">
38-
<div className="w-full">
39-
<div className="lg:flex mb-1">
40-
<div className="lg:pr-20 w-full lg:w-3/5">
41-
<div className="text-lg text-gray-900 font-medium leading-normal">{data.name}</div>
42-
<div className="text-sm mt-3 pb-2 text-gray-700">{data.description}</div>
43-
<Badges challenge={data} className="md:hidden" />
44-
</div>
45-
46-
<div className="flex flex-col mb-6 lg:mb-0 mt-6 md:mt-0 max-w-max text-sm">
47-
<div className="flex items-center mb-8 gap-2 md:gap-0">
48-
<Certificate size="medium" name={community.slug} />
49-
<div className="md:pl-2 max-w-max">
50-
<div className="flex text-sm text-gray-700">
51-
<span className="block font-medium pr-1">
52-
{community?.slug === "celo" && "NFT"} {t("communities.overview.challenge.certificate")}
53-
</span>
54-
</div>
55-
<div className="text-gray-400 text-xs font-normal">Upon successful completion</div>
56-
</div>
57-
</div>
58-
<div className="flex items-center">
59-
<Coin size="medium" token={reward?.token} />
60-
<div className="md:pl-2 max-w-max">
61-
<div className="flex text-sm text-gray-700">
62-
<span className="block font-medium">
63-
{data?.isHackathon ? <>{reward?.fiatCurrency ?
64-
t('communities.overview.reward.fiat.prize.pool', { amount, currency: reward.fiatCurrency, token: reward?.token }) :
65-
t('communities.overview.reward.crypto.prize.pool', { amount, token: reward?.token })
66-
} </> : <>{amount} {reward?.token} </>}
67-
68-
{t("communities.overview.reward.title")}
69-
</span>
70-
</div>
71-
<div className="text-gray-400 text-xs font-normal">{data?.isHackathon ? "Top projects win money prizes" : "For submission and feedback"}</div>
72-
</div>
73-
</div>
74-
</div>
75-
</div>
76-
</div>
77-
<div className="divide-y-2 divide-gray-200 divide-dotted flex flex-col">
78-
<Badges challenge={data} className="hidden md:flex" />
79-
<div className="lg:flex lg:flex-row flex-col justify-between pt-6 items-center">
33+
<div className="w-full justify-between- flex flex-col sm:flex-row md:flex-col lg:flex-row border-solid border border-gray-200 bg-gray-50 rounded-3xl mb-5 group text-gray-700">
34+
<div className="border-solid border-b border-gray-300 bg-white rounded-3xl sm:p-8 sm:pb-6 p-6 lg:w-2/3">
35+
<div className="flex flex-col mb-1">
36+
<div className="lg:pr-20 lg:w-3/5-">
8037
<div className="text-gray-400 lg:w-2/3 text-sm font-normal mb-6 lg:mb-0">
8138
{expiresAt && (
8239
<>
83-
<span>Deadline</span>
40+
<span>{t("communities.overview.challenge.deadline")}</span>
8441
<span className="font-medium pl-1">{expiresAt}</span>
8542
</>
8643
)}
8744
</div>
88-
89-
<Link href={link}>
90-
<ArrowButton communityStyles={true} variant="outline-primary">
91-
{isCourseEnd ? "Take the challenge" : "See the challenge"}
92-
</ArrowButton>
93-
</Link>
45+
<div className="text-lg text-gray-900 font-medium leading-normal mb-6">{data.name}</div>
46+
<Badges challenge={data} className="" />
47+
<div className="text-sm pb-2 text-gray-700">{data.description}</div>
48+
</div>
49+
<div className="divide-y-2 divide-gray-200 divide-dotted flex flex-col mt-3">
50+
<p className="pb-6">
51+
{learningModulesCount ? `${learningModulesCount} learning ${learningModulesCount === 1 ? "module" : "modules"} included` : "No learning modules included"}
52+
</p>
53+
<div className="lg:flex lg:flex-row flex-col justify-between pt-6 items-center">
54+
<Link href={link}>
55+
<ArrowButton communityStyles={true} variant="outline-primary">
56+
{isCourseEnd ? t("communities.overview.challenge.take.challenge") : t("communities.overview.challenge.see.challenge")}
57+
</ArrowButton>
58+
</Link>
59+
</div>
9460
</div>
9561
</div>
9662
</div>
97-
98-
{(data.courses?.length > 0 || data.learningModules?.length > 0) && !isCourseEnd && (
99-
<div className="sm:px-8 sm:pt-6 sm:pb-9 w-full p-6 rounded-3xl text-sm">
100-
<div className="mb-3 text-gray-400 font-semibold uppercase text-xxs">related content</div>
101-
{data.courses?.map((course) => (
102-
<RelatedContent key={course.id} content={course} />
103-
))}
104-
{data.learningModules?.map((learningModule) => (
105-
<RelatedContent key={learningModule.id} content={learningModule} />
106-
))}
63+
<div className="p-6">
64+
<div className={"mx-auto relative rounded-full mb-5 w-[147px] h-[184px]"}>
65+
<Image src={data?.certificateData?.icon} alt="achievement" fill />
66+
</div>
67+
<div className="">
68+
<h1 className="font-bold text-gray-400 text-xs uppercase pb-2">{t("communities.overview.challenge.unlock.certificate")}</h1>
69+
<RewardCertificate rewards={data?.rewards}/>
10770
</div>
108-
)}
71+
{data?.isHackathon && <p className="py-2 border-t border-gray-200 text-sm">{t("communities.overview.challenge.participate", { token: reward?.token })}</p>}
72+
</div>
10973
</div>
11074
);
11175
}

0 commit comments

Comments
 (0)