aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src/Bug.js
blob: 91463b51119601a9efc93fbc633224dd3a6d60d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { withStyles } from '@material-ui/core/styles'
import gql from 'graphql-tag'
import React from 'react'
import BugSummary from './BugSummary'

import Comment from './Comment'

const styles = theme => ({
  main: {
    maxWidth: 600,
    margin: 'auto',
    marginTop: theme.spacing.unit * 4
  }
})

const Bug = ({bug, classes}) => (
  <main className={classes.main}>
    <BugSummary bug={bug}/>

    {bug.comments.edges.map(({cursor, node}) => (
      <Comment key={cursor} comment={node}/>
    ))}
  </main>
)

Bug.fragment = gql`
  fragment Bug on Bug {
    ...BugSummary
    comments(first: 10) {
      edges {
        cursor
        node {
          ...Comment
        }
      }
    }
  }

  ${BugSummary.fragment}
  ${Comment.fragment}
`

export default withStyles(styles)(Bug)