From cdd05f6476efac364ac32765e212d2346953c605 Mon Sep 17 00:00:00 2001 From: Flavio Mastrangelo Date: Thu, 20 Feb 2025 23:56:11 +0100 Subject: [PATCH] feat: implement FormTagInput for learnings and tags in course creation & edit forms. --- .../(withmenu)/course/[courseuuid]/course.tsx | 2 +- .../EditCourseGeneral/EditCourseGeneral.tsx | 23 +++---- .../Modals/Course/Create/CreateCourse.tsx | 66 +++++++++++------- .../Objects/StyledElements/Form/TagInput.tsx | 68 +++++++++++++++++++ apps/web/services/courses/courses.ts | 2 +- 5 files changed, 121 insertions(+), 40 deletions(-) create mode 100644 apps/web/components/Objects/StyledElements/Form/TagInput.tsx diff --git a/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/course.tsx b/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/course.tsx index b98bb364..6adb5836 100644 --- a/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/course.tsx +++ b/apps/web/app/orgs/[orgslug]/(withmenu)/course/[courseuuid]/course.tsx @@ -30,7 +30,7 @@ const CourseClient = (props: any) => { function getLearningTags() { // create array of learnings from a string object (comma separated) - let learnings = course?.learnings ? course?.learnings.split(',') : [] + let learnings = course?.learnings ? course?.learnings.split('|') : [] setLearnings(learnings) } diff --git a/apps/web/components/Dashboard/Pages/Course/EditCourseGeneral/EditCourseGeneral.tsx b/apps/web/components/Dashboard/Pages/Course/EditCourseGeneral/EditCourseGeneral.tsx index e1403d1c..1c250168 100644 --- a/apps/web/components/Dashboard/Pages/Course/EditCourseGeneral/EditCourseGeneral.tsx +++ b/apps/web/components/Dashboard/Pages/Course/EditCourseGeneral/EditCourseGeneral.tsx @@ -10,6 +10,7 @@ import * as Form from '@radix-ui/react-form'; import React, { useEffect, useState } from 'react'; import ThumbnailUpdate from './ThumbnailUpdate'; import { useCourse, useCourseDispatch } from '@components/Contexts/CourseContext'; +import FormTagInput from '@components/Objects/StyledElements/Form/TagInput'; type EditCourseStructureProps = { orgslug: string @@ -138,24 +139,22 @@ function EditCourseGeneral(props: EditCourseStructureProps) { -