From bca5a2ac15bb9b7f81353d74871210258fff43ce Mon Sep 17 00:00:00 2001 From: Bagasbanuna02 Date: Tue, 2 Jul 2024 17:38:13 +0800 Subject: [PATCH] UI Forum untuk user - UI selesai - Realtime dan notifikasi selesai ## No Issuee --- src/app/dev/forum/create/loading.tsx | 9 -- .../forum/detail/main-detail/[id]/loading.tsx | 9 -- .../forum/detail/main-detail/[id]/page.tsx | 9 +- .../dev/forum/edit/posting/[id]/loading.tsx | 9 -- src/app/dev/forum/forumku/[id]/loading.tsx | 9 -- src/app/dev/forum/main/loading.tsx | 9 -- .../report/komentar-lainnya/[id]/loading.tsx | 9 -- .../report/komentar-lainnya/[id]/page.tsx | 7 +- .../forum/report/komentar/[id]/loading.tsx | 9 -- .../report/posting-lainnya/[id]/loading.tsx | 9 -- .../dev/forum/report/posting/[id]/loading.tsx | 9 -- .../sub_detail/hasil_report_komentar.tsx | 31 ++-- .../admin/notifikasi/route_setting/forum.ts | 23 ++- .../ui/ui_header_tamplate.tsx | 41 ++++-- .../ui/ui_layout_tamplate.tsx | 1 - .../detail_create_komentar.tsx | 19 ++- .../detail_component/detail_header.tsx | 131 ++++++++++------- .../detail_component/detail_list_komentar.tsx | 112 ++++++++------- .../detail_component/detail_view.tsx | 36 +++-- .../forumku_component/forumku_more_button.tsx | 134 +++++++++++------- .../forumku_component/forumku_view.tsx | 1 - .../komentar_author_header_name.tsx | 18 +-- .../komentar_button_more.tsx | 82 +++++------ .../main_component/card_more_button.tsx | 106 ++++++++------ .../component/main_component/card_view.tsx | 11 +- src/app_modules/forum/detail/layout.tsx | 13 +- src/app_modules/forum/detail/main_detail.tsx | 62 +++++--- .../forum/forumku/forum_profile.tsx | 15 +- src/app_modules/forum/forumku/index.tsx | 18 +-- .../fun/count/count_total_komentar_by_id.ts | 30 ++-- .../fun/create/fun_create_report_komentar.ts | 13 +- .../fun_create_notifikasi.tsx | 21 --- .../forum/fun/get/get_all_komentar_by_id.ts | 14 +- .../forum/fun/get/get_list_all_posting.ts | 4 +- src/app_modules/forum/main/beranda.tsx | 7 +- src/app_modules/forum/main/layout.tsx | 15 -- .../forum/report/komentar/index.tsx | 94 ++++++------ .../forum/report/komentar/lainnya.tsx | 64 +++++++-- .../forum/report/komentar/layout.tsx | 21 +-- .../forum/report/posting/index.tsx | 57 +++++--- .../forum/report/posting/layout.tsx | 16 +-- src/app_modules/forum/splash/index.tsx | 26 ++-- src/app_modules/home/view.tsx | 24 ++-- 43 files changed, 719 insertions(+), 638 deletions(-) delete mode 100644 src/app/dev/forum/create/loading.tsx delete mode 100644 src/app/dev/forum/detail/main-detail/[id]/loading.tsx delete mode 100644 src/app/dev/forum/edit/posting/[id]/loading.tsx delete mode 100644 src/app/dev/forum/forumku/[id]/loading.tsx delete mode 100644 src/app/dev/forum/main/loading.tsx delete mode 100644 src/app/dev/forum/report/komentar-lainnya/[id]/loading.tsx delete mode 100644 src/app/dev/forum/report/komentar/[id]/loading.tsx delete mode 100644 src/app/dev/forum/report/posting-lainnya/[id]/loading.tsx delete mode 100644 src/app/dev/forum/report/posting/[id]/loading.tsx delete mode 100644 src/app_modules/forum/fun/forum_notifikasi/fun_create_notifikasi.tsx diff --git a/src/app/dev/forum/create/loading.tsx b/src/app/dev/forum/create/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/create/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/detail/main-detail/[id]/loading.tsx b/src/app/dev/forum/detail/main-detail/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/detail/main-detail/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/detail/main-detail/[id]/page.tsx b/src/app/dev/forum/detail/main-detail/[id]/page.tsx index 325d3b6b..0c764797 100644 --- a/src/app/dev/forum/detail/main-detail/[id]/page.tsx +++ b/src/app/dev/forum/detail/main-detail/[id]/page.tsx @@ -5,22 +5,29 @@ import { forum_countOneTotalKomentarById } from "@/app_modules/forum/fun/count/c import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token"; import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; import { redirect } from "next/navigation"; +import { forum_countTotalKomenById } from "@/app_modules/forum/fun/count/count_total_komentar_by_id"; export default async function Page({ params }: { params: { id: string } }) { let postingId = params.id; const userLoginId = await user_getOneUserId(); const dataPosting = await forum_getOnePostingById(postingId); - const listKomentar = await forum_funGetAllKomentarById(postingId); + const listKomentar = await forum_funGetAllKomentarById({ + postingId: postingId, + page: 1, + }); dataPosting?.isActive === false && redirect(RouterForum.beranda); + const countKomentar = await forum_countTotalKomenById(postingId); + return ( <> ); diff --git a/src/app/dev/forum/edit/posting/[id]/loading.tsx b/src/app/dev/forum/edit/posting/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/edit/posting/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/forumku/[id]/loading.tsx b/src/app/dev/forum/forumku/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/forumku/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/main/loading.tsx b/src/app/dev/forum/main/loading.tsx deleted file mode 100644 index 874bc4a9..00000000 --- a/src/app/dev/forum/main/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/report/komentar-lainnya/[id]/loading.tsx b/src/app/dev/forum/report/komentar-lainnya/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/report/komentar-lainnya/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/report/komentar-lainnya/[id]/page.tsx b/src/app/dev/forum/report/komentar-lainnya/[id]/page.tsx index 1f34498e..4c4b9439 100644 --- a/src/app/dev/forum/report/komentar-lainnya/[id]/page.tsx +++ b/src/app/dev/forum/report/komentar-lainnya/[id]/page.tsx @@ -1,11 +1,16 @@ import { Forum_ReportKomentarLainnya } from "@/app_modules/forum"; +import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token"; export default async function Page({ params }: { params: { id: string } }) { let komentarId = params.id; + const userLoginId = await user_getOneUserId(); return ( <> - + ); } diff --git a/src/app/dev/forum/report/komentar/[id]/loading.tsx b/src/app/dev/forum/report/komentar/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/report/komentar/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/report/posting-lainnya/[id]/loading.tsx b/src/app/dev/forum/report/posting-lainnya/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/report/posting-lainnya/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/forum/report/posting/[id]/loading.tsx b/src/app/dev/forum/report/posting/[id]/loading.tsx deleted file mode 100644 index b1f8b62f..00000000 --- a/src/app/dev/forum/report/posting/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app_modules/admin/forum/sub_detail/hasil_report_komentar.tsx b/src/app_modules/admin/forum/sub_detail/hasil_report_komentar.tsx index 097ed84f..3e65bfb8 100644 --- a/src/app_modules/admin/forum/sub_detail/hasil_report_komentar.tsx +++ b/src/app_modules/admin/forum/sub_detail/hasil_report_komentar.tsx @@ -1,18 +1,14 @@ "use client"; -import { RouterAdminForum } from "@/app/lib/router_admin/router_admin_forum"; import ComponentAdminGlobal_HeaderTamplate from "@/app_modules/admin/component_global/header_tamplate"; -import ComponentAdminDonasi_TombolKembali from "@/app_modules/admin/donasi/component/tombol_kembali"; import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal"; import { MODEL_FORUM_KOMENTAR, - MODEL_FORUM_MASTER_REPORT, - MODEL_FORUM_REPORT_POSTING, + MODEL_FORUM_REPORT_POSTING } from "@/app_modules/forum/model/interface"; +import mqtt_client from "@/util/mqtt_client"; import { - Badge, - Box, Button, Center, Group, @@ -24,28 +20,22 @@ import { Stack, Table, Text, - TextInput, - Title, + Title } from "@mantine/core"; +import { useDisclosure } from "@mantine/hooks"; import { - IconMessageCircle, - IconFlag3, - IconTrash, - IconSearch, + IconTrash } from "@tabler/icons-react"; import _ from "lodash"; import { useRouter } from "next/navigation"; import { useState } from "react"; -import { adminForum_funDeletePostingById } from "../fun/delete/fun_delete_posting_by_id"; -import { adminForum_funDeleteKomentarById } from "../fun/delete/fun_delete_komentar_by_id"; -import { useDisclosure, useShallowEffect } from "@mantine/hooks"; -import ComponentAdminGlobal_IsEmptyData from "../../component_global/is_empty_data"; -import { adminForum_getListReportKomentarbyId } from "../fun/get/get_list_report_komentar_by_id"; import ComponentAdminGlobal_BackButton from "../../component_global/back_button"; -import ComponentAdminForum_ViewOneDetailKomentar from "../component/detail_one_komentar"; -import adminForum_funGetOneKomentarById from "../fun/get/get_one_komentar_by_id"; -import mqtt_client from "@/util/mqtt_client"; +import ComponentAdminGlobal_IsEmptyData from "../../component_global/is_empty_data"; import adminNotifikasi_funCreateToUser from "../../notifikasi/fun/create/fun_create_notif_user"; +import ComponentAdminForum_ViewOneDetailKomentar from "../component/detail_one_komentar"; +import { adminForum_funDeleteKomentarById } from "../fun/delete/fun_delete_komentar_by_id"; +import { adminForum_getListReportKomentarbyId } from "../fun/get/get_list_report_komentar_by_id"; +import adminForum_funGetOneKomentarById from "../fun/get/get_one_komentar_by_id"; export default function AdminForum_HasilReportKomentar({ komentarId, @@ -108,6 +98,7 @@ function ButtonDeleteKomentar({ const dataNotif = { appId: data.id, status: "Report Komentar", + // userId harus sama seperti author userId: data.authorId, pesan: data.komentar, kategoriApp: "FORUM", diff --git a/src/app_modules/admin/notifikasi/route_setting/forum.ts b/src/app_modules/admin/notifikasi/route_setting/forum.ts index 279c5dc4..99dd044a 100644 --- a/src/app_modules/admin/notifikasi/route_setting/forum.ts +++ b/src/app_modules/admin/notifikasi/route_setting/forum.ts @@ -13,10 +13,21 @@ export default async function adminNotifikasi_findRouterForum({ onChangeNavbar: (val: any) => void; onToggleNavbar: (val: any) => void; }) { - const routeName = RouterAdminForum.table_report_posting; - router.push(routeName); - onChangeNavbar({ - id: 7, - childId: 73, - }); + if (data.status === "Report Posting") { + const routeName = RouterAdminForum.table_report_posting; + router.push(routeName); + onChangeNavbar({ + id: 7, + childId: 73, + }); + } + + if (data.status === "Report Komentar") { + const routeName = RouterAdminForum.table_report_komentar; + router.push(routeName); + onChangeNavbar({ + id: 7, + childId: 74, + }); + } } diff --git a/src/app_modules/component_global/ui/ui_header_tamplate.tsx b/src/app_modules/component_global/ui/ui_header_tamplate.tsx index 22e2f794..00104819 100644 --- a/src/app_modules/component_global/ui/ui_header_tamplate.tsx +++ b/src/app_modules/component_global/ui/ui_header_tamplate.tsx @@ -16,6 +16,7 @@ import { AccentColor, MainColor } from "../color/color_pallet"; export default function ComponentGlobal_UI_HeaderTamplate({ title, + posotion, // left button hideButtonLeft, iconLeft, @@ -25,6 +26,7 @@ export default function ComponentGlobal_UI_HeaderTamplate({ routerRight, }: { title: string; + posotion?: any; // left button hideButtonLeft?: boolean; iconLeft?: any; @@ -48,20 +50,31 @@ export default function ComponentGlobal_UI_HeaderTamplate({ }} bg={MainColor.darkblue} > - - { - setIsLoading(true); - routerLeft === undefined - ? router.back() - : router.push(routerLeft); - }} - > - {isLoading ? : iconLeft ? iconLeft : } - + + {hideButtonLeft ? ( + + ) : ( + { + setIsLoading(true); + routerLeft === undefined + ? router.back() + : router.push(routerLeft); + }} + > + {isLoading ? ( + + ) : iconLeft ? ( + iconLeft + ) : ( + + )} + + )} + {title} diff --git a/src/app_modules/component_global/ui/ui_layout_tamplate.tsx b/src/app_modules/component_global/ui/ui_layout_tamplate.tsx index 14cc3dd5..17446934 100644 --- a/src/app_modules/component_global/ui/ui_layout_tamplate.tsx +++ b/src/app_modules/component_global/ui/ui_layout_tamplate.tsx @@ -20,7 +20,6 @@ export default function ComponentGlobal_UI_LayoutTamplate({ {/* Header */} {header ? ( diff --git a/src/app_modules/forum/component/detail_component/detail_create_komentar.tsx b/src/app_modules/forum/component/detail_component/detail_create_komentar.tsx index 64e44782..4840bc18 100644 --- a/src/app_modules/forum/component/detail_component/detail_create_komentar.tsx +++ b/src/app_modules/forum/component/detail_component/detail_create_komentar.tsx @@ -1,4 +1,4 @@ -"use client" +"use client"; import ComponentGlobal_InputCountDown from "@/app_modules/component_global/input_countdown"; import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; @@ -17,7 +17,8 @@ import { forum_funCreateKomentar } from "../../fun/create/fun_create_komentar"; import { forum_funGetAllKomentarById } from "../../fun/get/get_all_komentar_by_id"; import { MODEL_FORUM_POSTING } from "../../model/interface"; import { useRouter } from "next/navigation"; - +import { MainColor } from "@/app_modules/component_global/color/color_pallet"; +import mqtt_client from "@/util/mqtt_client"; export default function ComponentForum_DetailCreateKomentar({ postingId, onSetKomentar, @@ -41,8 +42,13 @@ export default function ComponentForum_DetailCreateKomentar({ const createComment = await forum_funCreateKomentar(postingId, value); if (createComment.status === 201) { - const loadKomentar = await forum_funGetAllKomentarById(data.id); - onSetKomentar(loadKomentar); + // const loadKomentar = await forum_funGetAllKomentarById(data.id); + + const loadData = await forum_funGetAllKomentarById({ + postingId: data.id, + page: 1, + }); + onSetKomentar(loadData); setValue(""); setIsEmpty(true); @@ -104,6 +110,8 @@ export default function ComponentForum_DetailCreateKomentar({ ? true : false } + bg={MainColor.yellow} + color={"yellow"} loaderPosition="center" loading={loading ? true : false} radius={"xl"} @@ -112,8 +120,7 @@ export default function ComponentForum_DetailCreateKomentar({ Balas - ); -} \ No newline at end of file +} diff --git a/src/app_modules/forum/component/detail_component/detail_header.tsx b/src/app_modules/forum/component/detail_component/detail_header.tsx index 63ec8d26..f241bd35 100644 --- a/src/app_modules/forum/component/detail_component/detail_header.tsx +++ b/src/app_modules/forum/component/detail_component/detail_header.tsx @@ -44,6 +44,7 @@ import { forum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_ import { forum_funEditStatusPostingById } from "../../fun/edit/fun_edit_status_posting_by_id"; import { forum_getOnePostingById } from "../../fun/get/get_one_posting_by_id"; import mqtt_client from "@/util/mqtt_client"; +import { AccentColor, MainColor } from "@/app_modules/component_global/color/color_pallet"; export default function ComponentForum_DetailHeader({ data, @@ -85,13 +86,13 @@ export default function ComponentForum_DetailHeader({ - - + + {data?.Author.username ? data?.Author.username : "Nama author "} {userLoginId != authorId ? ( - "" + { + setLoadingReport(true); + router.push(RouterForum.report_posting + postingId); + }} + > + + + + + + + Laporkan posting + {" "} + {loadingReport ? : ""} + + + ) : ( + { + setLoadingEdit(true); + router.push(RouterForum.edit_posting + postingId); + }} + > + + + + + + Edit posting{" "} + {loadingEdit ? : ""} + + + + { close(); @@ -173,16 +214,16 @@ function ComponentForum_DetailButtonMore_V2({ > {statusId === 1 ? ( - + ) : ( - + )} {statusId === 1 ? ( - Tutup forum + Tutup forum ) : ( - Buka forum + Buka forum )} @@ -200,56 +241,30 @@ function ComponentForum_DetailButtonMore_V2({ Hapus - - { - setLoadingEdit(true); - router.push(RouterForum.edit_posting + postingId); - }} - > - - - - - - Edit posting{" "} - {loadingEdit ? : ""} - - - )} - {userLoginId == authorId ? ( - "" - ) : ( - { - setLoadingReport(true); - router.push(RouterForum.report_posting + postingId); - }} - > - - - - - - - Laporkan posting - {" "} - {loadingReport ? : ""} - - - - )} - - { setOpenDel(false); @@ -261,6 +276,12 @@ function ComponentForum_DetailButtonMore_V2({ setOpenStatusClose(false)} centered @@ -276,7 +297,7 @@ function ComponentForum_DetailButtonMore_V2({ /> - open()}> + open()}> @@ -317,7 +338,7 @@ function ButtonDelete({ return ( <> - Yakin menghapus posting ini ? + Yakin menghapus posting ini ? { setOpenDel(false); @@ -177,10 +192,15 @@ export default function ComponentForum_ForumkuMoreButton({ }} allData={allData} /> - {/*
{JSON.stringify(allData, null, 2)}
*/}
setOpenStatusClose(false)} centered @@ -245,7 +265,9 @@ function ButtonDelete({ return ( <> - Yakin menghapus posting ini ? + + Yakin menghapus posting ini ? + { setOpenDel(false); @@ -153,7 +151,7 @@ export default function ComponentForum_KomentarButtonMore({ /> - open()}> + open()}> @@ -188,19 +186,11 @@ function ButtonDelete({ ComponentGlobal_NotifikasiGagal(res.message); } }); - - // await forum_funDeletePostingById(komentarId as any).then((res) => { - // if (res.status === 200) { - // ComponentGlobal_NotifikasiBerhasil(`Postingan Terhapus`, 2000); - // } else { - // ComponentGlobal_NotifikasiGagal(res.message); - // } - // }); } return ( <> - Yakin menghapus komentar ini ? + Yakin menghapus komentar ini ? { setOpenDel(false); @@ -188,6 +196,12 @@ export default function ComponentForum_BerandaMoreButton({ setOpenStatusClose(false)} centered @@ -252,7 +266,9 @@ function ButtonDelete({ return ( <> - Yakin menghapus posting ini ? + + Yakin menghapus posting ini ? + diff --git a/src/app_modules/forum/report/komentar/lainnya.tsx b/src/app_modules/forum/report/komentar/lainnya.tsx index 9af12274..cd027a3e 100644 --- a/src/app_modules/forum/report/komentar/lainnya.tsx +++ b/src/app_modules/forum/report/komentar/lainnya.tsx @@ -9,8 +9,16 @@ import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_glob import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal"; import { forum_funCreateReportPostingLainnya } from "../../fun/create/fun_create_report_posting_lainnya"; import { forum_funCreateReportKomentarLainnya } from "../../fun/create/fun_create_report_komentar_lainnya"; +import mqtt_client from "@/util/mqtt_client"; +import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin"; -export default function Forum_ReportKomentarLainnya({ komentarId }: { komentarId: string }) { +export default function Forum_ReportKomentarLainnya({ + komentarId, + userLoginId, +}: { + komentarId: string; + userLoginId: string; +}) { const [deskripsi, setDeskripsi] = useState(""); return ( <> @@ -23,7 +31,11 @@ export default function Forum_ReportKomentarLainnya({ komentarId }: { komentarId setDeskripsi(val.currentTarget.value); }} /> - + ); @@ -32,23 +44,43 @@ export default function Forum_ReportKomentarLainnya({ komentarId }: { komentarId function ButtonAction({ komentarId, deskripsi, + userLoginId, }: { komentarId: string; deskripsi: string; + userLoginId: string; }) { const router = useRouter(); async function onReport() { - await forum_funCreateReportKomentarLainnya(komentarId, deskripsi).then( - (res) => { - if (res.status === 201) { - ComponentGlobal_NotifikasiBerhasil(res.message); - router.back(); - } else { - ComponentGlobal_NotifikasiGagal(res.message); - } - } + const report = await forum_funCreateReportKomentarLainnya( + komentarId, + deskripsi ); + + if (report.status === 201) { + const dataNotif = { + appId: komentarId, + pesan: deskripsi, + kategoriApp: "FORUM", + title: "Lainnya", + userId: userLoginId, + status: "Report Komentar", + }; + + const createNotifikasi = await notifikasiToAdmin_funCreate({ + data: dataNotif as any, + }); + + if (createNotifikasi.status === 201) { + mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 })); + } + + ComponentGlobal_NotifikasiBerhasil(report.message); + router.back(); + } else { + ComponentGlobal_NotifikasiGagal(report.message); + } } return ( <> @@ -61,7 +93,15 @@ function ButtonAction({ > Batal -
diff --git a/src/app_modules/forum/report/komentar/layout.tsx b/src/app_modules/forum/report/komentar/layout.tsx index fd72b2ef..f131b935 100644 --- a/src/app_modules/forum/report/komentar/layout.tsx +++ b/src/app_modules/forum/report/komentar/layout.tsx @@ -1,12 +1,10 @@ "use client"; -import { ActionIcon, AppShell, Group, Header, Title } from "@mantine/core"; -import React from "react"; -import ComponentForum_HeaderTamplate from "../../component/header/header_tamplate"; -import { IconChevronLeft, IconX } from "@tabler/icons-react"; -import router from "next/router"; -import ComponentForum_HeaderRataKiri from "../../component/header/header_rata_kiri"; import AppComponentGlobal_LayoutTamplate from "@/app_modules/component_global/component_layout_tamplate"; +import React from "react"; +import ComponentForum_HeaderRataKiri from "../../component/header/header_rata_kiri"; +import ComponentGlobal_UI_LayoutTamplate from "@/app_modules/component_global/ui/ui_layout_tamplate"; +import ComponentGlobal_UI_HeaderTamplate from "@/app_modules/component_global/ui/ui_header_tamplate"; export default function LayoutForum_ReportKomentar({ children, @@ -15,13 +13,20 @@ export default function LayoutForum_ReportKomentar({ }) { return ( <> - + } + > + {children} + + {/* } > {children} - + */} ); } diff --git a/src/app_modules/forum/report/posting/index.tsx b/src/app_modules/forum/report/posting/index.tsx index 4836e4b6..47e4cbc6 100644 --- a/src/app_modules/forum/report/posting/index.tsx +++ b/src/app_modules/forum/report/posting/index.tsx @@ -1,18 +1,21 @@ "use client"; -import { Box, Button, Paper, Radio, Stack, Text, Title } from "@mantine/core"; -import { MODEL_FORUM_MASTER_REPORT } from "../../model/interface"; +import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; +import { + AccentColor, + MainColor, +} from "@/app_modules/component_global/color/color_pallet"; +import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; +import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal"; +import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin"; +import mqtt_client from "@/util/mqtt_client"; +import { Button, Radio, Stack, Text, Title } from "@mantine/core"; +import { toNumber } from "lodash"; +import { useRouter } from "next/navigation"; import { useState } from "react"; import { forum_funCreateReportPosting } from "../../fun/create/fun_create_report_posting"; -import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/component_global/notif_global/notifikasi_berhasil"; -import { useRouter } from "next/navigation"; -import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/component_global/notif_global/notifikasi_gagal"; -import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; -import mqtt_client from "@/util/mqtt_client"; -import adminNotifikasi_funCreateToUser from "@/app_modules/admin/notifikasi/fun/create/fun_create_notif_user"; -import notifikasiToAdmin_funCreate from "@/app_modules/notifikasi/fun/create/create_notif_to_admin"; import forum_getOneKategoriById from "../../fun/get/get_one_kategori_by_id"; -import { toNumber } from "lodash"; +import { MODEL_FORUM_MASTER_REPORT } from "../../model/interface"; export default function Forum_ReportPosting({ postingId, @@ -27,8 +30,17 @@ export default function Forum_ReportPosting({ return ( <> - + { setReportValue(val); @@ -39,7 +51,11 @@ export default function Forum_ReportPosting({ {e.title}} + label={ + + {e.title} + + } /> {e.deskripsi} @@ -66,7 +82,8 @@ function ButtonAction({ userLoginId: string; }) { const router = useRouter(); - const [loading, setLoading] = useState(false); + const [isLoading, setIsLoading] = useState(false); + const [isLoadingLain, setIsLoadingLain] = useState(false); async function onReport() { const report = await forum_funCreateReportPosting({ @@ -98,8 +115,7 @@ function ButtonAction({ if (createNotifikasi.status === 201) { mqtt_client.publish("ADMIN", JSON.stringify({ count: 1 })); } - setLoading(true); - + setIsLoading(true); } else { ComponentGlobal_NotifikasiGagal(report.message); } @@ -108,10 +124,13 @@ function ButtonAction({ <> @@ -119,7 +138,7 @@ function ButtonAction({ radius={"xl"} color="orange" loaderPosition="center" - loading={loading ? true : false} + loading={isLoading ? true : false} onClick={() => onReport()} > Report diff --git a/src/app_modules/forum/report/posting/layout.tsx b/src/app_modules/forum/report/posting/layout.tsx index 888c3fcd..0b9b250b 100644 --- a/src/app_modules/forum/report/posting/layout.tsx +++ b/src/app_modules/forum/report/posting/layout.tsx @@ -1,12 +1,8 @@ "use client"; -import { ActionIcon, AppShell, Group, Header, Title } from "@mantine/core"; +import ComponentGlobal_UI_HeaderTamplate from "@/app_modules/component_global/ui/ui_header_tamplate"; +import ComponentGlobal_UI_LayoutTamplate from "@/app_modules/component_global/ui/ui_layout_tamplate"; import React from "react"; -import ComponentForum_HeaderTamplate from "../../component/header/header_tamplate"; -import { IconChevronLeft, IconX } from "@tabler/icons-react"; -import router from "next/router"; -import ComponentForum_HeaderRataKiri from "../../component/header/header_rata_kiri"; -import AppComponentGlobal_LayoutTamplate from "@/app_modules/component_global/component_layout_tamplate"; export default function LayoutForum_ReportPosting({ children, @@ -15,13 +11,15 @@ export default function LayoutForum_ReportPosting({ }) { return ( <> - + } > {children} - + + + ); } diff --git a/src/app_modules/forum/splash/index.tsx b/src/app_modules/forum/splash/index.tsx index 57888ab5..fc828945 100644 --- a/src/app_modules/forum/splash/index.tsx +++ b/src/app_modules/forum/splash/index.tsx @@ -2,8 +2,17 @@ import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; import ComponentGlobal_UI_LayoutTamplate from "@/app_modules/component_global/ui/ui_layout_tamplate"; -import { Center, Image, Paper, Stack } from "@mantine/core"; +import { + Avatar, + Center, + Image, + Loader, + Paper, + Stack, + Text, +} from "@mantine/core"; import { useShallowEffect } from "@mantine/hooks"; +import { IconMessages } from "@tabler/icons-react"; import { useRouter } from "next/navigation"; export default function Forum_Splash() { @@ -26,18 +35,9 @@ export default function Forum_Splash() { function ViewSplash() { return ( <> - - - logo - + + + ); diff --git a/src/app_modules/home/view.tsx b/src/app_modules/home/view.tsx index b84d6a13..04fde044 100644 --- a/src/app_modules/home/view.tsx +++ b/src/app_modules/home/view.tsx @@ -3,12 +3,16 @@ import { ActionIcon, Box, + Center, Group, Image, + Loader, + LoadingOverlay, + Overlay, Paper, SimpleGrid, Stack, - Text + Text, } from "@mantine/core"; import { @@ -17,20 +21,18 @@ import { IconHeartHandshake, IconPackageImport, IconPresentation, - IconUserSearch + IconUserSearch, } from "@tabler/icons-react"; import { RouterColab } from "@/app/lib/router_hipmi/router_colab"; import { RouterEvent } from "@/app/lib/router_hipmi/router_event"; import { RouterJob } from "@/app/lib/router_hipmi/router_job"; import { RouterVote } from "@/app/lib/router_hipmi/router_vote"; -import { useDisclosure } from "@mantine/hooks"; import _ from "lodash"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { AccentColor, MainColor } from "../component_global/color/color_pallet"; import ComponentGlobal_IsEmptyData from "../component_global/is_empty_data"; -import ComponentGlobal_V2_LoadingPage from "../component_global/loading_page_v2"; import { ComponentGlobal_NotifikasiPeringatan } from "../component_global/notif_global/notifikasi_peringatan"; import { MODEL_JOB } from "../job/model/interface"; import { MODEL_USER } from "./model/interface"; @@ -43,8 +45,8 @@ export default function HomeView({ dataJob: MODEL_JOB[]; }) { const router = useRouter(); - const [loading, setLoading] = useState(false); - const [visible, { toggle }] = useDisclosure(false); + const [isLoading, setIsLoading] = useState(false); + const [pageId, setPageId] = useState(0); const listPageOnBox = [ { @@ -83,8 +85,6 @@ export default function HomeView({ return ( <> - {visible ? : ""} - - {e.icon} + {isLoading && e.id === pageId ? : e.icon} {e.name} @@ -172,7 +173,6 @@ export default function HomeView({ "Cooming Soon !!" ); } else { - toggle(); return router.push(routePageJob.link); } }