diff --git a/CHANGELOG.md b/CHANGELOG.md index 3613783e..a37c6198 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. +## [1.2.74](https://github.com/bipproduction/hipmi/compare/v1.2.73...v1.2.74) (2025-03-07) + ## [1.2.73](https://github.com/bipproduction/hipmi/compare/v1.2.72...v1.2.73) (2025-03-06) ## [1.2.72](https://github.com/bipproduction/hipmi/compare/v1.2.71...v1.2.72) (2025-03-05) diff --git a/package.json b/package.json index def29541..851124e4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hipmi", - "version": "1.2.73", + "version": "1.2.74", "private": true, "prisma": { "seed": "bun prisma/seed.ts" diff --git a/src/app/dev/job/main/layout.tsx b/src/app/dev/job/main/layout.tsx index 337a18bc..1d810b6a 100644 --- a/src/app/dev/job/main/layout.tsx +++ b/src/app/dev/job/main/layout.tsx @@ -1,4 +1,5 @@ import { LayoutJob_Main } from "@/app_modules/job"; +import NewLayoutJob_Main from "@/app_modules/job/main/new_layout"; import React from "react"; export default async function Layout({ @@ -8,7 +9,8 @@ export default async function Layout({ }) { return ( <> - {children} + {/* {children} */} + {children} ); } diff --git a/src/app_modules/_global/ui/new_ui_footer.tsx b/src/app_modules/_global/ui/new_ui_footer.tsx index 7f48957e..645dd94f 100644 --- a/src/app_modules/_global/ui/new_ui_footer.tsx +++ b/src/app_modules/_global/ui/new_ui_footer.tsx @@ -1,4 +1,4 @@ -import { Box } from "@mantine/core"; +import { Box, rem } from "@mantine/core"; import { AccentColor } from "../color"; export function NewUI_Footer({ children }: { children: React.ReactNode }) { @@ -19,6 +19,8 @@ export function NewUI_Footer({ children }: { children: React.ReactNode }) { justifyContent: "center", maxWidth: "500px", // Batasi lebar maksimum untuk tampilan mobile margin: "0 auto", // Pusatkan di tengah layar desktop + borderRadius: "20px 20px 0px 0px", + width: "100%", }} > {children} diff --git a/src/app_modules/_global/ui/new_ui_tamplate.tsx b/src/app_modules/_global/ui/new_ui_tamplate.tsx index aeff2adb..0ce2c583 100644 --- a/src/app_modules/_global/ui/new_ui_tamplate.tsx +++ b/src/app_modules/_global/ui/new_ui_tamplate.tsx @@ -10,22 +10,23 @@ export function NewUI_Tamplate({ children }: { children: React.ReactNode }) { width: "100%", height: "100vh", overflow: "hidden", - backgroundColor: MainColor.black, + backgroundColor: MainColor.darkblue, position: "relative", maxWidth: "500px", // Batasi lebar maksimum untuk tampilan mobile margin: "0 auto", // Pusatkan di tengah layar desktop border: "1px solid #ccc", // Garis tepi untuk visualisasi }} > - {children} - + ); } diff --git a/src/app_modules/job/main/beranda/view.back.txt b/src/app_modules/job/main/beranda/view.back.txt new file mode 100644 index 00000000..184d2495 --- /dev/null +++ b/src/app_modules/job/main/beranda/view.back.txt @@ -0,0 +1,157 @@ +"use client"; + +import { gs_jobTiggerBeranda } from "@/lib/global_state"; +import { RouterJob } from "@/lib/router_hipmi/router_job"; +import ComponentGlobal_CreateButton from "@/app_modules/_global/component/button_create"; +import ComponentGlobal_IsEmptyData from "@/app_modules/_global/component/is_empty_data"; +import { Center, Loader, Stack, TextInput } from "@mantine/core"; +import { useShallowEffect } from "@mantine/hooks"; +import { IconSearch } from "@tabler/icons-react"; +import { useAtom } from "jotai"; +import _ from "lodash"; +import { ScrollOnly } from "next-scroll-loader"; +import { useState } from "react"; +import { + Job_ComponentButtonUpdateBeranda, + Job_ComponentSkeletonBeranda, +} from "../../component"; +import ComponentJob_BerandaCardView from "../../component/beranda/card_view"; +import { MODEL_JOB } from "../../model/interface"; +import { apiGetJob } from "../../component/api_fetch_job"; +import { clientLogger } from "@/util/clientLogger"; + +export default function Job_ViewBeranda() { + const [data, setData] = useState([]); + const [activePage, setActivePage] = useState(1); + const [isSearch, setIsSearch] = useState(""); + const [hasMore, setHasMore] = useState(true); + const [isLoading, setIsLoading] = useState(false); + + // Notifikasi + const [isShowUpdate, setIsShowUpdate] = useState(false); + const [isTriggerJob, setIsTriggerJob] = useAtom(gs_jobTiggerBeranda); + + useShallowEffect(() => { + if (isTriggerJob == true) { + setIsShowUpdate(true); + } + }, [isTriggerJob]); + + useShallowEffect(() => { + setIsTriggerJob(false); + setIsShowUpdate(false); + onLoadNewData(); + }, [isSearch]); + + async function onSearch(text: string) { + setIsSearch(text); + setActivePage(1); + setHasMore(true); + } + + async function onLoadNewData() { + try { + setIsLoading(true); + const response = await apiGetJob({ + page: `${activePage}`, + search: isSearch, + }); + + if (response.success) { + setData(response.data); + setActivePage(1); + setHasMore(response.data.length > 0); + } else { + setData([]); + setHasMore(false); + } + } catch (error) { + clientLogger.error("Error get job", error); + setData([]); + setHasMore(false); + } finally { + setIsLoading(false); + } + } + + const handleMoreData = async () => { + if (!hasMore || isLoading) return null; + + try { + const nextPage = activePage + 1; + + const response = await apiGetJob({ + page: `${nextPage}`, + search: isSearch, + }); + + if (response?.data && response.data.length > 0) { + setActivePage(nextPage); + setHasMore(response.data.length > 0); + return response.data; + } else { + setHasMore(false); + return null; + } + } catch (error) { + clientLogger.error("Error get job", error); + setHasMore(false); + return null; + } + }; + + return ( + <> + + {isShowUpdate && ( + { + setIsShowUpdate(val); + setIsTriggerJob(val); + }} + onSetData={(val: any[]) => { + setData(val); + }} + /> + )} + + + + } + placeholder="Pekerjaan apa yang anda cari ?" + onChange={(val) => { + onSearch(val.currentTarget.value); + }} + /> + + {!data?.length && isLoading ? ( + + ) : _.isEmpty(data) ? ( + + ) : ( + // --- Main component --- // + ( +
+ +
+ )} + data={data} + setData={setData as any} + moreData={handleMoreData} + > + {(item) => } +
+ )} +
+ + ); +} diff --git a/src/app_modules/job/main/beranda/view_beranda.tsx b/src/app_modules/job/main/beranda/view_beranda.tsx index 915f0c21..184d2495 100644 --- a/src/app_modules/job/main/beranda/view_beranda.tsx +++ b/src/app_modules/job/main/beranda/view_beranda.tsx @@ -102,7 +102,7 @@ export default function Job_ViewBeranda() { return ( <> - + {isShowUpdate && ( { diff --git a/src/app_modules/job/main/new_layout.tsx b/src/app_modules/job/main/new_layout.tsx new file mode 100644 index 00000000..28244456 --- /dev/null +++ b/src/app_modules/job/main/new_layout.tsx @@ -0,0 +1,98 @@ +"use client"; + +import { MainColor } from "@/app_modules/_global/color/color_pallet"; +import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global/notifikasi_peringatan"; +import { NewUI_Content } from "@/app_modules/_global/ui/new_ui_content"; +import { NewUI_Footer } from "@/app_modules/_global/ui/new_ui_footer"; +import { NewUI_Header } from "@/app_modules/_global/ui/new_ui_header"; +import { NewUI_Tamplate } from "@/app_modules/_global/ui/new_ui_tamplate"; +import { RouterHome } from "@/lib/router_hipmi/router_home"; +import { RouterJob } from "@/lib/router_hipmi/router_job"; +import { ActionIcon, SimpleGrid, Stack, Text } from "@mantine/core"; +import { IconHistory, IconHome, IconReservedLine } from "@tabler/icons-react"; +import { useAtom } from "jotai"; +import { useRouter } from "next/navigation"; +import React, { useState } from "react"; +import { gs_job_hot_menu } from "../global_state"; + +export default function NewLayoutJob_Main({ + children, +}: { + children: React.ReactNode; +}) { + const router = useRouter(); + const [hotMenuId, setHotMenuId] = useAtom(gs_job_hot_menu); + const [isLoading, setLoading] = useState(false); + + const listFooter = [ + { + id: 1, + name: "Beranda", + path: RouterJob.beranda, + icon: , + }, + + { + id: 2, + name: "Status", + path: RouterJob.status({ id: "1" }), + icon: , + }, + { + id: 3, + name: "Arsip", + path: RouterJob.arsip, + icon: , + }, + ]; + + return ( + <> + + + + {children} + + + + {listFooter.map((e, i) => ( + + + e.path === "" + ? ComponentGlobal_NotifikasiPeringatan("Cooming Soon") + : (router.replace(e.path), setHotMenuId(e.id)) + } + > + {e.icon} + + + {e.name} + + + ))} + + + + + {/* + } + footer={} + > + {children} + */} + + ); +}