2018-02-07 18:50:32 +01:00
|
|
|
import React from 'react'
|
2018-02-04 19:08:21 +01:00
|
|
|
import { connect } from 'react-redux'
|
|
|
|
import BoardComponent from '../components/Board'
|
2018-02-07 18:50:32 +01:00
|
|
|
import { getBoardAddress } from '../utils/orbitdb'
|
2018-02-04 19:08:21 +01:00
|
|
|
|
2018-02-08 23:52:06 +01:00
|
|
|
function Board({ stats, location, match, boards }) {
|
2018-02-07 18:50:32 +01:00
|
|
|
const { hash, name } = match.params
|
2018-02-08 23:52:06 +01:00
|
|
|
const address = getBoardAddress(hash, name)
|
|
|
|
const boardStats = stats.dbs[address] || {}
|
|
|
|
return <BoardComponent stats={boardStats} {...boards[address]} />
|
2018-02-04 19:08:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function mapStateToProps(state){
|
|
|
|
return {
|
|
|
|
boards: state.boards.boards
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default connect(
|
2018-02-07 18:50:32 +01:00
|
|
|
mapStateToProps
|
2018-02-04 19:08:21 +01:00
|
|
|
)(Board)
|