Deskripsi:
- Upload ke stroage untuk job
## Np Issuee
This commit is contained in:
2024-09-19 15:59:21 +08:00
parent 128dc98839
commit f96d80d55d
153 changed files with 1369 additions and 1200 deletions

View File

@@ -3,7 +3,15 @@
import { RouterJob } from "@/app/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 {
Affix,
Button,
Center,
Loader,
rem,
Stack,
TextInput,
} from "@mantine/core";
import { IconSearch } from "@tabler/icons-react";
import _ from "lodash";
import { ScrollOnly } from "next-scroll-loader";
@@ -11,11 +19,15 @@ import { useState } from "react";
import ComponentJob_BerandaCardView from "../../component/beranda/card_view";
import { job_getAllListPublish } from "../../fun/get/get_all_publish";
import { MODEL_JOB } from "../../model/interface";
import { useShallowEffect } from "@mantine/hooks";
import mqtt_client from "@/util/mqtt_client";
import { Job_ComponentButtonUpdateBeranda } from "../../component";
export function Job_UiBeranda({ listData }: { listData: MODEL_JOB[] }) {
const [data, setData] = useState(listData);
const [activePage, setActivePage] = useState(1);
const [isSearch, setIsSearch] = useState("");
const [isNewPost, setIsNewPost] = useState(false);
async function onSearch(text: string) {
setIsSearch(text);
@@ -27,21 +39,45 @@ export function Job_UiBeranda({ listData }: { listData: MODEL_JOB[] }) {
setActivePage(1);
}
useShallowEffect(() => {
onLoadNewData({
onLoad(val) {
setData(val);
},
});
mqtt_client.subscribe("Job_new_post");
mqtt_client.on("message", (topic, message) => {
if (topic === "Job_new_post") {
setIsNewPost(true);
}
});
}, [setIsNewPost, setData]);
async function onLoadNewData({ onLoad }: { onLoad: (val: any) => void }) {
const loadData = await job_getAllListPublish({ page: 1 });
onLoad(loadData);
}
return (
<>
<Stack my={1} spacing={30}>
{/* <ComponentJob_CreateButton /> */}
<ComponentGlobal_CreateButton path={RouterJob.create}/>
{isNewPost && (
<Job_ComponentButtonUpdateBeranda
onSetIsNewPost={(val) => setIsNewPost(val)}
onSetData={(val) => setData(val)}
/>
)}
<ComponentGlobal_CreateButton path={RouterJob.create} />
<TextInput
style={{
position: "sticky",
top: 0,
zIndex: 99,
}}
radius={"xl"}
icon={<IconSearch/>}
icon={<IconSearch />}
placeholder="Pekerjaan apa yang anda cari ?"
onChange={(val) => {
onSearch(val.currentTarget.value);