diff --git a/components/form/content/spit-convert-form.tsx b/components/form/content/spit-convert-form.tsx index fa1c1fb5..700fe5fe 100644 --- a/components/form/content/spit-convert-form.tsx +++ b/components/form/content/spit-convert-form.tsx @@ -394,6 +394,33 @@ export default function FormConvertSPIT() { return temp; }; + // const setupPlacement = ( + // index: number, + // category: string, + // isChecked: boolean + // ) => { + // setFilePlacements((prev) => + // prev.map((placement, i) => + // i === index + // ? isChecked + // ? [...new Set([...placement, category])] // Tambahkan kategori jika belum ada + // : placement.filter((item) => item !== category) // Hapus kategori jika ada + // : placement + // ) + // ); + // }; + + const handleSelectAll = (category: string, isChecked: boolean) => { + setFilePlacements((prev: string[][]) => + prev.map( + (placement: string[]) => + isChecked + ? Array.from(new Set([...placement, category])) // Konversi Set ke array dengan Array.from() + : placement.filter((item: string) => item !== category) // Hapus jika ada + ) + ); + }; + const save = async (data: { contentTitle: string; contentDescription: string; @@ -785,6 +812,66 @@ export default function FormConvertSPIT() {