diff options
author | Michael Muré <batolettre@gmail.com> | 2018-08-15 15:50:19 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-08-15 15:50:19 +0200 |
commit | 2530cee1eac225924e1119554cf475cdc46ed7dc (patch) | |
tree | 4d36ca529a2e25a3fe9f1a881d037215184ec9a1 /webui/src/BugSummary.js | |
parent | 24d862a65c603de4ea77a2688f5c90effc65be2f (diff) | |
download | git-bug-2530cee1eac225924e1119554cf475cdc46ed7dc.tar.gz |
webui: reorganize the code
Diffstat (limited to 'webui/src/BugSummary.js')
-rw-r--r-- | webui/src/BugSummary.js | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/webui/src/BugSummary.js b/webui/src/BugSummary.js deleted file mode 100644 index 5ffa8e05..00000000 --- a/webui/src/BugSummary.js +++ /dev/null @@ -1,93 +0,0 @@ -import { withStyles } from '@material-ui/core/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 Typography from '@material-ui/core/Typography' -import ErrorOutline from '@material-ui/icons/ErrorOutline' -import gql from 'graphql-tag' -import React from 'react' -import { Link } from 'react-router-dom' -import * as moment from 'moment' - -const Open = ({className}) => <Tooltip title="Open"> - <ErrorOutline nativeColor='#28a745' className={className}/> -</Tooltip> - -const Closed = ({className}) => <Tooltip title="Closed"> - <ErrorOutline nativeColor='#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 styles = theme => ({ - cell: { - display: 'flex', - alignItems: 'center' - }, - status: { - margin: 10 - }, - title: { - display: 'inline-block', - textDecoration: 'none' - }, - labels: { - display: 'inline-block', - paddingLeft: theme.spacing.unit, - '&>span': { - padding: '0 4px', - margin: '0 1px', - backgroundColor: '#da9898', - borderRadius: '3px', - } - }, -}) - -const BugSummary = ({bug, classes}) => ( - <TableRow hover> - <TableCell className={classes.cell}> - <Status status={bug.status} className={classes.status}/> - <div> - <Link to={'bug/'+bug.humanId}> - <Typography variant={'title'} className={classes.title}> - {bug.title} - </Typography> - </Link> - <span className={classes.labels}> - {bug.labels.map(l => ( - <span key={l}>{l}</span>) - )} - </span> - <Typography color={'textSecondary'}> - {bug.humanId} opened - <Tooltip title={moment(bug.createdAt).format('MMMM D, YYYY, h:mm a')}> - <span> {moment(bug.createdAt).fromNow()} </span> - </Tooltip> - by {bug.author.name} - </Typography> - </div> - </TableCell> - </TableRow> -) - -BugSummary.fragment = gql` - fragment BugSummary on Bug { - id - humanId - title - status - createdAt - labels - author { - name - } - } -` - -export default withStyles(styles)(BugSummary) |