diff --git a/app/[locale]/(public)/content-management/download/page.tsx b/app/[locale]/(public)/content-management/download/page.tsx index 0d4876e4..a99cf83d 100644 --- a/app/[locale]/(public)/content-management/download/page.tsx +++ b/app/[locale]/(public)/content-management/download/page.tsx @@ -1,7 +1,13 @@ "use client"; import { close, error, loading, successCallback } from "@/config/swal"; -import { checkWishlistStatus, deleteWishlist, getInfoProfile, mediaWishlist, saveWishlist } from "@/service/landing/landing"; +import { + checkWishlistStatus, + deleteWishlist, + getInfoProfile, + mediaWishlist, + saveWishlist, +} from "@/service/landing/landing"; import React, { useEffect, useState } from "react"; import { Link, useRouter } from "@/i18n/routing"; import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"; @@ -13,7 +19,11 @@ import withReactContent from "sweetalert2-react-content"; import { getCookiesDecrypt } from "@/lib/utils"; import Swal from "sweetalert2"; import { Icon } from "@iconify/react/dist/iconify.js"; -import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; +import { + Popover, + PopoverContent, + PopoverTrigger, +} from "@/components/ui/popover"; import { Input } from "@/components/ui/input"; import { Button } from "@/components/ui/button"; import { sendMediaUploadToEmail } from "@/service/media-tracking/media-tracking"; @@ -59,11 +69,23 @@ const Galery = (props: any) => { }, [page, category, title]); async function getDataVideo() { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : category || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : category || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); - const response = await mediaWishlist("2", isInstitute ? instituteId : "", name, filter, "9", pages, sortBy, format); + const response = await mediaWishlist( + "2", + isInstitute ? instituteId : "", + name, + filter, + "9", + pages, + sortBy, + format + ); setGetTotalPage(response?.data?.data?.totalPages); setContentVideo(response?.data?.data?.content); @@ -92,12 +114,24 @@ const Galery = (props: any) => { }, [page, category, title]); async function getDataDocument() { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : category || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : category || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); - const response = await mediaWishlist("3", isInstitute ? instituteId : "", name, filter, "12", pages, sortBy, format); + const response = await mediaWishlist( + "3", + isInstitute ? instituteId : "", + name, + filter, + "12", + pages, + sortBy, + format + ); setGetTotalPage(response?.data?.data?.totalPages); setContentDocument(response?.data?.data?.content); @@ -117,12 +151,24 @@ const Galery = (props: any) => { }, [change, refresh]); async function getDataAudio() { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : category || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : category || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); - const response = await mediaWishlist("4", isInstitute ? instituteId : "", name, filter, "6", pages, sortBy, format); + const response = await mediaWishlist( + "4", + isInstitute ? instituteId : "", + name, + filter, + "6", + pages, + sortBy, + format + ); setGetTotalPage(response?.data?.data?.totalPages); setContentAudio(response?.data?.data?.content); @@ -138,12 +184,24 @@ const Galery = (props: any) => { }, [page, category, title, refresh]); async function getDataImage() { - const filter = categoryFilter?.length > 0 ? categoryFilter?.sort().join(",") : category || ""; + const filter = + categoryFilter?.length > 0 + ? categoryFilter?.sort().join(",") + : category || ""; const name = title == undefined ? "" : title; const format = formatFilter == undefined ? "" : formatFilter?.join(","); - const response = await mediaWishlist("1", isInstitute ? instituteId : "", name, filter, "12", pages, sortBy, format); + const response = await mediaWishlist( + "1", + isInstitute ? instituteId : "", + name, + filter, + "12", + pages, + sortBy, + format + ); setGetTotalPage(response?.data?.data?.totalPages); setContentImage(response?.data?.data?.content); @@ -225,7 +283,9 @@ const Galery = (props: any) => { }; const copyToClip = async (url: any) => { - await navigator.clipboard.writeText(`https://mediahub.polri.go.id/video/detail/${url}`); + await navigator.clipboard.writeText( + `https://mediahub.polri.go.id/video/detail/${url}` + ); setCopySuccess("Copied"); // toast.success("Link Berhasil Di Copy"); }; @@ -283,7 +343,7 @@ const Galery = (props: any) => {
-
+

{/* Galeri Saya */} @@ -308,21 +368,27 @@ const Galery = (props: any) => { > {t("image")} -
|
+
+ | +
{t("video")} -
|
+
+ | +
{t("text")} -
|
+
+ | +
{ contentVideo?.length > 0 ? (
{contentVideo?.map((video: any) => ( - +
- -
- -

{video?.mediaUpload?.title}

+ +
+ +

+ {video?.mediaUpload?.title} +

-

+

- + - + -

handleSaveWishlist(video?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> - -

{t("save")}

-
- + {/*

Content Rewrite

- + */}
-

{t("shareTo")}

+

+ {t("shareTo")} +

-

{t("destinationEmail")}

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} /> +

+ {t("destinationEmail")} +

+ + setEmailShareInput( + event.target.value + ) + } + onKeyPress={handleEmailList} + type="email" + placeholder={t( + "pressEnter" + )} + />
-
+
+ handleDelete(video?.id) + } + className="cursor-pointer flex flex-row gap-2 hover:text-red-800" + > + +

+ {t("delete")} +

+

@@ -399,16 +521,31 @@ const Galery = (props: any) => {
) : (

- empty + empty

) ) : selectedTab == "audio" ? ( contentAudio?.length > 0 ? (
{contentAudio?.map((audio: any) => ( -
+
- + {
- -
{audio?.mediaUpload?.title}
+ +
+ {audio?.mediaUpload?.title} +
@@ -425,9 +566,20 @@ const Galery = (props: any) => {
- # -
{audio?.mediaUpload?.duration}
- + # +
+ {audio?.mediaUpload?.duration} +
+ {
- + - + -
handleSaveWishlist(audio?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> - -

{t("save")}

-
- - -

Content Rewrite

- + {/* + +

Content Rewrite

+ */}

{t("shareTo")}

-

{t("destinationEmail")}

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} /> +

+ {t("destinationEmail")} +

+ + setEmailShareInput(event.target.value) + } + onKeyPress={handleEmailList} + type="email" + placeholder={t("pressEnter")} + />
-
+
handleDelete(audio?.id)} + className="cursor-pointer flex flex-row gap-2 hover:text-red-800" + > + +

+ {t("delete")} +

+
@@ -479,61 +658,123 @@ const Galery = (props: any) => {
) : (

- empty + empty

) ) : selectedTab == "image" ? ( contentImage?.length > 0 ? (
{contentImage?.map((image: any) => ( - +
- -
- -

{image?.mediaUpload?.title}

+ +
+ +

+ {image?.mediaUpload?.title} +

-

+

- + - + -

handleSaveWishlist(image?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> - -

{t("save")}

-
- + {/*

Content Rewrite

- + */}
-

{t("shareTo")}

+

+ {t("shareTo")} +

-

{t("destinationEmail")}

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} /> +

+ {t("destinationEmail")} +

+ + setEmailShareInput( + event.target.value + ) + } + onKeyPress={handleEmailList} + type="email" + placeholder={t( + "pressEnter" + )} + />
-
+
+ handleDelete(image?.id) + } + className="cursor-pointer flex flex-row gap-2 hover:text-red-800" + > + +

+ {t("delete")} +

+

@@ -547,15 +788,30 @@ const Galery = (props: any) => {
) : (

- empty + empty

) ) : contentDocument.length > 0 ? (
{contentDocument?.map((document: any) => ( -
+
- + {
- + {document?.mediaUpload?.title}
- - + + Download {t("document")}
- - - + + + -
handleSaveWishlist(document?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> - -

{t("save")}

-
- - -

Content Rewrite

- + {/* + +

Content Rewrite

+ */}
-

{t("shareTo")}

-

{t("destinationEmail")}

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} /> +

+ {t("destinationEmail")} +

+ + setEmailShareInput(event.target.value) + } + onKeyPress={handleEmailList} + type="email" + placeholder={t("pressEnter")} + />
-
+
handleDelete(document?.id)} + className="cursor-pointer flex flex-row gap-2 hover:text-red-800" + > + +

+ {t("delete")} +

+
@@ -618,7 +909,13 @@ const Galery = (props: any) => {
) : (

- empty + empty

)}
diff --git a/app/[locale]/(public)/content-management/galery/page.tsx b/app/[locale]/(public)/content-management/galery/page.tsx index 05b566ba..f261d8c3 100644 --- a/app/[locale]/(public)/content-management/galery/page.tsx +++ b/app/[locale]/(public)/content-management/galery/page.tsx @@ -288,7 +288,7 @@ const Galery = (props: any) => {
-
+

{t("gallery")} {profile?.institute?.name} @@ -337,14 +337,14 @@ const Galery = (props: any) => {
-
+

{video?.mediaUpload?.title}

-

+

- + @@ -483,11 +483,11 @@ const Galery = (props: any) => {

-
+

{image?.mediaUpload?.title}

-

+

diff --git a/app/[locale]/(public)/content-management/rewrite/create/[id]/page.tsx b/app/[locale]/(public)/content-management/rewrite/create/[id]/page.tsx index 9900b1ba..c74aa695 100644 --- a/app/[locale]/(public)/content-management/rewrite/create/[id]/page.tsx +++ b/app/[locale]/(public)/content-management/rewrite/create/[id]/page.tsx @@ -20,7 +20,6 @@ import { import { Controller, useForm } from "react-hook-form"; import * as z from "zod"; import { zodResolver } from "@hookform/resolvers/zod"; -import CustomEditor from "@/components/editor/custom-editor"; import { generateDataArticle, generateDataRewrite, @@ -37,6 +36,7 @@ import Cookies from "js-cookie"; import { Input } from "@/components/ui/input"; import { Textarea } from "@/components/ui/textarea"; import { useTranslations } from "next-intl"; +import dynamic from "next/dynamic"; const imageSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -51,6 +51,12 @@ const imageSchema = z.object({ creatorName: z.string().min(1, { message: "Creator diperlukan" }), // tags: z.string().min(1, { message: "Judul diperlukan" }), }); +const CustomEditor = dynamic( + () => { + return import("@/components/editor/custom-editor"); + }, + { ssr: false } +); const page = (props: any) => { const { states } = props; @@ -90,9 +96,6 @@ const page = (props: any) => { const validationSchema = Yup.object().shape({ title: Yup.string().required("Judul tidak boleh kosong"), mainKeyword: Yup.string().required("Keyword tidak boleh kosong"), - seo: Yup.string().required( - "Tuliskan kata kunci atau frasa yang relevan dengan blog Anda, lalu tekan enter" - ), description: Yup.string().required( "Narasi Penugasan harus lebih dari 2 karakter." ), @@ -172,6 +175,7 @@ const page = (props: any) => { useEffect(() => { async function initState() { + loading(); setLoadingState(true); const response = await getDetail( id, @@ -187,7 +191,7 @@ const page = (props: any) => { if (componentMounted) { setValue("title", response?.data?.data?.title); setValue("mainKeyword", response?.data?.data?.title); - setValue("seo", response?.data?.data?.description); + setValue("description", response?.data?.data?.htmlDescription); setContent(response?.data?.data); setIsFromSPIT(response?.data?.data?.isFromSPIT); setListSuggestion(responseGet?.data?.data); @@ -221,6 +225,7 @@ const page = (props: any) => { setLoadingState(false); // (2) write some value to state // await new Promise(resolve => setTimeout(resolve, 1000)); // 2 sec // setIdm(); + close(); } return () => { @@ -235,7 +240,7 @@ const page = (props: any) => { const handleGenerateArtikel = async () => { loading(); const request = { - style: "friendly", + style: "Professional", lang: "id", contextType: "text", urlContext: null, @@ -295,12 +300,13 @@ const page = (props: any) => { /]*>/g, "" ); - console.log("lalalala", cleanArticleBody); + console.log("lalalala", articleData); const articleImagesData = articleData?.imagesUrl?.split(","); setValue("description", cleanArticleBody || ""); setArticleBody(cleanArticleBody || ""); setDetailArticle(articleData); - setSelectedArticleId(id); + // setSelectedArticleId(id); + console.log("idnya", id); setArticleImages(articleImagesData || []); } catch (error) { console.error("Error fetching article details:", error); @@ -454,18 +460,22 @@ const page = (props: any) => { />

-

SEO

+

Deskripsi

( -