import { DeleteIcon } from '@chakra-ui/icons' import { IconButton, Spinner, Table, TableContainer, Tbody, Td, Th, Thead, Tooltip, Tr, } from '@chakra-ui/react' import { useEffect } from 'react' import { useDispatch, useSelector } from 'react-redux' import { selectAuthUser } from '../../store/authSlice' import { fetchDevices, selectDeviceList, selectDeviceLoading } from '../../store/deviceSlice' const DeviceRow = ({ device }: any) => { const { enabled, model, brand, _id, createdAt } = device return ( {`${brand}/ ${model}`} {enabled ? 'enabled' : 'disabled'} {/* {}} /> */} } onDoubleClick={(e) => {}} /> ) } const DeviceList = () => { const dispatch = useDispatch() const authUser = useSelector(selectAuthUser) useEffect(() => { if (authUser) { dispatch(fetchDevices()) } }, [authUser, dispatch]) const deviceList = useSelector(selectDeviceList) const loading = useSelector(selectDeviceLoading) const onDelete = (apiKeyId: string) => {} return ( {loading && ( )} {!loading && deviceList.length === 0 && ( )} {!loading && deviceList.length > 0 && deviceList.map((device) => ( ))}
Your Devices Status Actions
No Devices
) } export default DeviceList