From a8bffe9867f5e056bc948a090b579f3a5ecbb8d8 Mon Sep 17 00:00:00 2001 From: mateuszszczecina Date: Thu, 19 Dec 2024 13:55:50 +0100 Subject: [PATCH 1/8] fix: splash screen (#307) fix: splash screen fixes --- apps/api/src/chapter/chapter.controller.ts | 2 +- apps/web/app/components/ui/select.tsx | 2 +- .../app/modules/Admin/AddCourse/AddCourse.tsx | 52 +++++++++++++------ .../Admin/AddCourse/components/Breadcrumb.tsx | 39 ++++++++++++++ .../validators/addCourseFormSchema.ts | 2 +- 5 files changed, 77 insertions(+), 20 deletions(-) create mode 100644 apps/web/app/modules/Admin/AddCourse/components/Breadcrumb.tsx diff --git a/apps/api/src/chapter/chapter.controller.ts b/apps/api/src/chapter/chapter.controller.ts index 67e8794e..9c470c31 100644 --- a/apps/api/src/chapter/chapter.controller.ts +++ b/apps/api/src/chapter/chapter.controller.ts @@ -15,7 +15,7 @@ import { createChapterSchema, UpdateChapterBody, updateChapterSchema, - showChapterSchema + showChapterSchema, } from "./schemas/chapter.schema"; import type { ShowChapterResponse } from "./schemas/chapter.schema"; diff --git a/apps/web/app/components/ui/select.tsx b/apps/web/app/components/ui/select.tsx index 05677789..a3329f33 100644 --- a/apps/web/app/components/ui/select.tsx +++ b/apps/web/app/components/ui/select.tsx @@ -17,7 +17,7 @@ const SelectTrigger = React.forwardRef< span]:line-clamp-1", + "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1", className, )} {...props} diff --git a/apps/web/app/modules/Admin/AddCourse/AddCourse.tsx b/apps/web/app/modules/Admin/AddCourse/AddCourse.tsx index 1e29adf8..71797153 100644 --- a/apps/web/app/modules/Admin/AddCourse/AddCourse.tsx +++ b/apps/web/app/modules/Admin/AddCourse/AddCourse.tsx @@ -1,4 +1,3 @@ -import { useNavigate } from "@remix-run/react"; import { useCallback, useState } from "react"; import { useUploadFile } from "~/api/mutations/admin/useUploadFile"; @@ -6,7 +5,6 @@ import { useCategoriesSuspense } from "~/api/queries/useCategories"; import SplashScreenImage from "~/assets/svgs/splash-screen-image.svg"; import ImageUploadInput from "~/components/FileUploadInput/ImageUploadInput"; import { Icon } from "~/components/Icon"; -import Editor from "~/components/RichText/Editor"; import { Button } from "~/components/ui/button"; import { Form, FormControl, FormField, FormItem, FormMessage } from "~/components/ui/form"; import { Input } from "~/components/ui/input"; @@ -20,9 +18,9 @@ import { } from "~/components/ui/select"; import { useAddCourseForm } from "./hooks/useAddCourseForm"; +import Breadcrumb from "./components/Breadcrumb"; const AddCourse = () => { - const navigate = useNavigate(); const { form, onSubmit } = useAddCourseForm(); const { data: categories } = useCategoriesSuspense(); const [isUploading, setIsUploading] = useState(false); @@ -30,6 +28,10 @@ const AddCourse = () => { const { isValid: isFormValid } = form.formState; const watchedImageUrl = form.watch("imageUrl"); const imageUrl = form.getValues("imageUrl"); + const maxDescriptionFieldLength = 800; + + const watchedDescriptionLength = form.watch("description").length; + const descriptionFieldCharactersLeft = maxDescriptionFieldLength - watchedDescriptionLength; const handleImageUpload = useCallback( async (file: File) => { @@ -47,15 +49,12 @@ const AddCourse = () => { ); return ( -
+
splashScreenImage
-
- +
+

Create new course

@@ -71,11 +70,17 @@ const AddCourse = () => { name="title" render={({ field }) => ( - @@ -92,7 +97,10 @@ const AddCourse = () => { ", isCorrect: false, - position: 3, + displayOrder: 3, }, ], }, @@ -149,22 +149,22 @@ export const niceCourses: NiceCourseData[] = [ { optionText: "", isCorrect: true, - position: 0, + displayOrder: 0, }, { optionText: "", isCorrect: false, - position: 1, + displayOrder: 1, }, { optionText: "