Merge pull request #198 from bipproduction/join

fix bug
This commit is contained in:
Bagasbanuna02
2024-12-12 16:16:52 +08:00
committed by GitHub
8 changed files with 93 additions and 50 deletions

View File

@@ -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. 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.27](https://github.com/bipproduction/hipmi/compare/v1.2.26...v1.2.27) (2024-12-12)
## [1.2.26](https://github.com/bipproduction/hipmi/compare/v1.2.25...v1.2.26) (2024-12-12) ## [1.2.26](https://github.com/bipproduction/hipmi/compare/v1.2.25...v1.2.26) (2024-12-12)
## [1.2.25](https://github.com/bipproduction/hipmi/compare/v1.2.24...v1.2.25) (2024-12-12) ## [1.2.25](https://github.com/bipproduction/hipmi/compare/v1.2.24...v1.2.25) (2024-12-12)

View File

@@ -1,6 +1,6 @@
{ {
"name": "hipmi", "name": "hipmi",
"version": "1.2.26", "version": "1.2.27",
"private": true, "private": true,
"prisma": { "prisma": {
"seed": "npx tsx prisma/seed.ts --yes" "seed": "npx tsx prisma/seed.ts --yes"

View File

@@ -40,11 +40,15 @@ export default function ComponentGlobal_CreateButton({
router.push(path); router.push(path);
}} }}
> >
{isLoading ? ( {/* PAKE LOADING */}
{/* {isLoading ? (
<Loader color={AccentColor.blue} size={25} /> <Loader color={AccentColor.blue} size={25} />
) : ( ) : (
<IconPencilPlus color="white" /> <IconPencilPlus color="white" />
)} )} */}
{/* GA PAKE LOADING */}
<IconPencilPlus color="white" />
</ActionIcon> </ActionIcon>
</> </>
); );

View File

@@ -74,11 +74,15 @@ export default function MainCrowd() {
</Grid.Col> </Grid.Col>
<Grid.Col span={2}> <Grid.Col span={2}>
<Stack h={"100%"} justify="center" align="center"> <Stack h={"100%"} justify="center" align="center">
{loadingInv ? ( {/* PAKE LOADING */}
{/* {loadingInv ? (
<ComponentGlobal_Loader /> <ComponentGlobal_Loader />
) : ( ) : (
<IconChevronRight /> <IconChevronRight />
)} )} */}
{/* GA PAKE LOADING */}
<IconChevronRight />
</Stack> </Stack>
</Grid.Col> </Grid.Col>
</Grid> </Grid>
@@ -114,11 +118,15 @@ export default function MainCrowd() {
</Grid.Col> </Grid.Col>
<Grid.Col span={2}> <Grid.Col span={2}>
<Stack h={"100%"} justify="center" align="center"> <Stack h={"100%"} justify="center" align="center">
{loadingDon ? ( {/* PAKE LOADING */}
{/* {loadingDon ? (
<ComponentGlobal_Loader /> <ComponentGlobal_Loader />
) : ( ) : (
<IconChevronRight /> <IconChevronRight />
)} )} */}
{/* GA PAKE LOADINGF */}
<IconChevronRight />
</Stack> </Stack>
</Grid.Col> </Grid.Col>
</Grid> </Grid>

View File

@@ -1,23 +1,21 @@
"use client"; "use client";
import { ComponentGlobal_CardLoadingOverlay, ComponentGlobal_CardStyles, ComponentGlobal_LoadImageCustom, } from "@/app_modules/_global/component"; import { RouterDonasi } from "@/app/lib/router_hipmi/router_donasi";
import { ComponentGlobal_CardStyles, ComponentGlobal_LoadImageCustom } from "@/app_modules/_global/component";
import { Grid, Progress, Stack, Text } from "@mantine/core"; import { Grid, Progress, Stack, Text } from "@mantine/core";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react";
import ComponentDonasi_TampilanHitungMundur from "../tampilan_hitung_mundur"; import ComponentDonasi_TampilanHitungMundur from "../tampilan_hitung_mundur";
import TampilanRupiahDonasi from "../tampilan_rupiah"; import TampilanRupiahDonasi from "../tampilan_rupiah";
export default function ComponentDonasi_CardPublishNew({ data, path, }: { data: any; path: string; }) { export default function ComponentDonasi_CardPublishNew({ data }: { data: any; }) {
const router = useRouter(); const router = useRouter();
const [visible, setVisible] = useState(false);
const [donasiId, setDonasiId] = useState("");
return ( return (
<> <>
<ComponentGlobal_CardStyles <ComponentGlobal_CardStyles
onClickHandler={() => { onClickHandler={() => {
setVisible(true); // DELSOON
setDonasiId(data.id); console.log(RouterDonasi.detail_main + `${data.id}`)
router.push(path + `${data.id}`); router.push(RouterDonasi.detail_main + `${data.id}`)
}} }}
> >
<Stack> <Stack>

View File

@@ -121,10 +121,7 @@ export default function MainDonasiNew() {
}} }}
> >
{(item) => ( {(item) => (
<ComponentDonasi_CardPublishNew <ComponentDonasi_CardPublishNew data={item as any} />
data={item as any}
path={RouterDonasi.detail_main}
/>
)} )}
</ScrollOnly> </ScrollOnly>
) )

View File

@@ -19,12 +19,16 @@ import { MODEL_PROFILE } from "../../model/interface";
export function Profile_ComponentCreateNewProfile({ export function Profile_ComponentCreateNewProfile({
value, value,
filePP, // filePP,
fileBG, // fileBG,
fotoProfileId,
backgroundProfileId,
}: { }: {
value: MODEL_PROFILE; value: MODEL_PROFILE;
filePP: File; // filePP: File;
fileBG: File; // fileBG: File;
fotoProfileId: string;
backgroundProfileId: string;
}) { }) {
const router = useRouter(); const router = useRouter();
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
@@ -41,9 +45,9 @@ export function Profile_ComponentCreateNewProfile({
if (!newData.email.match(gmailRegex)) if (!newData.email.match(gmailRegex))
return ComponentGlobal_NotifikasiPeringatan("Format email salah"); return ComponentGlobal_NotifikasiPeringatan("Format email salah");
if (filePP == null) if (fotoProfileId == "")
return ComponentGlobal_NotifikasiPeringatan("Lengkapi foto profile"); return ComponentGlobal_NotifikasiPeringatan("Lengkapi foto profile");
if (fileBG == null) if (backgroundProfileId == null)
return ComponentGlobal_NotifikasiPeringatan( return ComponentGlobal_NotifikasiPeringatan(
"Lengkapi background profile" "Lengkapi background profile"
); );
@@ -51,28 +55,28 @@ export function Profile_ComponentCreateNewProfile({
try { try {
setLoading(true); setLoading(true);
const uploadPhoto = await funGlobal_UploadToStorage({ // const uploadPhoto = await funGlobal_UploadToStorage({
file: filePP, // file: filePP,
dirId: DIRECTORY_ID.profile_foto, // dirId: DIRECTORY_ID.profile_foto,
}); // });
if (!uploadPhoto.success) { // if (!uploadPhoto.success) {
ComponentGlobal_NotifikasiPeringatan("Gagal upload foto profile"); // ComponentGlobal_NotifikasiPeringatan("Gagal upload foto profile");
return; // return;
} // }
const uploadBackground = await funGlobal_UploadToStorage({ // const uploadBackground = await funGlobal_UploadToStorage({
file: fileBG, // file: fileBG,
dirId: DIRECTORY_ID.profile_background, // dirId: DIRECTORY_ID.profile_background,
}); // });
if (!uploadBackground.success) { // if (!uploadBackground.success) {
ComponentGlobal_NotifikasiPeringatan("Gagal upload background profile"); // ComponentGlobal_NotifikasiPeringatan("Gagal upload background profile");
return; // return;
} // }
const create = await funCreateNewProfile({ const create = await funCreateNewProfile({
data: newData as any, data: newData as any,
imageId: uploadPhoto.data.id, imageId: fotoProfileId,
imageBackgroundId: uploadBackground.data.id, imageBackgroundId: backgroundProfileId,
}); });
if (create.status === 201) { if (create.status === 201) {

View File

@@ -1,12 +1,15 @@
"use client"; "use client";
import { DIRECTORY_ID } from "@/app/lib";
import { MainColor } from "@/app_modules/_global/color"; import { MainColor } from "@/app_modules/_global/color";
import { import {
ComponentGlobal_BoxInformation, ComponentGlobal_BoxInformation,
ComponentGlobal_BoxUploadImage, ComponentGlobal_BoxUploadImage,
ComponentGlobal_ErrorInput, ComponentGlobal_ErrorInput,
} from "@/app_modules/_global/component"; } from "@/app_modules/_global/component";
import { funGlobal_UploadToStorage } from "@/app_modules/_global/fun";
import { MAX_SIZE } from "@/app_modules/_global/lib"; import { MAX_SIZE } from "@/app_modules/_global/lib";
import { PemberitahuanMaksimalFile } from "@/app_modules/_global/lib/max_size";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global"; import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global";
import { import {
AspectRatio, AspectRatio,
@@ -26,13 +29,14 @@ import { IconAt, IconCamera, IconUpload } from "@tabler/icons-react";
import { useState } from "react"; import { useState } from "react";
import { gmailRegex } from "../../component/regular_expressions"; import { gmailRegex } from "../../component/regular_expressions";
import { Profile_ComponentCreateNewProfile } from "../_component"; import { Profile_ComponentCreateNewProfile } from "../_component";
import { PemberitahuanMaksimalFile } from "@/app_modules/_global/lib/max_size";
export default function CreateProfile() { export default function CreateProfile() {
const [filePP, setFilePP] = useState<File | null>(null); const [filePP, setFilePP] = useState<File | null>(null);
const [imgPP, setImgPP] = useState<any | null>(); const [imgPP, setImgPP] = useState<any | null>();
const [fileBG, setFileBG] = useState<File | null>(null); const [fileBG, setFileBG] = useState<File | null>(null);
const [imgBG, setImgBG] = useState<any | null>(); const [imgBG, setImgBG] = useState<any | null>();
const [fotoProfileId, setFotoProfileId] = useState("");
const [backgroundProfileId, setBackgroundProfileId] = useState("");
const [value, setValue] = useState({ const [value, setValue] = useState({
name: "", name: "",
@@ -92,8 +96,20 @@ export default function CreateProfile() {
PemberitahuanMaksimalFile PemberitahuanMaksimalFile
); );
} else { } else {
setImgPP(buffer); const uploadPhoto = await funGlobal_UploadToStorage({
setFilePP(files); file: files,
dirId: DIRECTORY_ID.profile_foto,
});
if (uploadPhoto.success) {
setFotoProfileId(uploadPhoto.data.id);
setImgPP(buffer);
setFilePP(files);
} else {
ComponentGlobal_NotifikasiPeringatan(
"Gagal upload foto profile"
);
}
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
@@ -154,8 +170,20 @@ export default function CreateProfile() {
PemberitahuanMaksimalFile PemberitahuanMaksimalFile
); );
} else { } else {
setImgBG(buffer); const uploadBackground = await funGlobal_UploadToStorage({
setFileBG(files); file: files,
dirId: DIRECTORY_ID.profile_background,
});
if (uploadBackground.success) {
setBackgroundProfileId(uploadBackground.data.id);
setImgBG(buffer);
setFileBG(files);
} else {
ComponentGlobal_NotifikasiPeringatan(
"Gagal upload background profile"
);
}
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
@@ -256,8 +284,10 @@ export default function CreateProfile() {
<Profile_ComponentCreateNewProfile <Profile_ComponentCreateNewProfile
value={value as any} value={value as any}
filePP={filePP as any} // filePP={filePP as any}
fileBG={fileBG as any} // fileBG={fileBG as any}
fotoProfileId={fotoProfileId}
backgroundProfileId={backgroundProfileId}
/> />
</Stack> </Stack>
</Stack> </Stack>