"use client";
import { RouterColab } from "@/app/lib/router_hipmi/router_colab";
import { RouterEvent } from "@/app/lib/router_hipmi/router_event";
import { RouterJob } from "@/app/lib/router_hipmi/router_job";
import { RouterVote } from "@/app/lib/router_hipmi/router_vote";
import {
AccentColor,
MainColor,
} from "@/app_modules/_global/color/color_pallet";
import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan";
import {
Box,
Paper,
Stack,
SimpleGrid,
ActionIcon,
Loader,
Group,
Image,
Text,
Avatar,
Center,
} from "@mantine/core";
import {
IconPresentation,
IconAffiliate,
IconPackageImport,
IconHeartHandshake,
IconBriefcase,
IconUserSearch,
IconMap2,
IconMessages,
IconShoppingBag,
IconUserCircle,
} from "@tabler/icons-react";
import _ from "lodash";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { MODEL_USER } from "../model/interface";
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";
export function Home_UiView({
dataUser,
dataJob,
}: {
dataUser: MODEL_USER;
dataJob: MODEL_JOB[];
}) {
const router = useRouter();
const [isLoading, setIsLoading] = useState(false);
const [pageId, setPageId] = useState(0);
const [isLoadingJob, setLoadingJob] = useState(false);
const listPageOnBox = [
{
id: 1,
name: "Event",
icon: ,
link: RouterEvent.splash,
},
{
id: 2,
name: "Project Collaboration",
icon: ,
link: RouterColab.splash,
},
{
id: 3,
name: "Voting",
icon: ,
link: RouterVote.splash,
},
{
id: 4,
name: "Crowd Funding",
icon: ,
link: `/dev/crowd/splash`,
},
];
const routePageJob = {
name: "Job Vacancy",
icon: ,
link: RouterJob.spalsh,
};
return (
<>
{listPageOnBox.map((e, i) => (
{
if (dataUser.Profile === null) {
return ComponentGlobal_NotifikasiPeringatan(
"Lengkapi Data Profile"
);
} else {
if (e.link === "") {
return ComponentGlobal_NotifikasiPeringatan(
"Cooming Soon !!"
);
} else {
setIsLoading(true);
setPageId(e.id);
router.push(e.link, { scroll: false });
}
}
}}
>
{isLoading && e.id === pageId ? (
) : (
e.icon
)}
{e.name}
))}
{/* Job View */}
{
if (dataUser.Profile === null) {
return ComponentGlobal_NotifikasiPeringatan(
"Lengkapi Data Profile"
);
} else {
if (routePageJob.link === "") {
return ComponentGlobal_NotifikasiPeringatan(
"Cooming Soon !!"
);
} else {
setLoadingJob(true);
return router.push(routePageJob.link, { scroll: false });
}
}
}}
>
{isLoadingJob ? (
) : (
routePageJob.icon
)}
{routePageJob.name}
{_.isEmpty(dataJob) ? (
) : (
{dataJob.map((e, i) => (
{e?.Author.username}
{e?.title}
))}
)}
>
);
}
const listHalamanFooter = [
{
id: 1,
name: "Forums",
icon: ,
link: RouterForum.splash,
},
{
id: 2,
name: "MarketPlace",
icon: ,
link: "",
},
{
id: 3,
name: "Business Maps",
icon: ,
link: RouterMap.splash,
},
];
export function Home_UiFooter({ dataUser }: { dataUser: MODEL_USER }) {
const router = useRouter();
const [isLoadingProfil, setIsLoadingProfile] = useState(false);
const [isLoadingPage, setIsLoadingPage] = useState(false);
const [pageId, setPageId] = useState(0);
return (
<>
{listHalamanFooter.map((e, i) => (
{
if (dataUser?.Profile === null) {
ComponentGlobal_NotifikasiPeringatan("Lengkapi Profile");
} else {
e.link === ""
? ComponentGlobal_NotifikasiPeringatan("Cooming Soon")
: (router.push(e.link, { scroll: false }),
setIsLoadingPage(true),
setPageId(e?.id));
}
}}
>
{isLoadingPage && e.id === pageId ? (
) : (
e.icon
)}
{e.name}
))}
{
setIsLoadingProfile(true);
if (dataUser?.Profile === null) {
router.push(RouterProfile.create, { scroll: false });
} else {
router.push(
RouterProfile.katalog + `${dataUser?.Profile?.id}`,
{ scroll: false }
);
}
}}
>
{dataUser?.Profile === null ? (
) : isLoadingProfil ? (
) : (
)}
Profile
>
);
}