summaryrefslogtreecommitdiff
path: root/animism-align/frontend/views/timestamp/containers/timestamp.index.js
blob: 35c2d82d51b2d119c4e8ea1ff2fc97db30ec1729 (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
49
50
51
52
53
import React, { Component } from 'react'
import { Link } from 'react-router-dom'
import { bindActionCreators } from 'redux'
import { connect } from 'react-redux'

import { Loader } from '../../../common'
import actions from '../../../actions'
// import * as uploadActions from './upload.actions'

class GraphIndex extends Component {
  componentDidMount() {
    actions.graph.index()
  }
  render() {
    const { index } = this.props
    // console.log(this.props)
    if (!index.order) {
      return (
        <div className='graphIndex'>
          <Loader />
        </div>
      )      
    }
    // console.log(state)
    return (
      <div className='graphIndex'>
        <div>
          <b>welcome, swimmer</b>
          <Link to='/index/new'>+ new project</Link>
        </div>
        {index.order.map(id => {
          const graph = index.lookup[id]
          return (
            <div key={id}>
              <Link to={'/' + graph.path}>{graph.title}</Link>
              <Link to={'/index/' + id + '/edit'}>{'edit project'}</Link>
            </div>
          )
        })}
      </div>
    )
  }
}

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

const mapDispatchToProps = dispatch => ({
  // uploadActions: bindActionCreators({ ...uploadActions }, dispatch),
})

export default connect(mapStateToProps, mapDispatchToProps)(GraphIndex)