-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhance(apps/frontend-manage): limit group activity creation to cours…
…es where group creation is enabled (#4259)
- Loading branch information
1 parent
7ed9ffb
commit 2cb5d11
Showing
16 changed files
with
165 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
apps/frontend-manage/src/lib/hooks/useCoursesGamificationSplit.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { ElementSelectCourse } from '../../components/sessions/creation/ElementCreation' | ||
|
||
function useCoursesGamificationSplit({ | ||
courseSelection, | ||
}: { | ||
courseSelection: ElementSelectCourse[] | ||
}) { | ||
return ( | ||
courseSelection?.reduce<{ | ||
gamifiedCourses: ElementSelectCourse[] | ||
nonGamifiedCourses: ElementSelectCourse[] | ||
}>( | ||
(acc, course) => { | ||
if (course.isGamified) { | ||
acc.gamifiedCourses.push({ | ||
...course, | ||
data: { cy: `select-course-${course.label}` }, | ||
}) | ||
} else { | ||
acc.nonGamifiedCourses.push({ | ||
...course, | ||
data: { cy: `select-course-${course.label}` }, | ||
}) | ||
} | ||
return acc | ||
}, | ||
{ gamifiedCourses: [], nonGamifiedCourses: [] } | ||
) ?? { gamifiedCourses: [], nonGamifiedCourses: [] } | ||
) | ||
} | ||
|
||
export default useCoursesGamificationSplit |
Oops, something went wrong.