diff options
author | Quentin Gliech <quentingliech@gmail.com> | 2020-02-04 20:57:43 +0100 |
---|---|---|
committer | Quentin Gliech <quentingliech@gmail.com> | 2020-02-11 20:54:37 +0100 |
commit | 6a502c145bd8f2e2e1a9c0b103c11f0433c60737 (patch) | |
tree | 72c3a23aa6c5df8013d53523fa4125a3e28063a8 /webui/src/list/BugRow.js | |
parent | 9c570cac725fe7048ddd1d181b33b8fa1808e401 (diff) | |
download | git-bug-6a502c145bd8f2e2e1a9c0b103c11f0433c60737.tar.gz |
webui: convert bug list to typescript
Diffstat (limited to 'webui/src/list/BugRow.js')
-rw-r--r-- | webui/src/list/BugRow.js | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/webui/src/list/BugRow.js b/webui/src/list/BugRow.js deleted file mode 100644 index add5c12f..00000000 --- a/webui/src/list/BugRow.js +++ /dev/null @@ -1,119 +0,0 @@ -import { makeStyles } from '@material-ui/styles'; -import TableCell from '@material-ui/core/TableCell/TableCell'; -import TableRow from '@material-ui/core/TableRow/TableRow'; -import Tooltip from '@material-ui/core/Tooltip/Tooltip'; -import ErrorOutline from '@material-ui/icons/ErrorOutline'; -import CheckCircleOutline from '@material-ui/icons/CheckCircleOutline'; -import gql from 'graphql-tag'; -import React from 'react'; -import { Link } from 'react-router-dom'; -import Date from '../Date'; -import Label from '../Label'; -import Author from '../Author'; - -const Open = ({ className }) => ( - <Tooltip title="Open"> - <ErrorOutline htmlColor="#28a745" className={className} /> - </Tooltip> -); - -const Closed = ({ className }) => ( - <Tooltip title="Closed"> - <CheckCircleOutline htmlColor="#cb2431" className={className} /> - </Tooltip> -); - -const Status = ({ status, className }) => { - switch (status) { - case 'OPEN': - return <Open className={className} />; - case 'CLOSED': - return <Closed className={className} />; - 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', - }, - title: { - display: 'inline', - color: theme.palette.text.primary, - fontSize: '1.3rem', - fontWeight: 500, - }, - details: { - ...theme.typography.textSecondary, - lineHeight: '1.5rem', - color: theme.palette.text.secondary, - }, - labels: { - paddingLeft: theme.spacing(1), - '& > *': { - display: 'inline-block', - }, - }, -})); - -function BugRow({ bug }) { - const classes = useStyles(); - return ( - <TableRow hover> - <TableCell className={classes.cell}> - <Status status={bug.status} className={classes.status} /> - <div className={classes.expand}> - <Link to={'bug/' + bug.humanId}> - <div className={classes.expand}> - <span className={classes.title}>{bug.title}</span> - {bug.labels.length > 0 && ( - <span className={classes.labels}> - {bug.labels.map(l => ( - <Label key={l.name} label={l} /> - ))} - </span> - )} - </div> - </Link> - <div className={classes.details}> - {bug.humanId} opened - <Date date={bug.createdAt} /> - by {bug.author.displayName} - </div> - </div> - </TableCell> - </TableRow> - ); -} - -BugRow.fragment = gql` - fragment BugRow on Bug { - id - humanId - title - status - createdAt - labels { - ...Label - } - ...authored - } - - ${Label.fragment} - ${Author.fragment} -`; - -export default BugRow; |