Fix: Event
Deksripsi - Fix notifikasi - Fix load beranda - Fix reload button di admin
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { gs_job_trigger } from "@/app/lib/global_state";
|
||||
import { gs_jobTiggerBeranda } from "@/app/lib/global_state";
|
||||
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";
|
||||
@@ -10,29 +10,35 @@ import { IconSearch } from "@tabler/icons-react";
|
||||
import { useAtom } from "jotai";
|
||||
import _ from "lodash";
|
||||
import { ScrollOnly } from "next-scroll-loader";
|
||||
import { useState } from "react";
|
||||
import { useEffect, 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 { 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);
|
||||
const [triggerJob, setTriggerJob] = useAtom(gs_job_trigger);
|
||||
|
||||
// Notifikasi
|
||||
const [isShowUpdate, setIsShowUpdate] = useState(false);
|
||||
const [isTriggerJob, setIsTriggerJob] = useAtom(gs_jobTiggerBeranda);
|
||||
|
||||
useShallowEffect(() => {
|
||||
if (triggerJob) {
|
||||
// setIsNewPost(true);
|
||||
setTriggerJob(false);
|
||||
onLoadNewData({
|
||||
onLoad(val) {
|
||||
setData(val);
|
||||
},
|
||||
});
|
||||
onLoadNewData({
|
||||
onLoad(val) {
|
||||
setData(val);
|
||||
},
|
||||
});
|
||||
}, [setData]);
|
||||
|
||||
useShallowEffect(() => {
|
||||
if (isTriggerJob) {
|
||||
setIsShowUpdate(true);
|
||||
// setIsTriggerJob(false);
|
||||
}
|
||||
}, [triggerJob, setData]);
|
||||
}, [isTriggerJob, setIsShowUpdate]);
|
||||
|
||||
async function onSearch(text: string) {
|
||||
setIsSearch(text);
|
||||
@@ -52,16 +58,16 @@ export function Job_UiBeranda({ listData }: { listData: MODEL_JOB[] }) {
|
||||
return (
|
||||
<>
|
||||
<Stack my={1} spacing={30}>
|
||||
{/* {isNewPost && (
|
||||
{isShowUpdate && (
|
||||
<Job_ComponentButtonUpdateBeranda
|
||||
onSetIsNewPost={(val) => {
|
||||
setIsNewPost(val);
|
||||
setIsShowUpdate(val);
|
||||
}}
|
||||
onSetData={(val: { data: any[] }) => {
|
||||
setData(val.data);
|
||||
onSetData={(val: any[]) => {
|
||||
setData(val);
|
||||
}}
|
||||
/>
|
||||
)} */}
|
||||
)}
|
||||
|
||||
<ComponentGlobal_CreateButton path={RouterJob.create} />
|
||||
|
||||
@@ -97,7 +103,6 @@ export function Job_UiBeranda({ listData }: { listData: MODEL_JOB[] }) {
|
||||
page: activePage + 1,
|
||||
search: isSearch,
|
||||
});
|
||||
console.log(loadData, "load daat");
|
||||
|
||||
setActivePage((val) => val + 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user