import { useEffect, useState } from 'react' import { useBoilers } from '../hooks/swrHooks' import { Stack, Text } from '@mantine/core' import CustomTable from '../components/CustomTable' function Boilers() { const [boilersPage, setBoilersPage] = useState(1) const [boilerSearch, setBoilerSearch] = useState("") const [debouncedBoilerSearch, setDebouncedBoilerSearch] = useState("") const { boilers } = useBoilers(10, boilersPage, debouncedBoilerSearch) useEffect(() => { const handler = setTimeout(() => { setDebouncedBoilerSearch(boilerSearch) }, 500) return () => { clearTimeout(handler) } }, [boilerSearch]) useEffect(() => { setBoilersPage(1) setBoilerSearch("") }, []) return ( Котельные {boilers && info.getValue(), }, { accessorKey: 'boiler_name', header: 'Название', cell: (info) => info.getValue(), }, { accessorKey: 'boiler_code', header: 'Код', cell: (info) => info.getValue(), }, { accessorKey: 'id_city', header: 'Город', cell: (info) => info.getValue(), }, { accessorKey: 'activity', header: 'Активен', cell: (info) => info.getValue(), }, ]} /> } {/* {boilers && {boilersColumns.map(column => ( {column.headerName} ))} {boilers.map((boiler: IBoiler) => ( {boilersColumns.map(column => { if (column.field === 'activity') { return ( boiler.activity ? ( Активен ) : ( Отключен ) ) } else return ( {boiler[column.field as keyof IBoiler]} ) })} ))}
} */}
) } export default Boilers