fix (upload image)

deskripsi:
- upload image di portofolio
This commit is contained in:
2025-01-08 15:18:33 +08:00
parent a45e24efe4
commit 5dbecae360
17 changed files with 557 additions and 428 deletions

View File

@@ -18,10 +18,11 @@ import { Home_ComponentAvatarProfile } from "./comp_avatar_profile";
import { listMenuHomeFooter } from "./list_menu_home";
import { MainColor } from "@/app_modules/_global/color";
import { clientLogger } from "@/util/clientLogger";
import CustomSkeleton from "@/app_modules/components/CustomSkeleton";
export default function FooterHome() {
const router = useRouter();
const [dataUser, setDataUser] = useState<any>({});
const [dataUser, setDataUser] = useState<any | null>(null);
useShallowEffect(() => {
cekUserLogin();
@@ -36,7 +37,7 @@ export default function FooterHome() {
setDataUser(response.data);
}
} catch (error) {
clientLogger.error("Error get data profile",error);
clientLogger.error("Error get data profile", error);
}
}
@@ -50,84 +51,101 @@ export default function FooterHome() {
bottom={0}
h={"9vh"}
>
<SimpleGrid cols={listMenuHomeFooter.length + 1}>
{listMenuHomeFooter.map((e) => (
<Center h={"9vh"} key={e.id}>
{dataUser?.profile === undefined || dataUser?.profile === null ? (
<SimpleGrid cols={4}>
{Array.from(new Array(4)).map((_, i) => (
<Center h={"9vh"} key={i}>
<Stack align="center">
<CustomSkeleton radius={"lg"} height={40} w={40} />
</Stack>
</Center>
))}
</SimpleGrid>
) : (
<SimpleGrid cols={listMenuHomeFooter.length + 1}>
{listMenuHomeFooter.map((e) => (
<Center h={"9vh"} key={e.id}>
<Stack
align="center"
spacing={0}
onClick={() => {
if (
dataUser.profile === undefined ||
dataUser?.profile === null
) {
return null;
} else if (
dataUser.profile === undefined ||
dataUser?.profile === null
) {
router.push(RouterProfile.create, { scroll: false });
} else {
if (e.link == "") {
ComponentGlobal_NotifikasiPeringatan("Cooming Soon");
} else {
router.push(e.link, { scroll: false });
}
}
}}
>
<ActionIcon
radius={"xl"}
c={e.link === "" ? "gray" : MainColor.white}
variant="transparent"
>
{e.icon}
</ActionIcon>
<Text
lineClamp={1}
c={e.link === "" ? "gray" : MainColor.white}
fz={12}
>
{e.name}
</Text>
</Stack>
</Center>
))}
<Center h={"9vh"}>
<Stack
align="center"
spacing={0}
spacing={2}
onClick={() => {
if (
dataUser.profile === undefined ||
dataUser?.profile === null
) {
return null;
} else if (
dataUser.profile === undefined ||
dataUser?.profile === null
) {
router.push(RouterProfile.create, { scroll: false });
} else {
if (e.link == "") {
ComponentGlobal_NotifikasiPeringatan("Cooming Soon");
} else {
router.push(e.link, { scroll: false });
}
router.push(
RouterProfile.katalogOLD + `${dataUser?.profile}`,
{
scroll: false,
}
);
}
}}
>
<ActionIcon
radius={"xl"}
c={e.link === "" ? "gray" : MainColor.white}
variant="transparent"
>
{e.icon}
<ActionIcon variant={"transparent"}>
{dataUser.profile === undefined ||
dataUser?.profile === null ? (
<IconUserCircle color={MainColor.white} />
) : (
<Home_ComponentAvatarProfile
url={APIs.GET({
fileId: dataUser?.imageId as string,
size: "50",
})}
/>
)}
</ActionIcon>
<Text lineClamp={1} c={e.link === "" ? "gray" : MainColor.white} fz={12}>
{e.name}
<Text fz={10} c={MainColor.white}>
Profile
</Text>
</Stack>
</Center>
))}
<Center h={"9vh"}>
<Stack
align="center"
spacing={2}
onClick={() => {
if (
dataUser.profile === undefined ||
dataUser?.profile === null
) {
router.push(RouterProfile.create, { scroll: false });
} else {
router.push(RouterProfile.katalogOLD + `${dataUser?.profile}`, {
scroll: false,
});
}
}}
>
<ActionIcon
variant={"transparent"}>
{dataUser.profile === undefined || dataUser?.profile === null ? (
<IconUserCircle color={MainColor.white} />
) : (
<Home_ComponentAvatarProfile
url={APIs.GET({
fileId: dataUser?.imageId as string,
size: "50",
})}
/>
)}
</ActionIcon>
<Text fz={10} c={MainColor.white}>
Profile
</Text>
</Stack>
</Center>
</SimpleGrid>
</SimpleGrid>
)}
</Box>
);
}

View File

@@ -18,11 +18,12 @@ import BodyHome from "./component/body_home";
import FooterHome from "./component/footer_home";
import { apiGetDataHome } from "./fun/get/api_home";
import { clientLogger } from "@/util/clientLogger";
import CustomSkeleton from "../components/CustomSkeleton";
export default function HomeViewNew() {
const [countNtf, setCountNtf] = useAtom(gs_count_ntf);
const [newUserNtf, setNewUserNtf] = useAtom(gs_user_ntf);
const [dataUser, setDataUser] = useState<any>({});
const [dataUser, setDataUser] = useState<any | null>(null);
const [categoryPage, setCategoryPage] = useAtom(gs_notifikasi_kategori_app);
const router = useRouter();
@@ -67,61 +68,69 @@ export default function HomeViewNew() {
<UIGlobal_LayoutHeaderTamplate
title="HIPMI"
customButtonLeft={
<ActionIcon
radius={"xl"}
disabled={countNtf == null}
variant={"transparent"}
onClick={() => {
if (
dataUser.profile != undefined ||
dataUser?.profile != null
) {
router.push(RouterUserSearch.main, { scroll: false });
} else {
router.push(RouterProfile.create, { scroll: false });
}
}}
>
<IconUserSearch color={MainColor.white} />
</ActionIcon>
dataUser?.profile == null ? (
<CustomSkeleton width={20} height={20} circle />
) : (
<ActionIcon
radius={"xl"}
disabled={countNtf == null}
variant={"transparent"}
onClick={() => {
if (
dataUser.profile != undefined ||
dataUser?.profile != null
) {
router.push(RouterUserSearch.main, { scroll: false });
} else {
router.push(RouterProfile.create, { scroll: false });
}
}}
>
<IconUserSearch color={MainColor.white} />
</ActionIcon>
)
}
customButtonRight={
<ActionIcon
variant="transparent"
disabled={countNtf == null}
onClick={() => {
if (
dataUser.profile != undefined ||
dataUser?.profile != null
) {
setCategoryPage("Semua");
router.push(
RouterNotifikasi.categoryApp({ name: "semua" }),
{
scroll: false,
}
);
} else {
router.push(RouterProfile.create, { scroll: false });
}
}}
>
{countNtf != null && countNtf > 0 ? (
<Indicator
processing
color={MainColor.yellow}
label={
<Text fz={10} c={MainColor.darkblue}>
{countNtf > 99 ? "99+" : countNtf}
</Text>
dataUser?.profile == null ? (
<CustomSkeleton width={20} height={20} circle />
) : (
<ActionIcon
variant="transparent"
disabled={countNtf == null}
onClick={() => {
if (
dataUser.profile != undefined ||
dataUser?.profile != null
) {
setCategoryPage("Semua");
router.push(
RouterNotifikasi.categoryApp({ name: "semua" }),
{
scroll: false,
}
);
} else {
router.push(RouterProfile.create, { scroll: false });
}
>
}}
>
{countNtf != null && countNtf > 0 ? (
<Indicator
processing
color={MainColor.yellow}
label={
<Text fz={10} c={MainColor.darkblue}>
{countNtf > 99 ? "99+" : countNtf}
</Text>
}
>
<IconBell color={MainColor.white} />
</Indicator>
) : (
<IconBell color={MainColor.white} />
</Indicator>
) : (
<IconBell color={MainColor.white} />
)}
</ActionIcon>
)}
</ActionIcon>
)
}
/>
}