Deskripsi:
- Upload foto profil ke storage
- Upload background profile ke storge
## No Issue
This commit is contained in:
2024-09-25 14:04:18 +08:00
parent 5670feb08c
commit 827b7c7bc1
54 changed files with 812 additions and 936 deletions

View File

@@ -0,0 +1,63 @@
"use client";
import ComponentGlobal_Loader from "@/app_modules/_global/component/loader";
import { Avatar, Center } from "@mantine/core";
import { useShallowEffect } from "@mantine/hooks";
import { useState } from "react";
export function Home_ComponentAvatarProfile({ url }: { url: string }) {
const [isImage, setIsImage] = useState<boolean | null>(null);
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) {
<Center>
<ComponentGlobal_Loader />
</Center>;
}
if (!isImage) {
return (
<>
<Avatar
radius={"xl"}
size={25}
sx={{
borderStyle: "solid",
borderWidth: "0.5px",
borderColor: "white",
}}
/>
</>
);
}
return (
<>
<Avatar
radius={"xl"}
size={25}
sx={{
borderStyle: "solid",
borderWidth: "0.5px",
borderColor: "white",
}}
src={url}
/>
</>
);
}

View File

@@ -0,0 +1,3 @@
import { Home_ComponentAvatarProfile } from "./comp_avatar_profile";
export { Home_ComponentAvatarProfile };

View File

@@ -43,6 +43,8 @@ import { MODEL_JOB } from "@/app_modules/job/model/interface";
import { RouterForum } from "@/app/lib/router_hipmi/router_forum";
import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog";
import { RouterMap } from "@/app/lib/router_hipmi/router_map";
import { Home_ComponentAvatarProfile } from "./comp_avatar_profile";
import { APIs } from "@/app/lib";
export function Home_UiView({
dataUser,
@@ -341,18 +343,11 @@ export function Home_UiFooter({ dataUser }: { dataUser: MODEL_USER }) {
) : isLoadingProfil ? (
<Loader color={AccentColor.yellow} size={20} />
) : (
<Avatar
radius={"xl"}
size={25}
sx={{
borderStyle: "solid",
borderWidth: "0.5px",
borderColor: "white",
}}
src={
RouterProfile.api_foto_profile +
`${dataUser?.Profile.imagesId}`
}
<Home_ComponentAvatarProfile
url={APIs.GET({
fileId: dataUser?.Profile?.imageId as string,
size: "50"
})}
/>
)}
</ActionIcon>