From 8bff567d55c0ff08fa6a6a91536b9986f0495645 Mon Sep 17 00:00:00 2001 From: Anang Yusman Date: Wed, 8 Jan 2025 02:04:41 +0800 Subject: [PATCH] feat:pull --- components/form/content/spit-convert-form.tsx | 168 +++++++++--------- components/form/content/video-form.tsx | 23 ++- components/form/task/task-detail-form.tsx | 38 ++-- 3 files changed, 127 insertions(+), 102 deletions(-) diff --git a/components/form/content/spit-convert-form.tsx b/components/form/content/spit-convert-form.tsx index 53800599..8ae4bb51 100644 --- a/components/form/content/spit-convert-form.tsx +++ b/components/form/content/spit-convert-form.tsx @@ -499,94 +499,92 @@ export default function FormConvertSPIT() { -
-
- - ( - // - - )} - /> - {errors.contentDescription?.message && ( -

- {errors.contentDescription.message} -

+
+ + ( + // + )} -
-
- -
- {showRewriteEditor && ( -
- {isGeneratedArticle && ( -
- {articleIds.map((id: string, index: number) => ( - - ))} -
- )} -
- - -
-
- - - isLoadingData ? ( -
-

- Loading Proses Data... -

-
- ) : ( - - ) - } - /> - {errors.contentRewriteDescription?.message && ( -

- {errors.contentRewriteDescription.message} -

- )} -
-
+ /> + {errors.contentDescription?.message && ( +

+ {errors.contentDescription.message} +

)}
+
+ +
+ {showRewriteEditor && ( +
+ {isGeneratedArticle && ( +
+ {articleIds.map((id: string, index: number) => ( + + ))} +
+ )} +
+ + +
+
+ + + isLoadingData ? ( +
+

+ Loading Proses Data... +

+
+ ) : ( + + ) + } + /> + {errors.contentRewriteDescription?.message && ( +

+ {errors.contentRewriteDescription.message} +

+ )} +
+
+ )}
diff --git a/components/form/content/video-form.tsx b/components/form/content/video-form.tsx index f569b617..aea060eb 100644 --- a/components/form/content/video-form.tsx +++ b/components/form/content/video-form.tsx @@ -150,7 +150,24 @@ export default function FormVideo() { const { getRootProps, getInputProps } = useDropzone({ onDrop: (acceptedFiles) => { - setFiles(acceptedFiles.map((file) => Object.assign(file))); + const validFiles = acceptedFiles.filter((file) => { + const isValidType = ["video/mp4", "video/mov"].includes(file.type); + const isValidSize = file.size <= 100 * 1024 * 1024; // 100MB + return isValidType && isValidSize; + }); + + if (!validFiles.length) { + alert("Format file harus mp4/mov dan ukuran maksimal 100MB"); + return; + } + + setFiles( + validFiles.map((file) => + Object.assign(file, { + preview: URL.createObjectURL(file), + }) + ) + ); }, }); @@ -1024,10 +1041,10 @@ export default function FormVideo() { )}
-
+ {/*
-
+
*/} {preview && (
{ + return import("@/components/editor/view-editor"); + }, + { ssr: false } +); + export default function FormTaskDetail() { const MySwal = withReactContent(Swal); const router = useRouter(); @@ -342,6 +351,7 @@ export default function FormTaskDetail() {
- {/* Submit Button */}
- + + +
) : (