| | |
| | | import { Box, Paper, Typography } from '@mui/material'; |
| | | import { RecordContextProvider, useListContext } from 'react-admin'; |
| | | |
| | | // import { CompanyCard } from './CompanyCard'; |
| | | import { AgvCard } from './AgvCard'; |
| | | |
| | | const times = (nbChildren, fn) => Array.from({ length: nbChildren }, (_, key) => fn(key)); |
| | | |
| | |
| | | </Box> |
| | | ); |
| | | |
| | | // const LoadedGridList = () => { |
| | | // const { data, error, isPending } = useListContext(); |
| | | const LoadedGridList = () => { |
| | | const { data, error, isPending } = useListContext(); |
| | | |
| | | // if (isPending || error) return null; |
| | | if (isPending || error) return null; |
| | | |
| | | // return ( |
| | | // <Box |
| | | // width="100%" |
| | | // gap={1} |
| | | // display="grid" |
| | | // gridTemplateColumns="repeat(auto-fill, minmax(180px, 1fr))" |
| | | // > |
| | | // {data.map(record => ( |
| | | // <RecordContextProvider key={record.id} value={record}> |
| | | // <CompanyCard /> |
| | | // </RecordContextProvider> |
| | | // ))} |
| | | return ( |
| | | <Box |
| | | width="100%" |
| | | gap={1} |
| | | display="grid" |
| | | gridTemplateColumns="repeat(auto-fill, minmax(180px, 1fr))" |
| | | > |
| | | {data.map(record => ( |
| | | <RecordContextProvider key={record.id} value={record}> |
| | | <AgvCard /> |
| | | </RecordContextProvider> |
| | | ))} |
| | | |
| | | // {data.length === 0 && ( |
| | | // <Typography p={2}>No companies found</Typography> |
| | | // )} |
| | | // </Box> |
| | | // ); |
| | | // }; |
| | | {data.length === 0 && ( |
| | | <Typography p={2}>No companies found</Typography> |
| | | )} |
| | | </Box> |
| | | ); |
| | | }; |
| | | |
| | | export const ImageList = () => { |
| | | const { isPending } = useListContext(); |
| | | // return isPending ? <LoadingGridList /> : <LoadedGridList />; |
| | | return <LoadingGridList />; |
| | | return isPending ? <LoadingGridList /> : <LoadedGridList />; |
| | | }; |