From 42d9fb0efeb4436d62e7480bfdfbca8d883568f3 Mon Sep 17 00:00:00 2001 From: Daniel Henkel Date: Thu, 23 May 2024 19:19:49 +0200 Subject: [PATCH 1/2] Revert "feature: remove achievement related important notification for now (#496)" This reverts commit 65908feee4da8e63f2cd367239b74586cb2f21a3. --- src/widgets/ImportantInformation.tsx | 53 ++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/src/widgets/ImportantInformation.tsx b/src/widgets/ImportantInformation.tsx index 83c0339b6..1979c3d38 100644 --- a/src/widgets/ImportantInformation.tsx +++ b/src/widgets/ImportantInformation.tsx @@ -5,12 +5,13 @@ import { gql } from '../gql'; import { useNavigate } from 'react-router-dom'; import { DateTime } from 'luxon'; import HSection from './HSection'; -import { GAMIFICATION_ACTIVE } from '../config'; +import { BACKEND_URL, GAMIFICATION_ACTIVE } from '../config'; import { useEffect, useMemo, useState } from 'react'; import useModal from '../hooks/useModal'; import { SuccessModal } from '../modals/SuccessModal'; import NextStepsCard from '../components/achievements/nextStepsCard/NextStepsCard'; -import { Achievement, Achievement_Action_Type_Enum } from '../gql/graphql'; +import { Achievement, Achievement_Action_Type_Enum, Achievement_State, Achievement_Type_Enum } from '../gql/graphql'; +import { PuzzlePieceType, getPuzzleEmptyState } from '../helper/achievement-helper'; import AchievementModal from '../components/achievements/modals/AchievementModal'; import NextStepModal from '../components/achievements/modals/NextStepModal'; import { NextStepLabelType } from '../helper/important-information-helper'; @@ -116,6 +117,27 @@ query GetOnboardingInfos { status } } + nextStepAchievements { + id + name + subtitle + description + image + alternativeText + actionType + achievementType + achievementState + steps { + name + isActive + } + maxSteps + currentStep + isNewAchievement + progressDescription + actionName + actionRedirectLink + } } myRoles } @@ -135,6 +157,7 @@ const ImportantInformation: React.FC = ({ variant }) => { const pupil = data?.me?.pupil; const student = data?.me?.student; const email = data?.me?.email; + const nextStepAchievements: Achievement[] = !GAMIFICATION_ACTIVE ? [] : data?.me.nextStepAchievements ?? []; // eslint-disable-next-line react-hooks/exhaustive-deps const roles = data?.myRoles ?? []; @@ -176,6 +199,8 @@ const ImportantInformation: React.FC = ({ variant }) => { let infos: Information[] = []; // -------- Verification ----------- + // TODO - remove if achievements are included + if (student && !student?.verifiedAt) infos.push({ label: NextStepLabelType.VERIFY, @@ -190,6 +215,7 @@ const ImportantInformation: React.FC = ({ variant }) => { }); // -------- Screening ----------- + // TODO - remove if achievements are included if ( student?.canRequestMatch?.reason === 'not-screened' || student?.canCreateCourse?.reason === 'not-screened' || @@ -268,6 +294,8 @@ const ImportantInformation: React.FC = ({ variant }) => { infos.push({ label: NextStepLabelType.PASSWORD, btnfn: [() => navigate('/new-password')], lang: {} }); // -------- New Match ----------- + // TODO - remove if achievements are included + pupil?.matches?.forEach((match) => { if (!match.dissolved && match.createdAt > new Date(Date.now() - 14 * 24 * 60 * 60 * 1000)) infos.push({ @@ -289,6 +317,8 @@ const ImportantInformation: React.FC = ({ variant }) => { }); // -------- Certificate of Conduct ----------- + // TODO - remove if achievements are included [ONBOARDING]? + if (student && student?.certificateOfConductDeactivationDate) infos.push({ label: NextStepLabelType.CERTIFICATE_OF_CONDUCT, @@ -339,7 +369,7 @@ const ImportantInformation: React.FC = ({ variant }) => { return configurableInfos; }, [importantInformations, pupil, student]); - if (!infos.length && !configurableInfos.length) return null; + if (!infos.length && !configurableInfos.length && !nextStepAchievements.length) return null; return ( @@ -422,6 +452,23 @@ const ImportantInformation: React.FC = ({ variant }) => { /> ); })} + {nextStepAchievements.map((achievement) => { + return ( + { + setSelectedAchievement(achievement); + }} + /> + ); + })} ); From 9e72b177ccc566ac0de224adf46e43bc42d61850 Mon Sep 17 00:00:00 2001 From: Daniel Henkel Date: Thu, 30 May 2024 13:12:40 +0200 Subject: [PATCH 2/2] refert important information change --- src/widgets/ImportantInformation.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/widgets/ImportantInformation.tsx b/src/widgets/ImportantInformation.tsx index 1979c3d38..9d47f9210 100644 --- a/src/widgets/ImportantInformation.tsx +++ b/src/widgets/ImportantInformation.tsx @@ -120,6 +120,9 @@ query GetOnboardingInfos { nextStepAchievements { id name + title + tagline + footer subtitle description image @@ -460,6 +463,7 @@ const ImportantInformation: React.FC = ({ variant }) => { title={achievement.subtitle || undefined} name={achievement.name} actionDescription={achievement.actionName || ''} + description={achievement.description} actionType={achievement.actionType || Achievement_Action_Type_Enum.Action} maxSteps={achievement.maxSteps} currentStep={achievement.currentStep}