Skip to content

Commit 247cf8b

Browse files
fix: second last module not showing next button on the challenge/learning-module page
1 parent 77bf81f commit 247cf8b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/cards/challenge/Challenge.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ export default function ChallengeCard({ data, community, isCourseEnd }: Challeng
2727
const link = `/communities/${community.slug}/challenges/${data.id}`;
2828
const expiresAt = useMemo(() => (data.expiresAt ? new Date(data.expiresAt).toLocaleDateString() : null), [data.expiresAt]);
2929
const reward = isCourseEnd ? data?.rewards?.find((reward) => reward.type === "SUBMISSION") : data?.reward;
30-
const learningMaterialsCount = data?.learningModules?.length + data?.courses?.length
30+
31+
const { learningModules = [], courses = [] } = data || {};
32+
const learningMaterialsCount = learningModules.length + courses.length;
33+
3134

3235
return (
3336
<div className="w-full 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">

0 commit comments

Comments
 (0)