From dba0a5c9bf842c99714250725a84f0fd60c7036a Mon Sep 17 00:00:00 2001 From: Bagasbanuna02 Date: Thu, 3 Oct 2024 12:00:05 +0800 Subject: [PATCH] Fix : Avatar Deskripsi: - Ubah avatar yang image nya di ambil dari storage wibu server - Avatar forum - Avatra job - Avatar Investasi - Avatar donasi ## No Issuee --- package.json | 2 +- prisma/schema.prisma | 3 + src/app/dev/forum/forumku/[id]/page.tsx | 2 +- .../detail_saham_terbeli/[id]/layout.tsx | 8 - .../detail_saham_terbeli/[id]/page.tsx | 13 - src/app/lib/id-derectory.ts | 1 + src/app/lib/index.ts | 6 +- .../lib/router_hipmi/router_image_preview.ts | 2 +- .../_global/component/comp_load_image.tsx | 4 +- .../component/comp_load_image_landscape.tsx | 92 +++ .../component/comp_not_user_load_image.tsx | 4 +- src/app_modules/_global/component/index.ts | 2 + .../component/card_view/card_publish.tsx | 19 +- .../detail_main/penggalang_dana/index.tsx | 175 ++---- .../donasi/fun/get/get_author_by_id.ts | 2 +- .../detail_create_komentar.tsx | 5 + .../detail_component/detail_header.tsx | 43 +- .../detail_component/detail_list_komentar.tsx | 13 +- .../detail_component/detail_view.tsx | 35 +- .../forumku_component/forumku_header.tsx | 30 +- .../forumku_component/forumku_view.tsx | 89 ++- .../komentar_author_header_name.tsx | 62 +- .../component/main_component/card_header.tsx | 37 +- .../component/main_component/card_view.tsx | 88 ++- src/app_modules/forum/detail/main_detail.tsx | 7 +- .../forum/forumku/forum_profile.tsx | 73 ++- src/app_modules/forum/forumku/index.tsx | 34 +- src/app_modules/forum/forumku/layout.tsx | 26 +- .../forum/fun/get/get_all_komentar_by_id.ts | 2 +- .../fun/get/get_list_posting_by_author_id.ts | 3 +- .../forum/fun/get/new_get_all_posting.ts | 3 +- src/app_modules/forum/main/layout.tsx | 117 +--- .../detail/saham_saya/comp_detail_data.tsx | 4 +- .../_component/main/comp_card_beranda.tsx | 61 +- .../investasi/_ui/main/ui_beranda.tsx | 4 - src/app_modules/investasi/create/view.tsx | 580 +++++++++--------- src/app_modules/investasi/detail/view.tsx | 6 +- .../investasi/detail_saham_terbeli/layout.tsx | 19 - .../investasi/detail_saham_terbeli/view.tsx | 379 ------------ src/app_modules/investasi/index.ts | 4 - .../button/comp_button_selanjutnya.tsx | 4 +- .../katalog/portofolio/create/view.tsx | 15 +- .../profile/_component/comp_load_avatar.tsx | 45 +- .../_component/comp_load_background.tsx | 61 +- src/app_modules/katalog/ui/ui_profile.tsx | 20 - .../map/_component/comp_load_image_map.tsx | 8 +- src/bin/seeder/forum/master_status.json | 2 +- 47 files changed, 839 insertions(+), 1375 deletions(-) delete mode 100644 src/app/dev/investasi/detail_saham_terbeli/[id]/layout.tsx delete mode 100644 src/app/dev/investasi/detail_saham_terbeli/[id]/page.tsx create mode 100644 src/app_modules/_global/component/comp_load_image_landscape.tsx delete mode 100644 src/app_modules/investasi/detail_saham_terbeli/layout.tsx delete mode 100644 src/app_modules/investasi/detail_saham_terbeli/view.tsx diff --git a/package.json b/package.json index cc991669..2f40871e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hipmi", - "version": "1.0.0", + "version": "1.0.1", "private": true, "prisma": { "seed": "npx tsx prisma/seed.ts" diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 0d831f43..8597029c 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -231,6 +231,9 @@ model Investasi { MasterProgresInvestasi MasterProgresInvestasi? @relation(fields: [masterProgresInvestasiId], references: [id]) masterProgresInvestasiId String? Investasi_Invoice Investasi_Invoice[] + + // imageId String? + // prospektusId String? } model MasterPencarianInvestor { diff --git a/src/app/dev/forum/forumku/[id]/page.tsx b/src/app/dev/forum/forumku/[id]/page.tsx index ba3aa54c..b4d4391f 100644 --- a/src/app/dev/forum/forumku/[id]/page.tsx +++ b/src/app/dev/forum/forumku/[id]/page.tsx @@ -19,7 +19,7 @@ export default async function Page({ params }: { params: { id: string } }) { "Profile.imagesBackgroundId", ]); // console.log(dataAuthor) - // console.log(auhtorSelectedData) + // console.log(auhtorSelectedData) // await new Promise((a, b) => { // setTimeout(a, 1000); diff --git a/src/app/dev/investasi/detail_saham_terbeli/[id]/layout.tsx b/src/app/dev/investasi/detail_saham_terbeli/[id]/layout.tsx deleted file mode 100644 index fed30f04..00000000 --- a/src/app/dev/investasi/detail_saham_terbeli/[id]/layout.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { LayoutDetailSahamTerbeli } from "@/app_modules/investasi"; -import React from "react"; - -export default async function Layout({children}: {children: React.ReactNode}) { - return<> - {children} - -} \ No newline at end of file diff --git a/src/app/dev/investasi/detail_saham_terbeli/[id]/page.tsx b/src/app/dev/investasi/detail_saham_terbeli/[id]/page.tsx deleted file mode 100644 index af7e1425..00000000 --- a/src/app/dev/investasi/detail_saham_terbeli/[id]/page.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { DetailSahamTerbeli } from "@/app_modules/investasi"; -import funTotalInvestorByIdInvestasi from "@/app_modules/investasi/fun/fun_total_investor_by_id"; -import getOneTransaksiBerhasilByIdInvestasi from "@/app_modules/investasi/fun/get_one_transaksi_by_id"; - -export default async function Page({ params }: { params: { id: string } }) { - const dataTransaksi = await getOneTransaksiBerhasilByIdInvestasi(params.id); - const investor = await funTotalInvestorByIdInvestasi( - dataTransaksi?.Investasi.id as any - ); - // console.log(investor); - - return ; -} diff --git a/src/app/lib/id-derectory.ts b/src/app/lib/id-derectory.ts index 3ee92dce..f94b253b 100644 --- a/src/app/lib/id-derectory.ts +++ b/src/app/lib/id-derectory.ts @@ -6,6 +6,7 @@ const DIRECTORY_ID = { map_image: "cm0yjqnxl000910njplqho07w", investasi_image: "cm0yjs35h000b10njb35o12h1", investasi_bukti_transfer: "cm0yjsflu000d10njrc3lnqho", + investasi_pdf: "cm1soio74003p38bjyciwf1oy", donasi_image: "cm0yk1coh000f10nj597a99kv", donasi_bukti_transfer: "cm0yk1pmh000h10njhi6m8b8t", job_image: "cm0ypp6zl0003kp7jf59zuvjy", diff --git a/src/app/lib/index.ts b/src/app/lib/index.ts index 7840c0e3..1e89379c 100644 --- a/src/app/lib/index.ts +++ b/src/app/lib/index.ts @@ -2,10 +2,12 @@ import APIs from "./APIs"; import DIRECTORY_ID from "./id-derectory"; import prisma from "./prisma"; import { pathAssetImage } from "./path_asset_image"; - +import { RouterImagePreview } from "./router_hipmi/router_image_preview"; export { DIRECTORY_ID }; export { prisma }; export { APIs }; -export { pathAssetImage as RouterAssetImage }; +export { pathAssetImage }; +// Router +export { RouterImagePreview }; diff --git a/src/app/lib/router_hipmi/router_image_preview.ts b/src/app/lib/router_hipmi/router_image_preview.ts index e16cec15..6340e186 100644 --- a/src/app/lib/router_hipmi/router_image_preview.ts +++ b/src/app/lib/router_hipmi/router_image_preview.ts @@ -1,4 +1,4 @@ -export const routerImagePreview = { +export const RouterImagePreview = { main: ({ id }: { id: string }) => `/dev/image-preview/${id}`, not_user_image: ({ id }: { id: string }) => `/preview-image/${id}`, }; diff --git a/src/app_modules/_global/component/comp_load_image.tsx b/src/app_modules/_global/component/comp_load_image.tsx index 07823211..d1851c87 100644 --- a/src/app_modules/_global/component/comp_load_image.tsx +++ b/src/app_modules/_global/component/comp_load_image.tsx @@ -2,7 +2,7 @@ import { APIs } from "@/app/lib"; import { pathAssetImage } from "@/app/lib/path_asset_image"; -import { routerImagePreview } from "@/app/lib/router_hipmi/router_image_preview"; +import { RouterImagePreview } from "@/app/lib/router_hipmi/router_image_preview"; import { Center, Image, Skeleton } from "@mantine/core"; import { useShallowEffect } from "@mantine/hooks"; import { useRouter } from "next/navigation"; @@ -67,7 +67,7 @@ export function ComponentGlobal_LoadImage({ { setIsLoading(true); - router.push(routerImagePreview.main({ id: fileId }), { + router.push(RouterImagePreview.main({ id: fileId }), { scroll: false, }); }} diff --git a/src/app_modules/_global/component/comp_load_image_landscape.tsx b/src/app_modules/_global/component/comp_load_image_landscape.tsx new file mode 100644 index 00000000..1a9c4257 --- /dev/null +++ b/src/app_modules/_global/component/comp_load_image_landscape.tsx @@ -0,0 +1,92 @@ +"use client"; + +import { APIs } from "@/app/lib"; +import { pathAssetImage } from "@/app/lib/path_asset_image"; +import { RouterImagePreview } from "@/app/lib"; +import { Center, Image, Skeleton } from "@mantine/core"; +import { useShallowEffect } from "@mantine/hooks"; +import { useRouter } from "next/navigation"; +import { useState } from "react"; + +export function ComponentGlobal_LoadImageLandscape({ + fileId, +}: { + fileId: string; +}) { + const router = useRouter(); + const [isImage, setIsImage] = useState(null); + const [isLoading, setLoading] = useState(false); + const url = APIs.GET({ fileId: fileId }); + + useShallowEffect(() => { + onLoadImage(); + }, []); + + async function onLoadImage() { + try { + const res = await fetch(url); + if (res.ok) { + return setIsImage(true); + } + setIsImage(false); + } catch (error) { + console.log(error); + } + } + + if (isImage === null) return ; + + if (!isImage) + return ( + <> +
+ No Image +
+ + ); + + return ( + <> +
+ { + setLoading(true); + router.push(RouterImagePreview.main({ id: fileId }), { + scroll: false, + }); + }} + style={{ + borderColor: "white", + borderStyle: "solid", + borderWidth: "1px", + borderRadius: "5px", + }} + radius={"4px"} + height={200} + alt="Image" + opacity={isLoading ? 0.5 : 1} + src={url} + /> + {isLoading ? ( + Loader + ) : ( + "" + )} +
+ + ); +} diff --git a/src/app_modules/_global/component/comp_not_user_load_image.tsx b/src/app_modules/_global/component/comp_not_user_load_image.tsx index 481c13ec..c8b14574 100644 --- a/src/app_modules/_global/component/comp_not_user_load_image.tsx +++ b/src/app_modules/_global/component/comp_not_user_load_image.tsx @@ -2,7 +2,7 @@ import { APIs } from "@/app/lib"; import { pathAssetImage } from "@/app/lib/path_asset_image"; -import { routerImagePreview } from "@/app/lib/router_hipmi/router_image_preview"; +import { RouterImagePreview } from "@/app/lib/router_hipmi/router_image_preview"; import { Center, Image, Skeleton } from "@mantine/core"; import { useShallowEffect } from "@mantine/hooks"; import { useRouter } from "next/navigation"; @@ -62,7 +62,7 @@ export function ComponentGlobal_NotUserLoadImage({ { setIsLoading(true); - router.push(routerImagePreview.not_user_image({ id: fileId }), { + router.push(RouterImagePreview.not_user_image({ id: fileId }), { scroll: false, }); }} diff --git a/src/app_modules/_global/component/index.ts b/src/app_modules/_global/component/index.ts index 38e99457..332bcb67 100644 --- a/src/app_modules/_global/component/index.ts +++ b/src/app_modules/_global/component/index.ts @@ -6,6 +6,7 @@ import { ComponentGlobal_BoxUploadImage } from "./comp_box_upload_image"; import { ComponentGlobal_CardStyles } from "./comp_card_box_and_background"; import { ComponentGlobal_LoaderAvatar } from "./comp_load_avatar"; import { ComponentGlobal_LoadImage } from "./comp_load_image"; +import { ComponentGlobal_LoadImageLandscape } from "./comp_load_image_landscape"; import ComponentGlobal_CardLoadingOverlay from "./comp_loading_card"; import { ComponentGlobal_NotUserLoadImage } from "./comp_not_user_load_image"; import ComponentGlobal_TampilanAngkaRatusan from "./comp_tampilan_angka_ratusan"; @@ -27,3 +28,4 @@ export { ComponentGlobal_ButtonUploadFileImage }; export { ComponentGlobal_LoaderAvatar }; export { ComponentGlobal_AvatarAndUsername }; export { ComponentGlobal_NotUserLoadImage }; +export { ComponentGlobal_LoadImageLandscape }; diff --git a/src/app_modules/donasi/component/card_view/card_publish.tsx b/src/app_modules/donasi/component/card_view/card_publish.tsx index 15a8e2a0..ea33b270 100644 --- a/src/app_modules/donasi/component/card_view/card_publish.tsx +++ b/src/app_modules/donasi/component/card_view/card_publish.tsx @@ -2,7 +2,10 @@ import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi"; import { AccentColor } from "@/app_modules/_global/color/color_pallet"; -import { ComponentGlobal_CardLoadingOverlay } from "@/app_modules/_global/component"; +import { + ComponentGlobal_CardLoadingOverlay, + ComponentGlobal_CardStyles, +} from "@/app_modules/_global/component"; import { AspectRatio, Card, @@ -31,16 +34,8 @@ export default function ComponentDonasi_CardPublish({ return ( <> - { + { setVisible(true); setDonasiId(data.id); router.push(path + `${data.id}`); @@ -88,7 +83,7 @@ export default function ComponentDonasi_CardPublish({ ) : ( "" )} - + ); } diff --git a/src/app_modules/donasi/detail/detail_main/penggalang_dana/index.tsx b/src/app_modules/donasi/detail/detail_main/penggalang_dana/index.tsx index 115b8c33..6af081d6 100644 --- a/src/app_modules/donasi/detail/detail_main/penggalang_dana/index.tsx +++ b/src/app_modules/donasi/detail/detail_main/penggalang_dana/index.tsx @@ -1,8 +1,16 @@ "use client"; +import { pathAssetImage, RouterImagePreview } from "@/app/lib"; import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi"; import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog"; -import { AccentColor, MainColor } from "@/app_modules/_global/color/color_pallet"; +import { + AccentColor, + MainColor, +} from "@/app_modules/_global/color/color_pallet"; +import { + ComponentGlobal_CardStyles, + ComponentGlobal_LoaderAvatar, +} from "@/app_modules/_global/component"; import ComponentDonasi_CardPublish from "@/app_modules/donasi/component/card_view/card_publish"; import TampilanRupiahDonasi from "@/app_modules/donasi/component/tampilan_rupiah"; import { @@ -11,6 +19,7 @@ import { } from "@/app_modules/donasi/model/interface"; import { MODEL_USER } from "@/app_modules/home/model/interface"; import { + ActionIcon, AspectRatio, Box, Center, @@ -23,14 +32,10 @@ import { SimpleGrid, Stack, Text, - Title + Title, } from "@mantine/core"; import { useViewportSize } from "@mantine/hooks"; -import { - IconBrandGmail, - IconMoodSmile, - IconPhone -} from "@tabler/icons-react"; +import { IconBrandGmail, IconMoodSmile, IconPhone } from "@tabler/icons-react"; import { useRouter } from "next/navigation"; import { useState } from "react"; @@ -39,64 +44,73 @@ export default function PenggalangDanaDonasi({ }: { dataPenggalang: MODEL_DONASI_INFO_PENGGALANG; }) { - const [value, setValue] = useState(dataPenggalang); + const [data, setData] = useState(dataPenggalang); return ( <> - - {value.Donasi.map((e, i) => ( - - - - ))} + + + {data.Donasi.map((e, i) => ( + + + + ))} + ); } function InformasiPenggalang({ value }: { value: MODEL_USER }) { + const router = useRouter(); + const [isLoading, setIsLoading] = useState(false); + return ( <> - {/*
{JSON.stringify(value, null, 2)}
*/} - - + + - -
- Foto + { + router.push( + RouterImagePreview.main({ + id: value.Profile.imageId as any, + }), + { scroll: false } + ); + setIsLoading(true); + }} + > + -
-
- @{value?.username} + + {isLoading && ( + Photo + )} + +
+ @ {value?.username} @@ -113,64 +127,7 @@ function InformasiPenggalang({ value }: { value: MODEL_USER }) { - - - ); -} - -function DataPengganganDana({ donasi }: { donasi: MODEL_DONASI[] }) { - const router = useRouter(); - const { height, width } = useViewportSize(); - return ( - <> - Peggalangan Dana Yang Dilakukan - - {donasi.map((e, i) => ( - router.push(RouterDonasi.detail_main + `${e.id}`)} - > - - - - - - Foto - - - - - - - {e.title} - - - - Terkumpul - - - - - - - - {width > 575 ? "" : } - - - ))} - + ); } diff --git a/src/app_modules/donasi/fun/get/get_author_by_id.ts b/src/app_modules/donasi/fun/get/get_author_by_id.ts index 8bbda55c..37a522a8 100644 --- a/src/app_modules/donasi/fun/get/get_author_by_id.ts +++ b/src/app_modules/donasi/fun/get/get_author_by_id.ts @@ -17,7 +17,7 @@ export async function Donasi_getAuthorById(authorId: string) { id: true, name: true, email: true, - imagesId: true, + imageId: true, }, }, Donasi: { 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 8e104046..a07eb6e0 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 @@ -93,6 +93,11 @@ export default function ComponentForum_DetailCreateKomentar({ onChange={(val) => { setValue(val); }} + style={{ + overflowY: "auto", + maxHeight: 100, + minHeight: 50, + }} /> 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 ad71596c..bf50128e 100644 --- a/src/app_modules/forum/component/detail_component/detail_header.tsx +++ b/src/app_modules/forum/component/detail_component/detail_header.tsx @@ -48,6 +48,8 @@ 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"; export default function ComponentForum_DetailHeader({ data, @@ -59,6 +61,7 @@ export default function ComponentForum_DetailHeader({ onLoadData: (val: any) => void; }) { const router = useRouter(); + const [isLoading, setIsLoading] = useState(false); return ( <> @@ -68,30 +71,38 @@ export default function ComponentForum_DetailHeader({ span={"content"} onClick={() => { if (data?.Author?.id) { + setIsLoading(true); router.push(RouterForum.forumku + data?.Author?.id); } else { ComponentGlobal_NotifikasiPeringatan("Id tidak ditemukan"); } }} > - + {isLoading ? ( + + + + ) : ( + + )} - {data?.Author.username ? data?.Author.username : "Nama author "} + {data?.Author.Profile.name + ? data?.Author.Profile.name + : "Nama author "} - - {(data?.ForumMaster_StatusPosting.id as any) === 1 - ? "Open" - : "Close"} - + {data?.ForumMaster_StatusPosting.status} diff --git a/src/app_modules/forum/component/detail_component/detail_list_komentar.tsx b/src/app_modules/forum/component/detail_component/detail_list_komentar.tsx index e7fc960b..04c42e52 100644 --- a/src/app_modules/forum/component/detail_component/detail_list_komentar.tsx +++ b/src/app_modules/forum/component/detail_component/detail_list_komentar.tsx @@ -1,18 +1,14 @@ "use client"; import { - Stack, - Center, - Box, Card, - Spoiler, Divider, - Text, + Spoiler, + Stack, + Text } from "@mantine/core"; -import _ from "lodash"; import { MODEL_FORUM_KOMENTAR } from "../../model/interface"; import ComponentForum_KomentarAuthorNameOnHeader from "../komentar_component/komentar_author_header_name"; -import { MainColor } from "@/app_modules/_global/color/color_pallet"; export default function ComponentForum_KomentarView({ data, @@ -30,8 +26,6 @@ export default function ComponentForum_KomentarView({ diff --git a/src/app_modules/forum/component/detail_component/detail_view.tsx b/src/app_modules/forum/component/detail_component/detail_view.tsx index 2a8feb7e..c445c779 100644 --- a/src/app_modules/forum/component/detail_component/detail_view.tsx +++ b/src/app_modules/forum/component/detail_component/detail_view.tsx @@ -1,6 +1,6 @@ "use client"; -import { Card, Stack, Group, Text } from "@mantine/core"; +import { Card, Stack, Group, Text, Box } from "@mantine/core"; import { IconMessageCircle, IconMessageCircleX } from "@tabler/icons-react"; import { MODEL_FORUM_POSTING } from "../../model/interface"; import ComponentForum_DetailHeader from "./detail_header"; @@ -8,6 +8,7 @@ import { AccentColor, MainColor, } from "@/app_modules/_global/color/color_pallet"; +import { ComponentGlobal_CardStyles } from "@/app_modules/_global/component"; export default function ComponentForum_DetailForumView({ data, @@ -22,19 +23,9 @@ export default function ComponentForum_DetailForumView({ }) { return ( <> - - {/*
{JSON.stringify(data, null, 2)}
*/} - - {/* HEADER */} - + + + {/* HEADER */} - - {/* CONTENT */} - - + {/* CONTENT */} + {data?.diskusi ? (
@@ -54,11 +43,9 @@ export default function ComponentForum_DetailForumView({ "" )} - - + - {/* FOOTER */} - + {/* FOOTER */} @@ -94,8 +81,8 @@ export default function ComponentForum_DetailForumView({ - - + + ); } diff --git a/src/app_modules/forum/component/forumku_component/forumku_header.tsx b/src/app_modules/forum/component/forumku_component/forumku_header.tsx index bf103a09..7a7711b5 100644 --- a/src/app_modules/forum/component/forumku_component/forumku_header.tsx +++ b/src/app_modules/forum/component/forumku_component/forumku_header.tsx @@ -9,7 +9,8 @@ import { useRouter } from "next/navigation"; import { useState } from "react"; import { MODEL_FORUM_POSTING } from "../../model/interface"; import ComponentForum_ForumkuMoreButton from "./forumku_more_button"; - +import ComponentGlobal_Loader from "@/app_modules/_global/component/loader"; +import { ComponentGlobal_LoaderAvatar } from "@/app_modules/_global/component"; export default function ComponentForum_ForumkuHeaderCard({ data, @@ -25,7 +26,6 @@ export default function ComponentForum_ForumkuHeaderCard({ allData: any[]; }) { const router = useRouter(); - const [isLoading, setIsLoading] = useState(false); return ( <> @@ -35,29 +35,15 @@ export default function ComponentForum_ForumkuHeaderCard({ span={"content"} onClick={() => { if (data.Author.id) { - setIsLoading(true); router.push(RouterForum.forumku + data.Author.id); } else { ComponentGlobal_NotifikasiPeringatan("Id tidak ditemukan"); } }} > - {isLoading ? ( - - ) : ( - - )} + @@ -82,7 +68,9 @@ export default function ComponentForum_ForumkuHeaderCard({ : "red" } > - {data?.ForumMaster_StatusPosting.status} + + {data?.ForumMaster_StatusPosting.status} + @@ -90,7 +78,7 @@ export default function ComponentForum_ForumkuHeaderCard({ - + {data.createdAt !== undefined && data?.createdAt ? new Date(data?.createdAt).toLocaleDateString(["id-ID"], { day: "numeric", diff --git a/src/app_modules/forum/component/forumku_component/forumku_view.tsx b/src/app_modules/forum/component/forumku_component/forumku_view.tsx index 3ec7f26a..ddbdfa5d 100644 --- a/src/app_modules/forum/component/forumku_component/forumku_view.tsx +++ b/src/app_modules/forum/component/forumku_component/forumku_view.tsx @@ -1,14 +1,16 @@ "use client"; import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; -import { ActionIcon, Card, Divider, Group, Stack, Text } from "@mantine/core"; +import { + ComponentGlobal_CardLoadingOverlay, + ComponentGlobal_CardStyles, +} from "@/app_modules/_global/component"; +import { Box, Group, Stack, Text } from "@mantine/core"; import { IconMessageCircle, IconMessageCircleX } from "@tabler/icons-react"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { MODEL_FORUM_POSTING } from "../../model/interface"; import ComponentForum_ForumkuHeaderCard from "./forumku_header"; -import { AccentColor, MainColor } from "@/app_modules/_global/color/color_pallet"; - export default function ComponentForum_ForumkuMainCardView({ data, @@ -22,23 +24,12 @@ export default function ComponentForum_ForumkuMainCardView({ allData: any[]; }) { const router = useRouter(); - const [loadingKomen, setLoadingKomen] = useState(false); - const [loadingDetail, setLoadingDetail] = useState(false); - - const [postingId, setPostingId] = useState(""); + const [visable, setVisible] = useState(false); return ( <> - - + + - - { - router.push(RouterForum.main_detail + data?.id); - }} - > - -
- - + { + setVisible(true); + router.push(RouterForum.main_detail + data?.id); + }} + > + +
+ + - - - - - {(data?.ForumMaster_StatusPosting?.id as any) === 1 ? ( - - ) : ( - - )} - + + {(data?.ForumMaster_StatusPosting?.id as any) === 1 ? ( + + ) : ( + + )} - {/* */} - - {data?.Forum_Komentar.length} - - - - + + {data?.Forum_Komentar.length} + + + {visable && } + + ); } diff --git a/src/app_modules/forum/component/komentar_component/komentar_author_header_name.tsx b/src/app_modules/forum/component/komentar_component/komentar_author_header_name.tsx index 7019bd27..daf86ea9 100644 --- a/src/app_modules/forum/component/komentar_component/komentar_author_header_name.tsx +++ b/src/app_modules/forum/component/komentar_component/komentar_author_header_name.tsx @@ -1,50 +1,41 @@ "use client"; -import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog"; -import { Stack, Grid, Avatar, Divider, Text, Group } 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 "@/app/lib/router_hipmi/router_forum"; -import { - IconCircleFilled, - IconDots, - IconEdit, - IconFlag3, - IconMessageCircle, - IconTrash, -} from "@tabler/icons-react"; +import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan"; +import { Avatar, Divider, Grid, Group, Stack, Text } from "@mantine/core"; import { IconCircle } from "@tabler/icons-react"; -import { IoIosMore } from "react-icons/io"; -import { useDisclosure } from "@mantine/hooks"; -import { useState } from "react"; -import ComponentForum_PostingButtonMore from "../more_button/posting_button_more"; +import { useRouter } from "next/navigation"; import ComponentForum_KomentarButtonMore from "./komentar_button_more"; +import { useState } from "react"; +import { ComponentGlobal_LoaderAvatar } from "@/app_modules/_global/component"; +import ComponentGlobal_Loader from "@/app_modules/_global/component/loader"; +import { data } from "autoprefixer"; +import { MODEL_PROFILE } from "@/app_modules/katalog/profile/model/interface"; export default function ComponentForum_KomentarAuthorNameOnHeader({ userId, komentarId, - imagesId, - authorName, tglPublish, isPembatas, isMoreButton, setKomentar, postingId, userLoginId, + profile, }: { userId?: string; komentarId?: string; - imagesId?: string; - authorName?: string; tglPublish?: Date; isPembatas?: boolean; isMoreButton?: boolean; setKomentar?: any; postingId?: string; userLoginId: string; + profile: MODEL_PROFILE; }) { const router = useRouter(); + const [isLoading, setIsLoading] = useState(false); return ( <> @@ -54,30 +45,35 @@ export default function ComponentForum_KomentarAuthorNameOnHeader({ span={"content"} onClick={() => { if (userId) { + setIsLoading(true); router.push(RouterForum.forumku + userId); } else { ComponentGlobal_NotifikasiPeringatan("Id tidak ditemukan"); } }} > - + {isLoading ? ( + + + + ) : ( + + )} - {authorName ? authorName : "Nama author "} + {profile.name ? profile.name : "Nama author "} diff --git a/src/app_modules/forum/component/main_component/card_header.tsx b/src/app_modules/forum/component/main_component/card_header.tsx index 784eca90..75839f59 100644 --- a/src/app_modules/forum/component/main_component/card_header.tsx +++ b/src/app_modules/forum/component/main_component/card_header.tsx @@ -3,20 +3,14 @@ import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog"; import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan"; -import { - Avatar, - Badge, - Grid, - Group, - Loader, - Stack, - Text -} from "@mantine/core"; +import { Avatar, Badge, Grid, Group, Loader, Stack, Text } from "@mantine/core"; import { IconCircle } from "@tabler/icons-react"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { MODEL_FORUM_POSTING } from "../../model/interface"; import ComponentForum_BerandaMoreButton from "./card_more_button"; +import { ComponentGlobal_LoaderAvatar } from "@/app_modules/_global/component"; +import ComponentGlobal_Loader from "@/app_modules/_global/component/loader"; export default function ComponentForum_BerandaHeaderCard({ data, @@ -50,23 +44,20 @@ export default function ComponentForum_BerandaHeaderCard({ }} > {isLoading ? ( - - ) : ( + + + ) : ( + )} @@ -76,8 +67,8 @@ export default function ComponentForum_BerandaHeaderCard({ - {data.Author.username - ? data.Author.username + {data.Author.Profile.name + ? data.Author.Profile.name : "Nama author "} diff --git a/src/app_modules/forum/component/main_component/card_view.tsx b/src/app_modules/forum/component/main_component/card_view.tsx index f8633952..200f3ee9 100644 --- a/src/app_modules/forum/component/main_component/card_view.tsx +++ b/src/app_modules/forum/component/main_component/card_view.tsx @@ -2,10 +2,10 @@ import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; import { - AccentColor, - MainColor, -} from "@/app_modules/_global/color/color_pallet"; -import { ActionIcon, Card, Group, Stack, Text } from "@mantine/core"; + ComponentGlobal_CardLoadingOverlay, + ComponentGlobal_CardStyles, +} from "@/app_modules/_global/component"; +import { Box, Group, Stack, Text } from "@mantine/core"; import { IconMessageCircle, IconMessageCircleX } from "@tabler/icons-react"; import { useRouter } from "next/navigation"; import { useState } from "react"; @@ -24,23 +24,12 @@ export default function ComponentForum_BerandaCardView({ allData: any[]; }) { const router = useRouter(); - const [loadingKomen, setLoadingKomen] = useState(false); - const [loadingDetail, setLoadingDetail] = useState(false); - - const [postingId, setPostingId] = useState(""); + const [visible, setVisible] = useState(false); return ( <> - - + + - - { - router.push(RouterForum.main_detail + data?.id); - }} - > - -
- - + { + setVisible(true), router.push(RouterForum.main_detail + data?.id); + }} + > + +
+ + - - - - - {(data?.ForumMaster_StatusPosting?.id as any) === 1 ? ( - - ) : ( - - )} - + + {(data?.ForumMaster_StatusPosting?.id as any) === 1 ? ( + + ) : ( + + )} - {/* */} - - {data?.Forum_Komentar.length} - - - - + + {data?.Forum_Komentar.length} + + + {visible && } + + ); } diff --git a/src/app_modules/forum/detail/main_detail.tsx b/src/app_modules/forum/detail/main_detail.tsx index 48315363..2ee67ed4 100644 --- a/src/app_modules/forum/detail/main_detail.tsx +++ b/src/app_modules/forum/detail/main_detail.tsx @@ -1,9 +1,8 @@ "use client"; -import { Box, Center, Loader, Stack } from "@mantine/core"; +import { Box, Center, Loader, Stack, TextInput } from "@mantine/core"; import _ from "lodash"; import { MODEL_FORUM_KOMENTAR, MODEL_FORUM_POSTING } from "../model/interface"; - import mqtt_client from "@/util/mqtt_client"; import { useShallowEffect } from "@mantine/hooks"; import { useState } from "react"; @@ -27,7 +26,6 @@ export default function Forum_MainDetail({ }) { const [data, setData] = useState(dataPosting); const [lsKomentar, setLsKomentar] = useState(listKomentar); - const [activePage, setActivePage] = useState(1); // useShallowEffect(() => { @@ -90,9 +88,8 @@ export default function Forum_MainDetail({ "" )} - + (
diff --git a/src/app_modules/forum/forumku/forum_profile.tsx b/src/app_modules/forum/forumku/forum_profile.tsx index b91458be..7ec720b7 100644 --- a/src/app_modules/forum/forumku/forum_profile.tsx +++ b/src/app_modules/forum/forumku/forum_profile.tsx @@ -1,12 +1,24 @@ "use client"; +import { pathAssetImage } from "@/app/lib"; +import { RouterImagePreview } from "@/app/lib/router_hipmi/router_image_preview"; import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog"; import { AccentColor, MainColor, } from "@/app_modules/_global/color/color_pallet"; +import { ComponentGlobal_LoaderAvatar } from "@/app_modules/_global/component"; import { MODEL_USER } from "@/app_modules/home/model/interface"; -import { Avatar, Button, Center, Grid, Stack, Text } from "@mantine/core"; +import { + Avatar, + Box, + Button, + Center, + Grid, + Image, + Stack, + Text, +} from "@mantine/core"; import { IconCircleFilled } from "@tabler/icons-react"; import { useRouter } from "next/navigation"; @@ -21,25 +33,54 @@ export default function ComponentForum_ViewForumProfile({ }) { const router = useRouter(); const [loading, setLoading] = useState(false); + const [isLoadingImage, setIsLoadingImage] = useState(false); return ( <>
- { + router.push( + RouterImagePreview.main({ + id: auhtorSelectedData.Profile.imageId as any, + }), + { scroll: false } + ); + setIsLoadingImage(true); }} - size={100} - alt="foto" - src={ - RouterProfile.api_foto_profile + - auhtorSelectedData?.Profile?.imagesId - } - /> + > + {isLoadingImage ? ( + + + Photo + + ) : ( + + )} +
@@ -69,7 +110,7 @@ export default function ComponentForum_ViewForumProfile({ border: `1px solid ${AccentColor.yellow}`, backgroundColor: MainColor.yellow, }} - c="white" + c="black" loaderPosition="center" loading={loading ? true : false} radius={"xl"} diff --git a/src/app_modules/forum/forumku/index.tsx b/src/app_modules/forum/forumku/index.tsx index d0c33a1e..ead4dfb8 100644 --- a/src/app_modules/forum/forumku/index.tsx +++ b/src/app_modules/forum/forumku/index.tsx @@ -2,8 +2,7 @@ import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; import { - AccentColor, - MainColor, + AccentColor } from "@/app_modules/_global/color/color_pallet"; import { MODEL_USER } from "@/app_modules/home/model/interface"; import { @@ -25,6 +24,7 @@ import ComponentForum_ForumkuMainCardView from "../component/forumku_component/f import { forum_getAllPostingByAuhtorId } from "../fun/get/get_list_posting_by_author_id"; import { MODEL_FORUM_POSTING } from "../model/interface"; import ComponentForum_ViewForumProfile from "./forum_profile"; +import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create"; export default function Forum_Forumku({ auhtorSelectedData, @@ -46,32 +46,8 @@ export default function Forum_Forumku({ return ( <> - {userLoginId === auhtorSelectedData.id ? ( - - 0 ? 0.5 : ""} - style={{ - transition: "0.5s", - border: `1px solid ${AccentColor.skyblue}`, - }} - size={"xl"} - radius={"xl"} - variant="transparent" - bg={AccentColor.blue} - onClick={() => { - setLoadingCreate(true); - router.push(RouterForum.create); - }} - > - {loadingCreate ? ( - - ) : ( - - )} - - - ) : ( - "" + {userLoginId === auhtorSelectedData.id && ( + )} @@ -92,7 +68,7 @@ export default function Forum_Forumku({ ) : ( // --- Main component --- // (
diff --git a/src/app_modules/forum/forumku/layout.tsx b/src/app_modules/forum/forumku/layout.tsx index 979149de..83db14b8 100644 --- a/src/app_modules/forum/forumku/layout.tsx +++ b/src/app_modules/forum/forumku/layout.tsx @@ -1,13 +1,9 @@ "use client"; -import { AppShell } from "@mantine/core"; -import React from "react"; -import ComponentForum_HeaderTamplate from "../component/header/header_tamplate"; -import { MODEL_USER } from "@/app_modules/home/model/interface"; -import { IconX } from "@tabler/icons-react"; -import AppComponentGlobal_LayoutTamplate from "@/app_modules/_global/component_layout_tamplate"; -import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate"; import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate"; +import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate"; +import { IconX } from "@tabler/icons-react"; +import React from "react"; export default function LayoutForum_Forumku({ children, @@ -20,25 +16,11 @@ export default function LayoutForum_Forumku({ <> } - /> + } /> } > {children} - - {/* } - /> - } - > - {children} - */} ); } diff --git a/src/app_modules/forum/fun/get/get_all_komentar_by_id.ts b/src/app_modules/forum/fun/get/get_all_komentar_by_id.ts index ad1d5cc8..5b4cd508 100644 --- a/src/app_modules/forum/fun/get/get_all_komentar_by_id.ts +++ b/src/app_modules/forum/fun/get/get_all_komentar_by_id.ts @@ -34,7 +34,7 @@ export async function forum_funGetAllKomentarById({ Profile: { select: { name: true, - imagesId: true, + imageId: true, }, }, }, diff --git a/src/app_modules/forum/fun/get/get_list_posting_by_author_id.ts b/src/app_modules/forum/fun/get/get_list_posting_by_author_id.ts index 39a8d2f4..d1b502c0 100644 --- a/src/app_modules/forum/fun/get/get_list_posting_by_author_id.ts +++ b/src/app_modules/forum/fun/get/get_list_posting_by_author_id.ts @@ -35,7 +35,8 @@ export async function forum_getAllPostingByAuhtorId({ Profile: { select: { id: true, - imagesId: true, + name: true, + imageId: true, }, }, }, diff --git a/src/app_modules/forum/fun/get/new_get_all_posting.ts b/src/app_modules/forum/fun/get/new_get_all_posting.ts index c95d6ac1..4bba8274 100644 --- a/src/app_modules/forum/fun/get/new_get_all_posting.ts +++ b/src/app_modules/forum/fun/get/new_get_all_posting.ts @@ -39,7 +39,8 @@ export async function forum_new_getAllPosting({ Profile: { select: { id: true, - imagesId: true, + name: true, + imageId: true, }, }, }, diff --git a/src/app_modules/forum/main/layout.tsx b/src/app_modules/forum/main/layout.tsx index 91141108..a9ad4ff6 100644 --- a/src/app_modules/forum/main/layout.tsx +++ b/src/app_modules/forum/main/layout.tsx @@ -1,15 +1,12 @@ "use client"; import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; -import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog"; +import { ComponentGlobal_LoaderAvatar } from "@/app_modules/_global/component"; +import ComponentGlobal_Loader from "@/app_modules/_global/component/loader"; import UIGlobal_LayoutHeaderTamplate from "@/app_modules/_global/ui/ui_header_tamplate"; import UIGlobal_LayoutTamplate from "@/app_modules/_global/ui/ui_layout_tamplate"; import { MODEL_USER } from "@/app_modules/home/model/interface"; -import { - ActionIcon, - Avatar, - Loader -} from "@mantine/core"; +import { ActionIcon, Avatar } from "@mantine/core"; import { useRouter } from "next/navigation"; import React, { useState } from "react"; @@ -21,9 +18,7 @@ export default function LayoutForum_Main({ dataAuthor: MODEL_USER; }) { const router = useRouter(); - const [hotMenu, setHotMenu] = useState(1); - const [loading, setLoading] = useState(false); - + const [isLoading, setIsLoading] = useState(false); return ( <> @@ -36,26 +31,26 @@ export default function LayoutForum_Main({ radius={"xl"} variant="transparent" onClick={() => { - setLoading(true); + setIsLoading(true); router.push(RouterForum.forumku + dataAuthor?.id); }} > - {loading ? ( - - ) : ( + {isLoading ? ( + + + ) : ( + )} @@ -65,84 +60,6 @@ export default function LayoutForum_Main({ > {children} - - {/* - - { - setLoading(true); - return router.push(RouterHome.main_home); - }} - > - - - - Forum - - { - setLoading(true); - router.push(RouterForum.forumku + dataAuthor?.id); - }} - > - - - - - } - - // footer={ - //
- // - // {listFooter.map((e) => ( - // { - // router.replace(e.path); - // setHotMenu(e.id); - // }} - // > - //
- // - // - // {e.icon} - // - // - // {e.name} - // - // - //
- //
- // ))} - //
- //
- // } - > - {children} -
*/} ); } diff --git a/src/app_modules/investasi/_component/detail/saham_saya/comp_detail_data.tsx b/src/app_modules/investasi/_component/detail/saham_saya/comp_detail_data.tsx index 73c3db46..dd330910 100644 --- a/src/app_modules/investasi/_component/detail/saham_saya/comp_detail_data.tsx +++ b/src/app_modules/investasi/_component/detail/saham_saya/comp_detail_data.tsx @@ -1,5 +1,5 @@ import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi"; -import { ComponentGlobal_AvatarAndAuthorName } from "@/app_modules/_global/component"; +import { ComponentGlobal_AvatarAndAuthorName, ComponentGlobal_AvatarAndUsername } from "@/app_modules/_global/component"; import { MODEL_INVOICE_INVESTASI } from "@/app_modules/investasi/_lib/interface"; import { Stack, @@ -25,7 +25,7 @@ export function Investasi_ComponentBoxDetailData({ <> - + - { + { setLoadingDetail(true); setVisible(true); router.push(RouterInvestasi_OLD.detail + `${data?.id}`); @@ -77,30 +74,9 @@ export function Investasi_ComponentCardBeranda({ size="xl" radius="xl" styles={{ - label:{color: MainColor.black} + label: { color: MainColor.black }, }} /> - {/* */} @@ -158,7 +134,20 @@ export function Investasi_ComponentCardBeranda({ {visible ? : ""} - + + + {/* */} ); } diff --git a/src/app_modules/investasi/_ui/main/ui_beranda.tsx b/src/app_modules/investasi/_ui/main/ui_beranda.tsx index 46e38aec..86902ba2 100644 --- a/src/app_modules/investasi/_ui/main/ui_beranda.tsx +++ b/src/app_modules/investasi/_ui/main/ui_beranda.tsx @@ -1,9 +1,5 @@ "use client"; -import mqtt_client from "@/util/mqtt_client"; -import { useShallowEffect } from "@mantine/hooks"; -import React, { useState } from "react"; -import { Investasi_ComponentButtonUpdateBeranda } from "../../_component/main/comp_update_beranda"; import { MODEL_INVESTASI } from "../../_lib/interface"; import { Investasi_ViewBeranda } from "../../_view"; diff --git a/src/app_modules/investasi/create/view.tsx b/src/app_modules/investasi/create/view.tsx index 72c76df7..4c51ea1f 100644 --- a/src/app_modules/investasi/create/view.tsx +++ b/src/app_modules/investasi/create/view.tsx @@ -30,13 +30,14 @@ import { Text, TextInput, } from "@mantine/core"; -import { IconUpload } from "@tabler/icons-react"; +import { IconCamera, IconUpload } from "@tabler/icons-react"; import { useAtom } from "jotai"; import _ from "lodash"; import { useRouter } from "next/navigation"; import { useState } from "react"; import { funCreateInvestasi } from "../fun/fun_create_investasi"; import { gs_investas_menu, gs_investasi_status } from "../g_state"; +import { ComponentGlobal_BoxUploadImage } from "@/app_modules/_global/component"; export default function InvestasiCreate({ pencarianInvestor, @@ -48,7 +49,7 @@ export default function InvestasiCreate({ pembagianDeviden: MODEL_DEFAULT_MASTER_OLD[]; }) { const router = useRouter(); - const [fl, setFl] = useState(null); + const [file, setFile] = useState(null); const [img, setImg] = useState(); const [pdf, setPdf] = useState(null); const [filePdf, setFilePdf] = useState(null); @@ -83,11 +84,11 @@ export default function InvestasiCreate({ }; // if (_.values(body).includes("")) return toast("Lengkapi data"); - if (!fl) return ComponentGlobal_NotifikasiPeringatan("Gambar Kosong"); + if (!file) return ComponentGlobal_NotifikasiPeringatan("Gambar Kosong"); if (!pdf) return ComponentGlobal_NotifikasiPeringatan("File Kosong"); const gmbr = new FormData(); - gmbr.append("file", fl as any); + gmbr.append("file", file as any); const flPdf = new FormData(); flPdf.append("file", pdf as any); @@ -138,38 +139,27 @@ export default function InvestasiCreate({ return ( <> - - {/* Inputan Create */} - - {img ? ( - - + + + + {img ? ( + Foto - - - ) : ( -
- - - - - Upload Gambar - - - -
- )} + + ) : ( + + + + Upload Gambar + + + )} + {/* Upload Foto */} @@ -185,7 +175,7 @@ export default function InvestasiCreate({ ComponentGlobal_WarningMaxUpload({}); } else { setImg(buffer); - setFl(files); + setFile(files); } } catch (error) { console.log(error); @@ -196,7 +186,7 @@ export default function InvestasiCreate({ {(props) => ( - )} - - - Upload File Prospektus + + ) : ( + { - setValue({ - ...value, - title: val.target.value, - }); - }} - /> + }} + > + {pdf.name} + + )} + {/* {JSON.stringify(filePdf)} */} + { + try { + const buffer = URL.createObjectURL( + new Blob([new Uint8Array(await files.arrayBuffer())]) + ); - maksimalUploadFile) { + ComponentGlobal_WarningMaxUpload({}); + } else { + setFilePdf(buffer); + setPdf(files); + } + } catch (error) { + console.log(error); + } }} - icon={Rp.} - min={0} - withAsterisk - label="Dana Dibutuhkan" - placeholder="0" - value={target} - onChange={(val) => { - // console.log(typeof val) + > + {(props) => ( + + )} + + + { + setValue({ + ...value, + title: val.target.value, + }); + }} + /> + + Rp.} + min={0} + withAsterisk + label="Dana Dibutuhkan" + placeholder="0" + value={target} + onChange={(val) => { + // console.log(typeof val) + const match = val.currentTarget.value + .replace(/\./g, "") + .match(/^[0-9]+$/); + + if (val.currentTarget.value === "") return setTarget(0 + ""); + if (!match?.[0]) return null; + + const nilai = val.currentTarget.value.replace(/\./g, ""); + const targetNilai = Intl.NumberFormat("id-ID").format(+nilai); + + setTarget(targetNilai); + setValue({ + ...value, + targetDana: +nilai, + }); + }} + /> + + Rp.} + min={0} + withAsterisk + label="Harga Per Lembar" + placeholder="0" + value={harga} + onChange={(val) => { + try { + // console.log(typeof +val.currentTarget.value); + const match = val.currentTarget.value .replace(/\./g, "") .match(/^[0-9]+$/); - if (val.currentTarget.value === "") return setTarget(0 + ""); + if (val.currentTarget.value === "") return setHarga(0 + ""); + if (!match?.[0]) return null; const nilai = val.currentTarget.value.replace(/\./g, ""); const targetNilai = Intl.NumberFormat("id-ID").format(+nilai); - setTarget(targetNilai); + onTotalLembar({ + target: value.targetDana, + harga: +nilai, + }); + + setHarga(targetNilai); setValue({ ...value, - targetDana: +nilai, + hargaLembar: +nilai, }); - }} - /> + } catch (error) { + console.log(error); + } + }} + /> - Rp.} - min={0} - withAsterisk - label="Harga Per Lembar" - placeholder="0" - value={harga} - onChange={(val) => { - try { - // console.log(typeof +val.currentTarget.value); - - const match = val.currentTarget.value - .replace(/\./g, "") - .match(/^[0-9]+$/); - - if (val.currentTarget.value === "") return setHarga(0 + ""); - - if (!match?.[0]) return null; - - const nilai = val.currentTarget.value.replace(/\./g, ""); - const targetNilai = Intl.NumberFormat("id-ID").format(+nilai); - - onTotalLembar({ - target: value.targetDana, - harga: +nilai, - }); - - setHarga(targetNilai); - setValue({ - ...value, - hargaLembar: +nilai, - }); - } catch (error) { - console.log(error); - } - }} - /> - - - - Total Lembar - - - {totalLembar} - - - - *Total lembar dihitung dari, Target Dana : Harga Perlembar - + + + Total Lembar + + + {totalLembar} + - - - % - - } - withAsterisk - type="number" - label={"Rasio Keuntungan / ROI %"} - placeholder="Masukan rasio keuntungan" - onChange={(val) => { - setValue({ - ...value, - roi: _.toNumber(val.target.value), - }); - }} - /> - - ({ value: e.id, label: e.name }))} - onChange={(val) => { - setValue({ - ...(value as any), - periodeDevidenId: val, - }); - }} - /> - ({ + value: e.id, + label: e.name + " " + "hari", + }))} + onChange={(val) => { + setValue({ + ...(value as any), + pencarianInvestorId: val, + }); + }} + /> + ({ + value: e.id, + label: e.name + " " + "bulan", + }))} + onChange={(val) => { + setValue({ + ...(value as any), + pembagianDevidenId: val, + }); + }} + /> + + + ); } diff --git a/src/app_modules/investasi/detail/view.tsx b/src/app_modules/investasi/detail/view.tsx index 9129b918..27570d95 100644 --- a/src/app_modules/investasi/detail/view.tsx +++ b/src/app_modules/investasi/detail/view.tsx @@ -119,8 +119,8 @@ export default function DetailInvestasi({ }} > {/* Foto username dan sisa waktu */} - @@ -174,7 +174,7 @@ export default function DetailInvestasi({
) } - /> + /> */} - }> - {children} - - - ); -} diff --git a/src/app_modules/investasi/detail_saham_terbeli/view.tsx b/src/app_modules/investasi/detail_saham_terbeli/view.tsx deleted file mode 100644 index 13daf283..00000000 --- a/src/app_modules/investasi/detail_saham_terbeli/view.tsx +++ /dev/null @@ -1,379 +0,0 @@ -"use client"; - -import { RouterInvestasi_OLD } from "@/app/lib/router_hipmi/router_investasi"; -import { Warna } from "@/app/lib/warna"; -import { - ActionIcon, - AspectRatio, - Avatar, - Box, - Button, - Center, - Divider, - Flex, - Grid, - Group, - Image, - Paper, - Progress, - Slider, - Stack, - Text, - Title, -} from "@mantine/core"; -import { - IconBookDownload, - IconCircleCheck, - IconFileDescription, - IconSpeakerphone, -} from "@tabler/icons-react"; -import { useRouter } from "next/navigation"; -import { MODEL_Transaksi_Investasi } from "../_lib/interface"; -import { useState } from "react"; -import moment from "moment"; -import _ from "lodash"; -import { AccentColor } from "@/app_modules/_global/color/color_pallet"; -import ComponentGlobal_AuthorNameOnHeader from "@/app_modules/_global/author_name_on_header"; - -export default function DetailSahamTerbeli({ - dataTransaksi, - investor, -}: { - dataTransaksi: MODEL_Transaksi_Investasi; - investor: number; -}) { - const router = useRouter(); - const [investasi, setINvestasi] = useState(dataTransaksi); - const listBox = [ - { - id: 1, - name: "Prospektus", - icon: , - route: RouterInvestasi_OLD.detail_prospektus, - }, - { - id: 2, - name: "Dokumen", - icon: , - route: RouterInvestasi_OLD.detail_dokumen, - }, - { - id: 3, - name: "Berita", - icon: , - route: RouterInvestasi_OLD.daftar_berita, - }, - ]; - - return ( - <> - - {/* Saham Terbeli */} - - - - - - Total Pembelian - - Rp.{" "} - {new Intl.NumberFormat("id-ID", { - maximumSignificantDigits: 10, - }).format(+investasi.gross_amount)} - - - - - - - Lembar Dibeli - - {new Intl.NumberFormat("id-ID", { - maximumSignificantDigits: 10, - }).format(+investasi.quantity)}{" "} - lembar - - - - - - - - - - {(() => { - if ( - Number(investasi.Investasi.MasterPencarianInvestor.name) - - moment(new Date()).diff( - new Date(investasi.createdAt), - "days" - ) <= - 0 - ) { - return ( - <> - - - Selesai - - - ); - } else { - return ( - <> - - {(() => { - if ( - Number( - investasi.Investasi.MasterPencarianInvestor.name - ) - - moment(new Date()).diff( - new Date(investasi.Investasi.countDown), - "days" - ) <= - 0 - ) { - return ( - <> - - - - Waktu Habis - - - - ); - } else { - return ( - <> - - Sisa waktu: - - {Number( - investasi.Investasi.MasterPencarianInvestor - .name - ) - - moment(new Date()).diff( - new Date(investasi.Investasi.countDown), - "days" - )} - - Hari - - - ); - } - })()} - - - ); - } - })()} - - - {/* Gambar Investasi */} - - - - - {/* Title dan Persentase */} - - - {investasi.Investasi.title} - - - - - {/* Rincian Data */} - - - - {/* - Terkumpul - Rp. - */} - - Dana Dibutuhkan - - Rp.{" "} - {new Intl.NumberFormat("id-ID", { - maximumSignificantDigits: 10, - }).format(+investasi.Investasi.targetDana)} - - - - Harga Per Lembar - - Rp.{" "} - {new Intl.NumberFormat("id-ID", { - maximumSignificantDigits: 10, - }).format(+investasi.Investasi.hargaLembar)} - - - - Jadwal Pembagian - - {investasi.Investasi.MasterPembagianDeviden.name} bulan{" "} - - - - Pembagian Deviden - {investasi.Investasi.MasterPeriodeDeviden.name} - - - - - - - Investor - - {new Intl.NumberFormat("id-ID", { - maximumSignificantDigits: 10, - }).format(investor)}{" "} - - - - ROI - {investasi.Investasi.roi}% - - - Total Lembar - - {new Intl.NumberFormat("id-ID", { - maximumSignificantDigits: 10, - }).format(+investasi.Investasi.totalLembar)}{" "} - lembar - - - - Sisa Lembar - - {new Intl.NumberFormat("id-ID", { - maximumSignificantDigits: 10, - }).format(+investasi.Investasi.sisaLembar)}{" "} - lembar - - - - - - - {/* List Box */} - - {listBox.map((e, i) => ( - - - {e.name} - router.push(e.route + `${investasi.Investasi.id}`)} - > - {e.icon} - - - - ))} - - - {/* - - {listBox.map((e) => ( - router.push(e.route + `${investasi.Investasi.id}`)} - > -
- - - {e.name} - - {e.icon} - - - -
-
- ))} -
*/} -
-
- - ); -} diff --git a/src/app_modules/investasi/index.ts b/src/app_modules/investasi/index.ts index fe79e4d3..5ce4f341 100644 --- a/src/app_modules/investasi/index.ts +++ b/src/app_modules/investasi/index.ts @@ -22,8 +22,6 @@ import EditDokumenInvestasi from "./edit_dokumen/view"; import LayoutEditDokumenInvestasi from "./edit_dokumen/layout"; import EditBeritaInvestasi from "./edit_berita/view"; import LayoutEditBeritaInvestasi from "./edit_berita/layout"; -import DetailSahamTerbeli from "./detail_saham_terbeli/view"; -import LayoutDetailSahamTerbeli from "./detail_saham_terbeli/layout"; import DetailPropektus from "./detail_prospektus/view"; import LayoutDetailPropektus from "./detail_prospektus/layout"; import DetailDokumenInvestasi from "./detail_dokumen/view"; @@ -91,8 +89,6 @@ export { LayoutEditDokumenInvestasi, EditBeritaInvestasi, LayoutEditBeritaInvestasi, - DetailSahamTerbeli, - LayoutDetailSahamTerbeli, DetailPropektus, LayoutDetailPropektus, DetailDokumenInvestasi, diff --git a/src/app_modules/katalog/portofolio/component/button/comp_button_selanjutnya.tsx b/src/app_modules/katalog/portofolio/component/button/comp_button_selanjutnya.tsx index 79693a3e..c7e3fcd5 100644 --- a/src/app_modules/katalog/portofolio/component/button/comp_button_selanjutnya.tsx +++ b/src/app_modules/katalog/portofolio/component/button/comp_button_selanjutnya.tsx @@ -1,7 +1,7 @@ import { RouterMap } from "@/app/lib/router_hipmi/router_map"; import { MainColor } from "@/app_modules/_global/color"; import { - ComponentGlobal_NotifikasiBerhasil, + ComponentGlobal_NotifikasiBerhasil, ComponentGlobal_NotifikasiGagal, ComponentGlobal_NotifikasiPeringatan, } from "@/app_modules/_global/notif_global"; @@ -20,13 +20,11 @@ export function Portofolio_ComponentButtonSelanjutnya({ dataPortofolio, file, dataMedsos, - setIsFile, }: { profileId: string; dataPortofolio: MODEL_PORTOFOLIO_OLD; file: File; dataMedsos: any; - setIsFile: any; }) { const router = useRouter(); const [loading, setLoading] = useState(false); diff --git a/src/app_modules/katalog/portofolio/create/view.tsx b/src/app_modules/katalog/portofolio/create/view.tsx index 55028cb5..97b009ab 100644 --- a/src/app_modules/katalog/portofolio/create/view.tsx +++ b/src/app_modules/katalog/portofolio/create/view.tsx @@ -4,7 +4,6 @@ import { MainColor } from "@/app_modules/_global/color/color_pallet"; import { ComponentGlobal_BoxUploadImage } from "@/app_modules/_global/component"; import ComponentGlobal_BoxInformation from "@/app_modules/_global/component/box_information"; import ComponentGlobal_InputCountDown from "@/app_modules/_global/component/input_countdown"; -import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan"; import { BIDANG_BISNIS_OLD } from "@/app_modules/model_global/portofolio"; import { AspectRatio, @@ -49,7 +48,6 @@ export default function CreatePortofolio({ const [file, setFile] = useState(null); const [img, setImg] = useState(null); - const [isFile, setIsFile] = useState(false); return ( <> @@ -186,16 +184,8 @@ export default function CreatePortofolio({ const buffer = URL.createObjectURL( new Blob([new Uint8Array(await files.arrayBuffer())]) ); - if (files.size > 2000000) { - ComponentGlobal_NotifikasiPeringatan( - "Maaf, Ukuran file terlalu besar, maximum 2mb", - 3000 - ); - } else { - setImg(buffer); - setFile(files); - setIsFile(false); - } + setImg(buffer); + setFile(files); } catch (error) { console.log(error); } @@ -307,7 +297,6 @@ export default function CreatePortofolio({ dataMedsos={dataMedsos} file={file} profileId={profileId} - setIsFile={setIsFile} /> diff --git a/src/app_modules/katalog/profile/_component/comp_load_avatar.tsx b/src/app_modules/katalog/profile/_component/comp_load_avatar.tsx index 93f64336..225a9adc 100644 --- a/src/app_modules/katalog/profile/_component/comp_load_avatar.tsx +++ b/src/app_modules/katalog/profile/_component/comp_load_avatar.tsx @@ -1,9 +1,10 @@ "use client"; import { APIs } from "@/app/lib"; -import { routerImagePreview } from "@/app/lib/router_hipmi/router_image_preview"; +import { pathAssetImage } from "@/app/lib"; +import { RouterImagePreview } from "@/app/lib/router_hipmi/router_image_preview"; import { AccentColor } from "@/app_modules/_global/color"; -import { Avatar, Image, Skeleton } from "@mantine/core"; +import { Avatar, Center, Image, Skeleton } from "@mantine/core"; import { useShallowEffect } from "@mantine/hooks"; import { useRouter } from "next/navigation"; import { CSSProperties, useState } from "react"; @@ -17,6 +18,7 @@ export function Profile_ComponentAvatarProfile({ }) { const router = useRouter(); const [isImage, setIsImage] = useState(null); + const [isLoading, setLoading] = useState(false); const url = APIs.GET({ fileId: fileId, size: "200" }); @@ -70,18 +72,33 @@ export function Profile_ComponentAvatarProfile({ return ( <> - - router.push(routerImagePreview.main({ id: fileId }), { - scroll: false, - }) - } - /> +
+ { + router.push(RouterImagePreview.main({ id: fileId }), { + scroll: false, + }); + setLoading(true); + }} + /> + {isLoading && ( + Loader + )} +
); } diff --git a/src/app_modules/katalog/profile/_component/comp_load_background.tsx b/src/app_modules/katalog/profile/_component/comp_load_background.tsx index 443b5f9a..bf09c029 100644 --- a/src/app_modules/katalog/profile/_component/comp_load_background.tsx +++ b/src/app_modules/katalog/profile/_component/comp_load_background.tsx @@ -1,13 +1,13 @@ "use client"; import { APIs } from "@/app/lib"; -import { routerImagePreview } from "@/app/lib/router_hipmi/router_image_preview"; -import { AspectRatio, Box, Center, Image, Skeleton } from "@mantine/core"; +import { pathAssetImage } from "@/app/lib/path_asset_image"; +import { RouterImagePreview } from "@/app/lib"; +import { Center, Image, Skeleton } from "@mantine/core"; import { useShallowEffect } from "@mantine/hooks"; import { useRouter } from "next/navigation"; import { useState } from "react"; -type IRadius = "xs" | "sm" | "md" | "lg" | "xl"; export function Profile_ComponentLoadBackgroundImage({ fileId, }: { @@ -15,7 +15,7 @@ export function Profile_ComponentLoadBackgroundImage({ }) { const router = useRouter(); const [isImage, setIsImage] = useState(null); - + const [isLoading, setLoading] = useState(false); const url = APIs.GET({ fileId: fileId }); useShallowEffect(() => { @@ -45,7 +45,7 @@ export function Profile_ComponentLoadBackgroundImage({ maw={150} m={"auto"} p={"xs"} - src={"/aset/global/no-image.svg"} + src={pathAssetImage.no_image} />
@@ -53,23 +53,40 @@ export function Profile_ComponentLoadBackgroundImage({ return ( <> - - router.push(routerImagePreview.main({ id: fileId }), { - scroll: false, - }) - } - style={{ - borderColor: "white", - borderStyle: "solid", - borderWidth: "1px", - borderRadius: "5px", - }} - radius={5} - height={200} - alt="Image" - src={url} - /> +
+ { + setLoading(true); + router.push(RouterImagePreview.main({ id: fileId }), { + scroll: false, + }); + }} + style={{ + borderColor: "white", + borderStyle: "solid", + borderWidth: "1px", + borderRadius: "5px", + }} + radius={"4px"} + height={200} + alt="Image" + opacity={isLoading ? 0.5 : 1} + src={url} + /> + {isLoading ? ( + Loader + ) : ( + "" + )} +
); } diff --git a/src/app_modules/katalog/ui/ui_profile.tsx b/src/app_modules/katalog/ui/ui_profile.tsx index a5b3a050..bc0be610 100644 --- a/src/app_modules/katalog/ui/ui_profile.tsx +++ b/src/app_modules/katalog/ui/ui_profile.tsx @@ -1,6 +1,5 @@ "use client"; -import { APIs } from "@/app/lib"; import { AccentColor } from "@/app_modules/_global/color/color_pallet"; import { Box, Center, Group, Stack, Text, ThemeIcon } from "@mantine/core"; import { @@ -70,12 +69,6 @@ export function Profile_UiView({ - {/* Background */} - {/* */}
diff --git a/src/app_modules/map/_component/comp_load_image_map.tsx b/src/app_modules/map/_component/comp_load_image_map.tsx index cef9792e..33fb58d5 100644 --- a/src/app_modules/map/_component/comp_load_image_map.tsx +++ b/src/app_modules/map/_component/comp_load_image_map.tsx @@ -1,7 +1,7 @@ "use client"; -import { APIs, RouterAssetImage } from "@/app/lib"; -import { routerImagePreview } from "@/app/lib/router_hipmi/router_image_preview"; +import { APIs, pathAssetImage } from "@/app/lib"; +import { RouterImagePreview } from "@/app/lib/router_hipmi/router_image_preview"; import { Box, Center, Image, Skeleton } from "@mantine/core"; import { useShallowEffect } from "@mantine/hooks"; import { useRouter } from "next/navigation"; @@ -41,7 +41,7 @@ export function ComponentMap_LoadImageMap({ ) : isImage ? ( - router.push(routerImagePreview.main({ id: fileId }), { + router.push(RouterImagePreview.main({ id: fileId }), { scroll: false, }) } @@ -74,7 +74,7 @@ export function ComponentMap_LoadImageMap({ alt="Image" height={100} width={100} - src={RouterAssetImage.no_image} + src={pathAssetImage.no_image} />
diff --git a/src/bin/seeder/forum/master_status.json b/src/bin/seeder/forum/master_status.json index 98615e77..c6ed1940 100644 --- a/src/bin/seeder/forum/master_status.json +++ b/src/bin/seeder/forum/master_status.json @@ -5,6 +5,6 @@ }, { "id": 2, - "status": "Close" + "status": "Closed" } ]