From e8c897242e2c58f961b68831d207ef665301285e Mon Sep 17 00:00:00 2001 From: Bagasbanuna02 Date: Wed, 21 May 2025 15:45:01 +0800 Subject: [PATCH] fix loading hapus forum --- .../forum/edit/komentar/[id]/loading.tsx | 9 --- .../investasi/dialog_page/create/loading.tsx | 9 --- .../app_info/view/sticker/view_stiker.tsx | 6 +- src/app_modules/auth/invalid_user/view.tsx | 13 ++- .../detail_component/detail_header.tsx | 79 ++++++++----------- .../komentar_button_more.tsx | 10 +-- .../more_button/detail_more_button.tsx | 8 +- src/app_modules/forum/detail/layout.tsx | 17 +--- src/app_modules/forum/edit/komentar/index.tsx | 38 ++------- 9 files changed, 53 insertions(+), 136 deletions(-) delete mode 100644 src/app/dev/(user)/forum/edit/komentar/[id]/loading.tsx delete mode 100644 src/app/dev/(user)/investasi/dialog_page/create/loading.tsx diff --git a/src/app/dev/(user)/forum/edit/komentar/[id]/loading.tsx b/src/app/dev/(user)/forum/edit/komentar/[id]/loading.tsx deleted file mode 100644 index 380b3fcd..00000000 --- a/src/app/dev/(user)/forum/edit/komentar/[id]/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app/dev/(user)/investasi/dialog_page/create/loading.tsx b/src/app/dev/(user)/investasi/dialog_page/create/loading.tsx deleted file mode 100644 index d8a1c040..00000000 --- a/src/app/dev/(user)/investasi/dialog_page/create/loading.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2"; - -export default async function Page() { - return ( - <> - - - ); -} diff --git a/src/app_modules/admin/app_info/view/sticker/view_stiker.tsx b/src/app_modules/admin/app_info/view/sticker/view_stiker.tsx index 6f3e942b..6d0dfe10 100644 --- a/src/app_modules/admin/app_info/view/sticker/view_stiker.tsx +++ b/src/app_modules/admin/app_info/view/sticker/view_stiker.tsx @@ -27,11 +27,10 @@ import { Stack, Switch, Table, - Text, - TextInput, + Text } from "@mantine/core"; import { useShallowEffect } from "@mantine/hooks"; -import { IconFilter, IconPencil, IconPlus } from "@tabler/icons-react"; +import { IconPencil, IconPlus } from "@tabler/icons-react"; import { AppRouterInstance } from "next/dist/shared/lib/app-router-context.shared-runtime"; import { useRouter } from "next/navigation"; import { useState } from "react"; @@ -39,7 +38,6 @@ import { apiAdminGetSticker, apiAdminUpdateStatusStickerById, } from "../../lib/api_fetch_stiker"; -import loading from "@/app/dev/(user)/investasi/dialog_page/create/loading"; export default function AdminAppInformation_ViewSticker() { const router = useRouter(); diff --git a/src/app_modules/auth/invalid_user/view.tsx b/src/app_modules/auth/invalid_user/view.tsx index f516025e..a3e5d8aa 100644 --- a/src/app_modules/auth/invalid_user/view.tsx +++ b/src/app_modules/auth/invalid_user/view.tsx @@ -21,11 +21,11 @@ export default function InvalidUser() { method: "GET", }); router.push("/login", {scroll: false}); - } catch (error) { - console.error("Gagal menghapus cookie:", error); - } finally { setIsLoading(false); - } + } catch (error) { + setIsLoading(false); + console.error("Gagal menghapus cookie:", error); + } }; return ( @@ -33,8 +33,7 @@ export default function InvalidUser() { - {" "} - Invalid User + Maaf, Anda tidak memiliki izin untuk mengakses halaman ini. Silakan logout terlebih dahulu. 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 f0293206..db38a22b 100644 --- a/src/app_modules/forum/component/detail_component/detail_header.tsx +++ b/src/app_modules/forum/component/detail_component/detail_header.tsx @@ -1,57 +1,46 @@ "use client"; -import { RouterProfile } from "@/lib/router_hipmi/router_katalog"; -import { - Stack, - Grid, - Avatar, - Divider, - Text, - Group, - ThemeIcon, - ActionIcon, - Badge, - Button, - Drawer, - Loader, - Modal, - Title, -} from "@mantine/core"; -import { useRouter } from "next/navigation"; -import moment from "moment"; -import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan"; -import { RouterForum } from "@/lib/router_hipmi/router_forum"; -import { - IconCircleFilled, - IconDots, - IconEdit, - IconFlag3, - IconMessageCircle, - IconSquareCheck, - IconSquareRoundedX, - IconTrash, -} from "@tabler/icons-react"; -import { IconCircle } from "@tabler/icons-react"; -import ComponentForum_PostingButtonMore from "../more_button/posting_button_more"; -import ComponentForum_DetailMoreButton from "../more_button/detail_more_button"; -import { MODEL_FORUM_POSTING } from "../../model/interface"; -import { useDisclosure } from "@mantine/hooks"; -import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2"; -import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil"; -import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal"; -import { useState } from "react"; -import { forum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_by_id"; -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/_global/color/color_pallet"; import { ComponentGlobal_LoaderAvatar } from "@/app_modules/_global/component"; import ComponentGlobal_Loader from "@/app_modules/_global/component/loader"; +import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil"; +import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan"; +import { RouterForum } from "@/lib/router_hipmi/router_forum"; import { clientLogger } from "@/util/clientLogger"; +import mqtt_client from "@/util/mqtt_client"; +import { + ActionIcon, + Avatar, + Badge, + Button, + Drawer, + Grid, + Group, + Loader, + Modal, + Stack, + Text, + Title, +} from "@mantine/core"; +import { useDisclosure } from "@mantine/hooks"; +import { + IconDots, + IconEdit, + IconFlag3, + IconSquareCheck, + IconSquareRoundedX, + IconTrash, +} from "@tabler/icons-react"; import _ from "lodash"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import { forum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_by_id"; +import { forum_funEditStatusPostingById } from "../../fun/edit/fun_edit_status_posting_by_id"; +import { MODEL_FORUM_POSTING } from "../../model/interface"; export default function ComponentForum_DetailHeader({ data, @@ -342,8 +331,6 @@ function ButtonDelete({ const router = useRouter(); const [loading, setLoading] = useState(false); - if (loading) return ; - async function onDelete() { try { setLoading(true); diff --git a/src/app_modules/forum/component/komentar_component/komentar_button_more.tsx b/src/app_modules/forum/component/komentar_component/komentar_button_more.tsx index c6428281..0c44c3ac 100644 --- a/src/app_modules/forum/component/komentar_component/komentar_button_more.tsx +++ b/src/app_modules/forum/component/komentar_component/komentar_button_more.tsx @@ -1,7 +1,7 @@ "use client"; -import { RouterForum } from "@/lib/router_hipmi/router_forum"; import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil"; +import { RouterForum } from "@/lib/router_hipmi/router_forum"; import { ActionIcon, Button, @@ -23,13 +23,11 @@ import { AccentColor, MainColor, } from "@/app_modules/_global/color/color_pallet"; -import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2"; -import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal"; -import { forum_funDeleteKomentarById } from "../../fun/delete/fun_delete_komentar_by_id"; -import { forum_funGetAllKomentarById } from "../../fun/get/get_all_komentar_by_id"; import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global"; -import { MODEL_FORUM_KOMENTAR } from "../../model/interface"; +import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal"; import _ from "lodash"; +import { forum_funDeleteKomentarById } from "../../fun/delete/fun_delete_komentar_by_id"; +import { MODEL_FORUM_KOMENTAR } from "../../model/interface"; export default function ComponentForum_KomentarButtonMore({ userId, diff --git a/src/app_modules/forum/component/more_button/detail_more_button.tsx b/src/app_modules/forum/component/more_button/detail_more_button.tsx index 0099b3b8..61c24cc4 100644 --- a/src/app_modules/forum/component/more_button/detail_more_button.tsx +++ b/src/app_modules/forum/component/more_button/detail_more_button.tsx @@ -1,7 +1,7 @@ "use client"; -import { RouterForum } from "@/lib/router_hipmi/router_forum"; import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil"; +import { RouterForum } from "@/lib/router_hipmi/router_forum"; import { ActionIcon, Button, @@ -24,8 +24,6 @@ import { } from "@tabler/icons-react"; import { useRouter } from "next/navigation"; import { useState } from "react"; - -import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2"; import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal"; import { IconSquareCheck } from "@tabler/icons-react"; import { forum_funDeletePostingById } from "../../fun/delete/fun_delete_posting_by_id"; @@ -51,8 +49,6 @@ export default function ComponentForum_DetailMoreButton({ const [loadingEdit, setLoadingEdit] = useState(false); const [loadingReport, setLoadingReport] = useState(false); - // if (loadingEdit) return ; - return ( <> ; - async function onDelete() { setOpenDel(false); await forum_funDeletePostingById(postingId as any).then((res) => { diff --git a/src/app_modules/forum/detail/layout.tsx b/src/app_modules/forum/detail/layout.tsx index 58453638..c0aa6fbb 100644 --- a/src/app_modules/forum/detail/layout.tsx +++ b/src/app_modules/forum/detail/layout.tsx @@ -1,13 +1,11 @@ "use client"; import { Component_Header } from "@/app_modules/_global/component/new/component_header"; -import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2"; import UI_NewLayoutTamplate, { UI_NewChildren, UI_NewHeader, } from "@/app_modules/_global/ui/V2_layout_tamplate"; -import { useRouter } from "next/navigation"; -import React, { useState } from "react"; +import React from "react"; export const dynamic = "force-dynamic"; export default function LayoutForum_Detail({ @@ -15,21 +13,8 @@ export default function LayoutForum_Detail({ }: { children: React.ReactNode; }) { - const router = useRouter(); - const [loading, setLoading] = useState(false); - - if (loading) return ; - return ( <> - {/* - } - > - {children} - */} - diff --git a/src/app_modules/forum/edit/komentar/index.tsx b/src/app_modules/forum/edit/komentar/index.tsx index 0d656e80..ef50eac5 100644 --- a/src/app_modules/forum/edit/komentar/index.tsx +++ b/src/app_modules/forum/edit/komentar/index.tsx @@ -1,24 +1,12 @@ "use client"; -import { - ActionIcon, - Button, - Center, - Group, - Loader, - Paper, - Stack, -} from "@mantine/core"; -import "react-quill/dist/quill.snow.css"; -import "react-quill/dist/quill.bubble.css"; -import { IconPhotoUp } from "@tabler/icons-react"; -import { useShallowEffect } from "@mantine/hooks"; -import { useRouter } from "next/navigation"; -import ComponentGlobal_V2_LoadingPage from "@/app_modules/_global/loading_page_v2"; - -import dynamic from "next/dynamic"; -import React, { useState } from "react"; +import { Button, Group, Paper, Stack } from "@mantine/core"; import { useAtom } from "jotai"; +import dynamic from "next/dynamic"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; +import "react-quill/dist/quill.bubble.css"; +import "react-quill/dist/quill.snow.css"; import { gs_forum_loading_edit_posting } from "../../global_state"; const ReactQuill = dynamic( () => { @@ -29,17 +17,6 @@ const ReactQuill = dynamic( export default function Forum_EditKomentar() { const [value, setValue] = useState(""); - const [reload, setReload] = useState(false); - useShallowEffect(() => { - if (window && window.document) setReload(true); - }, []); - - if (!reload) - return ( - <> - - - ); return ( <> @@ -55,9 +32,6 @@ export default function Forum_EditKomentar() { /> - {/* - - */}