diff --git a/public/portofolio/logo/01b978fb-40f4-47c1-9431-70981fb17b8b.png b/public/portofolio/logo/01b978fb-40f4-47c1-9431-70981fb17b8b.png
deleted file mode 100644
index 7db4a537..00000000
Binary files a/public/portofolio/logo/01b978fb-40f4-47c1-9431-70981fb17b8b.png and /dev/null differ
diff --git a/public/portofolio/logo/142118e7-a915-46e6-89f8-92f1d3779e7c.png b/public/portofolio/logo/142118e7-a915-46e6-89f8-92f1d3779e7c.png
deleted file mode 100644
index 5d1f3b87..00000000
Binary files a/public/portofolio/logo/142118e7-a915-46e6-89f8-92f1d3779e7c.png and /dev/null differ
diff --git a/public/portofolio/logo/19ccfa45-31c6-4214-a925-4e2747ff278c.png b/public/portofolio/logo/19ccfa45-31c6-4214-a925-4e2747ff278c.png
deleted file mode 100644
index 176da5a2..00000000
Binary files a/public/portofolio/logo/19ccfa45-31c6-4214-a925-4e2747ff278c.png and /dev/null differ
diff --git a/public/portofolio/logo/9a40ec12-176f-4e20-a2e9-685d19a3c350.jpg b/public/portofolio/logo/9a40ec12-176f-4e20-a2e9-685d19a3c350.jpg
deleted file mode 100644
index d906e018..00000000
Binary files a/public/portofolio/logo/9a40ec12-176f-4e20-a2e9-685d19a3c350.jpg and /dev/null differ
diff --git a/public/portofolio/logo/ed10f0e8-fd5c-4ed8-a59c-6f690ca360cc.jpg b/public/portofolio/logo/a8b687db-75f3-4087-bf8a-b8e4c9f0a748.jpg
similarity index 100%
rename from public/portofolio/logo/ed10f0e8-fd5c-4ed8-a59c-6f690ca360cc.jpg
rename to public/portofolio/logo/a8b687db-75f3-4087-bf8a-b8e4c9f0a748.jpg
diff --git a/public/portofolio/logo/bd2c3ce3-e94d-4309-ac48-6fbaa2f72c66.png b/public/portofolio/logo/bd2c3ce3-e94d-4309-ac48-6fbaa2f72c66.png
new file mode 100644
index 00000000..256b64ba
Binary files /dev/null and b/public/portofolio/logo/bd2c3ce3-e94d-4309-ac48-6fbaa2f72c66.png differ
diff --git a/public/profile/background/34f19452-0a72-4b26-8915-43f7b87c37d8.jpeg b/public/profile/background/34f19452-0a72-4b26-8915-43f7b87c37d8.jpeg
new file mode 100644
index 00000000..8cd38350
Binary files /dev/null and b/public/profile/background/34f19452-0a72-4b26-8915-43f7b87c37d8.jpeg differ
diff --git a/public/profile/background/45841dcd-d518-4c97-b04a-d6547359bb8b.jpeg b/public/profile/background/45841dcd-d518-4c97-b04a-d6547359bb8b.jpeg
new file mode 100644
index 00000000..8a84a01d
Binary files /dev/null and b/public/profile/background/45841dcd-d518-4c97-b04a-d6547359bb8b.jpeg differ
diff --git a/public/profile/background/99c41f6b-6710-49df-a658-1b4243b57b1d.jpeg b/public/profile/background/99c41f6b-6710-49df-a658-1b4243b57b1d.jpeg
new file mode 100644
index 00000000..8cd38350
Binary files /dev/null and b/public/profile/background/99c41f6b-6710-49df-a658-1b4243b57b1d.jpeg differ
diff --git a/public/profile/foto/2c10a620-4222-43bc-886e-2f317de4711c.jpeg b/public/profile/foto/2c10a620-4222-43bc-886e-2f317de4711c.jpeg
new file mode 100644
index 00000000..4660498f
Binary files /dev/null and b/public/profile/foto/2c10a620-4222-43bc-886e-2f317de4711c.jpeg differ
diff --git a/public/profile/foto/51b1addd-2e15-409e-8f72-388dc1cc1c2e.jpeg b/public/profile/foto/51b1addd-2e15-409e-8f72-388dc1cc1c2e.jpeg
new file mode 100644
index 00000000..4660498f
Binary files /dev/null and b/public/profile/foto/51b1addd-2e15-409e-8f72-388dc1cc1c2e.jpeg differ
diff --git a/public/profile/foto/994ecb8e-59f6-43b7-a4ea-e14d8e441200.jpeg b/public/profile/foto/994ecb8e-59f6-43b7-a4ea-e14d8e441200.jpeg
new file mode 100644
index 00000000..4660498f
Binary files /dev/null and b/public/profile/foto/994ecb8e-59f6-43b7-a4ea-e14d8e441200.jpeg differ
diff --git a/src/app/api/test-scroll/route.ts b/src/app/api/test-scroll/route.ts
index 8af369fc..c722ba33 100644
--- a/src/app/api/test-scroll/route.ts
+++ b/src/app/api/test-scroll/route.ts
@@ -8,5 +8,5 @@ export async function GET(req: Request) {
skip: +page * 5 - 5,
});
- return Response.json(res);
+ // return Response.json(res);
}
diff --git a/src/app/dev/colab/detail/group/[id]/page.tsx b/src/app/dev/colab/detail/group/[id]/page.tsx
index 93b70b60..ef18896d 100644
--- a/src/app/dev/colab/detail/group/[id]/page.tsx
+++ b/src/app/dev/colab/detail/group/[id]/page.tsx
@@ -17,23 +17,19 @@ export default async function Page({ params }: { params: { id: string } }) {
]);
let listMsg = await colab_getMessageByRoomId({ roomId: roomId, page: 1 });
- // const listMessage = await colab_V2getListMessageByRoomId({
- // roomId: roomId,
- // page: 1,
- // });
-
return (
<>
- {/* */}
-
+
+ {/*
+ /> */}
>
);
}
diff --git a/src/app/dev/event/detail/draft/[id]/layout.tsx b/src/app/dev/event/detail/draft/[id]/layout.tsx
index 529e8e2e..e2e18be4 100644
--- a/src/app/dev/event/detail/draft/[id]/layout.tsx
+++ b/src/app/dev/event/detail/draft/[id]/layout.tsx
@@ -8,9 +8,13 @@ export default async function Page({
children: React.ReactNode;
params: { id: string };
}) {
- let eventId = params.id
+ let eventId = params.id;
- return <>
- {children};
- >
+ return (
+ <>
+
+ {children}
+
+ >
+ );
}
diff --git a/src/app/dev/event/detail/draft/[id]/page.tsx b/src/app/dev/event/detail/draft/[id]/page.tsx
index ff593528..e4ecbc73 100644
--- a/src/app/dev/event/detail/draft/[id]/page.tsx
+++ b/src/app/dev/event/detail/draft/[id]/page.tsx
@@ -1,8 +1,8 @@
-import { Event_DetailDraft } from "@/app_modules/event";
-import { Event_getOneById } from "@/app_modules/event/fun/get/get_one_by_id";
+import { Event_DetailDraft } from "@/app_modules/event"
+import { Event_getOneById } from "@/app_modules/event/fun/get/get_one_by_id"
-export default async function Page({params}: {params: {id: string}}) {
+export default async function Page({ params }: { params: { id: string } }) {
let eventId = params.id
const dataEvent = await Event_getOneById(eventId)
- return ;
+ return
}
diff --git a/src/app/dev/forum/forumku/[id]/page.tsx b/src/app/dev/forum/forumku/[id]/page.tsx
index 0bfe0fcb..ca9e99b3 100644
--- a/src/app/dev/forum/forumku/[id]/page.tsx
+++ b/src/app/dev/forum/forumku/[id]/page.tsx
@@ -8,7 +8,7 @@ import { forum_countPostingByAuthorId } from "@/app_modules/forum/fun/count/coun
export default async function Page({ params }: { params: { id: string } }) {
const authorId = params.id;
- const userLoginId = await user_getOneUserId()
+ const userLoginId = await user_getOneUserId();
const dataAuthor = await user_getOneByUserId(authorId);
const auhtorSelectedData = _.omit(dataAuthor, [
"Profile.email",
@@ -25,14 +25,11 @@ export default async function Page({ params }: { params: { id: string } }) {
// setTimeout(a, 1000);
// });
-
-
const dataPosting = await forum_getListPostingByAuhtorId(authorId);
const totalPosting = await forum_countPostingByAuthorId(authorId);
return (
<>
-
- {children}
+ {children}
+
);
}
diff --git a/src/app_modules/auth/register/view.tsx b/src/app_modules/auth/register/view.tsx
index 206a9002..9b0012a5 100644
--- a/src/app_modules/auth/register/view.tsx
+++ b/src/app_modules/auth/register/view.tsx
@@ -27,11 +27,13 @@ import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_glob
import { IconPencilCheck } from "@tabler/icons-react";
import { RouterHome } from "@/app/lib/router_hipmi/router_home";
import { auth_funEditAktivasiKodeOtpById } from "../fun/fun_edit_aktivasi_kode_otp_by_id";
+import ComponentGlobal_ErrorInput from "@/app_modules/component_global/error_input";
export default function Register({ dataOtp }: { dataOtp: any }) {
const router = useRouter();
const [nomor, setNomor] = useState(dataOtp.nomor);
const [value, setValue] = useState("");
+ const [isValue, setIsValue] = useState(false);
const focusTrapRef = useFocusTrap();
const [loading, setLoading] = useState(false);
@@ -42,17 +44,12 @@ export default function Register({ dataOtp }: { dataOtp: any }) {
};
// console.log(body);
- if (body.username === "")
- return ComponentGlobal_NotifikasiPeringatan("Lengkapi Username");
-
- if (body.username.length < 5)
- return ComponentGlobal_NotifikasiPeringatan("Username tidak sesuai");
-
- if (_.values(body.username).includes(" "))
- return ComponentGlobal_NotifikasiPeringatan(
- "Username tidak sesuai",
- 3000
- );
+ if (body.username === "") {
+ setIsValue(true);
+ return null;
+ }
+ if (body.username.length < 5) return null;
+ if (_.values(body.username).includes(" ")) return null;
await Auth_funRegister(body).then(async (res) => {
if (res.status === 200) {
@@ -92,23 +89,27 @@ export default function Register({ dataOtp }: { dataOtp: any }) {
REGISTRASI
Masukan username anda !
-
+
0 && value.length < 5 ? (
- Minimal 5 karakter
+
) : _.values(value).includes(" ") ? (
-
- - Tidak boleh ada space
- - Sambungkan huruf meggunakan karakter _
+
+
+
+ ) : isValue ? (
+
) : (
""
)
}
onChange={(val) => {
+ val.currentTarget.value.length > 0 ? setIsValue(false) : "";
setValue(val.currentTarget.value);
}}
/>
diff --git a/src/app_modules/colab/detail/chat/index.tsx b/src/app_modules/colab/detail/chat/index.tsx
index b65f2097..e1bd2f98 100644
--- a/src/app_modules/colab/detail/chat/index.tsx
+++ b/src/app_modules/colab/detail/chat/index.tsx
@@ -46,6 +46,7 @@ import useInfiniteScroll, {
import toast from "react-simple-toasts";
import colab_getOneMessageById from "../../fun/get/room_chat/get_one_message_by_id";
import { List } from "react-virtualized";
+import { evnPesan } from "@/util/evn";
const list = Array(100).fill(0);
export default function ColabViewChat({
@@ -74,23 +75,53 @@ export default function ColabViewChat({
down: false,
});
+ const [topik, setTopic] = useState("")
+
+ useShallowEffect(() => {
+ evnPesan.on(topik, (msgg) => {
+ let dd: any[] = _.clone(data);
+ const a = [...dd, JSON.parse(msgg)];
+ // console.log(dd.length);
+ setData(a);
+ });
+ }, [data]);
+
+
+
// Kirim pesan
async function onSend() {
- await colab_funCreateMessageByUserId(msg, dataRoom.id).then(async (res) => {
- if (res.status === 200) {
- const newData = await colab_getMessageByRoomId({
- roomId: dataRoom?.id,
- page: 1,
- });
- setData(newData as any);
- setHasMore({ up: true });
-
+ // console.log(JSON.stringify(data[0], null, 2));
+ const kiriman = {
+ id: "clw8glvt4000j12efrecoubug",
+ createdAt: "2024-05-15T23:35:05.032Z",
+ isActive: true,
+ message: msg,
+ isFile: false,
+ User: {
+ id: "clvag8xt10007134j8sapm46n",
+ Profile: {
+ id: "clvajdger000g134jhhhg21c4",
+ name: "malikkurosaki",
+ },
+ },
+ };
+ mqtt_client.publish("pesan", JSON.stringify(kiriman));
+ // await colab_funCreateMessageByUserId(msg, dataRoom.id).then(async (res) => {
+ // if (res.status === 200) {
+ // const newData = await colab_getMessageByRoomId({
+ // roomId: dataRoom?.id,
+ // page: 1,
+ // });
+
+ // setData(newData as any);
+ // setHasMore({ up: true });
+
setMsg("");
- } else {
- ComponentGlobal_NotifikasiGagal(res.message);
- }
- });
+ // } else {
+ // ComponentGlobal_NotifikasiGagal(res.message);
+ // }
+ // });
}
const next = async (direction: ScrollDirection) => {
@@ -220,19 +251,19 @@ export default function ColabViewChat({
dangerouslySetInnerHTML={{ __html: e?.message }}
/>
- {/*
+
- {new Intl.DateTimeFormat("id-ID", {
+ {/* {new Intl.DateTimeFormat("id-ID", {
timeStyle: "medium",
- }).format(e.createdAt)}
+ }).format(e.createdAt)} */}
- {new Intl.DateTimeFormat("id-ID", {
+ {/* {new Intl.DateTimeFormat("id-ID", {
dateStyle: "medium",
- }).format(e.createdAt)}
+ }).format(e.createdAt)} */}
- */}
+
@@ -246,19 +277,19 @@ export default function ColabViewChat({
- {/*
+
- {new Intl.DateTimeFormat("id-ID", {
+ {/* {new Intl.DateTimeFormat("id-ID", {
timeStyle: "medium",
- }).format(e.createdAt)}
+ }).format(e.createdAt)} */}
- {new Intl.DateTimeFormat("id-ID", {
+ {/* {new Intl.DateTimeFormat("id-ID", {
dateStyle: "medium",
- }).format(e.createdAt)}
+ }).format(e.createdAt)} */}
- */}
+
diff --git a/src/app_modules/colab/detail/group/index.tsx b/src/app_modules/colab/detail/group/index.tsx
index f402e85a..0592e46c 100644
--- a/src/app_modules/colab/detail/group/index.tsx
+++ b/src/app_modules/colab/detail/group/index.tsx
@@ -103,9 +103,6 @@ export default function Colab_GroupChatView({
mqtt_client.publish(selectRoom.id, msg);
setMsg("");
- // const d = JSON.parse(JSON.stringify(res.data));
- // setData([...data, ...[d]]);
-
await colab_getOneMessageById({
messageId: res.data?.id as any,
}).then((res) => {
@@ -114,9 +111,9 @@ export default function Colab_GroupChatView({
// const d = JSON.parse(JSON.stringify(res));
// setData([...data, ...[d]]);
- mqtt_client.on("message", (a,b) => {
- setData([...data, ...[res]])
- })
+ mqtt_client.on("message", (a, b) => {
+ setData([...data, ...[res]]);
+ });
});
} else {
ComponentGlobal_NotifikasiGagal(res.message);
diff --git a/src/app_modules/colab/fun/get/room_chat/get_message_by_room_id.ts b/src/app_modules/colab/fun/get/room_chat/get_message_by_room_id.ts
index 4a915ba5..4e27d8cd 100644
--- a/src/app_modules/colab/fun/get/room_chat/get_message_by_room_id.ts
+++ b/src/app_modules/colab/fun/get/room_chat/get_message_by_room_id.ts
@@ -12,8 +12,8 @@ export default async function colab_getMessageByRoomId({
roomId: string;
page: number;
}) {
- const lewat = page * 10 - 10;
- const ambil = 10;
+ const lewat = page * 6 - 6;
+ const ambil = 6;
const getList = await prisma.projectCollaboration_Message.findMany({
orderBy: {
diff --git a/src/app_modules/component_global/error_input.tsx b/src/app_modules/component_global/error_input.tsx
new file mode 100644
index 00000000..93da4dc9
--- /dev/null
+++ b/src/app_modules/component_global/error_input.tsx
@@ -0,0 +1,25 @@
+"use client";
+
+import { Group, Text } from "@mantine/core";
+import { IconAlertTriangle } from "@tabler/icons-react";
+
+export default function ComponentGlobal_ErrorInput({
+ max,
+ text,
+ color,
+}: {
+ max?: number;
+ text?: string;
+ color?: string;
+}) {
+ return (
+ <>
+
+
+
+ {text ? text : ` Maksimal ${max ? max : "-"} karakter !`}
+
+
+ >
+ );
+}
diff --git a/src/app_modules/component_global/input_countdown.tsx b/src/app_modules/component_global/input_countdown.tsx
new file mode 100644
index 00000000..7aaa444b
--- /dev/null
+++ b/src/app_modules/component_global/input_countdown.tsx
@@ -0,0 +1,23 @@
+"use client";
+
+import { Text } from "@mantine/core";
+import { useState } from "react";
+
+export default function ComponentGlobal_InputCountDown({
+ maxInput,
+ lengthInput,
+}: {
+ maxInput: number;
+ lengthInput: number;
+}) {
+ return (
+ <>
+
+ {maxInput - lengthInput < 0 ? 0 : maxInput - lengthInput} /{" "}
+
+ {maxInput}
+
+
+ >
+ );
+}
diff --git a/src/app_modules/event/component/detail/detail_data.tsx b/src/app_modules/event/component/detail/detail_data.tsx
index be67a372..c5de678a 100644
--- a/src/app_modules/event/component/detail/detail_data.tsx
+++ b/src/app_modules/event/component/detail/detail_data.tsx
@@ -15,14 +15,14 @@ export default function ComponentEvent_DetailData({
const jam = tgl.toLocaleTimeString([], {
hour: "2-digit",
minute: "2-digit",
- hour12: false,
});
return (
<>
+ {/* {JSON.stringify(jam)} */}
- {data ? data?.title : null}
+ {data ? data?.title : null}
@@ -52,7 +52,7 @@ export default function ComponentEvent_DetailData({
:
- {hari}
+ {hari ? hari : ""}
@@ -61,7 +61,7 @@ export default function ComponentEvent_DetailData({
:
- {jam}
+ {jam ? jam : ""}
diff --git a/src/app_modules/event/component/error_maksimal_input.tsx b/src/app_modules/event/component/error_maksimal_input.tsx
index 2118cc1d..a7941811 100644
--- a/src/app_modules/event/component/error_maksimal_input.tsx
+++ b/src/app_modules/event/component/error_maksimal_input.tsx
@@ -1,17 +1,23 @@
-"use client"
+"use client";
import { Group, Text } from "@mantine/core";
import { IconAlertTriangle } from "@tabler/icons-react";
-export default function ComponentEvent_ErrorMaximalInput({max}:{max: number}){
- return (
- <>
-
-
-
- Maksimal {max} karakter !
-
-
- >
- );
-}
\ No newline at end of file
+export default function ComponentEvent_ErrorMaximalInput({
+ max,
+ text,
+}: {
+ max?: number;
+ text?: string;
+}) {
+ return (
+ <>
+
+
+
+ {text ? text : ` Maksimal ${max} karakter !`}
+
+
+ >
+ );
+}
diff --git a/src/app_modules/event/component/header_tamplate.tsx b/src/app_modules/event/component/header_tamplate.tsx
index 51d8ac70..f1f0c1e0 100644
--- a/src/app_modules/event/component/header_tamplate.tsx
+++ b/src/app_modules/event/component/header_tamplate.tsx
@@ -15,7 +15,7 @@ export default function ComponentEvent_HeaderTamplate({
bg,
}: {
hideBack?: boolean;
- changeIconBack?: any
+ changeIconBack?: any;
route?: any;
route2?: any;
title: string;
@@ -23,6 +23,8 @@ export default function ComponentEvent_HeaderTamplate({
bg?: any;
}) {
const router = useRouter();
+ const [isLoadingBack, setLoadingBack] = useState(false);
+ const [isLoadingOtherIcon, setLoadingOtherIcon] = useState(false);
return (
<>
+
{isMoreButton ? (
) : (
diff --git a/src/app_modules/forum/component/main_card_view.tsx b/src/app_modules/forum/component/main_card_view.tsx
index a9bcbc49..5303dcbb 100644
--- a/src/app_modules/forum/component/main_card_view.tsx
+++ b/src/app_modules/forum/component/main_card_view.tsx
@@ -17,14 +17,16 @@ import { IconMessageCircleX } from "@tabler/icons-react";
export default function ComponentForum_MainCardView({
data,
+ setData,
setLoadingKomen,
setLoadingDetail,
userLoginId,
}: {
data: MODEL_FORUM_POSTING[];
+ setData: any,
setLoadingKomen: any;
setLoadingDetail: any;
- userLoginId: any
+ userLoginId: any;
}) {
const router = useRouter();
return (
@@ -33,7 +35,9 @@ export default function ComponentForum_MainCardView({
{data.map((e, i) => (
- {/* {JSON.stringify( typeof e.ForumMaster_StatusPosting.id)} */}
+ {/* {JSON.stringify(e.Author.id, null, 2)}
+ {JSON.stringify(userLoginId, null, 2)} */}
+
-
+
@@ -196,18 +207,22 @@ export default function ComponentForum_PostingButtonMore({
function ButtonDelete({
postingId,
setOpenDel,
+ setData,
}: {
postingId?: string;
setOpenDel: any;
+ setData: any;
}) {
const [loading, setLoading] = useState(false);
async function onDelete() {
setOpenDel(false);
- await forum_funDeletePostingById(postingId as any).then((res) => {
+ await forum_funDeletePostingById(postingId as any).then(async (res) => {
if (res.status === 200) {
ComponentGlobal_NotifikasiBerhasil(`Postingan Terhapus`, 2000);
setLoading(true);
+ const listForum = await forum_getListAllPosting();
+ setData(listForum);
} else {
ComponentGlobal_NotifikasiGagal(res.message);
}
@@ -242,37 +257,61 @@ function ButtonStatus({
postingId,
setOpenStatus,
statusId,
+ setData,
+ userLoginId,
+ authorId,
}: {
postingId?: string;
setOpenStatus: any;
statusId?: any;
+ setData: any;
+ userLoginId: string;
+ authorId: string;
}) {
const [loading, setLoading] = useState(false);
async function onTutupForum() {
setOpenStatus(false);
- await forum_funEditStatusPostingById(postingId as any, 2).then((res) => {
- if (res.status === 200) {
- ComponentGlobal_NotifikasiBerhasil(`Forum Ditutup`, 2000);
- setLoading(true);
- } else {
- ComponentGlobal_NotifikasiGagal(res.message);
+ await forum_funEditStatusPostingById(postingId as any, 2).then(
+ async (res) => {
+ if (res.status === 200) {
+ if (userLoginId === authorId) {
+ await forum_getListPostingByAuhtorId(authorId).then((val: any) =>
+ setData(val)
+ );
+ } else {
+ await forum_getListAllPosting().then((val) => setData(val as any));
+ }
+ ComponentGlobal_NotifikasiBerhasil(`Forum Ditutup`, 2000);
+ setLoading(true);
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
}
- });
+ );
}
async function onBukaForum() {
setOpenStatus(false);
- await forum_funEditStatusPostingById(postingId as any, 1).then((res) => {
- if (res.status === 200) {
- ComponentGlobal_NotifikasiBerhasil(`Forum Dibuka`, 2000);
- setLoading(true);
- } else {
- ComponentGlobal_NotifikasiGagal(res.message);
+ await forum_funEditStatusPostingById(postingId as any, 1).then(
+ async (res) => {
+ if (res.status === 200) {
+ if (userLoginId === authorId) {
+ await forum_getListPostingByAuhtorId(authorId).then((val: any) =>
+ setData(val)
+ );
+ } else {
+ await forum_getListAllPosting().then((val) => setData(val as any));
+ }
+ ComponentGlobal_NotifikasiBerhasil(`Forum Dibuka`, 2000);
+ setLoading(true);
+ } else {
+ ComponentGlobal_NotifikasiGagal(res.message);
+ }
}
- });
+ );
}
return (
diff --git a/src/app_modules/forum/create/index.tsx b/src/app_modules/forum/create/index.tsx
index 786918ba..4906734d 100644
--- a/src/app_modules/forum/create/index.tsx
+++ b/src/app_modules/forum/create/index.tsx
@@ -2,12 +2,14 @@
import {
ActionIcon,
+ Box,
Button,
Center,
Group,
Loader,
Paper,
Stack,
+ Text,
} from "@mantine/core";
import "react-quill/dist/quill.snow.css";
import "react-quill/dist/quill.bubble.css";
@@ -23,6 +25,9 @@ import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_glob
import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/component_global/notif_global/notifikasi_peringatan";
import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
+import ComponentGlobal_ErrorInput from "@/app_modules/component_global/error_input";
+import ComponentGlobal_InputCountDown from "@/app_modules/component_global/input_countdown";
+import _ from "lodash";
const ReactQuill = dynamic(
() => {
return import("react-quill");
@@ -32,7 +37,8 @@ const ReactQuill = dynamic(
export default function Forum_Create() {
const [value, setValue] = useState("");
- const [maxForum, setMaxForum] = useState(0);
+ const [totalLength, setTotalLength] = useState(0);
+
const [reload, setReload] = useState(false);
useShallowEffect(() => {
if (window && window.document) setReload(true);
@@ -48,27 +54,27 @@ export default function Forum_Create() {
return (
<>
-
+
{
- // if (val.length > 300) {
- // setMaxForum(val.length);
- // }
setValue(val);
}}
/>
- {/*
-
- */}
+
+
+
- {/* */}
+ {/* {JSON.stringify(value, null, 2)} */}
>
);
}
@@ -78,6 +84,10 @@ function ButtonAction({ value }: { value: string }) {
const [loading, setLoading] = useState(false);
async function onCreate() {
+ if (value.length > 500) {
+ return null;
+ }
+
await forum_funCreate(value).then((res) => {
if (res.status === 201) {
setLoading(true);
@@ -91,6 +101,14 @@ function ButtonAction({ value }: { value: string }) {
return (
<>
" || value === "" || value.length > 500
+ ? true
+ : false
+ }
radius={"xl"}
loading={loading ? true : false}
loaderPosition="center"
diff --git a/src/app_modules/forum/detail/index.tsx b/src/app_modules/forum/detail/index.tsx
index 5cadc5a0..bfdec053 100644
--- a/src/app_modules/forum/detail/index.tsx
+++ b/src/app_modules/forum/detail/index.tsx
@@ -10,6 +10,7 @@ import {
Divider,
Group,
Paper,
+ Spoiler,
Stack,
Text,
} from "@mantine/core";
@@ -34,6 +35,7 @@ const ReactQuill = dynamic(
);
import "react-quill/dist/quill.bubble.css";
import { forum_getKomentarById } from "../fun/get/get_komentar_by_id";
+import ComponentGlobal_InputCountDown from "@/app_modules/component_global/input_countdown";
export default function Forum_Detail({
dataPosting,
@@ -162,14 +164,20 @@ function CreateKomentar({
const router = useRouter();
const [value, setValue] = useState("");
const [loading, setLoading] = useState(false);
+ const [isEmpty, setIsEmpty] = useState(false);
async function onComment() {
+ if (value.length > 500) {
+ return null;
+ }
+
await forum_funCreateKomentar(postingId, value).then(async (res) => {
if (res.status === 201) {
await forum_getKomentarById(postingId).then((val) => {
setKomentar(val);
// setLoading(true);
setValue("");
+ setIsEmpty(true);
ComponentGlobal_NotifikasiBerhasil(res.message, 2000);
});
// router.replace(RouterForum.main_detail + postingId, { scroll: false });
@@ -192,8 +200,22 @@ function CreateKomentar({
}}
/>
+
+
+