summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/viewer/checklist/checklist.container.js
blob: 7a8db0e5844536d4fecdb5c64c352c731f479072 (plain)
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
44
45
46
47
48
import React, { Component } from 'react'
import { connect } from 'react-redux'

import actions from 'app/actions'

import ChecklistDropdown from './checklist.dropdown'
import ChecklistContent from './checklist.content'
import CreditsContent from './credits.content'

class Checklist extends Component {
  state = {
    currentSection: 'all',
  }
  constructor(props) {
    super(props)
    this.handleSectionChange = this.handleSectionChange.bind(this)
  }
  handleSectionChange(currentSection) {
    this.setState({ currentSection })
  }
  render() {
    const { currentSection } = this.state
    return (
      <div className="checklist">
        (viewer.checklist && (
          <div>
            <ChecklistDropdown
              currentSection={currentSection}
              onChange={this.handleSectionChange}
            />
            <ChecklistContent
              currentSection={currentSection}
            />
          </div>
        )
        (viewer.credits && (
          <CreditsContent />
        ))
      </div>
    )
  }
}

const mapStateToProps = state => ({
  viewer: state.viewer,
})

export default connect(mapStateToProps)(Checklist)