From b5fe86821a261311bfac1fe2c398096aa65d68bb Mon Sep 17 00:00:00 2001 From: Anang Yusman Date: Sat, 7 Jun 2025 20:37:06 +0800 Subject: [PATCH] merge --- .../account-report/account-report-form.tsx | 4 +-- components/form/content/spit-convert-form.tsx | 25 ++++++++----------- components/form/schedule/event-form.tsx | 4 +-- .../schedule/form-calendar-polri-detail.tsx | 4 +-- .../schedule/form-calendar-polri-update.tsx | 4 +-- components/form/schedule/live-report-form.tsx | 4 +-- .../form/schedule/pers-release-form.tsx | 4 +-- .../form/schedule/press-conference-form.tsx | 4 +-- components/form/setting/form-add-iklan.tsx | 4 +-- .../form/shared/accept-assignment-form.tsx | 4 +-- components/form/shared/ask-expert-form.tsx | 4 +-- .../form/shared/do-it-yourself-form.tsx | 4 +-- components/form/task-ta/task-ta-form.tsx | 4 +-- 13 files changed, 23 insertions(+), 50 deletions(-) diff --git a/components/form/account-report/account-report-form.tsx b/components/form/account-report/account-report-form.tsx index 499be0db..8c1baf09 100644 --- a/components/form/account-report/account-report-form.tsx +++ b/components/form/account-report/account-report-form.tsx @@ -129,9 +129,7 @@ export default function FormAccountReport() { const [isTextUploadFinish, setIsTextUploadFinish] = useState(false); const [isAudioUploadFinish, setIsAudioUploadFinish] = useState(false); const [voiceNoteLink, setVoiceNoteLink] = useState(""); - const [date, setDate] = React.useState({ - from: new Date(2024, 0, 1), - }); + const [date, setDate] = React.useState(); const [platformTypeVisible, setPlatformTypeVisible] = useState(false); const [unitSelection, setUnitSelection] = useState({ diff --git a/components/form/content/spit-convert-form.tsx b/components/form/content/spit-convert-form.tsx index ff20524e..ea19bac3 100644 --- a/components/form/content/spit-convert-form.tsx +++ b/components/form/content/spit-convert-form.tsx @@ -85,7 +85,7 @@ type Option = { interface FileData { contentId: number; placement?: string[]; - [key: string]: any; // Extendable for additional properties + [key: string]: any; } interface PlacementData { @@ -173,11 +173,10 @@ export default function FormConvertSPIT() { }) .refine( (data) => { - // Jika tombol rewrite diklik, pastikan field-nya tidak kosong if (isContentRewriteClicked) { return detail?.contentRewriteDescription?.trim().length > 0; } - return true; // tidak diklik => tidak wajib + return true; }, { path: ["contentRewriteDescription"], @@ -239,8 +238,8 @@ export default function FormConvertSPIT() { }; const handleDirectSave = () => { - const values = form.getValues(); // ambil semua nilai tanpa validasi - onSubmit(values); // langsung submit + const values = form.getValues(); + onSubmit(values); }; useEffect(() => { @@ -287,8 +286,7 @@ export default function FormConvertSPIT() { ); if (findCategory) { - // setValue("categoryId", findCategory.id); - setSelectedCategoryId(findCategory.id); // Set the selected category + setSelectedCategoryId(findCategory.id); const response = await getTagsBySubCategoryId(findCategory.id); setTags(response?.data?.data); } @@ -391,8 +389,8 @@ export default function FormConvertSPIT() { return { ...file, placement: isChecked - ? file.placement.filter((v: any) => v !== value) // Uncheck - : [...(file.placement || []), value], // Check + ? file.placement.filter((v: any) => v !== value) + : [...(file.placement || []), value], }; } return file; @@ -458,11 +456,10 @@ export default function FormConvertSPIT() { 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 + prev.map((placement: string[]) => + isChecked + ? Array.from(new Set([...placement, category])) + : placement.filter((item: string) => item !== category) ) ); }; diff --git a/components/form/schedule/event-form.tsx b/components/form/schedule/event-form.tsx index 3119a4f6..29314d64 100644 --- a/components/form/schedule/event-form.tsx +++ b/components/form/schedule/event-form.tsx @@ -57,9 +57,7 @@ export default function FormEvent() { const [startTime, setStartTime] = useState("08:00"); const [endTime, setEndTime] = useState("09:00"); - const [date, setDate] = React.useState({ - from: new Date(2024, 0, 1), - }); + const [date, setDate] = React.useState(); const handleStartTime = (e: any) => { setStartTime(e.target.value); diff --git a/components/form/schedule/form-calendar-polri-detail.tsx b/components/form/schedule/form-calendar-polri-detail.tsx index 0cdc7b7f..784d2f0e 100644 --- a/components/form/schedule/form-calendar-polri-detail.tsx +++ b/components/form/schedule/form-calendar-polri-detail.tsx @@ -65,9 +65,7 @@ export function CalendarPolriAddDetail() { const [expandedPolda, setExpandedPolda] = React.useState([{}]); const [isLoading, setIsLoading] = React.useState(false); const [detail, setDetail] = React.useState(); - const [date, setDate] = React.useState({ - from: new Date(2025, 0, 1), - }); + const [date, setDate] = React.useState(); const [refresh, setRefresh] = React.useState(false); const [unitSelection, setUnitSelection] = React.useState({ diff --git a/components/form/schedule/form-calendar-polri-update.tsx b/components/form/schedule/form-calendar-polri-update.tsx index b4aaacb8..1f9c6cdf 100644 --- a/components/form/schedule/form-calendar-polri-update.tsx +++ b/components/form/schedule/form-calendar-polri-update.tsx @@ -91,9 +91,7 @@ export function CalendarPolriAddUpdate() { >([]); const [detail, setDetail] = React.useState(); const [imageFiles, setImageFiles] = React.useState([]); - const [date, setDate] = React.useState({ - from: new Date(2025, 0, 1), - }); + const [date, setDate] = React.useState(); const [refresh, setRefresh] = React.useState(false); const [unitSelection, setUnitSelection] = React.useState({ diff --git a/components/form/schedule/live-report-form.tsx b/components/form/schedule/live-report-form.tsx index cf3a73a4..80585f09 100644 --- a/components/form/schedule/live-report-form.tsx +++ b/components/form/schedule/live-report-form.tsx @@ -57,9 +57,7 @@ export default function FormLiveReport() { const [endTime, setEndTime] = useState("09:00"); const [scheduleTypeId, setScheduleTypeId] = React.useState("1"); - const [date, setDate] = React.useState({ - from: new Date(2024, 0, 1), - }); + const [date, setDate] = React.useState(); const handleStartTime = (e: any) => { setStartTime(e.target.value); diff --git a/components/form/schedule/pers-release-form.tsx b/components/form/schedule/pers-release-form.tsx index b80756fa..8f53dd87 100644 --- a/components/form/schedule/pers-release-form.tsx +++ b/components/form/schedule/pers-release-form.tsx @@ -57,9 +57,7 @@ export default function FormPressRelease() { const [startTime, setStartTime] = useState("08:00"); const [endTime, setEndTime] = useState("09:00"); - const [date, setDate] = React.useState({ - from: new Date(2024, 0, 1), - }); + const [date, setDate] = React.useState(); const handleStartTime = (e: any) => { setStartTime(e.target.value); diff --git a/components/form/schedule/press-conference-form.tsx b/components/form/schedule/press-conference-form.tsx index c8dbbf83..0cad16fb 100644 --- a/components/form/schedule/press-conference-form.tsx +++ b/components/form/schedule/press-conference-form.tsx @@ -47,9 +47,7 @@ export default function FormPressConference() { const [startTime, setStartTime] = useState("08:00"); const [endTime, setEndTime] = useState("09:00"); - const [date, setDate] = React.useState({ - from: new Date(2024, 0, 1), - }); + const [date, setDate] = React.useState(); const handleStartTime = (e: any) => { setStartTime(e.target.value); diff --git a/components/form/setting/form-add-iklan.tsx b/components/form/setting/form-add-iklan.tsx index 841c622c..8faa5004 100644 --- a/components/form/setting/form-add-iklan.tsx +++ b/components/form/setting/form-add-iklan.tsx @@ -70,9 +70,7 @@ export function TambahIklanModal() { FileUploaded[] >([]); const [imageFiles, setImageFiles] = React.useState([]); - const [date, setDate] = React.useState({ - from: new Date(2025, 0, 1), - }); + const [date, setDate] = React.useState(); const [unitSelection, setUnitSelection] = React.useState({ semua: false, diff --git a/components/form/shared/accept-assignment-form.tsx b/components/form/shared/accept-assignment-form.tsx index 69527547..f21d504e 100644 --- a/components/form/shared/accept-assignment-form.tsx +++ b/components/form/shared/accept-assignment-form.tsx @@ -147,9 +147,7 @@ export default function FormAcceptAssignment() { const [isTextUploadFinish, setIsTextUploadFinish] = useState(false); const [isAudioUploadFinish, setIsAudioUploadFinish] = useState(false); const [voiceNoteLink, setVoiceNoteLink] = useState(""); - const [date, setDate] = React.useState({ - from: new Date(2024, 0, 1), - }); + const [date, setDate] = React.useState(); const [platformTypeVisible, setPlatformTypeVisible] = useState(false); const [unitSelection, setUnitSelection] = useState({ diff --git a/components/form/shared/ask-expert-form.tsx b/components/form/shared/ask-expert-form.tsx index c4797497..f5685e02 100644 --- a/components/form/shared/ask-expert-form.tsx +++ b/components/form/shared/ask-expert-form.tsx @@ -154,9 +154,7 @@ export default function FormAskExpert() { const [isTextUploadFinish, setIsTextUploadFinish] = useState(false); const [isAudioUploadFinish, setIsAudioUploadFinish] = useState(false); const [voiceNoteLink, setVoiceNoteLink] = useState(""); - const [date, setDate] = React.useState({ - from: new Date(2024, 0, 1), - }); + const [date, setDate] = React.useState(); const [links, setLinks] = useState([""]); diff --git a/components/form/shared/do-it-yourself-form.tsx b/components/form/shared/do-it-yourself-form.tsx index 84856c16..12473463 100644 --- a/components/form/shared/do-it-yourself-form.tsx +++ b/components/form/shared/do-it-yourself-form.tsx @@ -147,9 +147,7 @@ export default function FormDoItYourself() { const [isTextUploadFinish, setIsTextUploadFinish] = useState(false); const [isAudioUploadFinish, setIsAudioUploadFinish] = useState(false); const [voiceNoteLink, setVoiceNoteLink] = useState(""); - const [date, setDate] = React.useState({ - from: new Date(2024, 0, 1), - }); + const [date, setDate] = React.useState(); const [platformTypeVisible, setPlatformTypeVisible] = useState(false); const [unitSelection, setUnitSelection] = useState({ diff --git a/components/form/task-ta/task-ta-form.tsx b/components/form/task-ta/task-ta-form.tsx index 113a72ee..29419c8d 100644 --- a/components/form/task-ta/task-ta-form.tsx +++ b/components/form/task-ta/task-ta-form.tsx @@ -156,9 +156,7 @@ export default function FormTaskTa() { const [isTextUploadFinish, setIsTextUploadFinish] = useState(false); const [isAudioUploadFinish, setIsAudioUploadFinish] = useState(false); const [voiceNoteLink, setVoiceNoteLink] = useState(""); - const [date, setDate] = React.useState({ - from: new Date(2024, 0, 1), - }); + const [date, setDate] = React.useState(); const [platformTypeVisible, setPlatformTypeVisible] = useState(false); const [unitSelection, setUnitSelection] = useState({