upd: kegiatan

Deskripsi:
- update realtime refresh
- update realtime per aksi per kegiatan

No Issues
This commit is contained in:
amel
2024-10-15 12:49:19 +08:00
parent b5c8004594
commit ee43572183
11 changed files with 349 additions and 205 deletions

View File

@@ -1,16 +1,17 @@
'use client'
import { globalRole, LayoutDrawer, LayoutNavbarNew, TEMA } from '@/module/_global';
import { globalRole, keyWibu, LayoutDrawer, LayoutNavbarNew, TEMA } from '@/module/_global';
import { useHookstate } from '@hookstate/core';
import { ActionIcon, Box, Flex, SimpleGrid, Stack, Text } from '@mantine/core';
import { useShallowEffect } from '@mantine/hooks';
import { useParams, useRouter } from 'next/navigation';
import React, { useState } from 'react';
import { useState } from 'react';
import toast from 'react-hot-toast';
import { FaFileCirclePlus, FaPencil, FaUsers } from 'react-icons/fa6';
import { HiMenu } from 'react-icons/hi';
import { IoAddCircle } from 'react-icons/io5';
import { MdCancel } from 'react-icons/md';
import { funGetOneProjectById } from '../lib/api_project';
import { useShallowEffect } from '@mantine/hooks';
import { useHookstate } from '@hookstate/core';
import { useWibuRealtime } from 'wibu-realtime';
export default function NavbarDetailProject() {
const router = useRouter()
@@ -20,6 +21,10 @@ export default function NavbarDetailProject() {
const roleLogin = useHookstate(globalRole)
const tema = useHookstate(TEMA)
const [reason, setReason] = useState("")
const [dataRealTime, setDataRealtime] = useWibuRealtime({
WIBU_REALTIME_TOKEN: keyWibu,
project: "sdm"
})
async function getOneData() {
try {
@@ -41,6 +46,12 @@ export default function NavbarDetailProject() {
getOneData();
}, [param.id])
useShallowEffect(() => {
if (dataRealTime && dataRealTime.some((i: any) => (i.category == 'project-detail' || i.category == 'project-detail-status') && i.id == param.id)) {
getOneData()
}
}, [dataRealTime])
return (
<>
<LayoutNavbarNew back="/project?status=0" title={name} menu={