Skip to content

Commit 2ecead0

Browse files
authored
Merge pull request #1259 from dacadeorg/ft/learning-materials-page
feat: add learning materials page
2 parents 457aa21 + 5e45b94 commit 2ecead0

File tree

27 files changed

+364
-226
lines changed

27 files changed

+364
-226
lines changed

__tests__/components/ui/MetaData.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ describe("MetaData", () => {
1313
expect(metaTags).toHaveLength(expectedMetaTags.length);
1414
});
1515

16+
it("should render the title when applicable", () => {
17+
render(<MetaData description={description} title="Any title" />);
18+
const metatitle = screen.getByTestId("page-title");
19+
expect(metatitle).toHaveTextContent("Any title");
20+
})
21+
1622
it("should render the correct content in the meta tags", () => {
1723
render(<MetaData description={description} />);
1824
const mockMetas = getMetadataDescription(description);

public/locales/bg/common.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@
9090
"page.protocols.contact.title.2": "Business Development",
9191
"page.protocols.contact.email.2": "[email protected]",
9292
"communities.overview.challenges.title": "Предизвикателства",
93-
"communities.overview.challenges.description": "В курсовете на тази общност ще имате възможност да научите за нови технологии, да решавате предизвикателства, да получавате обратна връзка и да печелите награди.",
93+
"communities.overview.challenges.description": "В предизвикателствата можете да се справите с практически задачи, да получите конструктивна обратна връзка и да спечелите награди за постиженията си.",
94+
"communities.overview.learning-materials.title": "учебни материали",
95+
96+
"communities.overview.learning-materials.description": "В учебните материали можете да изследвате разнообразие от курсове и кратки модули, за да научите за нови технологии и да подобрите уменията си.",
9497
"communities.overview.challenge": "Creative Challenge",
9598
"communities.overview.chapter": "Chapter Overview",
9699
"communities.overview.learning-modules": "Learning Modules",
@@ -179,6 +182,7 @@
179182
"communities.navigation.challenge.overview": "Описание",
180183
"communities.navigation.submissions": "Заявки",
181184
"communities.navigation.scoreboard": "Scoreboard",
185+
"communities.navigation.learning-materials": "учебни материали",
182186
"communities.navigation.courses": "Challenges",
183187
"communities.navigation.language.text": "This course is available in multiple languages",
184188
"communities.navigation.language.eng": "English",

public/locales/en/common.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@
113113
"communities.submission": "Submission",
114114
"communities.challenge.title": "Challenge",
115115
"communities.overview.challenges.title": "Challenges",
116-
"communities.overview.challenges.description": "In the courses of this community, you will be able to learn about new technologies, solve challenges, get feedback, and earn bounties.",
116+
"communities.overview.challenges.description": "In challenges, you can tackle practical tasks, receive constructive feedback, and earn bounties for your achievements.",
117+
"communities.overview.learning-materials.title": "Learning materials",
118+
"communities.overview.learning-materials.description": "In the learning materials, you can explore a variety of courses and short modules to learn about new technologies and enhance your skills.",
117119
"communities.overview.challenge.title": "Already ready to complete the challenge?",
118120
"communities.overview.challenge.rewards": " Rewards",
119121
"communities.overview.challenge.certificate": "Certificate",
@@ -177,6 +179,7 @@
177179
"communities.navigation.learning-modules": "Learning Modules",
178180
"communities.navigation.bounties": "Bounties",
179181
"communities.navigation.challenge": "Challenge",
182+
"communities.navigation.learning-materials": "Learning materials",
180183
"communities.navigation.challenge.overview": "Description",
181184
"communities.navigation.submissions": "Submissions",
182185
"communities.navigation.scoreboard": "Scoreboard",

public/locales/es/common.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@
113113
"communities.submission": "Envío",
114114
"communities.challenge.title": "Reto",
115115
"communities.overview.challenges.title": "Desafíos",
116-
"communities.overview.challenges.description": "En los cursos de esta comunidad, podrás aprender sobre nuevas tecnologías, resolver desafíos, recibir retroalimentación y ganar recompensas.",
116+
"communities.overview.challenges.description": "En los desafíos, puedes abordar tareas prácticas, recibir retroalimentación constructiva y ganar recompensas por tus logros.",
117+
"communities.overview.learning-materials.title": "materiales de aprendizaje",
118+
"communities.overview.learning-materials.description": "En los materiales de aprendizaje, puedes explorar una variedad de cursos y módulos cortos para aprender sobre nuevas tecnologías y mejorar tus habilidades.",
117119
"communities.overview.challenge.rewards": "Recompensas",
118120
"communities.overview.challenge.certificate": "Certificate",
119121
"communities.overview.challenge.subtitle": "Al completar con éxito",
@@ -180,6 +182,7 @@
180182
"communities.navigation.learning-modules": "Módulos de Aprendizaje",
181183
"communities.navigation.bounties": "Premios",
182184
"communities.navigation.challenge": "Reto",
185+
"communities.navigation.learning-materials": " materiales de aprendizaje",
183186
"communities.navigation.challenge.overview": "Descripción",
184187
"communities.navigation.submissions": "Propuestas",
185188
"communities.navigation.scoreboard": "Tabla de Resultados",

public/locales/hr/common.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@
9090
"page.protocols.contact.title.2": "Business Development",
9191
"page.protocols.contact.email.2": "[email protected]",
9292
"communities.overview.challenges.title": "Izazovi",
93-
"communities.overview.challenges.description": "Kroz tečajeve ove zajednice, moći ćete učiti o novim tehnologijama, rješavati izazove, dobivati povratne informacije i zarađivati nagrade.",
93+
"communities.overview.learning-materials.title": "nastavni materijali",
94+
"communities.overview.challenges.description": "U izazovima možete rješavati praktične zadatke, dobivati konstruktivne povratne informacije i zarađivati nagrade za svoja postignuća.",
95+
"communities.overview.learning-materials.description": "U nastavnim materijalima možete istraživati različite tečajeve i kratke module kako biste naučili o novim tehnologijama i unaprijedili svoje vještine.",
9496
"communities.overview.challenge": "Kreativni izazov",
9597
"communities.overview.chapter": "Chapter Overview",
9698
"communities.overview.learning-modules": "Moduli učenja",
@@ -153,6 +155,7 @@
153155
"communities.navigation.submissions": "Prijave",
154156
"communities.navigation.scoreboard": "Scoreboard",
155157
"communities.navigation.courses": "Izazov",
158+
"communities.navigation.learning-materials": "nastavni materijali",
156159
"communities.navigation.language.text": "This course is available in multiple languages",
157160
"communities.navigation.language.eng": "English",
158161
"communities.navigation.language.es": "Spanish",

src/components/badges/Duration.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import classNames from "classnames";
33
import { useRouter } from "next/router";
44
import { useMemo } from "react";
55

6-
export const DurationBadge = ({ value, type = "gray" }: { value: number, type?: string }) => {
6+
interface DurationBadgeProps {
7+
value: number;
8+
type?: string;
9+
}
10+
11+
export const DurationBadge = ({ value, type = "gray" }: DurationBadgeProps) => {
712
const router = useRouter();
813
const duration = useMemo(() => {
914
if (!value) {
@@ -14,7 +19,7 @@ export const DurationBadge = ({ value, type = "gray" }: { value: number, type?:
1419
}, [router.locale, value]);
1520

1621
return (
17-
<span className={classNames("text-xxs uppercase font-semibold px-2 rounded-3xl inline-block text-gray-500",
22+
<span className={classNames("text-xxs uppercase font-semibold px-2 rounded-3xl inline-block text-gray-500 text-nowrap",
1823
{
1924
"bg-gray-200": type === 'gray',
2025
"border border-gray-200": type === "bordered"

src/components/badges/DurationBadge.tsx

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/components/cards/LearningModule.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export function LearningModuleCard({ data }: { data: LearningModule }): JSX.Elem
2424
})
2525

2626
const level = useMemo(() => {
27-
const value = challenge?.level;
27+
const value = data?.level || challenge?.level;
2828
return t((value === 0 || value === 1) ? "course.challenge.level-0" : "course.challenge.level-2");
2929
}, [challenge?.level]);
3030

@@ -38,7 +38,7 @@ export function LearningModuleCard({ data }: { data: LearningModule }): JSX.Elem
3838
<span className="uppercase font-semibold">{t("communities.card.module")}</span>
3939
</div>
4040
<div className="gap-2 flex items-center">
41-
{challenge.level && <Tag className="uppercase">{level}</Tag>}
41+
{challenge?.level && <Tag className="uppercase">{level}</Tag>}
4242
<DurationBadge value={data.duration} type="bordered" />
4343
</div>
4444
</div>

src/components/cards/challenge/Challenge.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function ChallengeCard({ data, community, isCourseEnd }: Challeng
3333

3434

3535
return (
36-
<div className="w-full flex flex-col sm:flex-row md:flex-col lg:flex-row border-solid border border-primary bg-secondary rounded-3xl mb-5 group text-secondary">
36+
<div className="w-full flex flex-col sm:flex-row md:flex-col lg:flex-row border-solid border border-primary bg-secondary rounded-3xl group text-secondary">
3737
<div className="border-solid border -m-px border-primary bg-primary rounded-3xl sm:p-8 sm:pb-6 p-6 sm:w-2/3 md:w-auto lg:w-2/3">
3838
<div className="flex flex-col mb-1">
3939
<div className="lg:pr-20">
@@ -49,9 +49,8 @@ export default function ChallengeCard({ data, community, isCourseEnd }: Challeng
4949
</div>
5050
<div className="divide-y-2 divide-gray-200 divide-dotted flex flex-col mt-8">
5151
{learningMaterialsCount && (
52-
<p className="pb-3 md:pb-4 text-sm font-medium text-tertiary">{`${learningMaterialsCount} Learning ${
53-
learningMaterialsCount === 1 ? "material" : "materials"
54-
} included`}</p>
52+
<p className="pb-3 md:pb-4 text-sm font-medium text-tertiary">{`${learningMaterialsCount} Learning ${learningMaterialsCount === 1 ? "material" : "materials"
53+
} included`}</p>
5554
)}
5655
<div className="lg:flex lg:flex-row flex-col justify-between pt-3 md:pt-4 items-center">
5756
<Link href={link}>

src/components/cards/course/CourseMaterial.tsx

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)