diff --git a/.env b/.env new file mode 100644 index 00000000..8835a9bc --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +NEXT_PUBLIC_API=https://netidhub.com/api +NEXT_PUBLIC=https://netidhub.com \ No newline at end of file diff --git a/.gitignore b/.gitignore index e051cc24..22aa14ed 100644 --- a/.gitignore +++ b/.gitignore @@ -26,8 +26,8 @@ yarn-debug.log* yarn-error.log* # local env files -.env*.local -.env +# .env*.local +# .env # vercel .vercel diff --git a/components/form/content/image-detail-form.tsx b/components/form/content/image-detail-form.tsx index 8da2165e..bfacd126 100644 --- a/components/form/content/image-detail-form.tsx +++ b/components/form/content/image-detail-form.tsx @@ -33,18 +33,27 @@ import { import { detailMedia } from "@/service/curated-content/curated-content"; import { Badge } from "@/components/ui/badge"; import { MailIcon } from "lucide-react"; -import { Icon } from "@iconify/react/dist/iconify.js"; -import { getCookiesDecrypt } from "@/lib/utils"; +import { Swiper, SwiperSlide } from "swiper/react"; +import "swiper/css"; +import "swiper/css/free-mode"; +import "swiper/css/navigation"; +import "swiper/css/pagination"; +import "swiper/css/thumbs"; +import "swiper/css"; +import "swiper/css/navigation"; +import { FreeMode, Navigation, Pagination, Thumbs } from "swiper/modules"; import { + DialogHeader, + DialogFooter, Dialog, DialogContent, - DialogFooter, - DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { Textarea } from "@/components/ui/textarea"; -import { close, error, loading } from "@/config/swal"; -import { te } from "date-fns/locale"; +import { close, loading } from "@/config/swal"; +import { getCookiesDecrypt } from "@/lib/utils"; +import { Icon } from "@iconify/react/dist/iconify.js"; +import { error } from "@/lib/swal"; const imageSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -114,6 +123,8 @@ export default function FormImageDetail() { const [description, setDescription] = useState(""); const [main, setMain] = useState([]); const [filePlacements, setFilePlacements] = useState([]); + const [detailThumb, setDetailThumb] = useState([]); + const [thumbsSwiper, setThumbsSwiper] = useState(null); const [selectedTarget, setSelectedTarget] = useState(""); const [files, setFiles] = useState([]); @@ -232,6 +243,12 @@ export default function FormImageDetail() { } setSelectedTarget(details.categoryId); // Untuk dropdown + + const filesData = details.files || []; + const fileUrls = filesData.map((file: { thumbnailFileUrl: string }) => + file.thumbnailFileUrl ? file.thumbnailFileUrl : "default-image.jpg" + ); + setDetailThumb(fileUrls); } } initState(); @@ -462,79 +479,45 @@ export default function FormImageDetail() { )} -
- - {/* Preview Image */} -
- Preview -
- - {/* Thumbnail Container with Navigation */} -
- {/* Scroll Left Button */} - {/* */} - - {/* Scrollable Thumbnail Container */} -
File Media +
+ + {detailThumb?.map((data: any) => ( + + {` + + ))} + +
+ -
- {detail?.files?.map((list: any, index: number) => ( - - ))} -
-
- - {/* Scroll Right Button */} - {/* */} + {detailThumb?.map((data: any) => ( + + {` + + ))} +