diff --git a/components/form/content/audio-detail-form.tsx b/components/form/content/audio-detail-form.tsx index a161233f..ecd07ab4 100644 --- a/components/form/content/audio-detail-form.tsx +++ b/components/form/content/audio-detail-form.tsx @@ -243,8 +243,8 @@ export default function FormAudioDetail() { setSelectedTarget(details.categoryId); // Untuk dropdown const filesData = details.files || []; - const fileUrls = filesData.map((file: { thumbnailFileUrl: string }) => - file.thumbnailFileUrl ? file.thumbnailFileUrl : "default-image.jpg" + const fileUrls = filesData.map((file: { secondaryUrl: string }) => + file.secondaryUrl ? file.secondaryUrl : "default-image.jpg" ); setDetailThumb(fileUrls); } @@ -354,7 +354,7 @@ export default function FormAudioDetail() {
-

Form Konten Foto

+

Form Konten Audio

{/* Input Title */}
@@ -418,25 +418,39 @@ export default function FormAudioDetail() { )}
- -
+ +
- {detailThumb?.map((data: any) => ( - - {` - - ))} + {detailThumb?.map((data: any) => { + const isAudio = + data.endsWith(".webm") || + data.endsWith(".mp3") || + data.endsWith(".ogg"); + return ( + + {isAudio ? ( + + ); + })} -
+
- {detailThumb?.map((data: any) => ( - - {` - - ))} + {detailThumb?.map((data: any) => { + const isAudio = + data.endsWith(".webm") || + data.endsWith(".mp3") || + data.endsWith(".ogg"); + return ( + + {isAudio ? ( + + ); + })}
diff --git a/components/form/content/audio-form.tsx b/components/form/content/audio-form.tsx index 2e2862c3..03274b48 100644 --- a/components/form/content/audio-form.tsx +++ b/components/form/content/audio-form.tsx @@ -121,7 +121,7 @@ export default function FormAudio() { const [detailData, setDetailData] = useState(null); const [articleImages, setArticleImages] = useState([]); const [isSwitchOn, setIsSwitchOn] = useState(false); - + const inputRef = useRef(null); const [selectedTarget, setSelectedTarget] = useState(""); const [unitSelection, setUnitSelection] = useState({ allUnit: false, @@ -347,7 +347,9 @@ export default function FormAudio() { const newTag = e.currentTarget.value.trim(); if (!tags.includes(newTag)) { setTags((prevTags) => [...prevTags, newTag]); // Add new tag - // setValue("tags", ""); // Clear input field + if (inputRef.current) { + inputRef.current.value = ""; // Clear input field + } } } }; @@ -479,12 +481,7 @@ export default function FormAudio() { close(); // showProgress(); files.map(async (item: any, index: number) => { - await uploadResumableFile( - index, - String(id), - item, - fileTypeId == "2" || fileTypeId == "4" ? item.duration : "0" - ); + await uploadResumableFile(index, String(id), item, "0"); }); Cookies.remove("idCreate"); @@ -528,7 +525,7 @@ export default function FormAudio() { filename: file.name, filetype: file.type, duration, - isWatermark: "true", // hardcode + isWatermark: "false", // hardcode }, onError: async (e: any) => { console.log("Error upload :", e); @@ -1033,6 +1030,7 @@ export default function FormAudio() { id="tags" placeholder="Add a tag and press Enter" onKeyDown={handleAddTag} + ref={inputRef} />
{tags.map((tag, index) => ( diff --git a/components/form/content/image-form.tsx b/components/form/content/image-form.tsx index 6218bf1a..21a90765 100644 --- a/components/form/content/image-form.tsx +++ b/components/form/content/image-form.tsx @@ -123,6 +123,7 @@ export default function FormImage() { const [detailData, setDetailData] = useState(null); const [articleImages, setArticleImages] = useState([]); const [isSwitchOn, setIsSwitchOn] = useState(false); + const inputRef = useRef(null); const [content, setContent] = useState(""); @@ -352,7 +353,9 @@ export default function FormImage() { const newTag = e.currentTarget.value.trim(); if (!tags.includes(newTag)) { setTags((prevTags) => [...prevTags, newTag]); // Add new tag - // setValue("tags", ""); // Clear input field + if (inputRef.current) { + inputRef.current.value = ""; // Clear input field + } } } }; @@ -1038,6 +1041,7 @@ export default function FormImage() { id="tags" placeholder="Add a tag and press Enter" onKeyDown={handleAddTag} + ref={inputRef} />
{tags.map((tag, index) => ( diff --git a/components/form/content/spit-convert-form.tsx b/components/form/content/spit-convert-form.tsx index 8ae4bb51..455d7ba1 100644 --- a/components/form/content/spit-convert-form.tsx +++ b/components/form/content/spit-convert-form.tsx @@ -487,19 +487,19 @@ export default function FormConvertSPIT() {
-
+
setSelectedFileType(value)} value={selectedFileType} + className=" grid-cols-1" > -
+
- -
+
-
+
- file.thumbnailFileUrl ? file.thumbnailFileUrl : "default-image.jpg" + const fileUrls = filesData.map((file: { url: string }) => + file.url ? file.url : "default-image.jpg" ); setDetailThumb(fileUrls); } @@ -419,9 +419,8 @@ export default function FormTeksDetail() {

)}
- -
+
{detailThumb?.map((data: any) => ( - {` + {[".jpg", ".jpeg", ".png", ".webp"].includes( + data.format + ) ? ( + {data.fileName} + ) : [".pdf", ".docx", ".txt"].includes(data.format) ? ( +