{"size": 2323, "ext": "js", "max_stars_repo_path": "app/modules/match/containers/MatchViewContainer.js", "max_stars_repo_name": "venelin-mihaylov/osnova15", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "app/modules/match/containers/MatchViewContainer.js", "max_issues_repo_name": "venelin-mihaylov/osnova15", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "app/modules/match/containers/MatchViewContainer.js", "max_forks_repo_name": "venelin-mihaylov/osnova15", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 32.2638888889, "max_line_length": 113, "alphanum_fraction": 0.6035299182}
import React from 'react'
import OsnovaViewContainer from 'components/OsnovaViewContainer'
import {mapAct, mapCrudStateToProps, formatEnum2, countryName} from 'utils/Util'
import {connect} from 'react-redux'
import {List, Label, Header, Flag} from 'semantic-ui-react'
import MatchSchema from '../../../../universal/model/schema/MatchSchema'
import moment from 'moment'


const entity = 'match'
const variation = '1'

@connect(mapCrudStateToProps(entity, variation), mapAct(entity, variation))
export default class MatchDetailContainer extends OsnovaViewContainer {
  render() {
    const {
      redux: {
        loading,
        record
      }
    } = this.props

    if (loading) {
      return <div>Loading ...</div>
    }

    if (!record) {
      // we should not get here ...
      return <div>...</div>
    }

    return (<div>
      <Header as='h2' textAlign='center'>{record.name}</Header>
      <Header as='h3' textAlign='center'><Flag name={record.country} /> {countryName(record.country)}</Header>
      <p style={{fontSize: '120%'}}>
        {record.description && record.description.split(/\n/).map((r, idx) => <span key={idx}>{r} <br /></span>)}
      </p>

      <List divided selection size='big'>
        <List.Item>
          <Label color='green' horizontal>Start - End</Label>
          {moment(record.startDate).format('MMMM Do YYYY')} - {moment(record.endDate).format('MMMM Do YYYY')}
        </List.Item>
        <List.Item>
          <Label color='green' horizontal>Discipline</Label>
          {formatEnum2(MatchSchema, 'discipline', record.discipline)}
        </List.Item>
        <List.Item>
          <Label color='green' horizontal>Type</Label>
          {formatEnum2(MatchSchema, 'type', record.type)}
        </List.Item>
        <List.Item>
          <Label color='green' horizontal>Organizer</Label>
          {record.organizer}
        </List.Item>
        <List.Item>
          <Label color='green' horizontal>Range Master</Label>
          {record.rangeMaster}
        </List.Item>
        <List.Item>
          <Label color='green' horizontal>Stat Master</Label>
          {record.statMaster}
        </List.Item>
        <List.Item>
          <Label color='green' horizontal>Match Director</Label>
          {record.matchDirector}
        </List.Item>
      </List>
    </div>)
  }
}
