Merge pull request #302 from bipproduction/amalia/09-okt-24

Amalia/09 okt 24
This commit is contained in:
Amalia
2024-10-09 17:36:18 +08:00
committed by GitHub
5 changed files with 31 additions and 11 deletions

View File

@@ -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}
</>
);