fix: theme

Deskripsi:
- realtime saat ada perubahan theme

No Issues
This commit is contained in:
amel
2024-11-07 15:54:39 +08:00
parent 5aec05bf06
commit 7f394311d7
5 changed files with 32 additions and 21 deletions

View File

@@ -1,15 +1,14 @@
'use client'
import { globalParamJumlahNotif } from "@/module/home";
import { useHookstate } from "@hookstate/core";
import { globalNotifPage, globalRole, keyWibu, TEMA } from "../bin/val_global";
import { useShallowEffect } from "@mantine/hooks";
import { usePathname, useRouter } from "next/navigation";
import { useEffect, useState } from "react";
import { useWibuRealtime } from "wibu-realtime";
import { globalNotifPage, globalRole, keyWibu, TEMA } from "../bin/val_global";
import NotificationCustome from "./notification_custome";
import { usePathname, 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 }) {
export default function WrapLayout({ children, role, theme, user, village }: { children: React.ReactNode, role: any, theme: any, user: any, village: any }) {
const router = useRouter()
const roleLogin = useHookstate(globalRole)
const tema = useHookstate(TEMA)
@@ -44,6 +43,10 @@ export default function WrapLayout({ children, role, theme, user }: { children:
}, 4000);
}
}
if (data && data.some((v: any) => v.category == "applied-theme" && v.user != user && v.village == village)) {
tema.set(data[0]?.theme)
}
}, [data])