From 67a66edd19040cd0de4a5df86d580014f63b9fd9 Mon Sep 17 00:00:00 2001 From: Bagasbanuna02 Date: Wed, 11 Dec 2024 11:00:46 +0800 Subject: [PATCH 1/6] chore(release): 1.2.23 --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75c82718..62e0291c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines. +## [1.2.23](https://github.com/bipproduction/hipmi/compare/v1.2.22...v1.2.23) (2024-12-11) + ## [1.2.22](https://github.com/bipproduction/hipmi/compare/v1.2.21...v1.2.22) (2024-12-10) ## [1.2.21](https://github.com/bipproduction/hipmi/compare/v1.2.20...v1.2.21) (2024-12-09) diff --git a/package.json b/package.json index 63e0b3b0..68de6a42 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hipmi", - "version": "1.2.22", + "version": "1.2.23", "private": true, "prisma": { "seed": "npx tsx prisma/seed.ts --yes" From 97fe458e1dede3f2faaeb921c44cdc20d3ec25be Mon Sep 17 00:00:00 2001 From: amel Date: Wed, 11 Dec 2024 11:51:34 +0800 Subject: [PATCH 2/6] upd: button back Deskripsi: - ilangin loading button back No s No Issues --- src/app_modules/_global/ui/ui_header_tamplate.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/app_modules/_global/ui/ui_header_tamplate.tsx b/src/app_modules/_global/ui/ui_header_tamplate.tsx index 6126711c..6f6425e9 100644 --- a/src/app_modules/_global/ui/ui_header_tamplate.tsx +++ b/src/app_modules/_global/ui/ui_header_tamplate.tsx @@ -77,12 +77,21 @@ export default function UIGlobal_LayoutHeaderTamplate({ : router.push(routerLeft, { scroll: false }); }} > - {isLoading ? ( + {/* PAKE LOADING SAAT KLIK BACK */} + {/* {isLoading ? ( ) : iconLeft ? ( iconLeft ) : ( + )} */} + + + {/* GA PAKE LOADING SAAT KLIK BACK */} + {iconLeft ? ( + iconLeft + ) : ( + )} )} From eab293dd35a6f061cfa4675679de1ce68f506c3c Mon Sep 17 00:00:00 2001 From: amel Date: Wed, 11 Dec 2024 12:03:56 +0800 Subject: [PATCH 3/6] fix: drawer katalog Deskripsi: - on click kotak drawer No Issues --- .../katalog/component/drawer_katalog_new.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/app_modules/katalog/component/drawer_katalog_new.tsx b/src/app_modules/katalog/component/drawer_katalog_new.tsx index 752a7643..ab0ef95c 100644 --- a/src/app_modules/katalog/component/drawer_katalog_new.tsx +++ b/src/app_modules/katalog/component/drawer_katalog_new.tsx @@ -108,14 +108,12 @@ export default function DrawerKatalogNew({ {listPage.map((e, i) => ( - - { - router.push(e.path, { scroll: false }); - }} - > + { + router.push(e.path, { scroll: false }); + }} + > + {e.icon} From 9ceb4867e35b991449a7f64995d63096908fd02f Mon Sep 17 00:00:00 2001 From: Bagasbanuna02 Date: Wed, 11 Dec 2024 13:58:32 +0800 Subject: [PATCH 4/6] Fix profile Deskripsi: - Fix load image saat di buka --- src/app/dev/profile/edit/[id]/page.tsx | 6 ++---- .../_global/button/comp_button_upload_photo.tsx | 12 ++++++++++-- src/app_modules/_global/lib/index.ts | 3 +++ src/app_modules/_global/lib/max_size.ts | 2 ++ src/app_modules/_global/ui/ui_image_preview.tsx | 2 +- .../_component/button/comp_create_new_profile.tsx | 7 +++---- src/app_modules/katalog/profile/create/view.tsx | 9 +++------ src/app_modules/katalog/profile/edit/view.tsx | 12 +++++++----- .../katalog/profile/upload/foto_background/index.tsx | 5 ++++- .../katalog/profile/upload/foto_profile/index.tsx | 6 +++++- 10 files changed, 40 insertions(+), 24 deletions(-) create mode 100644 src/app_modules/_global/lib/index.ts create mode 100644 src/app_modules/_global/lib/max_size.ts diff --git a/src/app/dev/profile/edit/[id]/page.tsx b/src/app/dev/profile/edit/[id]/page.tsx index 53e6ca6d..1941dc84 100644 --- a/src/app/dev/profile/edit/[id]/page.tsx +++ b/src/app/dev/profile/edit/[id]/page.tsx @@ -1,14 +1,12 @@ - import EditProfile from "@/app_modules/katalog/profile/edit/view"; import { Profile_getOneProfileAndUserById } from "@/app_modules/katalog/profile/fun/get/get_one_user_profile"; export default async function Page({ params }: { params: { id: string } }) { - let profileId = params.id - const dataProfile = await Profile_getOneProfileAndUserById(profileId) + let profileId = params.id; + const dataProfile = await Profile_getOneProfileAndUserById(profileId); return ( <> - {/* {JSON.stringify(data)} */} ); diff --git a/src/app_modules/_global/button/comp_button_upload_photo.tsx b/src/app_modules/_global/button/comp_button_upload_photo.tsx index 642feddc..8cd0b16b 100644 --- a/src/app_modules/_global/button/comp_button_upload_photo.tsx +++ b/src/app_modules/_global/button/comp_button_upload_photo.tsx @@ -3,6 +3,8 @@ import { Button, FileButton } from "@mantine/core"; import { IconCamera } from "@tabler/icons-react"; import { MainColor } from "../color"; +import { MAX_SIZE } from "../lib"; +import { ComponentGlobal_NotifikasiPeringatan } from "../notif_global"; export function ComponentGlobal_ButtonUploadFileImage({ onSetFile, @@ -19,8 +21,14 @@ export function ComponentGlobal_ButtonUploadFileImage({ new Blob([new Uint8Array(await files.arrayBuffer())]) ); - onSetFile(files); - onSetImage(buffer); + if (files.size > MAX_SIZE) { + ComponentGlobal_NotifikasiPeringatan( + "Ukuran file terlalu besar. Maksimal 2 MB." + ); + } else { + onSetFile(files); + onSetImage(buffer); + } } catch (error) { console.log(error); } diff --git a/src/app_modules/_global/lib/index.ts b/src/app_modules/_global/lib/index.ts new file mode 100644 index 00000000..78b13e14 --- /dev/null +++ b/src/app_modules/_global/lib/index.ts @@ -0,0 +1,3 @@ +import { MAX_SIZE } from "./max_size"; + +export { MAX_SIZE }; diff --git a/src/app_modules/_global/lib/max_size.ts b/src/app_modules/_global/lib/max_size.ts new file mode 100644 index 00000000..d312cf45 --- /dev/null +++ b/src/app_modules/_global/lib/max_size.ts @@ -0,0 +1,2 @@ +// Maksimal ukuran file dalam byte (2 MB) +export const MAX_SIZE = 2 * 1024 * 1024; // 2 MB diff --git a/src/app_modules/_global/ui/ui_image_preview.tsx b/src/app_modules/_global/ui/ui_image_preview.tsx index 9f37411a..a2057b2d 100644 --- a/src/app_modules/_global/ui/ui_image_preview.tsx +++ b/src/app_modules/_global/ui/ui_image_preview.tsx @@ -28,7 +28,7 @@ export function UIGlobal_ImagePreview({ fileId }: { fileId: string }) { const [isImage, setIsImage] = useState(null); const [isLoading, setIsLoading] = useState(false); - const url = APIs.GET({ fileId: fileId }); + const url = APIs.GET({ fileId: fileId, size: "500" }); useShallowEffect(() => { onLoadImage(); diff --git a/src/app_modules/katalog/profile/_component/button/comp_create_new_profile.tsx b/src/app_modules/katalog/profile/_component/button/comp_create_new_profile.tsx index e523a2ba..d649d346 100644 --- a/src/app_modules/katalog/profile/_component/button/comp_create_new_profile.tsx +++ b/src/app_modules/katalog/profile/_component/button/comp_create_new_profile.tsx @@ -9,15 +9,13 @@ import { ComponentGlobal_NotifikasiGagal, ComponentGlobal_NotifikasiPeringatan, } from "@/app_modules/_global/notif_global"; +import { gmailRegex } from "@/app_modules/katalog/component/regular_expressions"; import { Button } from "@mantine/core"; import _ from "lodash"; import { useRouter } from "next/navigation"; import { useState } from "react"; import funCreateNewProfile from "../../fun/fun_create_profile"; import { MODEL_PROFILE } from "../../model/interface"; -import { validRegex } from "@/app_modules/katalog/component"; -import { envs } from "@/lib/envs"; -import { TokenProvider, TokenStorage } from "@/app/lib/token"; export function Profile_ComponentCreateNewProfile({ value, @@ -40,7 +38,8 @@ export function Profile_ComponentCreateNewProfile({ }; if (_.values(newData).includes("")) return ComponentGlobal_NotifikasiPeringatan("Lengkapi Data"); - if (!newData.email.match(validRegex)) return null; + if (!newData.email.match(gmailRegex)) + return ComponentGlobal_NotifikasiPeringatan("Format email salah"); if (filePP == null) return ComponentGlobal_NotifikasiPeringatan("Lengkapi foto profile"); diff --git a/src/app_modules/katalog/profile/create/view.tsx b/src/app_modules/katalog/profile/create/view.tsx index c97942ee..dce45a60 100644 --- a/src/app_modules/katalog/profile/create/view.tsx +++ b/src/app_modules/katalog/profile/create/view.tsx @@ -6,6 +6,8 @@ import { ComponentGlobal_BoxUploadImage, ComponentGlobal_ErrorInput, } from "@/app_modules/_global/component"; +import { MAX_SIZE } from "@/app_modules/_global/lib"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global"; import { AspectRatio, Avatar, @@ -22,10 +24,8 @@ import { } from "@mantine/core"; import { IconAt, IconCamera, IconUpload } from "@tabler/icons-react"; import { useState } from "react"; -import { validRegex } from "../../component"; -import { Profile_ComponentCreateNewProfile } from "../_component"; -import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global"; import { gmailRegex } from "../../component/regular_expressions"; +import { Profile_ComponentCreateNewProfile } from "../_component"; export default function CreateProfile() { const [filePP, setFilePP] = useState(null); @@ -40,9 +40,6 @@ export default function CreateProfile() { jenisKelamin: "", }); - // Maksimal ukuran file dalam byte (2 MB) - const MAX_SIZE = 2 * 1024 * 1024; // 2 MB - return ( <> diff --git a/src/app_modules/katalog/profile/edit/view.tsx b/src/app_modules/katalog/profile/edit/view.tsx index 8a907706..9b33f424 100644 --- a/src/app_modules/katalog/profile/edit/view.tsx +++ b/src/app_modules/katalog/profile/edit/view.tsx @@ -4,14 +4,14 @@ import { Button, Loader, Select, Stack, TextInput } from "@mantine/core"; import _ from "lodash"; import { useRouter } from "next/navigation"; import { useState } from "react"; - import { MainColor } from "@/app_modules/_global/color/color_pallet"; import ComponentGlobal_ErrorInput from "@/app_modules/_global/component/error_input"; import { ComponentGlobal_NotifikasiBerhasil } from "@/app_modules/_global/notif_global/notifikasi_berhasil"; import { ComponentGlobal_NotifikasiGagal } from "@/app_modules/_global/notif_global/notifikasi_gagal"; -import { validRegex } from "../../component/regular_expressions"; +import { gmailRegex, validRegex } from "../../component/regular_expressions"; import { Profile_funEditById } from "../fun/update/fun_edit_profile_by_id"; import { MODEL_PROFILE } from "../model/interface"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global"; export default function EditProfile({ data }: { data: MODEL_PROFILE }) { const router = useRouter(); @@ -24,8 +24,10 @@ export default function EditProfile({ data }: { data: MODEL_PROFILE }) { const body = dataProfile; // console.log(body) - if (_.values(body).includes("")) return null; - if (!body.email.match(validRegex)) return null; + if (_.values(body).includes("")) + return ComponentGlobal_NotifikasiPeringatan("Lengkapi data"); + if (!body.email.match(gmailRegex)) + return ComponentGlobal_NotifikasiPeringatan("Format email salah"); await Profile_funEditById(body).then((res) => { if (res.status === 200) { @@ -126,7 +128,7 @@ export default function EditProfile({ data }: { data: MODEL_PROFILE }) { dataProfile?.email === "" ? ( ) : dataProfile?.email?.length > 0 && - !dataProfile?.email.match(validRegex) ? ( + !dataProfile?.email.match(gmailRegex) ? ( ) : ( "" diff --git a/src/app_modules/katalog/profile/upload/foto_background/index.tsx b/src/app_modules/katalog/profile/upload/foto_background/index.tsx index 12d03b46..559b003c 100644 --- a/src/app_modules/katalog/profile/upload/foto_background/index.tsx +++ b/src/app_modules/katalog/profile/upload/foto_background/index.tsx @@ -30,7 +30,10 @@ export default function Profile_UpdateFotoBackground({ src={ image ? image - : APIs.GET({ fileId: profile.imageBackgroundId as any }) + : APIs.GET({ + fileId: profile.imageBackgroundId as any, + size: "400", + }) } /> diff --git a/src/app_modules/katalog/profile/upload/foto_profile/index.tsx b/src/app_modules/katalog/profile/upload/foto_profile/index.tsx index 6e49f09f..4f1a960e 100644 --- a/src/app_modules/katalog/profile/upload/foto_profile/index.tsx +++ b/src/app_modules/katalog/profile/upload/foto_profile/index.tsx @@ -27,7 +27,11 @@ export default function UploadFotoProfile({ Avatar From 8823a01b067928cbeea195402f2bb454df8e8bea Mon Sep 17 00:00:00 2001 From: amel Date: Wed, 11 Dec 2024 14:02:04 +0800 Subject: [PATCH 5/6] fix: loading button tambah portofolio Deskripsi: - loading button selanjutjnya - loading button simpan pin No Issues --- .../component/button/comp_button_selanjutnya.tsx | 2 +- .../map/_component/button/comp_button_save_pin.tsx | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) 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 c7e3fcd5..41c037b9 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 @@ -30,6 +30,7 @@ export function Portofolio_ComponentButtonSelanjutnya({ const [loading, setLoading] = useState(false); async function onSubmit() { + setLoading(true); const porto = { namaBisnis: dataPortofolio.namaBisnis, masterBidangBisnisId: dataPortofolio.masterBidangBisnisId, @@ -56,7 +57,6 @@ export function Portofolio_ComponentButtonSelanjutnya({ fileId: uploadFileToStorage.data.id, }); if (res.status === 201) { - setLoading(true); ComponentGlobal_NotifikasiBerhasil("Berhasil disimpan"); router.replace(RouterMap.create + res.id, { scroll: false }); } else { diff --git a/src/app_modules/map/_component/button/comp_button_save_pin.tsx b/src/app_modules/map/_component/button/comp_button_save_pin.tsx index 8af85a08..40a398d2 100644 --- a/src/app_modules/map/_component/button/comp_button_save_pin.tsx +++ b/src/app_modules/map/_component/button/comp_button_save_pin.tsx @@ -11,6 +11,7 @@ import { useRouter } from "next/navigation"; import { map_funCreatePin } from "../../fun/create/fun_create_pin"; import { DIRECTORY_ID } from "@/app/lib"; import { funGlobal_UploadToStorage } from "@/app_modules/_global/fun"; +import { useState } from "react"; export function ComponentMap_ButtonSavePin({ namePin, @@ -26,7 +27,10 @@ export function ComponentMap_ButtonSavePin({ file: File; }) { const router = useRouter(); + const [loading, setLoading] = useState(false) + async function onSavePin() { + setLoading(true) const uploadFileToStorage = await funGlobal_UploadToStorage({ file: file, dirId: DIRECTORY_ID.map_image, @@ -49,15 +53,19 @@ export function ComponentMap_ButtonSavePin({ res.status === 200 ? (ComponentGlobal_NotifikasiBerhasil(res.message), router.back()) : ComponentGlobal_NotifikasiGagal(res.message); + + setLoading(false) } return ( <>