summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/editor/footnotes/footnotes.container.js
blob: d17f2eb5fa4d654991498ff79f6a02a13f87f19e (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
import React, { Component } from 'react'
import { connect } from 'react-redux'

import './footnotes.css'

import FootnoteForm from './components/footnote.form'

class FootnotesContainer extends Component {
  render() {
    const { annotation } = this.props
    const { order, lookup } = annotation
    const footnote_ids = order.filter(id => lookup[id].type === 'footnote')

    return (
      <div className='overview'>
        <div className='project-top'>
          <div className='project-heading'>
            <h2>Footnotes</h2>
          </div>
          {footnote_ids.map((footnote_id, index) => (
            <FootnoteForm
              key={footnote_id}
              footnote={lookup[footnote_id]}
              index={index + 1}
            />
          ))}
        </div>
      </div>
    )
  }
}

const mapStateToProps = state => ({
  project: state.site.project,
  episode: state.site.episode,
  annotation: state.annotation.index,
})

export default connect(mapStateToProps)(FootnotesContainer)