diff --git a/Dockerfile b/Dockerfile index 43cfb96f..1d64af49 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ RUN pnpm install --frozen-lockfile COPY . . # Build aplikasi -RUN pnpm run build +RUN NODE_OPTIONS="--max-old-space-size=4096" pnpm next build # Expose port untuk server EXPOSE 3000 diff --git a/app/[locale]/(public)/(polda)/polda/[polda_name]/audio/detail/[slug]/page.tsx b/app/[locale]/(public)/(polda)/polda/[polda_name]/audio/detail/[slug]/page.tsx index fffbae98..3f1e5ddf 100644 --- a/app/[locale]/(public)/(polda)/polda/[polda_name]/audio/detail/[slug]/page.tsx +++ b/app/[locale]/(public)/(polda)/polda/[polda_name]/audio/detail/[slug]/page.tsx @@ -8,13 +8,20 @@ import { Link, useRouter } from "@/i18n/routing"; import { Textarea } from "@/components/ui/textarea"; import { BarWave } from "react-cssfx-loading"; import { useToast } from "@/components/ui/use-toast"; -import { checkWishlistStatus, deleteWishlist, getDetail, saveWishlist } from "@/service/landing/landing"; +import { checkWishlistStatus, createPublicSuggestion, deletePublicSuggestion, deleteWishlist, getDetail, getPublicSuggestionList, saveWishlist } from "@/service/landing/landing"; import { getCookiesDecrypt } from "@/lib/utils"; -import { close, error, loading } from "@/config/swal"; +import { close, error, loading, warning } from "@/config/swal"; +import { useTranslations } from "next-intl"; +import { checkMaliciousText, getPublicLocaleTimestamp } from "@/utils/globals"; +import withReactContent from "sweetalert2-react-content"; +import Swal from "sweetalert2"; +import parse from "html-react-parser"; + const DetailAudio = () => { const [selectedSize, setSelectedSize] = useState("L"); const [selectedTab, setSelectedTab] = useState("video"); + const t = useTranslations("LandingPage"); const router = useRouter(); const pathname = usePathname(); const params = useParams(); @@ -29,6 +36,11 @@ const DetailAudio = () => { const [main, setMain] = useState(); const [resolutionSelected, setResolutionSelected] = useState("720"); const [imageSizeSelected, setImageSizeSelected] = useState("l"); + const [message, setMessage] = useState(""); + const userRoleId = getCookiesDecrypt("urie"); + const [listSuggestion, setListSuggestion] = useState(); + const [visibleInput, setVisibleInput] = useState(null); + const MySwal = withReactContent(Swal); const userId = getCookiesDecrypt("uie"); @@ -215,7 +227,120 @@ const DetailAudio = () => { { label: "S", value: "1066 x 599 px" }, { label: "XS", value: "800 x 450 px" }, ]; + async function sendSuggestionParent() { + if (message?.length > 3) { + loading(); + const data = { + mediaUploadId: slug?.split("-")?.[0], + message, + parentId: null, + }; + const response = await createPublicSuggestion(data); + + console.log(response); + setMessage(""); + + const responseGet = await getPublicSuggestionList(slug?.split("-")?.[0]); + console.log(responseGet?.data?.data); + setListSuggestion(responseGet?.data?.data); + + // Hapus nilai semua input secara manual jika perlu + const inputs = document.querySelectorAll("input"); + inputs.forEach((input) => { + input.value = ""; + }); + + close(); + } + } + const getInputValue = (e: any) => { + const message = e.target.value; + console.log(message); + setMessage(message); + }; + const postData = () => { + const checkMessage = checkMaliciousText(message); + if (checkMessage == "") { + if (Number(userRoleId) < 1 || userRoleId == undefined) { + router.push("/auth"); + } else { + sendSuggestionParent(); + } + } else { + warning(checkMessage); + } + }; + function addDefaultProfile(ev: any) { + ev.target.src = "/assets/avatar-profile.png"; + } + const showInput = (e: any) => { + console.log(document.querySelector(`#${e}`)?.classList); + document.querySelector(`#${e}`)?.classList.toggle("none"); + setVisibleInput(visibleInput === e ? null : e); + }; + async function sendSuggestionChild(parentId: any) { + const inputElement = document.querySelector(`#input-comment-${parentId}`) as HTMLInputElement; + + if (inputElement && inputElement.value.length > 3) { + loading(); + const data = { + mediaUploadId: slug?.split("-")?.[0], + message: inputElement.value, + parentId, + }; + + console.log(data); + const response = await createPublicSuggestion(data); + console.log(response); + const responseGet: any = await getPublicSuggestionList(slug?.split("-")?.[0]); + console.log(responseGet.data?.data); + setListSuggestion(responseGet.data?.data); + + // Reset input field + inputElement.value = ""; + + // document.querySelector("#comment-id-" + parentId)?.style.display = "none"; + + close(); + } + } + async function deleteDataSuggestion(dataId: any) { + loading(); + const response = await deletePublicSuggestion(dataId); + console.log(response); + const responseGet = await getPublicSuggestionList(slug.split("-")?.[0]); + console.log(responseGet.data?.data); + setListSuggestion(responseGet.data?.data); + close(); + } + const deleteData = (dataId: any) => { + MySwal.fire({ + title: "Delete Comment", + icon: "warning", + showCancelButton: true, + cancelButtonColor: "#3085d6", + confirmButtonColor: "#d33", + confirmButtonText: "Delete", + }).then((result: any) => { + if (result.isConfirmed) { + deleteDataSuggestion(dataId); + console.log(dataId); + } + }); + }; + const postDataChild = (id: any) => { + const checkMessage = checkMaliciousText(message); + if (checkMessage == "") { + if (Number(userRoleId) < 1 || userRoleId == undefined) { + router.push("/auth"); + } else { + sendSuggestionChild(id); + } + } else { + warning(checkMessage); + } + }; return ( <>
@@ -316,10 +441,188 @@ const DetailAudio = () => {
{/* Comment */} -
+ {/*

Berikan Komentar

+ +
-
+ ); }; diff --git a/app/[locale]/(public)/content-management/download/page.tsx b/app/[locale]/(public)/content-management/download/page.tsx index 729e70dc..0d4876e4 100644 --- a/app/[locale]/(public)/content-management/download/page.tsx +++ b/app/[locale]/(public)/content-management/download/page.tsx @@ -5,7 +5,7 @@ import { checkWishlistStatus, deleteWishlist, getInfoProfile, mediaWishlist, sav import React, { useEffect, useState } from "react"; import { Link, useRouter } from "@/i18n/routing"; import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs"; -import { useSearchParams } from "next/navigation"; +import { usePathname, useSearchParams } from "next/navigation"; import { Card, CardContent } from "@/components/ui/card"; import HeaderManagement from "@/components/landing-page/header-management"; import SidebarManagement from "@/components/landing-page/sidebar-management"; @@ -19,6 +19,7 @@ import { Button } from "@/components/ui/button"; import { sendMediaUploadToEmail } from "@/service/media-tracking/media-tracking"; import ImageBlurry from "@/components/ui/image-blurry"; import Image from "next/image"; +import { useTranslations } from "next-intl"; const Galery = (props: any) => { const [profile, setProfile] = useState(); @@ -26,6 +27,7 @@ const Galery = (props: any) => { const router = useRouter(); const MySwal = withReactContent(Swal); const searchParams = useSearchParams(); + const pathname = usePathname(); const page: any = searchParams?.get("page"); const title = searchParams?.get("title"); const category = searchParams?.get("category"); @@ -50,6 +52,7 @@ const Galery = (props: any) => { const [emailShareInput, setEmailShareInput] = useState(); const [emailMessageInput, setEmailMessageInput] = useState(); const id = searchParams?.get("id"); + const t = useTranslations("LandingPage"); useEffect(() => { getDataVideo(); @@ -278,98 +281,117 @@ const Galery = (props: any) => {
-
-
-

Galeri Saya

-
-
+
+
+

+ {/* Galeri + Saya */} + {pathname?.split("/")[1] == "in" ? ( + <> + {t("gallery")}  + {t("my")} + + ) : ( + <> + {t("my")}  + {t("gallery")} + + )} +

+ - Foto + {t("image")}
|
- Audio Visual + {t("video")}
|
- Teks + {t("text")}
|
- Audio + {t("audio")}
+
{selectedTab == "video" ? ( contentVideo?.length > 0 ? ( -
+
{contentVideo?.map((video: any) => ( - - + +
- - {/* */} -
- -
- -
{video?.mediaUpload?.title}
- - - - - - - - - -

Content Rewrite

- -
- - - - - -
-

Share Ke Email

-
-

Email Tujuan :

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> +
+
+ +
+ +

{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("destinationEmail")}

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

- handleDelete(video?.id)} className="flex items-center gap-3 hover:text-red-800 w-full rounded-lg"> - -

Hapus

-
- - +
+
@@ -414,12 +436,16 @@ const Galery = (props: any) => {
- + +
handleSaveWishlist(audio?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> + +

{t("save")}

+

Content Rewrite

@@ -427,29 +453,25 @@ const Galery = (props: any) => {
-
-

Share Ke Email

+

{t("shareTo")}

-

Email Tujuan :

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> +

{t("destinationEmail")}

+ setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} />
- handleDelete(audio?.id)} className="flex items-center gap-3 hover:text-red-800 w-full rounded-lg"> - -

Hapus

-
@@ -464,54 +486,61 @@ const Galery = (props: any) => { contentImage?.length > 0 ? (
{contentImage?.map((image: any) => ( - - - - {/* */} -
- -
- -
{image?.mediaUpload?.title}
- - - - - - - - - -

Content Rewrite

- -
- - - - - -
-

Share Ke Email

-
-

Email Tujuan :

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> -
- -
-
-
+ + +
+
+
+ +
+ +

{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("destinationEmail")}

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

+
- handleDelete(image?.id)} className="flex items-center gap-3 hover:text-red-800 w-full rounded-lg"> - -

Hapus

-
- - +
+
))} @@ -542,7 +571,7 @@ const Galery = (props: any) => { - Download Dokumen + Download {t("document")}
@@ -552,6 +581,10 @@ const Galery = (props: any) => { +
handleSaveWishlist(document?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> + +

{t("save")}

+

Content Rewrite

@@ -559,29 +592,25 @@ const Galery = (props: any) => {
-
-

Share Ke Email

+

{t("shareTo")}

-

Email Tujuan :

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> +

{t("destinationEmail")}

+ setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} />
- handleDelete(document?.id)} className="flex items-center gap-3 hover:text-red-800 w-full rounded-lg"> - -

Hapus

-
diff --git a/app/[locale]/(public)/content-management/galery/page.tsx b/app/[locale]/(public)/content-management/galery/page.tsx index adedbe35..05b566ba 100644 --- a/app/[locale]/(public)/content-management/galery/page.tsx +++ b/app/[locale]/(public)/content-management/galery/page.tsx @@ -21,6 +21,7 @@ import { Button } from "@/components/ui/button"; import { sendMediaUploadToEmail } from "@/service/media-tracking/media-tracking"; import ImageBlurry from "@/components/ui/image-blurry"; import Image from "next/image"; +import { useTranslations } from "next-intl"; const Galery = (props: any) => { const [profile, setProfile] = useState(); @@ -53,6 +54,7 @@ const Galery = (props: any) => { const [emailShareInput, setEmailShareInput] = useState(); const [emailMessageInput, setEmailMessageInput] = useState(); const id = searchParams?.get("id"); + const t = useTranslations("LandingPage"); useEffect(() => { getDataVideo(); @@ -284,98 +286,105 @@ const Galery = (props: any) => {
-
-
-

Galeri {profile?.institute?.name}

-
+
+

+ {t("gallery")} + {profile?.institute?.name} +

- Foto + {t("image")}
|
- Audio Visual + {t("video")}
|
- Teks + {t("text")}
|
- Audio + {t("audio")}
+
{selectedTab == "video" ? ( contentVideo?.length > 0 ? ( -
+
{contentVideo?.map((video: any) => ( - - + +
- - {/* */} -
- -
- -
{video?.mediaUpload?.title}
- - - - - - - -
handleSaveWishlist(video?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> - -

Simpan

-
- - -

Content Rewrite

- -
- - - - - -
-

Share Ke Email

-
-

Email Tujuan :

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> +
+
+ +
+ +

{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("destinationEmail")}

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

- - +
+
@@ -426,7 +435,7 @@ const Galery = (props: any) => {
handleSaveWishlist(audio?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> -

Simpan

+

{t("save")}

@@ -437,18 +446,18 @@ const Galery = (props: any) => {
-

Share Ke Email

+

{t("shareTo")}

-

Email Tujuan :

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> +

{t("destinationEmail")}

+ setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} />
@@ -468,54 +477,61 @@ const Galery = (props: any) => { contentImage?.length > 0 ? (
{contentImage?.map((image: any) => ( - - - - {/* */} -
- + + +
+
+
+ +
+ +

{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("destinationEmail")}

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

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

Simpan

-
- - -

Content Rewrite

- -
- - - - - -
-

Share Ke Email

-
-

Email Tujuan :

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> -
- -
-
-
-
-
-
+
))} @@ -546,7 +562,7 @@ const Galery = (props: any) => { - Download Dokumen + Download {t("document")}
@@ -558,7 +574,7 @@ const Galery = (props: any) => {
handleSaveWishlist(document?.mediaUpload?.id)} className="cursor-pointer flex flex-row gap-2 hover:text-red-800"> -

Simpan

+

{t("save")}

@@ -569,18 +585,18 @@ const Galery = (props: any) => {
-

Share Ke Email

+

{t("shareTo")}

-

Email Tujuan :

- setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> +

{t("destinationEmail")}

+ setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder={t("pressEnter")} />
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 1c1f8d15..a982672d 100644 --- a/app/[locale]/(public)/content-management/rewrite/create/[id]/page.tsx +++ b/app/[locale]/(public)/content-management/rewrite/create/[id]/page.tsx @@ -21,10 +21,10 @@ import { getPublicSuggestionList } from "@/service/landing/landing"; import { getDetail } from "@/service/detail/detail"; import { yupResolver } from "@hookform/resolvers/yup"; import * as Yup from "yup"; -import { htmlToString } from "@/utils/globals"; import Cookies from "js-cookie"; import { Input } from "@/components/ui/input"; import { Textarea } from "@/components/ui/textarea"; +import { useTranslations } from "next-intl"; const imageSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -63,6 +63,7 @@ const page = (props: any) => { const [isLoadingData, setIsLoadingData] = useState(false); const [detailData, setDetailData] = useState(null); const [articleImages, setArticleImages] = useState([]); + const t = useTranslations("LandingPage"); const userLevelId = getCookiesDecrypt("ulie"); const roleId = getCookiesDecrypt("urie"); @@ -293,21 +294,21 @@ const page = (props: any) => {
-
Content Rewrite
+
{t("content")} Rewrite
{content && (
-

Bahasa

+

{t("language")}

-

Context Type

+

{t("contextType")}

-

Writing Style

+

{t("writingStyle")}

-

Article Size

+

{t("articleSize")}

setEmailShareInput(event.target.value)} onKeyPress={handleEmailList} type="email" placeholder="Tekan Enter untuk input Email" /> +
+ +

{image?.title}

+ +

+ + + + + + + +

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

{t("save")}

- -
- - + + +

Content Rewrite

+ +
+ + + + + +
+

{t("shareTo")}

+
+

{t("destinationEmail")}

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

- handleDelete(image?.id)} className="flex items-center gap-1 hover:text-red-800 w-full rounded-lg"> - -

Hapus

-
- - +
+
diff --git a/app/[locale]/(public)/content-management/users/page.tsx b/app/[locale]/(public)/content-management/users/page.tsx index b46bea79..6f047011 100644 --- a/app/[locale]/(public)/content-management/users/page.tsx +++ b/app/[locale]/(public)/content-management/users/page.tsx @@ -2,7 +2,7 @@ import HeaderManagement from "@/components/landing-page/header-management"; import SidebarManagement from "@/components/landing-page/sidebar-management"; -import { close, error, loading } from "@/config/swal"; +import { close, loading } from "@/config/swal"; import { getCookiesDecrypt } from "@/lib/utils"; import { getInfoProfile, getUsersTeams, saveUserReports } from "@/service/landing/landing"; import React, { useEffect, useState } from "react"; @@ -10,9 +10,9 @@ import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, Di import withReactContent from "sweetalert2-react-content"; import Swal from "sweetalert2"; import { Button } from "@/components/ui/button"; -import toast from "react-hot-toast"; import { useToast } from "@/components/ui/use-toast"; -import { ToastAction } from "@/components/ui/toast"; +import Image from "next/image"; +import { useTranslations } from "next-intl"; const page = () => { const [user, setUser] = useState(); @@ -23,6 +23,7 @@ const page = () => { const MySwal = withReactContent(Swal); const { toast } = useToast(); const [reportMessageOpen, setReportMessageOpen] = useState(false); + const t = useTranslations("LandingPage"); // const launchModal = (user: any) => { // setUserSelected(user); @@ -118,25 +119,22 @@ const page = () => {
-

Tim {profile?.institute?.name}

-

{user?.length} Anggota

+

+ {t("team")} + {profile?.institute?.name} +

+

+ {user?.length} {t("teamMembers")} {profile?.institute?.name} +

{user?.map((row: any) => (
-
- - - - -

{row?.fullname}

+
+ +

{row?.fullname}

{row?.username || "username"}

@@ -166,7 +164,7 @@ const page = () => {
-

Alasan Report Akun

+

{t("reasonReport")}