FitTrackee/mpwo_client/src/components/Activities/ActivityAdd.jsx

59 lines
1.3 KiB
React
Raw Normal View History

2018-05-01 19:29:21 +02:00
import React from 'react'
import { Helmet } from 'react-helmet'
import { connect } from 'react-redux'
2018-05-08 16:42:10 +02:00
import FormWithGpx from './ActivityForms/FormWithGpx'
2018-05-01 19:29:21 +02:00
import { getData } from '../../actions/index'
class AddActivity extends React.Component {
componentDidMount() {
this.props.loadSports()
}
render() {
2018-05-08 16:42:10 +02:00
const { message, sports } = this.props
2018-05-01 19:29:21 +02:00
return (
<div>
<Helmet>
<title>mpwo - Add an activity</title>
</Helmet>
<br /><br />
{message && (
<code>{message}</code>
)}
<div className="container">
<div className="row">
<div className="col-md-2" />
<div className="col-md-8">
<div className="card add-activity">
<h2 className="card-header text-center">
Add a sport
</h2>
<div className="card-body">
2018-05-08 16:42:10 +02:00
<FormWithGpx sports={sports} />
2018-05-01 19:29:21 +02:00
</div>
</div>
</div>
<div className="col-md-2" />
</div>
</div>
</div>
)
}
}
export default connect(
state => ({
message: state.message,
sports: state.sports.data,
user: state.user,
}),
dispatch => ({
loadSports: () => {
dispatch(getData('sports'))
},
})
)(AddActivity)