feat:pull

This commit is contained in:
Anang Yusman 2025-01-08 02:04:41 +08:00
parent e514cee3b0
commit 8bff567d55
3 changed files with 127 additions and 102 deletions

View File

@ -499,7 +499,6 @@ export default function FormConvertSPIT() {
</Label>
</div>
<div>
<div className="py-3">
<Label>Deskripsi</Label>
<Controller
@ -586,7 +585,6 @@ export default function FormConvertSPIT() {
</div>
</div>
)}
</div>
</RadioGroup>
</div>
<div>

View File

@ -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() {
)}
</div>
</div>
<div className="px-3 py-3">
{/* <div className="px-3 py-3">
<Label htmlFor="fileInput">Gambar Utama</Label>
<Input id="fileInput" type="file" onChange={handleImageChange} />
</div>
</div> */}
{preview && (
<div className="mt-3 px-3">
<img

View File

@ -33,6 +33,8 @@ import {
DialogTrigger,
} from "@/components/ui/dialog";
import { ChevronDown, ChevronUp } from "lucide-react";
import dynamic from "next/dynamic";
import { Link } from "@/components/navigation";
const taskSchema = z.object({
uniqueCode: z.string().min(1, { message: "Judul diperlukan" }),
@ -63,6 +65,13 @@ export type taskDetail = {
is_active: string;
};
const ViewEditor = dynamic(
() => {
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() {
<div className="flex items-center gap-2" key={key}>
<Checkbox
id={key}
disabled
checked={
unitSelection[key as keyof typeof unitSelection]
}
@ -373,6 +383,7 @@ export default function FormTaskDetail() {
<div key={polda.id} className="border p-2">
<Label className="flex items-center">
<Checkbox
disabled
checked={checkedLevels.has(polda.id)}
onCheckedChange={() =>
handleCheckboxChange(polda.id)
@ -395,6 +406,7 @@ export default function FormTaskDetail() {
<div className="ml-6 mt-2">
<Label className="block">
<Checkbox
disabled
checked={polda?.subDestination?.every(
(polres: any) =>
checkedLevels.has(polres.id)
@ -421,6 +433,7 @@ export default function FormTaskDetail() {
{polda?.subDestination?.map((polres: any) => (
<Label key={polres.id} className="block mt-1">
<Checkbox
disabled
checked={checkedLevels.has(polres.id)}
onCheckedChange={() =>
handleCheckboxChange(polres.id)
@ -496,6 +509,7 @@ export default function FormTaskDetail() {
<div className="flex items-center gap-2" key={key}>
<Checkbox
id={key}
disabled
checked={taskOutput[key as keyof typeof taskOutput]}
onCheckedChange={(value) =>
setTaskOutput({ ...taskOutput, [key]: value })
@ -508,11 +522,11 @@ export default function FormTaskDetail() {
))}
</div>
</div>
<div className="mt-6">
{/* <div className="mt-6">
<Label>Broadcast </Label>
<RadioGroup
value={broadcastType} // Nilai terpilih diambil dari state broadcastType
onValueChange={(value) => setBroadcastType(value)} // Mengatur nilai saat radio berubah
value={broadcastType}
onValueChange={(value) => setBroadcastType(value)}
className="flex flex-wrap gap-3"
>
<div className="flex items-center gap-2">
@ -528,19 +542,14 @@ export default function FormTaskDetail() {
<Label htmlFor="whatsapp">WhatsApp Blast</Label>
</div>
</RadioGroup>
</div>
</div> */}
<div className="mt-6">
<Label>Narasi Penugasan</Label>
<Controller
control={control}
name="naration"
render={({ field: { onChange, value } }) => (
<JoditEditor
ref={editor}
value={detail?.narration}
onChange={onChange}
className="dark:text-black"
/>
<ViewEditor initialData={detail?.narration} />
)}
/>
{errors.naration?.message && (
@ -551,11 +560,12 @@ export default function FormTaskDetail() {
</div>
</div>
{/* Submit Button */}
<div className="mt-4">
<Button type="submit" color="primary">
Submit
<Link href={"/contributor/task"}>
<Button color="primary" variant={"outline"}>
Cancel
</Button>
</Link>
</div>
</form>
) : (