import CheckCircleOutline from '@mui/icons-material/CheckCircleOutline'; import CommentOutlinedIcon from '@mui/icons-material/CommentOutlined'; import ErrorOutline from '@mui/icons-material/ErrorOutline'; import TableCell from '@mui/material/TableCell/TableCell'; import TableRow from '@mui/material/TableRow/TableRow'; import Tooltip from '@mui/material/Tooltip/Tooltip'; import makeStyles from '@mui/styles/makeStyles'; import * as React from 'react'; import { Link } from 'react-router-dom'; import Author from 'src/components/Author'; import Date from 'src/components/Date'; import Label from 'src/components/Label'; import { Status } from 'src/gqlTypes'; import { BugRowFragment } from './BugRow.generated'; type OpenClosedProps = { className: string }; const Open = ({ className }: OpenClosedProps) => ( ); const Closed = ({ className }: OpenClosedProps) => ( ); type StatusProps = { className: string; status: Status }; const BugStatus: React.FC = ({ status, className, }: StatusProps) => { switch (status) { case 'OPEN': return ; case 'CLOSED': return ; default: return

{'unknown status ' + status}

; } }; const useStyles = makeStyles((theme) => ({ cell: { display: 'flex', alignItems: 'center', padding: theme.spacing(1), '& a': { textDecoration: 'none', }, }, status: { margin: theme.spacing(1, 2), }, expand: { width: '100%', lineHeight: '20px', }, bugTitleWrapper: { display: 'flex', flexDirection: 'row', flexWrap: 'wrap', //alignItems: 'center', }, title: { display: 'inline', color: theme.palette.text.primary, fontSize: '1.3rem', fontWeight: 500, marginBottom: theme.spacing(1), }, label: { maxWidth: '40ch', marginLeft: theme.spacing(0.25), marginRight: theme.spacing(0.25), }, details: { lineHeight: '1.5rem', color: theme.palette.text.secondary, }, commentCount: { fontSize: '1rem', minWidth: '2rem', marginLeft: theme.spacing(0.5), marginRight: theme.spacing(1), }, commentCountCell: { display: 'inline-flex', minWidth: theme.spacing(5), marginLeft: theme.spacing(0.5), }, })); type Props = { bug: BugRowFragment; }; function BugRow({ bug }: Props) { const classes = useStyles(); // Subtract 1 from totalCount as 1 comment is the bug description const commentCount = bug.comments.totalCount - 1; return (
{bug.title} {bug.labels.length > 0 && bug.labels.map((l) => (
{bug.humanId} opened   by 
{commentCount > 0 && ( <> {commentCount} )}
); } export default BugRow;