(
+ render={({ field: { onChange, value } }) =>
//
//
- isDetail ?
-
- :
-
- )}
+ isDetail ? (
+
+ ) : (
+
+ )
+ }
/>
{errors?.description && (
diff --git a/components/form/article/generate-ai-single-form.tsx b/components/form/article/generate-ai-single-form.tsx
index be082c7..c3289b2 100644
--- a/components/form/article/generate-ai-single-form.tsx
+++ b/components/form/article/generate-ai-single-form.tsx
@@ -60,8 +60,19 @@ const articleSize = [
},
];
+interface DiseData {
+ id: number;
+ articleBody: string;
+ title: string;
+ metaTitle: string;
+ description: string;
+ metaDescription: string;
+ mainKeyword: string;
+ additionalKeywords: string;
+}
+
export default function GenerateSingleArticleForm(props: {
- content: (data: string) => void;
+ content: (data: DiseData) => void;
}) {
const [selectedWritingSyle, setSelectedWritingStyle] =
useState("Informational");
@@ -162,14 +173,23 @@ export default function GenerateSingleArticleForm(props: {
const getArticleDetail = async () => {
if (selectedId) {
const res = await getDetailArticle(selectedId);
- const data = res?.data?.data?.articleBody;
- checkArticleStatus(data);
- if (data !== null) {
+ const data = res?.data?.data;
+ checkArticleStatus(data?.articleBody);
+ if (data?.articleBody !== null) {
setIsLoading(false);
props.content(data);
} else {
setIsLoading(true);
- props.content("");
+ props.content({
+ id: data?.id,
+ articleBody: "",
+ title: "",
+ metaTitle: "",
+ description: "",
+ metaDescription: "",
+ additionalKeywords: "",
+ mainKeyword: "",
+ });
}
}
};
diff --git a/components/form/article/get-seo-score-form.tsx b/components/form/article/get-seo-score-form.tsx
index 471caca..b6fec83 100644
--- a/components/form/article/get-seo-score-form.tsx
+++ b/components/form/article/get-seo-score-form.tsx
@@ -8,7 +8,7 @@ import { useEffect, useRef, useState } from "react";
export default function GetSeoScore(props: { id: string }) {
useEffect(() => {
fetchSeoScore();
- }, []);
+ }, [props.id]);
const [totalScoreSEO, setTotalScoreSEO] = useState();
const [errorSEO, setErrorSEO] = useState([]);
@@ -16,9 +16,9 @@ export default function GetSeoScore(props: { id: string }) {
const [optimizedSEO, setOptimizedSEO] = useState([]);
const fetchSeoScore = async () => {
- const res = await getSeoScore("1931");
+ const res = await getSeoScore(props?.id);
if (res.error) {
- error(res.message);
+ // error(res.message);
return false;
}
setTotalScoreSEO(res.data.data?.seo_analysis?.score || 0);
@@ -42,97 +42,103 @@ export default function GetSeoScore(props: { id: string }) {
SEO Score
-
-
-
-
-
- {/*
*/}
- Error : {errorSEO.length || 0}
+ {totalScoreSEO ? (
+
+
+
-
- {/*
+
+
+ {/* */}
+ Error : {errorSEO.length || 0}
+
+
+ {/*
!
*/}
- Warning : {warningSEO.length || 0}
-
-
- {/* */}
- Optimize : {optimizedSEO.length || 0}
+ Warning : {warningSEO.length || 0}
+
+
+ {/* */}
+ Optimize : {optimizedSEO.length || 0}
+
-
-
- }
- title={`${errorSEO?.length || 0} Errors`}
+ ) : (
+ "Belum ada Data"
+ )}
+ {totalScoreSEO && (
+
-
- {errorSEO?.map((item: any) => (
-
- {item}
-
- ))}
-
-
-
- // !
- //
- // }
- title={`${warningSEO?.length || 0} Warnings`}
- >
-
- {warningSEO?.map((item: any) => (
-
- {item}
-
- ))}
-
-
- }
- title={`${optimizedSEO?.length || 0} Optimized`}
- >
-
- {optimizedSEO?.map((item: any) => (
-
- {item}
-
- ))}
-
-
-
+ }
+ title={`${errorSEO?.length || 0} Errors`}
+ >
+
+ {errorSEO?.map((item: any) => (
+
+ {item}
+
+ ))}
+
+
+
+ // !
+ //
+ // }
+ title={`${warningSEO?.length || 0} Warnings`}
+ >
+
+ {warningSEO?.map((item: any) => (
+
+ {item}
+
+ ))}
+
+
+ }
+ title={`${optimizedSEO?.length || 0} Optimized`}
+ >
+
+ {optimizedSEO?.map((item: any) => (
+
+ {item}
+
+ ))}
+
+
+
+ )}
);
diff --git a/components/form/login.tsx b/components/form/login.tsx
index d7304e4..4f44062 100644
--- a/components/form/login.tsx
+++ b/components/form/login.tsx
@@ -101,116 +101,7 @@ export default function Login() {
};
return (
- //
- //
- //
- //
- // Selamat Datang di Portal Resmi Humas Polri
- //
- //
- // {
- // setValUsername(e.target.value.trim());
- // }}
- // onPaste={(e: any) => {
- // setValUsername(e.target.value.trim());
- // }}
- // onCopy={(e: any) => {
- // setValUsername(e.target.value.trim());
- // }}
- // />
- //
- //
- //
- // {isVisible ? (
- //
- // ) : (
- //
- // )}
- //
- // }
- // type={isVisible ? "text" : "password"}
- // label="Password"
- // placeholder="Masukkan password anda"
- // variant="underlined"
- // onChange={(event) => setPassword(event.target.value)}
- // />
- //
-
- //
- //
- //
- //
- // Don't have account? Register Now
- //
- //
- //
- //
- //
- //
- //
- //
- //

- //
- //
- //
-
+
-

+
+

+
-
+
Login
Username
{
-// return import("@/components/editor/custom-editor");
-// },
-// { ssr: false }
-// );
+const CustomEditor = dynamic(
+ () => {
+ return import("@/components/editor/custom-editor");
+ },
+ { ssr: false }
+);
interface FileWithPreview extends File {
preview: string;
@@ -375,13 +375,7 @@ export default function NewCreateMagazineForm() {
control={control}
name="description"
render={({ field: { onChange, value } }) => (
- //
-
+
)}
/>
{errors?.description && (
diff --git a/components/form/magazine/edit-magazine-form.tsx b/components/form/magazine/edit-magazine-form.tsx
index fcbdbec..e7fb650 100644
--- a/components/form/magazine/edit-magazine-form.tsx
+++ b/components/form/magazine/edit-magazine-form.tsx
@@ -42,12 +42,12 @@ import {
uploadMagazineFile,
} from "@/service/magazine";
-// const CustomEditor = dynamic(
-// () => {
-// return import("@/components/editor/custom-editor");
-// },
-// { ssr: false }
-// );
+const CustomEditor = dynamic(
+ () => {
+ return import("@/components/editor/custom-editor");
+ },
+ { ssr: false }
+);
interface FileWithPreview extends File {
preview: string;
@@ -445,14 +445,7 @@ export default function EditMagazineForm(props: { isDetail: boolean }) {
control={control}
name="description"
render={({ field: { onChange, value } }) => (
- //
-
+
)}
/>
{errors?.description && (
diff --git a/components/form/settings/password.tsx b/components/form/settings/password.tsx
new file mode 100644
index 0000000..a8c1be9
--- /dev/null
+++ b/components/form/settings/password.tsx
@@ -0,0 +1,108 @@
+"use client";
+import { FormEvent, Fragment, useEffect, useRef, useState } from "react";
+import { Controller, useForm } from "react-hook-form";
+import * as z from "zod";
+import { zodResolver } from "@hookform/resolvers/zod";
+import Swal from "sweetalert2";
+import withReactContent from "sweetalert2-react-content";
+import { Input, Textarea } from "@nextui-org/input";
+
+const formSchema = z.object({
+ password: z.string().min(2, {
+ message: "Judul harus diisi",
+ }),
+ passwordConf: z.string().min(2, {
+ message: "Slug harus diisi",
+ }),
+});
+
+export default function PasswordForm() {
+ const MySwal = withReactContent(Swal);
+
+ const formOptions = {
+ resolver: zodResolver(formSchema),
+ };
+ type UserSettingSchema = z.infer
;
+ const {
+ register,
+ control,
+ handleSubmit,
+ formState: { errors },
+ setValue,
+ getValues,
+ watch,
+ setError,
+ clearErrors,
+ } = useForm(formOptions);
+
+ const onSubmit = async (values: z.infer) => {
+ console.log("values");
+ };
+
+ return (
+
+ );
+}
diff --git a/components/form/settings/profile.tsx b/components/form/settings/profile.tsx
new file mode 100644
index 0000000..60ed39a
--- /dev/null
+++ b/components/form/settings/profile.tsx
@@ -0,0 +1,212 @@
+"use client";
+import { FormEvent, Fragment, useEffect, useRef, useState } from "react";
+import { Controller, useForm } from "react-hook-form";
+import * as z from "zod";
+import { zodResolver } from "@hookform/resolvers/zod";
+import Swal from "sweetalert2";
+import withReactContent from "sweetalert2-react-content";
+import { Input, Textarea } from "@nextui-org/input";
+import { Button } from "@nextui-org/button";
+import { Radio, RadioGroup } from "@nextui-org/react";
+
+const formSchema = z.object({
+ fullname: z.string().min(1, {
+ message: "Harus diisi",
+ }),
+ username: z.string().min(1, {
+ message: "Harus diisi",
+ }),
+ email: z
+ .string()
+ .email({
+ message: "Email tidak valid",
+ })
+ .min(2, {
+ message: "Harus diisi",
+ }),
+ nrp: z.string().min(1, {
+ message: "Harus diisi",
+ }),
+ gender: z.string().min(1, {
+ message: "Harus diisi",
+ }),
+ phoneNumber: z.string().min(1, {
+ message: "Harus diisi",
+ }),
+});
+
+export default function ProfileForm() {
+ const MySwal = withReactContent(Swal);
+
+ const formOptions = {
+ resolver: zodResolver(formSchema),
+ };
+ type UserSettingSchema = z.infer;
+ const {
+ register,
+ control,
+ handleSubmit,
+ formState: { errors },
+ setValue,
+ getValues,
+ watch,
+ setError,
+ clearErrors,
+ } = useForm(formOptions);
+
+ const onSubmit = async (values: z.infer) => {
+ console.log("values");
+ };
+
+ return (
+
+ );
+}
diff --git a/components/icons/globals.tsx b/components/icons/globals.tsx
index f90059a..0d11c16 100644
--- a/components/icons/globals.tsx
+++ b/components/icons/globals.tsx
@@ -148,3 +148,49 @@ export const FileIcon = ({
/>
);
+export const UserProfileIcon = ({
+ size,
+ height = 24,
+ width = 24,
+ fill = "currentColor",
+ ...props
+}: IconSvgProps) => (
+
+);
+export const SettingsIcon = ({
+ size,
+ height = 24,
+ width = 24,
+ fill = "currentColor",
+ ...props
+}: IconSvgProps) => (
+
+);
diff --git a/components/landing/ENewsPolri.tsx b/components/landing/ENewsPolri.tsx
index 00e0d9b..a8200bb 100644
--- a/components/landing/ENewsPolri.tsx
+++ b/components/landing/ENewsPolri.tsx
@@ -12,6 +12,7 @@ import "swiper/css";
import "swiper/css/pagination";
import "swiper/css/effect-fade";
import "swiper/css/navigation";
+import { getListMagazine } from "@/service/magazine";
export default function ENewsPolri() {
const [article, setArticle] = useState([]);
@@ -20,7 +21,7 @@ export default function ENewsPolri() {
async function getArticle() {
const req = { page: 1, search: "", limit: "10" };
- const response = await getListArticle(req);
+ const response = await getListMagazine(req);
setArticle(response?.data?.data);
}
getArticle();
@@ -68,13 +69,13 @@ export default function ENewsPolri() {
-
+
{textEllipsis(newsItem.title, 40)}
diff --git a/components/landing/SidebarNav.tsx b/components/landing/SidebarNav.tsx
index 17aa68f..4159c61 100644
--- a/components/landing/SidebarNav.tsx
+++ b/components/landing/SidebarNav.tsx
@@ -30,7 +30,7 @@ export default function SidebarNav() {
onClick={() => setSelectedTab("media")}
className={
selectedTab === "media"
- ? "text-black border-b-3 border-red-400 cursor-pointer py-2"
+ ? "text-black dark:text-white border-b-3 border-red-400 cursor-pointer py-2"
: "text-slate-300 cursor-pointer py-2"
}
>
@@ -40,7 +40,7 @@ export default function SidebarNav() {
onClick={() => setSelectedTab("video")}
className={
selectedTab === "video"
- ? "text-black border-b-3 border-red-400 cursor-pointer py-2"
+ ? "text-black dark:text-white border-b-3 border-red-400 cursor-pointer py-2"
: "text-slate-300 cursor-pointer py-2"
}
>
diff --git a/components/layout/admin-layout.tsx b/components/layout/admin-layout.tsx
index 836ad50..fe4f828 100644
--- a/components/layout/admin-layout.tsx
+++ b/components/layout/admin-layout.tsx
@@ -27,9 +27,9 @@ export const AdminLayout = ({ children }: Props) => {
return (
-
+
-
+
{children}
diff --git a/components/layout/humas-layout.tsx b/components/layout/humas-layout.tsx
index bf79e01..68f821a 100644
--- a/components/layout/humas-layout.tsx
+++ b/components/layout/humas-layout.tsx
@@ -9,7 +9,7 @@ interface Props {
export const HumasLayout = ({ children }: Props) => {
return (
-
+
diff --git a/components/layout/sidebar/sidebar.tsx b/components/layout/sidebar/sidebar.tsx
index 091a748..832875a 100644
--- a/components/layout/sidebar/sidebar.tsx
+++ b/components/layout/sidebar/sidebar.tsx
@@ -32,6 +32,7 @@ import { useSidebar } from "./sidebar-context";
import { SidebarMenu } from "./sidebar-menu";
import Image from "next/image";
import Cookies from "js-cookie";
+import { SettingsIcon, UserProfileIcon } from "@/components/icons/globals";
interface SubMenuItems {
id: number;
@@ -114,13 +115,13 @@ const sideBarDummyData = [
childModule: null,
},
{
- id: 4,
- name: "Majalah",
- moduleId: 652,
- moduleName: "Apps",
- modulePathUrl: "/admin/magazine",
+ id: 30,
+ name: "Category",
+ moduleId: 654,
+ moduleName: "Master",
+ modulePathUrl: "/admin/master-category",
parentId: -1,
- icon: ,
+ icon: ,
position: 1,
statusId: 1,
childMenu: [],
@@ -128,19 +129,20 @@ const sideBarDummyData = [
childModule: null,
},
{
- id: 11,
- name: "Static Page",
+ id: 4,
+ name: "Majalah",
moduleId: 652,
- moduleName: "Dashboard",
- modulePathUrl: "/admin/static-page",
+ moduleName: "Apps",
+ modulePathUrl: "/admin/magazine",
parentId: -1,
- icon: ,
+ icon: ,
position: 1,
statusId: 1,
childMenu: [],
statusName: "Active",
childModule: null,
},
+
// {
// id: 4,
// name: "E-Magazine",
@@ -199,13 +201,13 @@ const sideBarDummyData = [
// childModule: null,
// },
{
- id: 30,
- name: "Master Category",
- moduleId: 654,
- moduleName: "Master",
- modulePathUrl: "/admin/master-category",
+ id: 11,
+ name: "Master Static Page",
+ moduleId: 652,
+ moduleName: "Dashboard",
+ modulePathUrl: "/admin/static-page",
parentId: -1,
- icon: ,
+ icon: ,
position: 1,
statusId: 1,
childMenu: [],
@@ -249,6 +251,7 @@ const Sidebar: React.FC = ({ updateSidebarData }) => {
const [sidebarMenu, setSidebarMenu] = useState();
const { isOpen, toggleSidebar } = useSidebar();
const token = Cookies.get("access_token");
+ const fullname = Cookies.get("ufne");
const isAuthenticated = Cookies.get("is_authenticated");
useEffect(() => {
@@ -270,12 +273,12 @@ const Sidebar: React.FC = ({ updateSidebarData }) => {
return (
@@ -304,7 +307,7 @@ const Sidebar: React.FC
= ({ updateSidebarData }) => {
{isOpen && (