|
@@ -1,12 +1,20 @@
|
|
|
import React from 'react';
|
|
|
+import { connect } from "react-redux";
|
|
|
+
|
|
|
+import { getResults } from "../../actions/getResults";
|
|
|
|
|
|
import './result.scss';
|
|
|
|
|
|
import Sidebar from '../../components/sidebar/Sidebar';
|
|
|
import Footer from '../../components/footer/Footer';
|
|
|
|
|
|
-export default class Result extends React.Component {
|
|
|
+export class Result extends React.Component {
|
|
|
+ componentDidMount() {
|
|
|
+ this.props.getResults();
|
|
|
+ }
|
|
|
render() {
|
|
|
+ const {marathone, halfMarathone} = this.props;
|
|
|
+ console.log('result page',marathone);
|
|
|
return (
|
|
|
<>
|
|
|
<Sidebar/>
|
|
@@ -15,8 +23,99 @@ export default class Result extends React.Component {
|
|
|
<h2>Result page</h2>
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
+ <div className="container-wrap">
|
|
|
+ <div className="results-wrap">
|
|
|
+ <div className="profile-tabs-wrap">
|
|
|
+ <div className="tabs-main">
|
|
|
+ <input id="tab1" type="radio" name="tabs" checked readOnly hidden/>
|
|
|
+ <label htmlFor="tab1" className="tab-label">Marathone</label>
|
|
|
+
|
|
|
+ <input id="tab2" type="radio" name="tabs" readOnly hidden/>
|
|
|
+ <label htmlFor="tab2" className="tab-label">Half marathone</label>
|
|
|
+
|
|
|
+ <div className="tab-item" id="content1">
|
|
|
+ <div className="history">
|
|
|
+ {/* имя, название ивента, тип ивента, время, пол, место */}
|
|
|
+ {/* фильтрация по тайтлу ивента,по типу ивента */}
|
|
|
+ <table>
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>User name</th>
|
|
|
+ <th>Event</th>
|
|
|
+ <th>Event type</th>
|
|
|
+ {/*<th>Distance</th>*/}
|
|
|
+ {/*<th>rating</th>*/}
|
|
|
+ <th>Time</th>
|
|
|
+ <th>User sex</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ {
|
|
|
+ marathone.map(result =><tr key={result._id}>
|
|
|
+ <td>{result.eventUser.name}</td>
|
|
|
+ <td>{result.event.title}</td>
|
|
|
+ <td>{result.event.eventType}</td>
|
|
|
+ <td>{result.time}</td>
|
|
|
+ <td><i className={`fa fa-${result.eventUser.sex === 'female' ? 'female' : 'male'}`} aria-hidden="true"></i></td>
|
|
|
+ </tr>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className="tab-item" id="content2">
|
|
|
+ <div className="history">
|
|
|
+ {/* имя, название ивента, тип ивента, время, пол, место */}
|
|
|
+ {/* фильтрация по тайтлу ивента,по типу ивента */}
|
|
|
+ <table>
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>User name</th>
|
|
|
+ <th>Event</th>
|
|
|
+ <th>Event type</th>
|
|
|
+ {/*<th>Distance</th>*/}
|
|
|
+ {/*<th>rating</th>*/}
|
|
|
+ <th>Time</th>
|
|
|
+ <th>User sex</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ {
|
|
|
+ halfMarathone.map(result =><tr key={result._id}>
|
|
|
+ <td>{result.eventUser.name}</td>
|
|
|
+ <td>{result.event.title}</td>
|
|
|
+ <td>{result.event.eventType}</td>
|
|
|
+ <td>{result.time}</td>
|
|
|
+ <td><i className={`fa fa-${result.eventUser.sex === 'female' ? 'female' : 'male'}`} aria-hidden="true"></i></td>
|
|
|
+ </tr>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<Footer/>
|
|
|
</>
|
|
|
)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+const mapStateToProps = state => {
|
|
|
+ return {
|
|
|
+ results: state.results.results,
|
|
|
+ marathone: state.results.marathoneResults,
|
|
|
+ halfMarathone: state.results.halfMarathoneResults
|
|
|
+ };
|
|
|
+};
|
|
|
+
|
|
|
+export default connect(
|
|
|
+ mapStateToProps,
|
|
|
+ { getResults }
|
|
|
+)(Result);
|