From 48cb12ef1c427cd1acfc9ba9c02a59cdacec7b92 Mon Sep 17 00:00:00 2001 From: Manabu Matsumoto Date: Sat, 24 Feb 2024 01:03:28 +0900 Subject: [PATCH] fix(UI): make the task challenges be in the grid view (#53687) Co-authored-by: Oliver Eyton-Williams --- client/i18n/locales/english/translations.json | 2 + .../Introduction/components/challenges.tsx | 79 +++++++++++++------ client/src/templates/Introduction/intro.css | 49 +++++++----- client/src/utils/curriculum-layout.ts | 3 +- 4 files changed, 88 insertions(+), 45 deletions(-) diff --git a/client/i18n/locales/english/translations.json b/client/i18n/locales/english/translations.json index 0d6686e8383..3cfcfeb3498 100644 --- a/client/i18n/locales/english/translations.json +++ b/client/i18n/locales/english/translations.json @@ -718,6 +718,8 @@ "step": "Step", "steps": "Steps", "steps-for": "Steps for {{blockTitle}}", + "task": "Task", + "dialogues-and-tasks-for": "Dialogues and tasks for {{blockTitle}}", "code-example": "{{codeName}} code example", "opens-new-window": "Opens in new window" }, diff --git a/client/src/templates/Introduction/components/challenges.tsx b/client/src/templates/Introduction/components/challenges.tsx index d7e70250363..b0c1f42e004 100644 --- a/client/src/templates/Introduction/components/challenges.tsx +++ b/client/src/templates/Introduction/components/challenges.tsx @@ -9,6 +9,14 @@ import GreenNotCompleted from '../../../assets/icons/green-not-completed'; import GreenPass from '../../../assets/icons/green-pass'; import { executeGA } from '../../../redux/actions'; import { ChallengeWithCompletedNode } from '../../../redux/prop-types'; +import { SuperBlocks } from '../../../../../shared/config/superblocks'; +import { challengeTypes } from '../../../../../shared/config/challenge-types'; + +const getStepNumber = (dashedName: string) => { + // dashedName should be in the format 'step-1' or 'task-1' + const match = dashedName.match(/-(\d+)/); + return match ? match[1] : ''; +}; const mapDispatchToProps = (dispatch: Dispatch) => bindActionCreators({ executeGA }, dispatch); @@ -23,6 +31,28 @@ interface Challenges { const CheckMark = ({ isCompleted }: { isCompleted: boolean }) => isCompleted ? : ; +const Challenge = ({ + challenge +}: { + challenge: ChallengeWithCompletedNode; +}) => ( + + + + + {challenge.title} + +); + +const Project = ({ challenge }: { challenge: ChallengeWithCompletedNode }) => ( + + {challenge.title} + + + + +); + function Challenges({ challengesWithCompleted, isProjectBlock, @@ -56,40 +86,51 @@ function Challenges({ )}