Table Penugasan
diff --git a/app/[locale]/(protected)/shared/curated-content/giat-routine/audio/all/audio.tsx b/app/[locale]/(protected)/shared/curated-content/giat-routine/audio/all/audio.tsx
new file mode 100644
index 00000000..59a9759c
--- /dev/null
+++ b/app/[locale]/(protected)/shared/curated-content/giat-routine/audio/all/audio.tsx
@@ -0,0 +1,129 @@
+"use client";
+import { Link } from "@/components/navigation";
+import {
+ Carousel,
+ CarouselContent,
+ CarouselItem,
+ CarouselNext,
+ CarouselPrevious,
+} from "@/components/ui/carousel";
+import { listCuratedContent } from "@/service/curated-content/curated-content";
+import { getListContent } from "@/service/landing/landing";
+import {
+ formatDateToIndonesian,
+ generateLocalizedPath,
+ textEllipsis,
+} from "@/utils/globals";
+import { Icon } from "@iconify/react/dist/iconify.js";
+import { useParams, usePathname, useRouter } from "next/navigation";
+import React, { Component, useEffect, useState } from "react";
+
+const AudioAll = () => {
+ const [audioData, setAudioData] = useState
();
+ const [displayAudio, setDisplayAudio] = useState([]);
+ const [page, setPage] = useState(1);
+ const [limit, setLimit] = React.useState(10);
+ const [search, setSearch] = React.useState("");
+
+ useEffect(() => {
+ initFetch();
+ }, [page, limit, search]);
+
+ useEffect(() => {
+ if (audioData?.length > 0) {
+ shuffleAndSetVideos();
+ const interval = setInterval(shuffleAndSetVideos, 5000);
+ return () => clearInterval(interval); // Cleanup interval on unmount
+ }
+ }, [audioData]);
+
+ const initFetch = async () => {
+ const response = await listCuratedContent(search, limit, page - 1, 4, "1");
+ console.log(response);
+
+ const data = response?.data?.data;
+ const contentData = data?.content;
+ setAudioData(contentData);
+ };
+
+ const shuffleAndSetVideos = () => {
+ const shuffled = shuffleArray([...audioData]);
+ setDisplayAudio(shuffled.slice(0, 3));
+ };
+
+ const shuffleArray = (array: any[]) => {
+ for (let i = array.length - 1; i > 0; i--) {
+ const j = Math.floor(Math.random() * (i + 1));
+ [array[i], array[j]] = [array[j], array[i]];
+ }
+ return array;
+ };
+
+ return (
+
+
+ {displayAudio?.map((audio: any) => (
+
+
+
+
+
+ {formatDateToIndonesian(new Date(audio?.createdAt))}{" "}
+ {audio?.timezone ? audio?.timezone : "WIB"} |{" "}
+ 518
+
+
+ {audio?.title}
+
+
+
+
+

+
+
+

+
+ {audio?.duration}
+
+
+
+
+
+ ))}
+
+
+ );
+};
+
+export default AudioAll;
diff --git a/app/[locale]/(protected)/shared/curated-content/giat-routine/audio/all/page.tsx b/app/[locale]/(protected)/shared/curated-content/giat-routine/audio/all/page.tsx
index feb9ce71..a98d9b75 100644
--- a/app/[locale]/(protected)/shared/curated-content/giat-routine/audio/all/page.tsx
+++ b/app/[locale]/(protected)/shared/curated-content/giat-routine/audio/all/page.tsx
@@ -23,6 +23,7 @@ import AudioSliderPage from "../../audio/audio";
import TeksSliderPage from "../../document/teks";
import ImageSliderPage from "../../image/image";
import VideoSliderPage from "../../video/audio-visual";
+import AudioAll from "./audio";
const AudioAllPage = () => {
return (
@@ -56,7 +57,7 @@ const AudioAllPage = () => {