diff --git a/public/locales/bg/common.json b/public/locales/bg/common.json index 74c50eb87..4a5172c22 100644 --- a/public/locales/bg/common.json +++ b/public/locales/bg/common.json @@ -119,7 +119,7 @@ "communities.overview.challenge.take.challenge": "Вземете предизвикателството", "communities.overview.challenge.see.challenge": "Вижте предизвикателството", "communities.overview.challenge.unlock.certificate": "Отключване с сертификат", - "communities.overview.challenge.participate": "Участвайте в хакатони {{token}}", + "communities.overview.challenge.participate": "Участвайте в хакатони {{community}}", "communities.overview.challenge.for.certificate": "за сертификата", "communities.overview.challenge.for.feedback": "за всеки отзив", "communities.overview.challenge.learning.modules.included": "Включени образователни модули", diff --git a/public/locales/en/common.json b/public/locales/en/common.json index c76d0d913..802ae21b1 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -126,7 +126,7 @@ "communities.overview.challenge.for.certificate": "for the certificate", "communities.overview.challenge.for.feedback": "for every feedback", "communities.overview.challenge.unlock.certificate": "Unlock with Certificate", - "communities.overview.challenge.participate": "Participate in {{token}} hackathons", + "communities.overview.challenge.participate": "Participate in {{community}} hackathons", "communities.overview.challenge.learning.modules.included": "Learning modules included", "communities.overview.challenge.no.learning.modules": "No learning modules included", "communities.overview.challenge.learning.title": "The following learning materials will equip you with the technical expertise required to successfully address the challenge.", diff --git a/public/locales/es/common.json b/public/locales/es/common.json index 77d40f5a6..90e724028 100644 --- a/public/locales/es/common.json +++ b/public/locales/es/common.json @@ -123,7 +123,7 @@ "communities.overview.challenge.take.challenge": "Toma el desafío", "communities.overview.challenge.see.challenge": "Ver el desafío", "communities.overview.challenge.unlock.certificate": "Desbloquear con certificado", - "communities.overview.challenge.participate": "Participa en hackatones {{token}}", + "communities.overview.challenge.participate": "Participa en hackatones {{community}}", "communities.overview.challenge.for.certificate": "para el certificado", "communities.overview.challenge.for.feedback": "para cada retroalimentación", "communities.overview.challenge.learning.modules.included": "Módulos de aprendizaje incluidos", diff --git a/public/locales/hr/common.json b/public/locales/hr/common.json index 202bf7225..19b66fee2 100644 --- a/public/locales/hr/common.json +++ b/public/locales/hr/common.json @@ -174,7 +174,7 @@ "communities.overview.challenge.take.challenges": "Prihvati izazov", "communities.overview.challenge.see.challenge": "Pogledaj izazov", "communities.overview.challenge.unlock.certificate": "Otključajte s certifikatom", - "communities.overview.challenge.participate": "Sudjelujte na ${token} hakatonima", + "communities.overview.challenge.participate": "Sudjelujte na {{community}} hakatonima", "communities.overview.challenge.for.certificate": "za certifikat", "communities.overview.challenge.for.feedback": "za svaki povratni odgovor", "communities.overview.challenge.learning.modules.included": "Uključeni moduli učenja", diff --git a/src/components/cards/challenge/Challenge.tsx b/src/components/cards/challenge/Challenge.tsx index 54918c60a..58c8764f9 100644 --- a/src/components/cards/challenge/Challenge.tsx +++ b/src/components/cards/challenge/Challenge.tsx @@ -26,7 +26,6 @@ export default function ChallengeCard({ data, community, isCourseEnd }: Challeng const { t } = useTranslation(); const link = `/communities/${community.slug}/challenges/${data.id}`; const expiresAt = useMemo(() => (data.expiresAt ? new Date(data.expiresAt).toLocaleDateString() : null), [data.expiresAt]); - const reward = isCourseEnd ? data?.rewards?.find((reward) => reward.type === "SUBMISSION") : data?.reward; const { learningModules = [], courses = [] } = data || {}; const learningMaterialsCount = learningModules.length + courses.length; @@ -49,9 +48,8 @@ export default function ChallengeCard({ data, community, isCourseEnd }: Challeng
{learningMaterialsCount && ( -

{`${learningMaterialsCount} Learning ${ - learningMaterialsCount === 1 ? "material" : "materials" - } included`}

+

{`${learningMaterialsCount} Learning ${learningMaterialsCount === 1 ? "material" : "materials" + } included`}

)}
@@ -71,7 +69,7 @@ export default function ChallengeCard({ data, community, isCourseEnd }: Challeng

{t("communities.overview.challenge.unlock.certificate")}

- {data?.isHackathon &&

{t("communities.overview.challenge.participate", { token: reward?.token })}

} + {data?.isHackathon &&

{t("communities.overview.challenge.participate", { community: community.name })}

}
); diff --git a/src/components/sections/challenges/Rewards.tsx b/src/components/sections/challenges/Rewards.tsx index adcbff865..defa28254 100644 --- a/src/components/sections/challenges/Rewards.tsx +++ b/src/components/sections/challenges/Rewards.tsx @@ -1,10 +1,13 @@ import Section from "@/components/sections/communities/_partials/Section"; -import { useSelector } from "@/hooks/useTypedSelector"; +import { useMultiSelector } from "@/hooks/useTypedSelector"; import { useTranslation } from "next-i18next"; import { ReactElement } from "react"; import Certificate from "@/components/ui/Certificate"; import { useRouter } from "next/router"; import RewardCertificate from "@/components/cards/challenge/RewardCertificate"; +import { IRootState } from "@/store"; +import { Challenge } from "@/types/course"; +import { Community } from "@/types/community"; /** * Overview reward section component @@ -15,9 +18,11 @@ import RewardCertificate from "@/components/cards/challenge/RewardCertificate"; */ export function OverviewRewards(): ReactElement { const { t } = useTranslation(); - const challenge = useSelector((state) => state.challenges.current); + const { challenge, community } = useMultiSelector({ + challenge: (state: IRootState) => state.challenges.current, + community: (state: IRootState) => state.communities.current, + }) const router = useRouter(); - const token = challenge?.reward?.token || challenge?.rewards[0]?.token || ""; return (
@@ -29,7 +34,7 @@ export function OverviewRewards(): ReactElement {
{challenge?.rewards && }
{!challenge?.isHackathon && ( -
{t("communities.overview.challenge.participate", { token: token })}
+
{t("communities.overview.challenge.participate", { community: community.name })}
)}