import PropTypes from 'prop-types' import { useNavigate } from 'react-router-dom' import moment from 'moment' import { styled } from '@mui/material/styles' import Table from '@mui/material/Table' import TableBody from '@mui/material/TableBody' import TableCell, { tableCellClasses } from '@mui/material/TableCell' import TableContainer from '@mui/material/TableContainer' import TableHead from '@mui/material/TableHead' import TableRow from '@mui/material/TableRow' import Paper from '@mui/material/Paper' import Chip from '@mui/material/Chip' import { Button, Stack, Typography } from '@mui/material' import FlowListMenu from '../button/FlowListMenu' const StyledTableCell = styled(TableCell)(({ theme }) => ({ [`&.${tableCellClasses.head}`]: { backgroundColor: theme.palette.common.black, color: theme.palette.common.white }, [`&.${tableCellClasses.body}`]: { fontSize: 14 } })) const StyledTableRow = styled(TableRow)(({ theme }) => ({ '&:nth-of-type(odd)': { backgroundColor: theme.palette.action.hover }, // hide last border '&:last-child td, &:last-child th': { border: 0 } })) export const FlowListTable = ({ data, images, filterFunction, updateFlowsApi }) => { const navigate = useNavigate() const goToCanvas = (selectedChatflow) => { navigate(`/canvas/${selectedChatflow.id}`) } return ( <> Name Category Nodes Last Modified Date Actions {data.filter(filterFunction).map((row, index) => (
  {row.category && row.category .split(';') .map((tag, index) => ( ))}
{images[row.id] && (
{images[row.id].slice(0, images[row.id].length > 5 ? 5 : images[row.id].length).map((img) => (
))} {images[row.id].length > 5 && ( + {images[row.id].length - 5} More )}
)}
{moment(row.updatedDate).format('MMMM Do, YYYY')}
))}
) } FlowListTable.propTypes = { data: PropTypes.object, images: PropTypes.array, filterFunction: PropTypes.func, updateFlowsApi: PropTypes.object }