'use client' import colors from '@/con/colors'; import { Box, Button, Center, Group, Pagination, Paper, Skeleton, Stack, Table, TableTbody, TableTd, TableTh, TableThead, TableTr, Text, Title } from '@mantine/core'; import { useShallowEffect } from '@mantine/hooks'; import { IconDeviceImacCog, IconFile, IconPlus, IconSearch } from '@tabler/icons-react'; import { useRouter } from 'next/navigation'; import { useState } from 'react'; import { useProxy } from 'valtio/utils'; import HeaderSearch from '../../_com/header'; import apbdes from '../../_state/landing-page/apbdes'; function APBDes() { const [search, setSearch] = useState(''); return ( } value={search} onChange={(e) => setSearch(e.currentTarget.value)} /> ); } function ListAPBDes({ search }: { search: string }) { const listState = useProxy(apbdes) const router = useRouter(); const { data, page, totalPages, loading, load, } = listState.findMany useShallowEffect(() => { load(page, 10, search) }, [page, search]) const filteredData = data || [] if (loading || !data) { return ( ); } return ( Daftar APBDes Nama APBDes Jumlah Dokumen Aksi {filteredData.length > 0 ? ( filteredData.map((item) => ( {item.name} Rp. {item.jumlah} {item.file?.link ? ( ) : ( Tidak ada dokumen )} )) ) : (
Tidak ada data APBDes yang cocok
)}
{ load(newPage, 10); window.scrollTo({ top: 0, behavior: 'smooth' }); }} total={totalPages} color="blue" radius="md" />
) } export default APBDes;