diff --git a/public/aset/global/main_background.png b/public/aset/global/main_background.png new file mode 100644 index 00000000..bc2282b7 Binary files /dev/null and b/public/aset/global/main_background.png differ diff --git a/src/app/dev/event/splash/page.tsx b/src/app/dev/event/splash/page.tsx index 8a50c2da..1c7128cd 100644 --- a/src/app/dev/event/splash/page.tsx +++ b/src/app/dev/event/splash/page.tsx @@ -2,7 +2,7 @@ import { Event_SplashScreen } from "@/app_modules/event"; export default async function Page() { // await new Promise((a, b) => { - // setTimeout(a, 1000); + // setTimeout(a, 3000); // }); return ; } diff --git a/src/app/dev/home/loading.tsx b/src/app/dev/home/loading.tsx index b1f8b62f..623b464d 100644 --- a/src/app/dev/home/loading.tsx +++ b/src/app/dev/home/loading.tsx @@ -3,7 +3,7 @@ import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loadi export default async function Page() { return ( <> - + {/* */} ); } diff --git a/src/app/dev/home/page.tsx b/src/app/dev/home/page.tsx index c27b1df5..e70705ff 100644 --- a/src/app/dev/home/page.tsx +++ b/src/app/dev/home/page.tsx @@ -1,17 +1,15 @@ -import { HomeView } from "@/app_modules/home"; -import { cookies } from "next/headers"; -import { unsealData } from "iron-session"; -import _ from "lodash"; -import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token"; -import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id"; -import { redirect } from "next/navigation"; import { RouterAdminDashboard } from "@/app/lib/router_hipmi/router_admin"; import { RouterHome } from "@/app/lib/router_hipmi/router_home"; -import ComponentGlobal_V2_LoadingPage from "@/app_modules/component_global/loading_page_v2"; +import { user_getOneUserId } from "@/app_modules/fun_global/get_user_token"; +import { HomeView } from "@/app_modules/home"; +import { user_getOneByUserId } from "@/app_modules/home/fun/get/get_one_user_by_id"; +import { job_getTwoForHomeView } from "@/app_modules/job/fun/get/get_two_for_home_view"; +import { redirect } from "next/navigation"; export default async function Page() { const userId = await user_getOneUserId(); const dataUser = await user_getOneByUserId(userId); + const dataJob = await job_getTwoForHomeView(); if (dataUser?.active === false) { return redirect(RouterHome.home_user_non_active); @@ -23,12 +21,12 @@ export default async function Page() { // if (dataUser?.Profile === null) return ; // await new Promise((a, b) => { - // setTimeout(a, 4000); + // setTimeout(a, 3000); // }); return ( <> - + ); } diff --git a/src/app/zCoba/page.tsx b/src/app/zCoba/page.tsx index 4a504557..d171ef0a 100644 --- a/src/app/zCoba/page.tsx +++ b/src/app/zCoba/page.tsx @@ -1,9 +1,16 @@ import Coba_TestLoading from "@/app_modules/zCoba"; export default async function Page() { + + + await new Promise((a, b) => { + setTimeout(a, 3000); + }); + return ( <> + ); } diff --git a/src/app_modules/component_global/is_empty_data.tsx b/src/app_modules/component_global/is_empty_data.tsx index 5f2262d7..f7418471 100644 --- a/src/app_modules/component_global/is_empty_data.tsx +++ b/src/app_modules/component_global/is_empty_data.tsx @@ -2,10 +2,20 @@ import { Center } from "@mantine/core"; -export default function ComponentGlobal_IsEmptyData({ text }: { text: string }) { +export default function ComponentGlobal_IsEmptyData({ + text, + height, +}: { + text: string; + height?: number}) { return ( <> -
+
{text}
diff --git a/src/app_modules/component_global/loading_page_v2.tsx b/src/app_modules/component_global/loading_page_v2.tsx index d05c5d3d..a36ab160 100644 --- a/src/app_modules/component_global/loading_page_v2.tsx +++ b/src/app_modules/component_global/loading_page_v2.tsx @@ -1,43 +1,56 @@ "use client"; -import { Box, Center, Group, LoadingOverlay, Skeleton, Text } from "@mantine/core"; +import { + Box, + Center, + Group, + LoadingOverlay, + Skeleton, + Text, +} from "@mantine/core"; +import { MainColor } from "./color/color_pallet"; export default function ComponentGlobal_V2_LoadingPage() { -const listhHuruf = [ - { - huruf: "H", - }, - { - huruf: "I", - }, - { - huruf: "P", - }, - { - huruf: "M", - }, - { - huruf: "I", - }, -]; -const customLOader = ( -
- - {listhHuruf.map((e, i) => ( -
- - - {e.huruf} - -
- ))} -
-
-); + const listhHuruf = [ + { + huruf: "H", + }, + { + huruf: "I", + }, + { + huruf: "P", + }, + { + huruf: "M", + }, + { + huruf: "I", + }, + ]; + const customLOader = ( +
+ + {listhHuruf.map((e, i) => ( +
+ + + {e.huruf} + +
+ ))} +
+
+ ); -return ( - <> - - -); + return ( + <> + + + ); } diff --git a/src/app_modules/home/layout.tsx b/src/app_modules/home/layout.tsx index 090698df..75784e11 100644 --- a/src/app_modules/home/layout.tsx +++ b/src/app_modules/home/layout.tsx @@ -3,6 +3,7 @@ import { ActionIcon, AppShell, Avatar, + BackgroundImage, Box, Center, Flex, @@ -12,6 +13,8 @@ import { Header, Indicator, Loader, + Paper, + ScrollArea, SimpleGrid, Stack, Text, @@ -25,6 +28,9 @@ import { IconQrcode, IconUserCircle, IconBell, + IconMessages, + IconShoppingBag, + IconMap2, } from "@tabler/icons-react"; import { Logout } from "../auth"; import { RouterProfile } from "@/app/lib/router_hipmi/router_katalog"; @@ -38,6 +44,8 @@ import { RouterNotifikasi } from "@/app/lib/router_hipmi/router_notifikasi"; import { useShallowEffect } from "@mantine/hooks"; import notifikasi_countUserNotifikasi from "../notifikasi/fun/count/fun_count_by_id"; import mqtt_client from "@/util/mqtt_client"; +import { AccentColor, MainColor } from "../component_global/color/color_pallet"; +import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; export default function HomeLayout({ dataUser, @@ -50,13 +58,38 @@ export default function HomeLayout({ }) { const router = useRouter(); // const [user, setUser] = useState(dataUser); - const [loadingProfil, setLoadingProfile] = useState(false); - const [loadingUS, setLoadingUS] = useState(false); + const [idLoadingProfil, setIsLoadingProfile] = useState(false); + const [isLoadingUS, setIsLoadingUS] = useState(false); + const [isLoadingBell, setIsLoadingBell] = useState(false); + const [isLoadingPage, setIsLoadingPage] = useState(false); + const [pageId, setPageId] = useState(0); + const [countNotif, setCountNotif] = useState(countNotifikasi); + const listHalamanFooter = [ + { + id: 1, + name: "Forums", + icon: , + link: RouterForum.splash, + }, + + { + id: 2, + name: "MarketPlace", + icon: , + link: "", + }, + { + id: 3, + name: "Business Maps", + icon: , + link: "", + }, + ]; + useShallowEffect(() => { mqtt_client.subscribe("USER"); - // mqtt_client.subscribe("Notifikasi_forum_create_komentar"); mqtt_client.on("message", (topic: any, message: any) => { console.log(topic); @@ -81,99 +114,166 @@ export default function HomeLayout({ return ( <> - + {/* Header */} - + { + if (dataUser?.Profile === null) { + ComponentGlobal_NotifikasiPeringatan("Lengkapi Profile"); + } else { + setIsLoadingUS(true); + router.push(RouterUserSearch.main); + } + }} + > + {isLoadingUS ? ( + + ) : ( + + )} + +
- + <Title order={4} c={MainColor.yellow}> HIPMI
{ - router.push(RouterNotifikasi.main); + if (dataUser?.Profile === null) { + ComponentGlobal_NotifikasiPeringatan("Lengkapi Profile"); + } else { + router.push(RouterNotifikasi.main); + setIsLoadingBell(true); + } }} > - {countNotif}}> - - + {isLoadingBell ? ( + + ) : ( + {countNotif}} + > + + + )}
{/* Children */} - - + + + + {/* {Array(10) + .fill(0) + .map((e, i) => ( + + {i + 1} + + ))} */} {children} - - + + + {/* + {children} + + */} + {/* Footer */} - -
- {loadingUS ? ( -
- -
- ) : ( -
- { - if (dataUser?.Profile === null) { - ComponentGlobal_NotifikasiPeringatan( - "Lengkapi Profile" - ); - } else { - setLoadingUS(true); - // router.push(RouterProfile.katalog + `${user.Profile.id}`); - router.push(RouterUserSearch.main); - } - }} - > - - + + {listHalamanFooter.map((e, i) => ( +
+ {isLoadingPage && e.id === pageId ? ( +
+ +
+ ) : ( + + { + if (dataUser?.Profile === null) { + ComponentGlobal_NotifikasiPeringatan( + "Lengkapi Profile" + ); + } else { + e.link === "" + ? ComponentGlobal_NotifikasiPeringatan( + "Cooming Soon" + ) + : (router.push(e.link), + setIsLoadingPage(true), + setPageId(e?.id)); + } + }} + > + {e.icon} - - Temukan pengguna + + {e.name} -
- )} -
+ )} +
+ ))}
- {loadingProfil ? ( + {idLoadingProfil ? (
- +
) : (
@@ -181,7 +281,7 @@ export default function HomeLayout({ align="center" spacing={2} onClick={() => { - setLoadingProfile(true); + setIsLoadingProfile(true); if (dataUser?.Profile === null) { router.push(RouterProfile.create); } else { @@ -219,7 +319,7 @@ export default function HomeLayout({
- + ); } diff --git a/src/app_modules/home/view.tsx b/src/app_modules/home/view.tsx index ea4403ec..21ce749b 100644 --- a/src/app_modules/home/view.tsx +++ b/src/app_modules/home/view.tsx @@ -2,14 +2,19 @@ import { ActionIcon, + BackgroundImage, Box, Center, Flex, + Group, Image, Loader, LoadingOverlay, Paper, + ScrollArea, SimpleGrid, + Skeleton, + Stack, Text, ThemeIcon, Title, @@ -25,6 +30,7 @@ import { IconPresentation, IconShoppingBag, IconUserCircle, + IconUserSearch, } from "@tabler/icons-react"; import toast from "react-simple-toasts"; @@ -41,27 +47,35 @@ import { useDisclosure } from "@mantine/hooks"; import { RouterForum } from "@/app/lib/router_hipmi/router_forum"; import ComponentGlobal_V2_LoadingPage from "../component_global/loading_page_v2"; import { RouterColab } from "@/app/lib/router_hipmi/router_colab"; +import { AccentColor, MainColor } from "../component_global/color/color_pallet"; +import { MODEL_JOB } from "../job/model/interface"; +import _ from "lodash"; +import ComponentGlobal_IsEmptyData from "../component_global/is_empty_data"; -export default function HomeView({ dataUser }: { dataUser: MODEL_USER }) { +export default function HomeView({ + dataUser, + dataJob, +}: { + dataUser: MODEL_USER; + dataJob: MODEL_JOB[]; +}) { const router = useRouter(); - // const [stateUser, setStateUser] = useState(user); const [loading, setLoading] = useState(false); const [visible, { toggle }] = useDisclosure(false); - const listHalaman = [ + const listPageOnBox = [ { id: 1, - name: "Forums", - icon: , - link: RouterForum.splash, - }, - - { - id: 2, name: "Event", icon: , link: RouterEvent.splash, }, + { + id: 2, + name: "Project Collaboration", + icon: , + link: RouterColab.splash, + }, { id: 3, @@ -69,51 +83,38 @@ export default function HomeView({ dataUser }: { dataUser: MODEL_USER }) { icon: , link: RouterVote.splash, }, + { id: 4, - name: "Project Collaboration", - icon: , - link: RouterColab.splash, - }, - { - id: 5, name: "Crowd Funding", icon: , link: `/dev/crowd/splash`, }, - { - id: 6, - name: "Job Vacancy", - icon: , - link: RouterJob.spalsh, - }, - { - id: 7, - name: "Business Maps", - icon: , - link: "", - }, - - { - id: 8, - name: "Marketplace", - icon: , - link: "", - }, ]; + const routePageJob = { + name: "Job Vacancy", + icon: , + link: RouterJob.spalsh, + }; + return ( <> {visible ? : ""} - - - logo + + + logo - {/*
{JSON.stringify(stateUser, null, 2)}
*/} - - + - {listHalaman.map((e, i) => ( + {listPageOnBox.map((e, i) => ( { if (dataUser.Profile === null) { return ComponentGlobal_NotifikasiPeringatan( @@ -145,27 +150,89 @@ export default function HomeView({ dataUser }: { dataUser: MODEL_USER }) { } }} > - + {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 { + toggle(); + return router.push(routePageJob.link); + } + } + }} + > + + + {routePageJob.icon} + + + {routePageJob.name} + + + + {_.isEmpty(dataJob) ? ( + + ) : ( + + {dataJob.map((e, i) => ( + + + + + + + + {e?.Author.username} + + + {e?.title} + + + + + ))} + + )} + + + ); diff --git a/src/app_modules/job/fun/get/get_two_for_home_view.ts b/src/app_modules/job/fun/get/get_two_for_home_view.ts new file mode 100644 index 00000000..e1a0fd6a --- /dev/null +++ b/src/app_modules/job/fun/get/get_two_for_home_view.ts @@ -0,0 +1,28 @@ +"use server"; + +import prisma from "@/app/lib/prisma"; + +export async function job_getTwoForHomeView() { + const get = await prisma.job.findMany({ + take: 2, + orderBy: { + createdAt: "desc", + }, + where: { + isActive: true, + }, + select: { + id: true, + Author: { + select: { + id: true, + username: true, + }, + }, + title: true, + deskripsi: true + }, + }); + + return get; +} diff --git a/src/app_modules/zCoba/index.tsx b/src/app_modules/zCoba/index.tsx index ae664453..2d2f6607 100644 --- a/src/app_modules/zCoba/index.tsx +++ b/src/app_modules/zCoba/index.tsx @@ -1,6 +1,7 @@ "use client"; import { + BackgroundImage, Box, Button, Center, @@ -21,6 +22,7 @@ import { v4 as uuidv4 } from "uuid"; import { useShallowEffect } from "@mantine/hooks"; import { ScrollOnly } from "next-scroll-loader"; import _ from "lodash"; +import ComponentGlobal_V2_LoadingPage from "../component_global/loading_page_v2"; const newData = Array(20) .fill(0) @@ -70,6 +72,27 @@ export default function Coba_TestLoading() { const [data, setData] = useState(data2); + return ( + <> + + Apa + + + ); + + return ( + <> + + {Array(50) + .fill(0) + .map((e, i) => ( + {i + 1} + ))} + + + + ); + return ( <>