|
@@ -2,19 +2,22 @@ import React from 'react';
|
|
|
import { connect } from "react-redux";
|
|
|
|
|
|
import { getResults } from "../../actions/getResults";
|
|
|
+import { getAllEvents } from "../../actions/getAllEvents";
|
|
|
|
|
|
import './result.scss';
|
|
|
|
|
|
import Sidebar from '../../components/sidebar/Sidebar';
|
|
|
import Footer from '../../components/footer/Footer';
|
|
|
+import FiltersReviews from '../../components/filtersReviews/filtersReviews';
|
|
|
|
|
|
export class Result extends React.Component {
|
|
|
componentDidMount() {
|
|
|
this.props.getResults();
|
|
|
+ this.props.getAllEvents();
|
|
|
}
|
|
|
render() {
|
|
|
- const {marathone, halfMarathone} = this.props;
|
|
|
- console.log('result page',marathone);
|
|
|
+ const {marathone, halfMarathone, getResults, eventsArr} = this.props;
|
|
|
+ //console.log('result page',marathone);
|
|
|
return (
|
|
|
<>
|
|
|
<Sidebar/>
|
|
@@ -25,6 +28,11 @@ export class Result extends React.Component {
|
|
|
</div>
|
|
|
|
|
|
<div className="container-wrap">
|
|
|
+ <div className="events-filters">
|
|
|
+ <h4>Events filter</h4>
|
|
|
+ <FiltersReviews labelType="Event Title" getRequest={getResults} eventTypes={eventsArr} />
|
|
|
+ </div>
|
|
|
+
|
|
|
<div className="results-wrap">
|
|
|
<div className="profile-tabs-wrap">
|
|
|
<div className="tabs-main">
|
|
@@ -36,30 +44,26 @@ export class Result extends React.Component {
|
|
|
|
|
|
<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}>
|
|
|
+ marathone.length !== 0 ? 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>
|
|
|
- )
|
|
|
+ ) : <tr><td colSpan="5"><p className="not-found">Not found results</p></td></tr>
|
|
|
}
|
|
|
</tbody>
|
|
|
</table>
|
|
@@ -68,30 +72,26 @@ export class Result extends React.Component {
|
|
|
|
|
|
<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}>
|
|
|
+ halfMarathone.length !== 0 ? 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>
|
|
|
- )
|
|
|
+ ) : <tr><td colSpan="5"><p className="not-found">Not found results</p></td></tr>
|
|
|
}
|
|
|
</tbody>
|
|
|
</table>
|
|
@@ -111,11 +111,13 @@ const mapStateToProps = state => {
|
|
|
return {
|
|
|
results: state.results.results,
|
|
|
marathone: state.results.marathoneResults,
|
|
|
- halfMarathone: state.results.halfMarathoneResults
|
|
|
+ halfMarathone: state.results.halfMarathoneResults,
|
|
|
+ events: state.getEvents.events,
|
|
|
+ eventsArr: state.getEvents.eventsArrShort
|
|
|
};
|
|
|
};
|
|
|
|
|
|
export default connect(
|
|
|
mapStateToProps,
|
|
|
- { getResults }
|
|
|
+ { getResults, getAllEvents }
|
|
|
)(Result);
|