diff --git a/src/interfaces/index.ts b/src/interfaces/index.ts index b5e460b..4757bd3 100644 --- a/src/interfaces/index.ts +++ b/src/interfaces/index.ts @@ -1,5 +1,5 @@ import type { RouteComponentProps } from 'react-router-dom'; -import { CourseImage, LinkType } from '@educt/types'; +import { AttachmentFileType, LinkType } from '@educt/types'; import { CourseStatusEnum, UserRoleEnum } from '../enums'; export interface IAppConfig { @@ -18,10 +18,10 @@ export interface IToken { export interface ICourse { id: string; + image: AttachmentFileType | null; title: string; description: string; status: CourseStatusEnum; - image: null | CourseImage; teacher: Pick; category: ICategory; lessons: ILesson[]; @@ -81,6 +81,7 @@ export interface IUser { id: string; first_name: string; last_name: string; + fullname: string; email: string; roles: IUserRole[]; contacts: IUserContacts | null; @@ -90,7 +91,6 @@ export interface IUser { * Current authenticated user data */ export interface IMe extends IUser { - fullname: string; /** * The field can be undefined if the user * does not have the STUDENT role diff --git a/src/pages/courses/components/CourseList/CourseItem.tsx b/src/pages/courses/components/CourseList/CourseItem.tsx index 44d6c1c..5ea2248 100644 --- a/src/pages/courses/components/CourseList/CourseItem.tsx +++ b/src/pages/courses/components/CourseList/CourseItem.tsx @@ -111,7 +111,7 @@ const CourseItem: React.FC = ({ course, onDelete, onSetStat borderTopRightRadius='lg' p='10px' > - {course.image && ( + {course.image && course.image.url && ( = ({ course, onDelete, onSetStat w='100%' borderTopLeftRadius='lg' borderTopRightRadius='lg' - src={`/api/assets/images/courses/${course.image.name}`} + src={course.image.url} /> )} diff --git a/src/pages/courses/create/components/CreateCourseForm.tsx b/src/pages/courses/create/components/CreateCourseForm.tsx new file mode 100644 index 0000000..debec8f --- /dev/null +++ b/src/pages/courses/create/components/CreateCourseForm.tsx @@ -0,0 +1,62 @@ +import React from 'react'; +import { Box, Grid } from '@chakra-ui/react'; +import { Input } from '@chakra-ui/react'; +import { Select, Flex, Button, Textarea } from '@chakra-ui/react'; +import { FormControl, FormLabel, InputGroup, InputRightElement } from '@chakra-ui/react'; + +/** + * Types + */ +import { MdCloudUpload } from 'react-icons/md'; + +type CreateCourseFormProps = {}; + +const CreateCourseForm: React.FC = () => { + return ( + +
+ + + Title + + + + + + + + Image + + + + + Category + + + + + Teacher + + + + + Description +