From 1319e35b8bdf2385153449b9f38ca0f2d98fba17 Mon Sep 17 00:00:00 2001 From: Anang Yusman Date: Fri, 31 Jan 2025 22:16:41 +0800 Subject: [PATCH] feat:fix approv konten, responsive konten,task,blog,kurasi konten detail --- .../contributor/content/audio/page.tsx | 2 +- .../contributor/content/image/page.tsx | 2 +- .../contributor/content/teks/page.tsx | 2 +- .../contributor/content/video/page.tsx | 2 +- .../task/components/task-table.tsx | 6 +- .../(protected)/contributor/task/page.tsx | 2 +- .../giat-routine/audio/all/audio.tsx | 129 ++++++++++++++++ .../giat-routine/audio/all/page.tsx | 3 +- .../giat-routine/audio/audio.tsx | 125 +++++++-------- .../giat-routine/audio/detail/[id]/page.tsx | 14 +- .../giat-routine/document/all/page.tsx | 3 +- .../giat-routine/document/all/teks.tsx | 116 ++++++++++++++ .../document/detail/[id]/page.tsx | 12 +- .../giat-routine/document/teks.tsx | 144 +++++++++--------- .../giat-routine/image/detail/[id]/page.tsx | 16 +- .../giat-routine/image/image.tsx | 127 ++++++++------- .../giat-routine/video/audio-visual.tsx | 129 +++++++++------- .../giat-routine/video/detail/[id]/page.tsx | 16 +- components/form/blog/blog--detail-form.tsx | 4 +- components/form/blog/blog--update-form.tsx | 6 +- components/form/blog/blog-form.tsx | 4 +- components/form/content/audio-detail-form.tsx | 8 +- components/form/content/audio-form.tsx | 12 +- components/form/content/audio-update-form.tsx | 6 +- components/form/content/image-detail-form.tsx | 6 +- components/form/content/image-form.tsx | 4 +- components/form/content/image-update-form.tsx | 8 +- components/form/content/spit-convert-form.tsx | 6 +- components/form/content/teks-detail-form.tsx | 8 +- components/form/content/teks-form.tsx | 10 +- components/form/content/teks-update-form.tsx | 6 +- components/form/content/video-detail-form.tsx | 6 +- components/form/content/video-form.tsx | 5 +- components/form/content/video-update-form.tsx | 6 +- components/form/task/task-detail-form.tsx | 24 +-- components/form/task/task-edit-form.tsx | 6 +- components/form/task/task-form.tsx | 6 +- components/ui/carousel.tsx | 4 +- 38 files changed, 627 insertions(+), 368 deletions(-) create mode 100644 app/[locale]/(protected)/shared/curated-content/giat-routine/audio/all/audio.tsx create mode 100644 app/[locale]/(protected)/shared/curated-content/giat-routine/document/all/teks.tsx diff --git a/app/[locale]/(protected)/contributor/content/audio/page.tsx b/app/[locale]/(protected)/contributor/content/audio/page.tsx index 90b45070..756b3272 100644 --- a/app/[locale]/(protected)/contributor/content/audio/page.tsx +++ b/app/[locale]/(protected)/contributor/content/audio/page.tsx @@ -13,7 +13,7 @@ const ReactTableAudioPage = () => {
-
+
diff --git a/app/[locale]/(protected)/contributor/content/image/page.tsx b/app/[locale]/(protected)/contributor/content/image/page.tsx index c661dd1a..a3d46ac4 100644 --- a/app/[locale]/(protected)/contributor/content/image/page.tsx +++ b/app/[locale]/(protected)/contributor/content/image/page.tsx @@ -13,7 +13,7 @@ const ReactTableImagePage = () => {
-
+
diff --git a/app/[locale]/(protected)/contributor/content/teks/page.tsx b/app/[locale]/(protected)/contributor/content/teks/page.tsx index a352d007..73bf6661 100644 --- a/app/[locale]/(protected)/contributor/content/teks/page.tsx +++ b/app/[locale]/(protected)/contributor/content/teks/page.tsx @@ -14,7 +14,7 @@ const ReactTableTeksPage = () => {
-
+
diff --git a/app/[locale]/(protected)/contributor/content/video/page.tsx b/app/[locale]/(protected)/contributor/content/video/page.tsx index d3202058..ef006ed0 100644 --- a/app/[locale]/(protected)/contributor/content/video/page.tsx +++ b/app/[locale]/(protected)/contributor/content/video/page.tsx @@ -14,7 +14,7 @@ const ReactTableVideoPage = () => {
-
+
diff --git a/app/[locale]/(protected)/contributor/task/components/task-table.tsx b/app/[locale]/(protected)/contributor/task/components/task-table.tsx index 7a089b02..64d80ec2 100644 --- a/app/[locale]/(protected)/contributor/task/components/task-table.tsx +++ b/app/[locale]/(protected)/contributor/task/components/task-table.tsx @@ -176,8 +176,8 @@ const TaskTable = () => {
-
-
+
+
@@ -185,7 +185,7 @@ const TaskTable = () => { diff --git a/app/[locale]/(protected)/contributor/task/page.tsx b/app/[locale]/(protected)/contributor/task/page.tsx index 00f328ef..0d91735d 100644 --- a/app/[locale]/(protected)/contributor/task/page.tsx +++ b/app/[locale]/(protected)/contributor/task/page.tsx @@ -25,7 +25,7 @@ const TaskPage = () => { -
+
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 = () => {
- +
diff --git a/app/[locale]/(protected)/shared/curated-content/giat-routine/audio/audio.tsx b/app/[locale]/(protected)/shared/curated-content/giat-routine/audio/audio.tsx index 9fd22e87..2cca7129 100644 --- a/app/[locale]/(protected)/shared/curated-content/giat-routine/audio/audio.tsx +++ b/app/[locale]/(protected)/shared/curated-content/giat-routine/audio/audio.tsx @@ -15,6 +15,7 @@ import { textEllipsis, } from "@/utils/globals"; import { Icon } from "@iconify/react/dist/iconify.js"; +import { hasData } from "jquery"; import { useParams, usePathname, useRouter } from "next/navigation"; import React, { Component, useEffect, useState } from "react"; @@ -24,18 +25,18 @@ const AudioSliderPage = () => { const [page, setPage] = useState(1); const [limit, setLimit] = React.useState(10); const [search, setSearch] = React.useState(""); - + const [hasData, setHasData] = useState(false); useEffect(() => { initFetch(); }, [page, limit, search]); - useEffect(() => { - if (audioData?.length > 0) { - shuffleAndSetVideos(); - const interval = setInterval(shuffleAndSetVideos, 5000); - return () => clearInterval(interval); // Cleanup interval on unmount - } - }, [audioData]); + // 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"); @@ -43,13 +44,14 @@ const AudioSliderPage = () => { const data = response?.data?.data; const contentData = data?.content; - setAudioData(contentData); + setHasData(displayAudio && displayAudio.length > 0); + setDisplayAudio(contentData); }; - const shuffleAndSetVideos = () => { - const shuffled = shuffleArray([...audioData]); - setDisplayAudio(shuffled.slice(0, 3)); - }; + // const shuffleAndSetVideos = () => { + // const shuffled = shuffleArray([...audioData]); + // setDisplayAudio(shuffled.slice(0, 3)); + // }; const shuffleArray = (array: any[]) => { for (let i = array.length - 1; i > 0; i--) { @@ -60,69 +62,46 @@ const AudioSliderPage = () => { }; return ( -
-
- {displayAudio?.map((audio: any) => ( - -
- - - -
- -
-
- {formatDateToIndonesian(new Date(audio?.createdAt))}{" "} - {audio?.timezone ? audio?.timezone : "WIB"} |{" "} - 518 -
-
- {audio?.title} -
-
-
-
- -
-
- # -
- {audio?.duration} -
- + + {Array.from({ length: 5 }).map((_, index) => ( + +
+ {displayAudio?.map((audio: any) => ( + - - -
+
+ + + +
+ +
+
+ {audio?.title} +
+
+ + ))}
- + ))} -
-
+ + + + ); }; diff --git a/app/[locale]/(protected)/shared/curated-content/giat-routine/audio/detail/[id]/page.tsx b/app/[locale]/(protected)/shared/curated-content/giat-routine/audio/detail/[id]/page.tsx index b6f8cee7..d7f4774e 100644 --- a/app/[locale]/(protected)/shared/curated-content/giat-routine/audio/detail/[id]/page.tsx +++ b/app/[locale]/(protected)/shared/curated-content/giat-routine/audio/detail/[id]/page.tsx @@ -349,8 +349,8 @@ export default function DetailAudio() {

Kurasi Detail

-
-
+
+
@@ -417,7 +417,7 @@ export default function DetailAudio() {
-
+
@@ -482,8 +482,8 @@ export default function DetailAudio() {
-
-
+
+
@@ -558,7 +558,7 @@ export default function DetailAudio() {
-
+