Merge pull request #302 from bipproduction/amalia/09-okt-24
Amalia/09 okt 24
This commit is contained in:
@@ -6,6 +6,8 @@ import { useEffect, useState } from "react";
|
||||
import { useWibuRealtime } from "wibu-realtime";
|
||||
import NotificationCustome from "./notification_custome";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { globalParamJumlahNotif } from "@/module/home";
|
||||
import ReloadButtonTop from "./reload_button_top";
|
||||
|
||||
export default function WrapLayout({ children, role, theme, user }: { children: React.ReactNode, role: any, theme: any, user: any }) {
|
||||
const router = useRouter()
|
||||
@@ -13,6 +15,7 @@ export default function WrapLayout({ children, role, theme, user }: { children:
|
||||
const tema = useHookstate(TEMA)
|
||||
const notifLoadPage = useHookstate(globalNotifPage)
|
||||
const [tampilNotif, setTampilNotif] = useState(false)
|
||||
const paramNotif = useHookstate(globalParamJumlahNotif)
|
||||
const [data, setData] = useWibuRealtime({
|
||||
WIBU_REALTIME_TOKEN: keyWibu,
|
||||
project: "sdm"
|
||||
@@ -27,6 +30,7 @@ export default function WrapLayout({ children, role, theme, user }: { children:
|
||||
useShallowEffect(() => {
|
||||
if (data && data.some((i: any) => i.idUserTo == user)) {
|
||||
setTampilNotif(true)
|
||||
paramNotif.set(!paramNotif.get())
|
||||
setTimeout(() => {
|
||||
setTampilNotif(false);
|
||||
}, 4000);
|
||||
@@ -40,7 +44,6 @@ export default function WrapLayout({ children, role, theme, user }: { children:
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* {JSON.stringify(data)} */}
|
||||
{
|
||||
tampilNotif &&
|
||||
<NotificationCustome
|
||||
@@ -51,6 +54,14 @@ export default function WrapLayout({ children, role, theme, user }: { children:
|
||||
/>
|
||||
}
|
||||
|
||||
{/* <ReloadButtonTop
|
||||
onReload={
|
||||
() => {
|
||||
''
|
||||
}
|
||||
}
|
||||
title='UPDATE'
|
||||
/> */}
|
||||
{children}
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user