diff --git a/components/form/article/create-article-form.tsx b/components/form/article/create-article-form.tsx index 2888906..c68e068 100644 --- a/components/form/article/create-article-form.tsx +++ b/components/form/article/create-article-form.tsx @@ -108,6 +108,7 @@ export default function CreateArticleForm() { const [filesValidation, setFileValidation] = useState(""); const [diseData, setDiseData] = useState(); const [selectedWritingType, setSelectedWritingType] = useState("single"); + const [status, setStatus] = useState<"publish" | "draft">("publish"); const { getRootProps, getInputProps } = useDropzone({ onDrop: (acceptedFiles) => { @@ -269,6 +270,8 @@ export default function CreateArticleForm() { description: htmlToString(removeImgTags(values.description)), htmlDescription: removeImgTags(values.description), aiArticleId: await saveArticleToDise(values), + isDraft: status === "draft", + isPublish: status === "publish", }; const response = await createArticle(formData); @@ -749,10 +752,18 @@ export default function CreateArticleForm() { )}
- - diff --git a/components/form/article/generate-ai-content-rewrite-form.tsx b/components/form/article/generate-ai-content-rewrite-form.tsx index 6a6e208..4ddfab4 100644 --- a/components/form/article/generate-ai-content-rewrite-form.tsx +++ b/components/form/article/generate-ai-content-rewrite-form.tsx @@ -20,6 +20,7 @@ import { } from "@/service/generate-article"; import { delay } from "@/utils/global"; import dynamic from "next/dynamic"; +import GetSeoScore from "./get-seo-score-form"; const CustomEditor = dynamic( () => { @@ -242,19 +243,21 @@ export default function GenerateContentRewriteForm(props: { {mainKeyword == "" && (

Required

)} - + {articleIds.length < 3 && ( + + )}
{articleIds.length > 0 && ( -
- {articleIds?.map((id) => ( +
+ {articleIds?.map((id, index) => ( ))}
)} + {!isLoading && ( +
+ +
+ )} ); diff --git a/components/form/article/generate-ai-single-form.tsx b/components/form/article/generate-ai-single-form.tsx index f32d23e..460969f 100644 --- a/components/form/article/generate-ai-single-form.tsx +++ b/components/form/article/generate-ai-single-form.tsx @@ -18,6 +18,7 @@ import { getGenerateTitle, } from "@/service/generate-article"; import { delay } from "@/utils/global"; +import GetSeoScore from "./get-seo-score-form"; const writingStyle = [ { @@ -374,20 +375,22 @@ export default function GenerateSingleArticleForm(props: { {/* {additionalKeyword == "" && (

Required

)} */} - + {articleIds.length < 3 && ( + + )}
{articleIds.length > 0 && ( -
+
{articleIds?.map((id, index) => ( ))}
)} + {!isLoading && ( +
+ +
+ )} ); diff --git a/components/landing/BodyLayout.tsx b/components/landing/BodyLayout.tsx index 18ea54c..9e02798 100644 --- a/components/landing/BodyLayout.tsx +++ b/components/landing/BodyLayout.tsx @@ -3,6 +3,7 @@ import CategorySatker from "./CategorySatker"; import ENewsPolri from "./ENewsPolri"; import MediaSocial from "./MediaSocial"; import MedolUpdate from "./MedolUpdate"; +import PolriApps from "./PolriApps"; import RegionalNews from "./RegionalNews"; import SidebarNav from "./SidebarNav"; @@ -13,6 +14,7 @@ export default function BodyLayout() {
+ diff --git a/components/landing/CategorySatker.tsx b/components/landing/CategorySatker.tsx index ddd9a0e..13e0b5c 100644 --- a/components/landing/CategorySatker.tsx +++ b/components/landing/CategorySatker.tsx @@ -310,7 +310,7 @@ export default function CategorySatker() { }; return ( -
+

{" "} diff --git a/components/landing/HeaderNews.tsx b/components/landing/HeaderNews.tsx index ca093e3..63870b3 100644 --- a/components/landing/HeaderNews.tsx +++ b/components/landing/HeaderNews.tsx @@ -26,6 +26,7 @@ import { Nabla } from "next/font/google"; export default function HeaderNews() { const [article, setArticle] = useState([]); const t = useTranslations("Landing"); + const [selectedTab, setSelectedTab] = useState("media"); useEffect(() => { async function getArticle() { @@ -243,8 +244,74 @@ export default function HeaderNews() { )}

-
- +
+ {/* */} + + {selectedTab === "media" ? ( +
+ + {article?.map((list: any) => ( +
+ +

{list?.title}

+ +
+

+ {convertDateFormat(list?.createdAt)} WIB +

+

+ + {list?.viewCount === null ? 0 : list?.viewCount} +

+
+
+ ))} +
+ +
+ ) : ( +
+ +
+ )}
); diff --git a/components/landing/MediaSocial.tsx b/components/landing/MediaSocial.tsx index e064497..f26060d 100644 --- a/components/landing/MediaSocial.tsx +++ b/components/landing/MediaSocial.tsx @@ -84,7 +84,7 @@ export default function MediaSocial() {

-
- + */}
-
+ {/*
-
+
*/}
diff --git a/components/landing/PolriApps.tsx b/components/landing/PolriApps.tsx new file mode 100644 index 0000000..e9252d5 --- /dev/null +++ b/components/landing/PolriApps.tsx @@ -0,0 +1,296 @@ +"use client"; +import { Button } from "@nextui-org/button"; +import { + Image, + Modal, + ModalBody, + ModalContent, + ModalFooter, + ModalHeader, + ModalProps, + useDisclosure, +} from "@nextui-org/react"; +import { ChevronLeftWhite, ChevronRightWhite } from "../icons"; +import React, { useEffect, useState } from "react"; +import Link from "next/link"; +import { useTranslations } from "next-intl"; + +export default function PolriApps() { + const { isOpen, onOpen, onOpenChange } = useDisclosure(); + const [scrollBehavior, setScrollBehavior] = + React.useState("inside"); + const [modalPlacement, setModalPlacement] = React.useState("auto"); + const t = useTranslations("Landing"); + + const listApps = [ + { + id: 1, + img: "/landing-polri-super-apps.png", + title: "Polri Super Apps", + path: "https://play.google.com/store/apps/details?id=superapps.polri.presisi.presisi&hl=en_US&gl=US", + }, + { + id: 2, + img: "/landing-portal-humas.png", + title: "Portal Humas", + path: "https://portal.humas.polri.go.id/", + }, + { + id: 3, + img: "/landing-mediahub-polri.png", + title: "Portal Humas", + path: "https://play.google.com/store/apps/details?id=com.mediahub.mediahub_mobile", + }, + { + id: 4, + img: "/landing-polri-tv.png", + title: "Portal Humas", + path: "https://play.google.com/store/apps/details?id=com.polritv", + }, + { + id: 5, + img: "/landing-inp.png", + title: "Portal Humas", + path: "https://inp.polri.go.id/", + }, + { + id: 6, + img: "/landing-polisiku.png", + title: "Portal Humas", + path: "https://play.google.com/store/apps/details?id=id.co.qlue.polisiku&hl=id&gl=ID", + }, + ]; + + const listAppsAll = [ + { + id: 1, + img: "/landing-polri-super-apps.png", + title: "Polri Super Apps", + path: "https://play.google.com/store/apps/details?id=superapps.polri.presisi.presisi&hl=en_US&gl=US", + }, + { + id: 2, + img: "/landing-portal-humas.png", + title: "Portal Humas", + path: "https://portal.humas.polri.go.id/", + }, + { + id: 3, + img: "/landing-mediahub-polri.png", + title: "Portal Humas", + path: "https://play.google.com/store/apps/details?id=com.mediahub.mediahub_mobile", + }, + { + id: 4, + img: "/landing-polri-tv.png", + title: "Portal Humas", + path: "https://play.google.com/store/apps/details?id=com.polritv", + }, + { + id: 5, + img: "/landing-inp.png", + title: "Portal Humas", + path: "https://inp.polri.go.id/", + }, + { + id: 6, + img: "/landing-polisiku.png", + title: "Portal Humas", + path: "https://play.google.com/store/apps/details?id=id.co.qlue.polisiku&hl=id&gl=ID", + }, + { + id: 7, + img: "/landing-e-rikkes.png", + title: "e-RIKKES", + path: "https://erikkes.id/", + }, + { + id: 8, + img: "/landing-e-ppsi.png", + title: "e-PPSI", + path: "https://eppsi.id/", + }, + { + id: 9, + img: "/landing-bos.png", + title: "BOS", + path: "https://bos.polri.go.id/login", + }, + { + id: 10, + img: "/landing-signal.png", + title: "SIGNAL", + path: "https://play.google.com/store/apps/details?id=app.signal.id", + }, + + { + id: 11, + img: "/landing-skck.png", + title: "SKCK Online", + path: "https://skck.polri.go.id/", + }, + { + id: 12, + img: "/landing-propam-presisi.png", + title: "Propam Presisi", + path: "https://play.google.com/store/apps/details?id=com.stk.pengaduanpropam", + }, + { + id: 13, + img: "/landing-sdm-polri.png", + title: "SDM Polri", + path: "https://penerimaan.polri.go.id/", + }, + { + id: 14, + img: "/landing-e-avis.png", + title: "e-AVIS", + path: "https://e-avis.korlantas.polri.go.id/", + }, + { + id: 10, + img: "/landing-wbs.png", + title: "Whistle Blowing System", + path: "https://pengaduan-penerimaan.polri.go.id/", + }, + + { + id: 11, + img: "/landing-dumas-presisi.png", + title: "Dumas Presisi", + path: "https://dumaspresisi.polri.go.id/", + }, + { + id: 12, + img: "/landing-sinar.png", + title: "Sinar", + path: "https://www.digitalkorlantas.id/sim/", + }, + ]; + + // useEffect(() => { + // function updateLimitedData() { + // if (window.matchMedia("(max-width: 767px)").matches) { + // setLimitedData(list.slice(0, 2)); + // } else if (window.matchMedia("(min-width: 768px) and (max-width: 1023px)").matches) { + // setLimitedData(list.slice(0, 3)); + // } else { + // setLimitedData(list.slice(0, 5)); + // } + // } + + // updateLimitedData(); + // window.addEventListener('resize', updateLimitedData); + // return () => { + // window.removeEventListener('resize', updateLimitedData); + // }; + // }, [list]); + + const changeNameToSlug = (name: string) => { + const cleaned = name.replace("Polda ", "").trim().toLowerCase(); + const slug = cleaned.replace(/\s+/g, "-"); + return slug; + }; + + return ( +
+
+

+ {" "} + {t("aplikasi")} +

+
+
+ {/*
+ +
*/} +
+ {listApps.map((item: any, index: any) => ( + +
+ +

{item.title}

+
+ + ))} +
+ {/*
+ +
*/} +
+
+ +
+ + + {(onClose) => ( + <> + +
+

+ {" "} + {t("aplikasi")} +

+
+
+ + {listAppsAll.map((item: any, index: any) => ( +
+ +
+ +

+ {item.title} +

+
+ +
+ ))} +
+ + + + + )} +
+
+
+ ); +} diff --git a/components/landing/SidebarNav.tsx b/components/landing/SidebarNav.tsx index 6db9e5e..ec56e96 100644 --- a/components/landing/SidebarNav.tsx +++ b/components/landing/SidebarNav.tsx @@ -25,7 +25,14 @@ export default function SidebarNav() { return ( <>
- */} - {/*
+
Publikasi
- publikasi + /> */} - + {/* publikasi - + */}
-
*/} +
Channel Humas Polri
diff --git a/components/table/master/master-user-level/mapping-user-level.tsx b/components/table/master/master-user-level/mapping-user-level.tsx index bd01979..b439da3 100644 --- a/components/table/master/master-user-level/mapping-user-level.tsx +++ b/components/table/master/master-user-level/mapping-user-level.tsx @@ -79,53 +79,51 @@ export default function MappingUserLevel() { let level2 = undefined; for (let i = 0; i < parsedData.length; i++) { - if (i < 4) { - const temp = parsedData[i]; - if (temp.level_number === "2") { - const request = { - aliasName: temp.slug, - group: temp.group, - isActive: true, - levelNumber: 2, - name: temp.name, - parentLevelId: level1, - provinceId: 0, - }; - const res = await createUserLevel(request); - if (res?.error) { - break; - } - level2 = res?.data?.data?.id; - } else if (temp.level_number === "3") { - const request = { - aliasName: temp.slug, - group: temp.group, - isActive: true, - levelNumber: 3, - name: temp.name, - parentLevelId: level2, - provinceId: 0, - }; - const res = await createUserLevel(request); - if (res?.error) { - break; - } - } else { - const request = { - aliasName: temp.slug, - group: temp.group, - isActive: true, - levelNumber: 1, - name: temp.name, - parentLevelId: 0, - provinceId: 0, - }; - const res = await createUserLevel(request); - if (res?.error) { - break; - } - level1 = res?.data?.data?.id; + const temp = parsedData[i]; + if (temp.level_number === "2") { + const request = { + aliasName: temp.slug, + group: temp.group, + isActive: true, + levelNumber: 2, + name: temp.name, + parentLevelId: level1, + provinceId: 0, + }; + const res = await createUserLevel(request); + if (res?.error) { + break; } + level2 = res?.data?.data?.id; + } else if (temp.level_number === "3") { + const request = { + aliasName: temp.slug, + group: temp.group, + isActive: true, + levelNumber: 3, + name: temp.name, + parentLevelId: level2, + provinceId: 0, + }; + const res = await createUserLevel(request); + if (res?.error) { + break; + } + } else { + const request = { + aliasName: temp.slug, + group: temp.group, + isActive: true, + levelNumber: 1, + name: temp.name, + parentLevelId: 0, + provinceId: 0, + }; + const res = await createUserLevel(request); + if (res?.error) { + break; + } + level1 = res?.data?.data?.id; } } } diff --git a/components/ui/social-media/facebook.tsx b/components/ui/social-media/facebook.tsx index a976e6c..ca411c9 100644 --- a/components/ui/social-media/facebook.tsx +++ b/components/ui/social-media/facebook.tsx @@ -15,10 +15,27 @@ const FacebookWidget = () => { }, []); return ( -
+ //
+ ); }; diff --git a/messages/en.json b/messages/en.json index 89d7d08..9cb17a1 100644 --- a/messages/en.json +++ b/messages/en.json @@ -39,6 +39,7 @@ "kategoriSatker": "Satker Cateogry", "beritaWilayah": "Regional News", "tutup": "Close", - "topik": "Main Topic" + "topik": "Main Topic", + "aplikasi": "Polri Apps" } } diff --git a/messages/id.json b/messages/id.json index a683b66..007bde3 100644 --- a/messages/id.json +++ b/messages/id.json @@ -38,6 +38,7 @@ "kategoriSatker": "Kategori Satker", "beritaWilayah": "Berita Wilayah", "tutup": "Tutup", - "topik": "Topik Utama" + "topik": "Topik Utama", + "aplikasi": "Aplikasi Polri" } } diff --git a/public/landing-bos.png b/public/landing-bos.png new file mode 100644 index 0000000..7ee4ad6 Binary files /dev/null and b/public/landing-bos.png differ diff --git a/public/landing-dumas-presisi.png b/public/landing-dumas-presisi.png new file mode 100644 index 0000000..e1872d2 Binary files /dev/null and b/public/landing-dumas-presisi.png differ diff --git a/public/landing-e-avis.png b/public/landing-e-avis.png new file mode 100644 index 0000000..b21db23 Binary files /dev/null and b/public/landing-e-avis.png differ diff --git a/public/landing-e-ppsi.png b/public/landing-e-ppsi.png new file mode 100644 index 0000000..54a80c5 Binary files /dev/null and b/public/landing-e-ppsi.png differ diff --git a/public/landing-e-rikkes.png b/public/landing-e-rikkes.png new file mode 100644 index 0000000..846dbb1 Binary files /dev/null and b/public/landing-e-rikkes.png differ diff --git a/public/landing-inp.png b/public/landing-inp.png new file mode 100644 index 0000000..9e6dd6c Binary files /dev/null and b/public/landing-inp.png differ diff --git a/public/landing-mediahub-polri.png b/public/landing-mediahub-polri.png new file mode 100644 index 0000000..971ba8a Binary files /dev/null and b/public/landing-mediahub-polri.png differ diff --git a/public/landing-polisiku.png b/public/landing-polisiku.png new file mode 100644 index 0000000..240c592 Binary files /dev/null and b/public/landing-polisiku.png differ diff --git a/public/landing-polri-super-apps.png b/public/landing-polri-super-apps.png new file mode 100644 index 0000000..7fc61fc Binary files /dev/null and b/public/landing-polri-super-apps.png differ diff --git a/public/landing-polri-tv.png b/public/landing-polri-tv.png new file mode 100644 index 0000000..03d164e Binary files /dev/null and b/public/landing-polri-tv.png differ diff --git a/public/landing-portal-humas.png b/public/landing-portal-humas.png new file mode 100644 index 0000000..c1ec7d7 Binary files /dev/null and b/public/landing-portal-humas.png differ diff --git a/public/landing-propam-presisi.png b/public/landing-propam-presisi.png new file mode 100644 index 0000000..4cfb66e Binary files /dev/null and b/public/landing-propam-presisi.png differ diff --git a/public/landing-sdm-polri.png b/public/landing-sdm-polri.png new file mode 100644 index 0000000..68b4d01 Binary files /dev/null and b/public/landing-sdm-polri.png differ diff --git a/public/landing-signal.png b/public/landing-signal.png new file mode 100644 index 0000000..b74c559 Binary files /dev/null and b/public/landing-signal.png differ diff --git a/public/landing-sinar.png b/public/landing-sinar.png new file mode 100644 index 0000000..b899b3c Binary files /dev/null and b/public/landing-sinar.png differ diff --git a/public/landing-skck.png b/public/landing-skck.png new file mode 100644 index 0000000..784bfe1 Binary files /dev/null and b/public/landing-skck.png differ diff --git a/public/landing-wbs.png b/public/landing-wbs.png new file mode 100644 index 0000000..a2383c3 Binary files /dev/null and b/public/landing-wbs.png differ diff --git a/public/sertifikat-1.png b/public/sertifikat-1.png new file mode 100644 index 0000000..76bdecc Binary files /dev/null and b/public/sertifikat-1.png differ diff --git a/service/article.ts b/service/article.ts index ca8e11b..14286b7 100644 --- a/service/article.ts +++ b/service/article.ts @@ -9,14 +9,14 @@ import Cookies from "js-cookie"; const token = Cookies.get("access_token"); export async function getListArticle(props: PaginationRequest) { - const { page, limit, search, startDate, endDate } = props; + const { page, limit, search, startDate, endDate, isPublish } = props; const headers = { "content-type": "application/json", }; return await httpGet( - `/articles?limit=${limit}&page=${page}&title=${search}&startDate=${ - startDate || "" - }&endDate=${endDate || ""}`, + `/articles?limit=${limit}&page=${page}&isPublish=${ + isPublish === undefined ? "" : isPublish + }&title=${search}&startDate=${startDate || ""}&endDate=${endDate || ""}`, headers ); } diff --git a/types/globals.tsx b/types/globals.tsx index 33cb8d7..a744786 100644 --- a/types/globals.tsx +++ b/types/globals.tsx @@ -61,4 +61,5 @@ export type PaginationRequest = { search: string; startDate?: string; endDate?: string; + isPublish?: boolean; };