diff --git a/src/components/Dashboard/common/ObjectList.jsx b/src/components/Dashboard/common/ObjectList.jsx new file mode 100644 index 0000000..aad9252 --- /dev/null +++ b/src/components/Dashboard/common/ObjectList.jsx @@ -0,0 +1,49 @@ +import React from 'react' +import PropTypes from 'prop-types' +import { List, Typography, Flex } from 'antd' +import { getModelByName } from '../../../database/ObjectModels' +import IdDisplay from './IdDisplay' + +const { Text } = Typography + +const ObjectList = ({ value, objectType, bordered = true }) => { + if (!value || !Array.isArray(value) || value.length === 0) { + return n/a + } + return ( + { + const model = getModelByName(objectType) + const Icon = model.icon + return ( + + + + {item?.name ? {item.name} : null} + {item?._id ? ( + + ) : null} + + + ) + }} + style={{ width: '100%' }} + /> + ) +} + +ObjectList.propTypes = { + value: PropTypes.array, + bordered: PropTypes.bool, + objectType: PropTypes.string +} + +export default ObjectList