14 Commits c92e24a1e9 ... 5b674ff5bd

Author SHA1 Message Date
  Marina Yakovenko 5b674ff5bd admin page 5 years ago
  Marina Yakovenko 66ad1f32d5 admin page 5 years ago
  Tanya Sashyna ee87d7ed2a fix sidebar 5 years ago
  Tanya Sashyna 239a2cca75 Merge branch 'dev' into Tanya 5 years ago
  Tanya Sashyna 59bc0d043f merge with dev 5 years ago
  Tanya Sashyna 16907048f9 change 5 years ago
  Tanya Sashyna daacc385ef change 5 years ago
  Tanya Sashyna ca649fa31d some change 5 years ago
  Tanya Sashyna 99161160ad fix date 5 years ago
  Tanya Sashyna 0a6d537aab Perfectionism 5 years ago
  Tanya Sashyna 7a2d4523e0 fix sidebar 5 years ago
  Tanya Sashyna 50784bf19c the profile page is finished 5 years ago
  Tanya Sashyna 8766f08b4a added filter on the gallery page 5 years ago
  Tanya Sashyna 3bb1e64b74 added filter on the results page 5 years ago
59 changed files with 706 additions and 742 deletions
  1. 67 65
      src/actionTypes/actionTypes.js
  2. 46 39
      src/actions/adminMainPageActions.js
  3. 2 2
      src/actions/getAllEvents.js
  4. 3 1
      src/actions/getRequestEvent.js
  5. 4 2
      src/actions/getResults.js
  6. 3 1
      src/actions/getUserInfo.js
  7. 0 1
      src/actions/logout.js
  8. 2 2
      src/actions/photogalaryActions.js
  9. 5 4
      src/actions/registrationEvent.js
  10. 25 16
      src/components/adminHeader/adminHeader.js
  11. 27 28
      src/components/adminMenu/adminMenu.js
  12. 147 147
      src/components/adminPhotogalary/adminPhotogalaryReduxForm.js
  13. 1 1
      src/components/adminResults/adminResultsForm.scss
  14. 90 54
      src/components/eventForm/eventReduxForm.js
  15. 5 8
      src/components/eventInfoShort/EventInfoShort.js
  16. 1 3
      src/components/filtersEvents/FiltersEvents.js
  17. 0 13
      src/components/filtersEvents/filtersEvents.scss
  18. 0 13
      src/components/filtersReviews/filters-reviews.scss
  19. 1 4
      src/components/filtersReviews/filtersReviews.js
  20. 0 2
      src/components/login-form/LoginForm.js
  21. 0 1
      src/components/login-form/login.scss
  22. 0 3
      src/components/reg-form-event/RegFormEvent.js
  23. 0 1
      src/components/reg-form-event/reg-form-event.scss
  24. 0 4
      src/components/registration-form/RegistrationForm.js
  25. 0 1
      src/components/registration-form/registrationForm.scss
  26. 0 4
      src/components/review-form/ReviewForm.js
  27. 0 1
      src/components/review-form/review-form.scss
  28. 8 6
      src/components/sidebar/Sidebar.js
  29. 1 1
      src/conteiners/adminAddEventPage/adminAddEventPage.js
  30. 14 16
      src/conteiners/adminMainPage/adminMainPage.js
  31. 1 1
      src/conteiners/adminMyEventsPage/adminMyEventsPage.js
  32. 11 24
      src/conteiners/eventCard/EventCard.js
  33. 1 2
      src/conteiners/events/Events.js
  34. 16 7
      src/conteiners/gallery/Gallery.js
  35. 1 1
      src/conteiners/home/Home.js
  36. 0 1
      src/conteiners/login/Login.js
  37. 17 28
      src/conteiners/profile/Profile.js
  38. 1 55
      src/conteiners/profile/profile.scss
  39. 18 17
      src/conteiners/result/Result.js
  40. 6 9
      src/conteiners/reviews/Reviews.js
  41. 31 24
      src/reducers/adminMainPageReducer.js
  42. 3 1
      src/reducers/combineReducers.js
  43. 20 4
      src/reducers/getAllEvents.js
  44. 4 2
      src/reducers/getRequestEvent.js
  45. 3 7
      src/reducers/getResults.js
  46. 1 3
      src/reducers/getUserInfo.js
  47. 5 4
      src/reducers/login.js
  48. 1 3
      src/reducers/logout.js
  49. 4 3
      src/reducers/registration.js
  50. 2 3
      src/reducers/registrationEvent.js
  51. 17 8
      src/reducers/reviews.js
  52. 37 36
      src/router.js
  53. 7 7
      src/state/adminMenu.js
  54. 0 9
      src/styles/base.scss
  55. 2 39
      src/styles/custom.scss
  56. 12 0
      src/styles/filters.scss
  57. 17 0
      src/styles/form-field.scss
  58. 14 0
      src/styles/login-reg.scss
  59. 2 0
      src/styles/main.scss

+ 67 - 65
src/actionTypes/actionTypes.js

@@ -1,87 +1,89 @@
-export const POST_NEW_EVENT_REQUEST = "POST_NEW_EVENT_REQUEST";
-export const POST_NEW_EVENT_REQUEST_SUCCESS = "POST_NEW_EVENT_REQUEST_SUCCESS";
-export const POST_NEW_EVENT_REQUEST_FAIL = "POST_NEW_EVENT_REQUEST_FAIL";
+export const POST_NEW_EVENT_REQUEST = 'POST_NEW_EVENT_REQUEST';
+export const POST_NEW_EVENT_REQUEST_SUCCESS = 'POST_NEW_EVENT_REQUEST_SUCCESS';
+export const POST_NEW_EVENT_REQUEST_FAIL = 'POST_NEW_EVENT_REQUEST_FAIL';
 
-export const GET_EVENTS_REQUEST = "GET_EVENTS_REQUEST";
-export const GET_EVENTS_REQUEST_SUCCESS = "GET_EVENTS_REQUEST_SUCCESS";
-export const GET_EVENTS_REQUEST_FAIL = "GET_EVENTS_REQUEST_FAIL";
+export const GET_EVENTS_REQUEST = 'GET_EVENTS_REQUEST';
+export const GET_EVENTS_REQUEST_SUCCESS = 'GET_EVENTS_REQUEST_SUCCESS';
+export const GET_EVENTS_REQUEST_FAIL = 'GET_EVENTS_REQUEST_FAIL';
 
-export const EDIT_EVENT_REQUEST = "EDIT_EVENT_REQUEST";
-export const EDIT_EVENT_REQUEST_SUCCESS = "EDIT_EVENT_REQUEST_SUCCESS";
-export const EDIT_EVENT_REQUEST_FAIL = "EDIT_EVENT_REQUEST_FAIL";
+export const EDIT_EVENT_REQUEST = 'EDIT_EVENT_REQUEST';
+export const EDIT_EVENT_REQUEST_SUCCESS = 'EDIT_EVENT_REQUEST_SUCCESS';
+export const EDIT_EVENT_REQUEST_FAIL = 'EDIT_EVENT_REQUEST_FAIL';
 
-export const REMOVE_EVENT_REQUEST = "REMOVE_EVENT_REQUEST";
-export const REMOVE_EVENT_REQUEST_SUCCESS = "REMOVE_EVENT_REQUEST_SUCCESS";
-export const REMOVE_EVENT_REQUEST_FAIL = "REMOVE_EVENT_REQUEST_FAIL";
+export const REMOVE_EVENT_REQUEST = 'REMOVE_EVENT_REQUEST';
+export const REMOVE_EVENT_REQUEST_SUCCESS = 'REMOVE_EVENT_REQUEST_SUCCESS';
+export const REMOVE_EVENT_REQUEST_FAIL = 'REMOVE_EVENT_REQUEST_FAIL';
 
-export const SHOW_SIDEBAR = "SHOW_SIDEBAR";
+export const SHOW_SIDEBAR = 'SHOW_SIDEBAR';
 
-export const POST_REQUEST_LOGIN = "POST_REQUEST_LOGIN";
-export const POST_REQUEST_SUCCESS_LOGIN = "POST_REQUEST_SUCCESS_LOGIN";
-export const POST_REQUEST_ERROR_LOGIN = "POST_REQUEST_ERROR_LOGIN";
+export const POST_REQUEST_LOGIN = 'POST_REQUEST_LOGIN';
+export const POST_REQUEST_SUCCESS_LOGIN = 'POST_REQUEST_SUCCESS_LOGIN';
+export const POST_REQUEST_ERROR_LOGIN = 'POST_REQUEST_ERROR_LOGIN';
 
-export const POST_REQUEST_CHECKIN = "POST_REQUEST_CHECKIN";
-export const POST_REQUEST_SUCCESS_CHECKIN = "POST_REQUEST_SUCCESS_CHECKIN";
-export const POST_REQUEST_ERROR_CHECKIN = "POST_REQUEST_ERROR_CHECKIN";
+export const POST_REQUEST_CHECKIN = 'POST_REQUEST_CHECKIN';
+export const POST_REQUEST_SUCCESS_CHECKIN = 'POST_REQUEST_SUCCESS_CHECKIN';
+export const POST_REQUEST_ERROR_CHECKIN = 'POST_REQUEST_ERROR_CHECKIN';
 
-export const GET_REQUEST_EVENTS = "GET_REQUEST_EVENTS";
-export const GET_REQUEST_SUCCESS_EVENTS = "GET_REQUEST_SUCCESS_EVENTS";
-export const GET_REQUEST_ERROR_EVENTS = "GET_REQUEST_ERROR_EVENTS";
+export const GET_REQUEST_EVENTS = 'GET_REQUEST_EVENTS';
+export const GET_REQUEST_SUCCESS_EVENTS = 'GET_REQUEST_SUCCESS_EVENTS';
+export const GET_REQUEST_ERROR_EVENTS = 'GET_REQUEST_ERROR_EVENTS';
 
-export const EDIT_EVENT = "EDIT_EVENT";
+export const EDIT_EVENT = 'EDIT_EVENT';
 
-export const GET_PHOTOGALARY_REQUEST = "GET_PHOTOGALARY_REQUEST";
-export const GET_PHOTOGALARY_REQUEST_SUCCESS = "GET_PHOTOGALARY_REQUEST_SUCCESS";
-export const GET_PHOTOGALARY_REQUEST_FAIL = "GET_PHOTOGALARY_REQUEST_FAIL";
+export const GET_PHOTOGALARY_REQUEST = 'GET_PHOTOGALARY_REQUEST';
+export const GET_PHOTOGALARY_REQUEST_SUCCESS = 'GET_PHOTOGALARY_REQUEST_SUCCESS';
+export const GET_PHOTOGALARY_REQUEST_FAIL = 'GET_PHOTOGALARY_REQUEST_FAIL';
 
-export const POST_PHOTOGALARY_REQUEST = "POST_PHOTOGALARY_REQUEST";
-export const POST_PHOTOGALARY_REQUEST_SUCCESS = "POST_PHOTOGALARY_REQUEST_SUCCESS";
-export const POST_PHOTOGALARY_REQUEST_FAIL = "POST_PHOTOGALARY_REQUEST_FAIL";
+export const POST_PHOTOGALARY_REQUEST = 'POST_PHOTOGALARY_REQUEST';
+export const POST_PHOTOGALARY_REQUEST_SUCCESS = 'POST_PHOTOGALARY_REQUEST_SUCCESS';
+export const POST_PHOTOGALARY_REQUEST_FAIL = 'POST_PHOTOGALARY_REQUEST_FAIL';
 
-export const PUT_PHOTOGALARY_REQUEST = "PUT_PHOTOGALARY_REQUEST";
-export const PUT_PHOTOGALARY_REQUEST_SUCCESS = "PUT_PHOTOGALARY_REQUEST_SUCCESS";
-export const PUT_PHOTOGALARY_REQUEST_FAIL = "PUT_PHOTOGALARY_REQUEST_FAIL";
+export const PUT_PHOTOGALARY_REQUEST = 'PUT_PHOTOGALARY_REQUEST';
+export const PUT_PHOTOGALARY_REQUEST_SUCCESS = 'PUT_PHOTOGALARY_REQUEST_SUCCESS';
+export const PUT_PHOTOGALARY_REQUEST_FAIL = 'PUT_PHOTOGALARY_REQUEST_FAIL';
 
-export const POST_REGISTRATION_EVENT = "POST_REGISTRATION_EVENT";
-export const POST_REGISTRATION_EVENT_SUCCESS = "POST_REGISTRATION_EVENT_SUCCESS";
-export const POST_REGISTRATION_EVENT_ERROR = "POST_REGISTRATION_EVENT_ERROR";
+export const POST_REGISTRATION_EVENT = 'POST_REGISTRATION_EVENT';
+export const POST_REGISTRATION_EVENT_SUCCESS = 'POST_REGISTRATION_EVENT_SUCCESS';
+export const POST_REGISTRATION_EVENT_ERROR = 'POST_REGISTRATION_EVENT_ERROR';
 
-export const GET_LOGOUT_USER = "GET_LOGOUT_USER";
-export const GET_LOGOUT_USER_SUCCESS = "GET_LOGOUT_USER_SUCCESS";
-export const GET_LOGOUT_USER_ERROR = "GET_LOGOUT_USER_ERROR";
+export const GET_LOGOUT_USER = 'GET_LOGOUT_USER';
+export const GET_LOGOUT_USER_SUCCESS = 'GET_LOGOUT_USER_SUCCESS';
+export const GET_LOGOUT_USER_ERROR = 'GET_LOGOUT_USER_ERROR';
 
-export const GET_REQUEST_EVENT_CARD = "GET_REQUEST_EVENT_CARD";
-export const GET_REQUEST_SUCCESS_EVENT_CARD = "GET_REQUEST_SUCCESS_EVENT_CARD";
-export const GET_REQUEST_ERROR_EVENT_CARD = "GET_REQUEST_ERROR_EVENT_CARD";
+export const GET_REQUEST_EVENT_CARD = 'GET_REQUEST_EVENT_CARD';
+export const GET_REQUEST_SUCCESS_EVENT_CARD = 'GET_REQUEST_SUCCESS_EVENT_CARD';
+export const GET_REQUEST_ERROR_EVENT_CARD = 'GET_REQUEST_ERROR_EVENT_CARD';
 
-export const GET_REQUEST_REVIEWS = "GET_REQUEST_REVIEWS";
-export const GET_REQUEST_SUCCESS_REVIEWS = "GET_REQUEST_SUCCESS_REVIEWS";
-export const GET_REQUEST_ERROR_REVIEWS = "GET_REQUEST_ERROR_REVIEWS";
+export const GET_REQUEST_REVIEWS = 'GET_REQUEST_REVIEWS';
+export const GET_REQUEST_SUCCESS_REVIEWS = 'GET_REQUEST_SUCCESS_REVIEWS';
+export const GET_REQUEST_ERROR_REVIEWS = 'GET_REQUEST_ERROR_REVIEWS';
 
-export const POST_REQUEST_REVIEW = "POST_REQUEST_REVIEW";
-export const POST_REQUEST_SUCCESS_REVIEW = "POST_REQUEST_SUCCESS_REVIEW";
-export const POST_REQUEST_ERROR_REVIEW = "POST_REQUEST_ERROR_REVIEW";
+export const POST_REQUEST_REVIEW = 'POST_REQUEST_REVIEW';
+export const POST_REQUEST_SUCCESS_REVIEW = 'POST_REQUEST_SUCCESS_REVIEW';
+export const POST_REQUEST_ERROR_REVIEW = 'POST_REQUEST_ERROR_REVIEW';
 
-export const GET_EVENT_BY_TITLE = "GET_EVENT_BY_TITLE";
-export const GET_EVENT_BY_TITLE_SUCCESS = "GET_EVENT_BY_TITLE_SUCCESS";
-export const GET_EVENT_BY_TITLE_FAIL = "GET_EVENT_BY_TITLE_FAIL";
+export const GET_EVENT_BY_TITLE = 'GET_EVENT_BY_TITLE';
+export const GET_EVENT_BY_TITLE_SUCCESS = 'GET_EVENT_BY_TITLE_SUCCESS';
+export const GET_EVENT_BY_TITLE_FAIL = 'GET_EVENT_BY_TITLE_FAIL';
 
-export const GET_REGISTRED_USERS = "GET_REGISTRED_USERS";
-export const GET_REGISTRED_USERS_SUCCESS = "GET_REGISTRED_USERS_SUCCESS";
-export const GET_REGISTRED_USERS_FAIL = "GET_REGISTRED_USERS_FAIL";
+export const GET_REGISTRED_USERS = 'GET_REGISTRED_USERS';
+export const GET_REGISTRED_USERS_SUCCESS = 'GET_REGISTRED_USERS_SUCCESS';
+export const GET_REGISTRED_USERS_FAIL = 'GET_REGISTRED_USERS_FAIL';
 
-export const GET_USERS_INFO = "GET_USERS_INFO";
-export const GET_USERS_INFO_SUCCESS = "GET_USERS_INFO_SUCCESS";
-export const GET_USERS_INFO_ERROR = "GET_USERS_INFO_ERROR";
+export const GET_USERS_INFO = 'GET_USERS_INFO';
+export const GET_USERS_INFO_SUCCESS = 'GET_USERS_INFO_SUCCESS';
+export const GET_USERS_INFO_ERROR = 'GET_USERS_INFO_ERROR';
 
-export const POST_RESULTS_REQUEST = "POST_RESULTS_REQUEST";
-export const POST_RESULTS_REQUEST_SUCCESS = "POST_RESULTS_REQUEST_SUCCESS";
-export const POST_RESULTS_REQUEST_FAIL = "POST_RESULTS_REQUEST_FAIL";
+export const POST_RESULTS_REQUEST = 'POST_RESULTS_REQUEST';
+export const POST_RESULTS_REQUEST_SUCCESS = 'POST_RESULTS_REQUEST_SUCCESS';
+export const POST_RESULTS_REQUEST_FAIL = 'POST_RESULTS_REQUEST_FAIL';
 
-export const GET_PHOTOGALARU_EVENTS_REQUEST = "GET_PHOTOGALARU_EVENTS_REQUEST";
-export const GET_PHOTOGALARU_EVENTS_REQUEST_SUCCESS = "GET_PHOTOGALARU_EVENTS_REQUEST_SUCCESS";
-export const GET_PHOTOGALARU_EVENTS_REQUEST_FAIL = "GET_PHOTOGALARU_EVENTS_REQUEST_FAIL";
+export const GET_PHOTOGALARU_EVENTS_REQUEST = 'GET_PHOTOGALARU_EVENTS_REQUEST';
+export const GET_PHOTOGALARU_EVENTS_REQUEST_SUCCESS = 'GET_PHOTOGALARU_EVENTS_REQUEST_SUCCESS';
+export const GET_PHOTOGALARU_EVENTS_REQUEST_FAIL = 'GET_PHOTOGALARU_EVENTS_REQUEST_FAIL';
 
-export const GET_RESULT = "GET_RESULT";
-export const GET_RESULT_SUCCESS = "GET_RESULT_SUCCESS";
-export const GET_RESULT_ERROR = "GET_RESULT_ERROR";
+export const GET_RESULT = 'GET_RESULT';
+export const GET_RESULT_SUCCESS = 'GET_RESULT_SUCCESS';
+export const GET_RESULT_ERROR = 'GET_RESULT_ERROR';
+
+export const CHANGE_EDIT_FLAG = 'CHANGE_EDIT_FLAG';

+ 46 - 39
src/actions/adminMainPageActions.js

@@ -1,36 +1,43 @@
-import axios from "axios";
-import * as types from "../actionTypes/actionTypes"
+import axios from 'axios';
+import * as types from '../actionTypes/actionTypes';
 
-const eventURL = 'https://api-marathon.herokuapp.com/api/v1/event'
+const eventURL = 'https://api-marathon.herokuapp.com/api/v1/event';
 
-export const editEvent = payload => {
+export const editEvent = (payload) => {
 	return {
 		type: types.EDIT_EVENT,
 		payload
 	};
 };
 
+export const changeEditFlag = (payload) => {
+	return {
+		type: types.CHANGE_EDIT_FLAG,
+		payload
+	};
+};
+
 //POST
-const postNewEventRequest = payload => ({
+const postNewEventRequest = (payload) => ({
 	type: types.POST_NEW_EVENT_REQUEST,
 	payload
 });
-const postNewEventRequestSuccess = payload => ({
+const postNewEventRequestSuccess = (payload) => ({
 	type: types.POST_NEW_EVENT_REQUEST_SUCCESS,
 	payload
 });
-const postNewEventRequestFail = payload => ({
+const postNewEventRequestFail = (payload) => ({
 	type: types.POST_NEW_EVENT_REQUEST_FAIL,
 	payload
 });
 
-export const postNewEvent = payload => {
-	return async dispatch => {
+export const postNewEvent = (payload) => {
+	return async (dispatch) => {
 		dispatch(postNewEventRequest());
 		try {
 			const { data } = await axios.post(eventURL, payload);
 			dispatch(postNewEventRequestSuccess(data));
-			console.log("New Event Posted", payload)
+			console.log('New Event Posted', payload);
 		} catch (error) {
 			dispatch(postNewEventRequestFail(error));
 		}
@@ -38,102 +45,102 @@ export const postNewEvent = payload => {
 };
 
 //PUT
-const editEventRequest = payload => ({
+const editEventRequest = (payload) => ({
 	type: types.EDIT_EVENT_REQUEST,
 	payload
 });
-const editEventRequestSuccess = payload => ({
+const editEventRequestSuccess = (payload) => ({
 	type: types.EDIT_EVENT_REQUEST_SUCCESS,
 	payload
 });
-const editEventRequestFail = payload => ({
+const editEventRequestFail = (payload) => ({
 	type: types.EDIT_EVENT_REQUEST_FAIL,
 	payload
 });
 
 export const changeEvent = (payload) => {
-	return async dispatch => {
+	return async (dispatch) => {
 		dispatch(editEventRequest());
 		try {
 			await axios.put(`${eventURL}/${payload._id} `, payload);
-			dispatch(editEventRequestSuccess({payload, id: payload._id}));
-			console.log("Event Changed", payload)
+			dispatch(editEventRequestSuccess({ payload, id: payload._id }));
+			console.log('Event Changed', payload);
 		} catch (error) {
-			console.log('edit payload',payload)
+			console.log('edit payload', payload);
 			dispatch(editEventRequestFail(error));
 		}
 	};
 };
 
 //GET
-const getEventsRequest = payload => ({
+const getEventsRequest = (payload) => ({
 	type: types.GET_EVENTS_REQUEST,
 	payload
 });
 
-const getEventsRequestSuccess = payload => ({
+const getEventsRequestSuccess = (payload) => ({
 	type: types.GET_EVENTS_REQUEST_SUCCESS,
 	payload
 });
 
-const getEventsRequestFail = payload => ({
+const getEventsRequestFail = (payload) => ({
 	type: types.GET_EVENTS_REQUEST_FAIL,
 	payload
 });
 
-export const getEvents = (type = 'Select Event Type') => dispatch => {
+export const getEvents = (type = 'Select Event Type') => (dispatch) => {
 	dispatch(getEventsRequest());
 	return axios
-		.get( type !== 'Select Event Type' ? `${eventURL}/?eventType=${type}` : eventURL)
-		.then(res => dispatch(getEventsRequestSuccess(res)))
-		.catch(err => dispatch(getEventsRequestFail(err)));
+		.get(type !== 'Select Event Type' ? `${eventURL}/?eventType=${type}` : eventURL)
+		.then((res) => dispatch(getEventsRequestSuccess(res)))
+		.catch((err) => dispatch(getEventsRequestFail(err)));
 };
 
-//GET BY TITLE 
+//GET BY TITLE
 
-const getEventByTitleRequest = payload => ({
+const getEventByTitleRequest = (payload) => ({
 	type: types.GET_EVENT_BY_TITLE,
 	payload
 });
 
-const getEventByTitleRequestSuccess = payload => ({
+const getEventByTitleRequestSuccess = (payload) => ({
 	type: types.GET_EVENT_BY_TITLE_SUCCESS,
 	payload
 });
 
-const getEventByTitleRequestFail = payload => ({
+const getEventByTitleRequestFail = (payload) => ({
 	type: types.GET_EVENT_BY_TITLE_FAIL,
 	payload
 });
 
-export const getEventByTitle = (title) => dispatch => {
+export const getEventByTitle = (title) => (dispatch) => {
 	dispatch(getEventByTitleRequest());
 	return axios
-		.get( title && `${eventURL}/?title=${title}`)
-		.then(res => dispatch(getEventByTitleRequestSuccess(res)))
-		.catch(err => dispatch(getEventByTitleRequestFail(err)));
+		.get(title && `${eventURL}/?title=${title}`)
+		.then((res) => dispatch(getEventByTitleRequestSuccess(res)))
+		.catch((err) => dispatch(getEventByTitleRequestFail(err)));
 };
 
 // REMOVE
-const removeEventRequest = payload => ({
+const removeEventRequest = (payload) => ({
 	type: types.REMOVE_EVENT_REQUEST,
 	payload
 });
 
-const removeEventSuccess = payload => ({
+const removeEventSuccess = (payload) => ({
 	type: types.REMOVE_EVENT_REQUEST_SUCCESS,
 	payload
 });
 
-const removeEventFail = payload => ({
+const removeEventFail = (payload) => ({
 	type: types.REMOVE_EVENT_REQUEST_FAIL,
 	payload
 });
 
-export const removeEvent = _id => dispatch => {
+export const removeEvent = (_id) => (dispatch) => {
 	dispatch(removeEventRequest());
 	return axios
 		.delete(`${eventURL}/${_id}`)
-		.then(res => dispatch(removeEventSuccess({ res, _id })))
-		.catch(err => dispatch(removeEventFail(err)));
-};
+		.then((res) => dispatch(removeEventSuccess({ res, _id })))
+		.catch((err) => dispatch(removeEventFail(err)));
+};

+ 2 - 2
src/actions/getAllEvents.js

@@ -1,6 +1,6 @@
 import * as types from "../actionTypes/actionTypes";
 
-const eventURL = 'https://api-marathon.herokuapp.com/api/v1/event';
+const eventsURL = 'https://api-marathon.herokuapp.com/api/v1/event';
 
 export const getEvents = payload => ({
     type: types.GET_REQUEST_EVENTS,
@@ -19,7 +19,7 @@ export const getEventsError = payload => ({
 
 export const getAllEvents = (type = 'All events') => {
     return dispatch => {
-        let promise = fetch(type !== 'All events' ? `${eventURL}/?eventType=${type}` : eventURL)
+        let promise = fetch(type !== 'All events' ? `${eventsURL}/?eventType=${type}` : eventsURL)
 
         dispatch(getEvents())
 

+ 3 - 1
src/actions/getRequestEvent.js

@@ -1,5 +1,7 @@
 import * as types from "../actionTypes/actionTypes";
 
+const urlEvent = 'https://api-marathon.herokuapp.com/api/v1/event';
+
 export const getEventCard = payload => ({
     type: types.GET_REQUEST_EVENT_CARD,
     payload
@@ -17,7 +19,7 @@ export const getEventCardError = payload => ({
 
 export const getRequestEvent = id => {
     return dispatch => {
-        let promise = fetch(`https://api-marathon.herokuapp.com/api/v1/event?_id=${id}`)
+        let promise = fetch(`${urlEvent}?_id=${id}`)
 
         dispatch(getEventCard())
 

+ 4 - 2
src/actions/getResults.js

@@ -1,5 +1,7 @@
 import * as types from "../actionTypes/actionTypes";
 
+const resultsURL = 'https://api-marathon.herokuapp.com/api/v1/results'
+
 export const getResultsSend = payload => ({
     type: types.GET_RESULT,
     payload
@@ -15,9 +17,9 @@ export const getResultsError = payload => ({
     payload
 });
 
-export const getResults = () => {
+export const getResults = (type = 'All events') => {
     return dispatch => {
-        let promise = fetch('https://api-marathon.herokuapp.com/api/v1/results')
+        let promise = fetch(type !== 'All events' ? `${resultsURL}/?event=${type}` : resultsURL)
 
         dispatch(getResultsSend())
 

+ 3 - 1
src/actions/getUserInfo.js

@@ -1,5 +1,7 @@
 import * as types from "../actionTypes/actionTypes";
 
+const urlUser = 'https://api-marathon.herokuapp.com/api/v1/users';
+
 export const getUserInfoRequest = payload => ({
     type: types.GET_USERS_INFO,
     payload
@@ -17,7 +19,7 @@ export const getUserInfoRequestError = payload => ({
 
 export const getUserInfo = id => {
     return dispatch => {
-        let promise = fetch(`https://api-marathon.herokuapp.com/api/v1/users/${id}`)
+        let promise = fetch(`${urlUser}/${id}`)
 
         dispatch(getUserInfoRequest())
 

+ 0 - 1
src/actions/logout.js

@@ -18,7 +18,6 @@ export const getLogoutUserError = payload => ({
 export const getLogoutUserSubmit = () => {
     return dispatch => {
         let promise = fetch("https://api-marathon.herokuapp.com/api/v1/auth/logout")
-        //console.log('getLogoutUserSubmit');
 
         dispatch(getLogoutUser())
 

+ 2 - 2
src/actions/photogalaryActions.js

@@ -44,10 +44,10 @@ const getPhotogalaryRequestFail = payload => ({
 	payload
 });
 
-export const getPhotogalary = () => dispatch => {
+export const getPhotogalary = (title = 'All events') => dispatch => {
 	dispatch(getPhotogalaryRequest());
 	return axios
-		.get(photogalaryURL)
+		.get(title !== 'All events' ? `${photogalaryURL}/?eventTitle=${title}` : photogalaryURL)
 		.then(res => dispatch(getPhotogalaryRequestSuccess(res)))
 		.catch(err => dispatch(getPhotogalaryRequestFail(err)));
 };

+ 5 - 4
src/actions/registrationEvent.js

@@ -1,23 +1,24 @@
 import * as types from "../actionTypes/actionTypes";
+const urlRegEvent = 'https://api-marathon.herokuapp.com/api/v1/eventUsers';
 
 export const regEvent = payload => ({
-    type: types.POST_REQUEST_CHECKIN,
+    type: types.POST_REGISTRATION_EVENT,
     payload
 });
 
 export const regEventSuccess = payload => ({
-    type: types.POST_REQUEST_SUCCESS_CHECKIN,
+    type: types.POST_REGISTRATION_EVENT_SUCCESS,
     payload
 });
 
 export const regEventError = payload => ({
-    type: types.POST_REQUEST_ERROR_CHECKIN,
+    type: types.POST_REGISTRATION_EVENT_ERROR,
     payload
 });
 
 export const regEventSubmit = payload => {
     return dispatch => {
-        let promise = fetch("https://api-marathon.herokuapp.com/api/v1/eventUsers",
+        let promise = fetch(urlRegEvent,
             {
                 method: 'POST',
                 body: JSON.stringify(payload),

+ 25 - 16
src/components/adminHeader/adminHeader.js

@@ -1,14 +1,18 @@
-import React from "react";
-import { Link, withRouter } from "react-router-dom";
-import "./adminHeader.scss";
-import { adminMenu } from "../../state/adminMenu";
-
-const adminHeader = props => {
+import React from 'react';
+import { Link, withRouter } from 'react-router-dom';
+import './adminHeader.scss';
+import { adminMenu } from '../../state/adminMenu';
 
+const adminHeader = (props) => {
 	const logout = (e) => {
 		localStorage.removeItem('user');
-		props.history.push('/')
-	}
+		props.history.push('/');
+	};
+
+	const clickEventHandler = (e) => {
+		console.log('menu props', props);
+		props.changeEditFlag();
+	};
 
 	return (
 		<header className="header" id="header">
@@ -17,17 +21,22 @@ const adminHeader = props => {
 					<div className="header__logo">
 						<Link to="/admin">
 							Just_<span>tri</span>_it
-                        </Link>
+						</Link>
 					</div>
 				</div>
 				<nav className="header__nav">
 					<ul className="header__list">
-						{adminMenu.map(el =>
-							el.hideWhenAuth && props.user ? null : (
-								<li className="header__item" key={el.id} onClick={el.logout ? logout : null}>
-									<Link to={el.path}>{el.text}</Link>
-								</li>
-							)
+						{adminMenu.map(
+							(el) =>
+								el.hideWhenAuth && props.user ? null : (
+									<li
+										className="header__item"
+										key={el.id}
+										onClick={el.logout ? logout : clickEventHandler}
+									>
+										<Link to={el.path}>{el.text}</Link>
+									</li>
+								)
 						)}
 					</ul>
 				</nav>
@@ -36,4 +45,4 @@ const adminHeader = props => {
 	);
 };
 
-export default withRouter(adminHeader);
+export default withRouter(adminHeader);

+ 27 - 28
src/components/adminMenu/adminMenu.js

@@ -1,35 +1,34 @@
-import React, { Component } from "react";
-import { withRouter } from "react-router-dom";
-import "./adminMenu.scss";
-import { adminMenu } from "../../state/adminMenu";
+import React, { Component } from 'react';
+import { withRouter } from 'react-router-dom';
+import './adminMenu.scss';
+import { adminMenu } from '../../state/adminMenu';
 
 class AdminMenu extends Component {
-    constructor(props) {
-        super(props);
+	constructor(props) {
+		super(props);
 
-        this.state = { adminMenu };
-    }
+		this.state = { adminMenu };
+	}
 
-    clickEventHandler = (e) => {
-        this.props.history.push(e)
-    }
+	clickEventHandler = (e) => {
+		this.props.history.push(e);
+	};
 
-    render() {
-        return (
-            <div className="menu-block">
-                {adminMenu.map(el =>
-                    el.text !== "Log out" && el.text !== "Main Page" &&
-                    <div
-                        className="menu-skew"
-                        key={el.id}
-                        onClick={this.clickEventHandler.bind(null, el.path)}
-                    >
-                        <h2 className="menu-text">{el.text.toUpperCase()}</h2>
-                    </div>
-                )}
-            </div>
-        )
-    }
+	render() {
+		return (
+			<div className="menu-block">
+				{adminMenu.map(
+					(el) =>
+						el.text !== 'Log out' &&
+						el.text !== 'Main Page' && (
+							<div className="menu-skew" key={el.id} onClick={this.clickEventHandler.bind(null, el.path)}>
+								<h2 className="menu-text">{el.text.toUpperCase()}</h2>
+							</div>
+						)
+				)}
+			</div>
+		);
+	}
 }
 
-export default withRouter(AdminMenu)
+export default withRouter(AdminMenu);

+ 147 - 147
src/components/adminPhotogalary/adminPhotogalaryReduxForm.js

@@ -1,151 +1,151 @@
-import React, { Component } from "react";
-import { reduxForm, Field } from "redux-form";
-import "./adminPhotogalary.scss";
-import { addPhotogalaryInitialValue } from "../../state/photogalaryFormData";
-import { customInput } from "../customFields/customInput/customInput";
-import { customSelect } from "../customFields/customSelect/customSelect";
+import React, { Component } from 'react';
+import { reduxForm, Field } from 'redux-form';
+import './adminPhotogalary.scss';
+import { addPhotogalaryInitialValue } from '../../state/photogalaryFormData';
+import { customInput } from '../customFields/customInput/customInput';
+import { customSelect } from '../customFields/customSelect/customSelect';
 
 class PhotogalaryReduxForm extends Component {
-
-    state = {
-        addPhotogalaryInitialValue,
-        filteredEventList: []
-    }
-
-    submit = values => {
-        const pictures = this.state.addPhotogalaryInitialValue.pictures.reduce((prev, elem) => {
-            return prev.concat(elem.value);
-        }, []);
-
-        const submitValues = {
-            ...this.state.addPhotogalaryInitialValue,
-            pictures: pictures,
-        }
-
-        this.props.submitHandler(submitValues);
-        this.props.reset()
-    };
-
-    onChangeTypeHandler = e => {
-        const { name, value } = e.target;
-
-        this.setState(prevState => {
-            return {
-                ...prevState,
-                addPhotogalaryInitialValue: {
-                    ...prevState.addPhotogalaryInitialValue,
-                    [name]: value
-                },
-                filteredEventList: [{_id: 1, title: "Select event"}].concat(
-                    this.props.eventList.filter(el => el.eventType === value)
-                )
-            };
-        });
-    };
-
-    onChangeTitleHandler = e => {
-        const { name, value } = e.target;
-
-        this.setState(prevState => {
-            return {
-                ...prevState,
-                addPhotogalaryInitialValue: {
-                    ...prevState.addPhotogalaryInitialValue,
-                    [name]: value
-                }
-            };
-        });
-    };
-
-    onChangePicturesHandler = e => {
-        const { value, id } = e.target;
-
-        this.setState(prevState => {
-            return {
-                ...prevState,
-                addPhotogalaryInitialValue: {
-                    ...prevState.addPhotogalaryInitialValue,
-                    pictures: prevState.addPhotogalaryInitialValue.pictures.map(
-                        el => (el.id === id ? { ...el, value } : el)
-                    )
-                }
-            };
-        });
-    };
-
-    addPicture = (e) => {
-        this.setState(prevState => {
-            return {
-                ...prevState,
-                addPhotogalaryInitialValue: {
-                    ...prevState.addPhotogalaryInitialValue,
-                    pictures: prevState.addPhotogalaryInitialValue.pictures.concat({
-                        id: Math.random()
-                            .toString()
-                            .substr(2, 100),
-                        name: `picture_${Math.random()
-                            .toString()
-                            .substr(2, 100)}`,
-                        value: ""
-                    })
-                }
-            }
-        });
-    };
-
-    render() {
-        const { filteredEventList, addPhotogalaryInitialValue } = this.state;
-
-        const {
-            handleSubmit,
-            eventTypes,
-        } = this.props;
-
-        return (
-            <form className="event-form__event-form__main" onSubmit={handleSubmit(this.submit)}>
-
-                <Field
-                    name="eventType"
-                    label="Event Type"
-                    required
-                    component={customSelect}
-                    onChange={this.onChangeTypeHandler}
-                    className="form-block__select -wide"
-                >
-                    {eventTypes.map(elem => <option key={elem.id} value={elem.optionName}>{elem.optionName}</option>)}
-                </Field>
-
-                <Field
-                    name="eventTitle"
-                    label="Event Title"
-                    required
-                    component={customSelect}
-                    onChange={this.onChangeTitleHandler}
-                    className="form-block__select -wide"
-                >
-                    {filteredEventList.map(elem => <option key={elem._id} value={elem.title}>{elem.title}</option>)}
-                </Field>
-
-                {addPhotogalaryInitialValue.pictures.map((el, i) => (
-                    <Field
-                        key={`${el.id}/${i}`}
-                        name={el.name}
-                        id={el.id}
-                        label="Picture"
-                        onChange={this.onChangePicturesHandler}
-                        className="input-box -wide"
-                        placeholder='Enter picture url'
-                        component={customInput}
-                    />
-                ))}
-                <button type="button" className="photogalary-form__picture-btn" onClick={this.addPicture} >Add Picture</button>
-                <div className="event-form__control-box">
-                    <button className="event-form__submit-btn" >Add Photogalary</button>
-                </div>
-            </form>
-
-        );
-    }
+	state = {
+		addPhotogalaryInitialValue,
+		filteredEventList: []
+	};
+
+	submit = (values) => {
+		const pictures = this.state.addPhotogalaryInitialValue.pictures.reduce((prev, elem) => {
+			return prev.concat(elem.value);
+		}, []);
+
+		const submitValues = {
+			...this.state.addPhotogalaryInitialValue,
+			pictures: pictures
+		};
+
+		this.props.submitHandler(submitValues);
+		this.props.reset();
+	};
+
+	onChangeTypeHandler = (e) => {
+		const { name, value } = e.target;
+
+		this.setState((prevState) => {
+			return {
+				...prevState,
+				addPhotogalaryInitialValue: {
+					...prevState.addPhotogalaryInitialValue,
+					[name]: value
+				},
+				filteredEventList: [ { _id: 1, title: 'Select event' } ].concat(
+					this.props.eventList.filter((el) => el.eventType === value)
+				)
+			};
+		});
+	};
+
+	onChangeTitleHandler = (e) => {
+		const { name, value } = e.target;
+
+		this.setState((prevState) => {
+			return {
+				...prevState,
+				addPhotogalaryInitialValue: {
+					...prevState.addPhotogalaryInitialValue,
+					[name]: value
+				}
+			};
+		});
+	};
+
+	onChangePicturesHandler = (e) => {
+		const { value, id } = e.target;
+
+		this.setState((prevState) => {
+			return {
+				...prevState,
+				addPhotogalaryInitialValue: {
+					...prevState.addPhotogalaryInitialValue,
+					pictures: prevState.addPhotogalaryInitialValue.pictures.map(
+						(el) => (el.id === id ? { ...el, value } : el)
+					)
+				}
+			};
+		});
+	};
+
+	addPicture = (e) => {
+		this.setState((prevState) => {
+			return {
+				...prevState,
+				addPhotogalaryInitialValue: {
+					...prevState.addPhotogalaryInitialValue,
+					pictures: prevState.addPhotogalaryInitialValue.pictures.concat({
+						id: Math.random().toString().substr(2, 100),
+						name: `picture_${Math.random().toString().substr(2, 100)}`,
+						value: ''
+					})
+				}
+			};
+		});
+	};
+
+	render() {
+		const { filteredEventList, addPhotogalaryInitialValue } = this.state;
+
+		const { handleSubmit, eventTypes } = this.props;
+
+		return (
+			<form className="event-form__event-form__main" onSubmit={handleSubmit(this.submit)}>
+				<Field
+					name="eventType"
+					label="Event Type"
+					required
+					component={customSelect}
+					onChange={this.onChangeTypeHandler}
+					className="form-block__select -wide"
+				>
+					{eventTypes.map((elem) => (
+						<option key={elem.id} value={elem.optionName}>
+							{elem.optionName}
+						</option>
+					))}
+				</Field>
+
+				<Field
+					name="eventTitle"
+					label="Event Title"
+					required
+					component={customSelect}
+					onChange={this.onChangeTitleHandler}
+					className="form-block__select -wide"
+				>
+					{filteredEventList.map((elem) => (
+						<option key={elem._id} value={elem.title}>
+							{elem.title}
+						</option>
+					))}
+				</Field>
+
+				{addPhotogalaryInitialValue.pictures.map((el, i) => (
+					<Field
+						key={`${el.id}/${i}`}
+						name={el.name}
+						id={el.id}
+						label="Picture"
+						onChange={this.onChangePicturesHandler}
+						className="input-box -wide"
+						placeholder="Enter picture url"
+						component={customInput}
+					/>
+				))}
+				<button type="button" className="photogalary-form__picture-btn" onClick={this.addPicture}>
+					Add Picture
+				</button>
+				<div className="event-form__control-box">
+					<button className="event-form__submit-btn">Add Photogalary</button>
+				</div>
+			</form>
+		);
+	}
 }
 
-export default reduxForm({ form: "photogalaryForm", enableReinitialize: true })(PhotogalaryReduxForm);
+export default reduxForm({ form: 'photogalaryForm', enableReinitialize: true })(PhotogalaryReduxForm);

+ 1 - 1
src/components/adminResults/adminResultsForm.scss

@@ -2,7 +2,7 @@
 
 .results-form {
 	width: 100%;
-	min-height: 100vh;
+	flex-grow: 1;
 	margin: auto;
 
 	background: -webkit-linear-gradient(top, #fff, $color-blue);

+ 90 - 54
src/components/eventForm/eventReduxForm.js

@@ -1,63 +1,99 @@
-import React from "react";
-import { reduxForm, Field } from "redux-form";
-import "./eventForm.scss";
-import { customInput } from "../customFields/customInput/customInput";
-import { customTextarea } from "../customFields/customTextarea/customTextarea";
-import { customSelect } from "../customFields/customSelect/customSelect";
-import { eventFormValidation } from "../../utils/eventFormValidation";
+import React from 'react';
+import { reduxForm, Field } from 'redux-form';
+import { withRouter } from 'react-router-dom';
+import './eventForm.scss';
+import { customInput } from '../customFields/customInput/customInput';
+import { customTextarea } from '../customFields/customTextarea/customTextarea';
+import { customSelect } from '../customFields/customSelect/customSelect';
+import { eventFormValidation } from '../../utils/eventFormValidation';
 
 const EventReduxForm = ({
-    handleSubmit,
-    postNewEvent,
-    showConfirmationMessage,
-    reset,
-    eventTypes,
-    initialValues,
-    editFormFlag,
-    changeEvent
+	handleSubmit,
+	postNewEvent,
+	showConfirmationMessage,
+	reset,
+	eventTypes,
+	initialValues,
+	editFormFlag,
+	changeEvent,
+	history
 }) => {
-
-    const submit = value => {
+	const submit = (value) => {
 		if (!editFormFlag) {
-            postNewEvent(value)
+			postNewEvent(value);
 		} else {
-            changeEvent(value);
+			changeEvent(value);
+			setTimeout(() => history.push('/admin/my_events'), 3000);
 		}
-        reset();
-        showConfirmationMessage();
-    };
-
-    return (
-        <form className="event-form__event-form__main" onSubmit={handleSubmit(submit)}>
+		reset();
+		showConfirmationMessage();
+	};
 
-            <img className="event-form__picture" alt="Event Bunner" src={initialValues.mainBannerPicture} />
-            <Field name="mainBannerPicture" className="input-box -wide"  label="Main Banner Picture" component={customInput} />
-            <Field name="title" label="Event Title" className="input-box -wide"  required component={customInput} />
-            <Field name="eventType" label="Event Type" required component={customSelect} >
-                {eventTypes.map(elem => <option key={elem.id} value={elem.optionName}>{elem.optionName}</option>)}
-            </Field>
-            <Field name="eventDate" type="date" label="Event Date" required component={customInput} />
-            <Field name="country" label="Country" required component={customInput} />
-            <Field name="city" label="City" required component={customInput} />
-            <Field name="overview" label="Overview" rows="10" placeholder='Enter event overview' component={customTextarea} />
-            <Field name="contentPicture" label="Content Picture" className="input-box -wide" placeholder='Enter picture url' component={customInput} />
-            <Field name="contentVideo" label="Content Video" className="input-box -wide" placeholder='Enter video url' component={customInput} />
-            <Field name="marathoneDistancePrice" label="Marathone Distance Price" component={customInput} />
-            <Field name="halfmarathoneDistancePrice" label="Halfmarathone Distance Price" component={customInput} />
-            <Field name="ageLimit" label="Age Limit" component={customTextarea} />
-            <Field name="awardMedals" label="Award Medals" component={customTextarea} />
-            <Field name="maximumTime" label="Maximum Time" component={customTextarea} />
-            <Field name="aidStations" label="Aid Stations" component={customTextarea} />
-            <Field name="equipmentStorage" label="Equipment Storage" component={customTextarea} />
-            <Field name="parking" label="Parking" component={customTextarea} />
-            <Field name="refreshments" label="Refreshments" component={customTextarea} />
-            <Field name="map" label="Map" className="input-box -wide" placeholder='Enter picture url' component={customInput} />
+	return (
+		<form className="event-form__event-form__main" onSubmit={handleSubmit(submit)}>
+			<img className="event-form__picture" alt="Event Bunner" src={initialValues.mainBannerPicture} />
+			<Field
+				name="mainBannerPicture"
+				className="input-box -wide"
+				label="Main Banner Picture"
+				component={customInput}
+			/>
+			<Field name="title" label="Event Title" className="input-box -wide" required component={customInput} />
+			<Field name="eventType" label="Event Type" required component={customSelect}>
+				{eventTypes.map((elem) => (
+					<option key={elem.id} value={elem.optionName}>
+						{elem.optionName}
+					</option>
+				))}
+			</Field>
+			<Field name="eventDate" type="date" label="Event Date" required component={customInput} />
+			<Field name="country" label="Country" required component={customInput} />
+			<Field name="city" label="City" required component={customInput} />
+			<Field
+				name="overview"
+				label="Overview"
+				rows="10"
+				placeholder="Enter event overview"
+				component={customTextarea}
+			/>
+			<Field
+				name="contentPicture"
+				label="Content Picture"
+				className="input-box -wide"
+				placeholder="Enter picture url"
+				component={customInput}
+			/>
+			<Field
+				name="contentVideo"
+				label="Content Video"
+				className="input-box -wide"
+				placeholder="Enter video url"
+				component={customInput}
+			/>
+			<Field name="marathoneDistancePrice" label="Marathone Distance Price" component={customInput} />
+			<Field name="halfmarathoneDistancePrice" label="Halfmarathone Distance Price" component={customInput} />
+			<Field name="ageLimit" label="Age Limit" component={customTextarea} />
+			<Field name="awardMedals" label="Award Medals" component={customTextarea} />
+			<Field name="maximumTime" label="Maximum Time" component={customTextarea} />
+			<Field name="aidStations" label="Aid Stations" component={customTextarea} />
+			<Field name="equipmentStorage" label="Equipment Storage" component={customTextarea} />
+			<Field name="parking" label="Parking" component={customTextarea} />
+			<Field name="refreshments" label="Refreshments" component={customTextarea} />
+			<Field
+				name="map"
+				label="Map"
+				className="input-box -wide"
+				placeholder="Enter picture url"
+				component={customInput}
+			/>
 
-            <div className="event-form__control-box">
-                <button className="event-form__submit-btn">{editFormFlag ? 'Save Changes' : 'Add Event'}</button>
-            </div>
-        </form>
-    );
-}
+			<div className="event-form__control-box">
+				<button className="event-form__submit-btn">{editFormFlag ? 'Save Changes' : 'Add Event'}</button>
+			</div>
+		</form>
+	);
+};
 
-export default reduxForm({ form: "eventForm", validate: eventFormValidation, enableReinitialize: true })(EventReduxForm);
+export default withRouter(
+	reduxForm({ form: 'eventForm', validate: eventFormValidation, enableReinitialize: true })(EventReduxForm)
+);

+ 5 - 8
src/components/eventInfoShort/EventInfoShort.js

@@ -6,7 +6,6 @@ import './eventInfoShort.scss';
 export class EventInfoShort extends React.Component {
     render() {
         const { title, country, city, eventDate, imgSrc, id } = this.props;
-        const dateArr = new Date(eventDate).toDateString().split(' ');
         return (
             <div className="event-item">
                 <Link to={`/events/${id}`}>
@@ -15,13 +14,11 @@ export class EventInfoShort extends React.Component {
                             <h3 className="caption">{title}</h3>
                             <div className="place">{country}, {city}</div>
                         </div>
-                        <div className="event-date">
-                            {
-                                dateArr.map(
-                                    (el, ind) => ind > 0 ? <span key={ind}>{el} </span> : null
-                                )
-                            }
-                        </div>
+                        {
+                            eventDate && <div className="event-date">
+                                { eventDate.map( (el,ind) =><span key={ind}>{el} </span>) }
+                            </div>
+                        }
                         <div className="bg-black"></div>
                         <div className="event-picture">
                             <img src={imgSrc} alt={title} />

+ 1 - 3
src/components/filtersEvents/FiltersEvents.js

@@ -1,15 +1,12 @@
 import React from 'react'
 import { Field, reduxForm } from 'redux-form';
 
-import './filtersEvents.scss';
-
 import { customSelect } from "../customFields/customSelect/customSelect";
 
 let FiltersEvents = props => {
     const { handleSubmit, getRequest, eventTypes, labelType } = props;
 
     const submit = value => {
-        console.log(value);
         getRequest(value.eventType);
     };
 
@@ -17,6 +14,7 @@ let FiltersEvents = props => {
         <form className="form-filter" onSubmit={handleSubmit(submit)}>
             <div>
                 <Field name="eventType" label={labelType} component={customSelect}>
+                    <option value="All events">All events</option>
                     {eventTypes.map( (elem,ind) => <option key={ind} value={elem}>{elem}</option>)}
                 </Field>
             </div>

+ 0 - 13
src/components/filtersEvents/filtersEvents.scss

@@ -1,13 +0,0 @@
-@import "../../styles/variables";
-
-.form-filter {
-    .form-block__select {
-        width: 100%;
-    }
-
-    .btn-group {
-        text-align: center;
-        padding-top: 1rem;
-        padding-bottom: 0;
-    }
-}

+ 0 - 13
src/components/filtersReviews/filters-reviews.scss

@@ -1,13 +0,0 @@
-@import "../../styles/variables";
-
-.form-filter {
-    .form-block__select {
-        width: 100%;
-    }
-
-    .btn-group {
-        text-align: center;
-        padding-top: 1rem;
-        padding-bottom: 0;
-    }
-}

+ 1 - 4
src/components/filtersReviews/filtersReviews.js

@@ -1,15 +1,12 @@
 import React from 'react'
 import { Field, reduxForm } from 'redux-form';
 
-import './filters-reviews.scss';
-
 import { customSelect } from "../customFields/customSelect/customSelect";
 
 let FiltersReviews = props => {
     const { handleSubmit, getRequest, eventTypes, labelType } = props;
 
     const submit = value => {
-        //console.log(value);
         getRequest(value.eventType);
     };
 
@@ -17,7 +14,7 @@ let FiltersReviews = props => {
         <form className="form-filter" onSubmit={handleSubmit(submit)}>
             <div>
                 <Field name="eventType" label={labelType} component={customSelect}>
-                    <option>All events</option>
+                    <option value="All events">All events</option>
                     {eventTypes.map( elem => <option key={elem.id} value={elem.id}>{elem.title}</option>)}
                 </Field>
             </div>

+ 0 - 2
src/components/login-form/LoginForm.js

@@ -1,8 +1,6 @@
 import React from 'react'
 import { Field, reduxForm } from 'redux-form';
 
-import './login.scss';
-
 import { customInput } from "../customFields/customInput/customInput";
 import { validationForms } from "../../utils/validationForms";
 

+ 0 - 1
src/components/login-form/login.scss

@@ -1 +0,0 @@
-@import "../../styles/variables";

+ 0 - 3
src/components/reg-form-event/RegFormEvent.js

@@ -1,8 +1,6 @@
 import React from 'react'
 import { Field, reduxForm } from 'redux-form';
 
-import './reg-form-event.scss';
-
 import { customSelect } from "../customFields/customSelect/customSelect";
 import { customInput } from "../customFields/customInput/customInput";
 import { validationForms } from "../../utils/validationForms";
@@ -13,7 +11,6 @@ let RegFormEvent = props => {
 
     const submit = value => {
         value.event = eventId;
-        //console.log('user-event', value);
         regEventSubmit(value);
         reset();
     };

+ 0 - 1
src/components/reg-form-event/reg-form-event.scss

@@ -1 +0,0 @@
-@import "../../styles/variables";

+ 0 - 4
src/components/registration-form/RegistrationForm.js

@@ -1,8 +1,6 @@
 import React from 'react'
 import { Field, reduxForm } from 'redux-form';
 
-import './registrationForm.scss';
-
 import { customInput } from "../customFields/customInput/customInput";
 import { validationForms } from "../../utils/validationForms";
 
@@ -10,10 +8,8 @@ let RegistrationForm = props => {
     const { handleSubmit, postCheckInSubmit, message } = props;
 
     const submit = value => {
-        //console.log(value);
         postCheckInSubmit(value);
         if(message !== 'User was successfully register'){
-            //console.log(message);
             props.history.push('/login');
         }
     };

+ 0 - 1
src/components/registration-form/registrationForm.scss

@@ -1 +0,0 @@
-@import "../../styles/variables";

+ 0 - 4
src/components/review-form/ReviewForm.js

@@ -1,8 +1,6 @@
 import React from 'react'
 import { Field, reduxForm } from 'redux-form';
 
-import './review-form.scss';
-
 import { customInput } from "../customFields/customInput/customInput";
 import { customTextarea } from "../customFields/customTextarea/customTextarea";
 import { customSelect } from "../customFields/customSelect/customSelect";
@@ -10,11 +8,9 @@ import { validationForms } from "../../utils/validationForms";
 
 let ReviewForm = props => {
     const { handleSubmit, postReviewSubmit, eventsArr, reset } = props;
-    //console.log(props);
 
     const submit = value => {
         value.date = new Date();
-        //console.log(value);
         postReviewSubmit(value);
         reset()
     };

+ 0 - 1
src/components/review-form/review-form.scss

@@ -1 +0,0 @@
-@import "../../styles/variables";

+ 8 - 6
src/components/sidebar/Sidebar.js

@@ -19,8 +19,8 @@ const siteMenu = [
         id: 1
     },
     {
-        text: 'Result',
-        href: '/result',
+        text: 'Results',
+        href: '/results',
         id: 2
     },
     {
@@ -44,7 +44,9 @@ export class Sidebar extends React.Component {
 
     render() {
         
-	    const { showSidebar, showSidebarFlag } = this.props;
+        const { showSidebar, showSidebarFlag } = this.props;
+        const role = localStorage.user && JSON.parse(localStorage.user).user.role;
+
         return (
             <div className={ !showSidebarFlag ? 'menu close' : 'menu' }>
                 <nav>
@@ -55,7 +57,7 @@ export class Sidebar extends React.Component {
                     </div>
                     <ul>
 						{
-                            localStorage.user && <li><Link to="/profile">Profile</Link></li>
+                            role === 'user' && <li><Link to="/profile">Profile</Link></li>
 						}
 						
                         {
@@ -66,10 +68,10 @@ export class Sidebar extends React.Component {
                             )
                         }
 						{
-                            !localStorage.user && <li><Link to="/login">Login</Link></li>
+                            !role && <li><Link to="/login">Login</Link></li>
 						}
                         {
-                            localStorage.user && <li>
+                            role === 'user' && <li>
                                 <button className="logout" onClick={this.logoutHandler}>
                                     <i className="fa fa-sign-out"></i>
                                 </button>

+ 1 - 1
src/conteiners/adminAddEventPage/adminAddEventPage.js

@@ -51,7 +51,7 @@ class AdminAddEventPage extends Component {
 
                 {this.state.confirmationMessageFlag &&
                     <ConfirmationMessage closeMessage={this.closeConfirmationMessage}>
-                        <div className="text">{editFormFlag ? `Event has been changed.` : `New event has beed added.`}</div>
+                        <div className="text">Event has been saved</div>
                     </ConfirmationMessage >}
             </>
         );

+ 14 - 16
src/conteiners/adminMainPage/adminMainPage.js

@@ -1,24 +1,22 @@
 import React, { Component } from 'react';
-import { connect } from "react-redux";
-import "./adminMainPage.scss";
+import { connect } from 'react-redux';
+import './adminMainPage.scss';
+import * as actions from '../../actions/adminMainPageActions';
 import Header from '../../components/adminHeader/adminHeader';
 import AdminMenu from '../../components/adminMenu/adminMenu';
 
 class AdminMainPage extends Component {
-
-  render() {
-
-    return (
-      <div className="admin-main-page-wrapper">
-        <Header />
-        <AdminMenu />
-      </div>
-    )
-  }
+	render() {
+		console.log('main', this.props);
+		return (
+			<div className="admin-main-page-wrapper">
+				<Header changeEditFlag={this.props.changeEditFlag} />
+				<AdminMenu />
+			</div>
+		);
+	}
 }
 
-const mapStateToProps = state => ({
-
-});
+const mapStateToProps = (state) => ({});
 
-export default connect(mapStateToProps)(AdminMainPage);
+export default connect(mapStateToProps, actions)(AdminMainPage);

+ 1 - 1
src/conteiners/adminMyEventsPage/adminMyEventsPage.js

@@ -65,7 +65,7 @@ class AdminAddEventPage extends Component {
                             )}
                         </div>
 
-                        {editFormFlag && <Redirect to='/admin/add_new_event' />}
+                        {editFormFlag && <Redirect to='/admin/event' />}
                     </div>
                 </div>
             </>

+ 11 - 24
src/conteiners/eventCard/EventCard.js

@@ -17,8 +17,6 @@ export class EventCard extends React.Component {
 
     render() {
         const { event, regEventSubmit } = this.props;
-        const dateArr = new Date(event.eventDate).toDateString().split(' ');
-        //console.log(event);
         return (
             <>
                 <Sidebar />
@@ -32,15 +30,11 @@ export class EventCard extends React.Component {
                                 <h2>{event.title}</h2>
                                 <p className="country">{event.country}, {event.city}</p>
                                 <p className="event-type">{event.eventType}</p>
-                                <div className="date">
-                                    <p>
-                                        {
-                                            dateArr.map(
-                                                (el, ind) => ind > 0 ? <span key={ind}>{el} </span> : null
-                                            )
-                                        }
-                                    </p>
-                                </div>
+                                {
+                                    event.eventDate && <div className="date">
+                                        <p>{ event.eventDate.map((el, ind) => <span key={ind}>{el} </span>) }</p>
+                                    </div>
+                                }                                
                             </div>
                             <div className="bg-black"></div>
                         </div>
@@ -60,21 +54,10 @@ export class EventCard extends React.Component {
                                 <div className="overview">
                                     <img src={event.mainBannerPicture} alt="banner" />
                                     <p>{event.overview}</p>
-                                    {/*{
-                                        event.contentVideo && <div className="event-video">
-                                            <video controls loop>
-                                                <source src={video} type="video/mp4" />
-                                                <source src={video} type="video/ogg" />
-                                                <source src={video} type="video/webm" />
-                                                Your browser does not support the video tag.
-                                            </video>
-                                        </div>
-                                    }*/}
                                 </div>
                                 
                                 {
                                     event.map && <div className="map-wrap">
-                                        {/*click open pop-up with map*/}
                                         <img src={event.map.toString()} alt="banner" />
                                     </div>
                                 }
@@ -97,7 +80,10 @@ export class EventCard extends React.Component {
                                     }
                                 </div>
                                 <div className="reg-form-event">
-                                    <RegFormEvent eventId={event._id} regEventSubmit={regEventSubmit}/>
+                                    <RegFormEvent 
+                                        eventId={event._id} 
+                                        regEventSubmit={regEventSubmit}
+                                    />
                                 </div>
                             </div>
                         </div>
@@ -111,7 +97,8 @@ export class EventCard extends React.Component {
 
 const mapStateToProps = state => {
     return {
-        event: state.getEventCard.event
+        event: state.getEventCard.event,
+        eventUsers: state.registrationEvent.eventUsers
     };
 };
 

+ 1 - 2
src/conteiners/events/Events.js

@@ -17,8 +17,7 @@ export class Events extends React.Component {
 
     render() {
         const { events, getAllEvents } = this.props;
-        const eventTypes = ['All events', 'Marathon', 'Triathlon', 'Cycling'];
-        //console.log(events);
+        const eventTypes = ['Marathon', 'Triathlon', 'Cycling'];
         return (
             <>
                 <Sidebar />

+ 16 - 7
src/conteiners/gallery/Gallery.js

@@ -2,20 +2,22 @@ import React from 'react';
 import { connect } from "react-redux";
 
 import { getPhotogalary } from "../../actions/photogalaryActions";
+import { getAllEvents } from "../../actions/getAllEvents";
 
 import './gallery.scss';
 
 import Sidebar from '../../components/sidebar/Sidebar';
 import Footer from '../../components/footer/Footer';
+import FiltersEvents from '../../components/filtersEvents/FiltersEvents';
 
 class Gallery extends React.Component {
     componentDidMount() {
-        this.props.getPhotogalary()
+        this.props.getPhotogalary();
+        this.props.getAllEvents();
     }
 
     render() {
-        const { gallery } = this.props;
-        //console.log('gallery', this.props.gallery);
+        const { gallery, eventsArrTitles, getPhotogalary } = this.props;
         return (
             <>
                 <Sidebar/>
@@ -25,9 +27,15 @@ class Gallery extends React.Component {
                     </div>
                 </div>
                 <div className="container-wrap">
+
+                    <div className="events-filters">
+                        <h4>Gallery filter</h4>
+                        <FiltersEvents labelType="Event Title" getRequest={getPhotogalary} eventTypes={eventsArrTitles} />
+                    </div>
+
                     <div className="gallery-wrap">
                         {
-                            gallery.map((item,ind) => 
+                            gallery.length !== 0 ? gallery.map((item,ind) => 
                                 <div className="gallery-item" key={ind}>
                                     <h3>{item.eventTitle}</h3>
                                     <h5>{item.eventType}</h5>
@@ -44,7 +52,7 @@ class Gallery extends React.Component {
                                         }
                                     </div>
                                 </div>
-                            )
+                            ) : <p className="not-found">Not found gallery</p>
                         }
                     </div>
                 </div>
@@ -56,11 +64,12 @@ class Gallery extends React.Component {
 
 const mapStateToProps = state => {
     return {
-        gallery: state.photogalaryReducer.gallery
+        gallery: state.photogalaryReducer.gallery,
+        eventsArrTitles: state.getEvents.eventsArrTitles
     };
 };
 
 export default connect(
     mapStateToProps,
-    { getPhotogalary }
+    { getPhotogalary, getAllEvents }
 )(Gallery);

+ 1 - 1
src/conteiners/home/Home.js

@@ -106,7 +106,7 @@ export class Home extends React.Component {
 
                         <div className="events-list">
                             {
-                                events.length !== 0 ? events.reverse().map( (event,ind) => ind < 6 && <EventInfoShort
+                                events.length !== 0 ? events.map( (event,ind) => ind < 6 && <EventInfoShort
                                     key={event._id}
                                     title={event.title}
                                     country={event.country}

+ 0 - 1
src/conteiners/login/Login.js

@@ -11,7 +11,6 @@ import LoginForm from '../../components/login-form/LoginForm';
 export class Login extends React.Component {
     render() {
         const { postLoginSubmit, message } = this.props;
-        console.log(message);
         return (
             <div className="login-page">
                 <div className="form-login">

+ 17 - 28
src/conteiners/profile/Profile.js

@@ -2,6 +2,7 @@ import React from 'react';
 import { connect } from "react-redux";
 
 import { getUserInfo } from "../../actions/getUserInfo";
+import { getResults } from "../../actions/getResults";
 
 import './profile.scss';
 
@@ -13,13 +14,12 @@ import Sidebar from '../../components/sidebar/Sidebar';
 export class Profile extends React.Component {
     componentDidMount() {
         this.props.getUserInfo(JSON.parse(localStorage.user).user._id)
+        this.props.getResults();
     }
 
     render() {
-        //console.log('profileUser',JSON.parse(localStorage.user).user._id);
-        //const user = JSON.parse(localStorage.user).user;
-        const { user } = this.props;
-        //console.log('user',user);
+        const { user, results } = this.props;
+        const userResult = results.filter(result => result.eventUser.email === user.email);
     
         return (
             <>
@@ -62,43 +62,31 @@ export class Profile extends React.Component {
                             <input id="tab1" type="radio" name="tabs" checked readOnly hidden/>
                             <label htmlFor="tab1" className="tab-label">History</label>
 
-                            {/*<input id="tab2" type="radio" name="tabs" readOnly hidden/>
-                            <label htmlFor="tab2" className="tab-label">Settings</label>*/}
-
                             <div className="tab-item" id="content1">
                                <div className="history">
-                                   {/* название ивента, дистанция, время, место */}
                                    <table>
                                        <thead>
                                            <tr>
                                                <th>Event</th>
                                                <th>Distance</th>
                                                <th>Time</th>
-                                               <th>Rating</th>
+                                               <th>Event type</th>
                                            </tr>
                                        </thead>
                                        <tbody>
-                                           <tr>
-                                               <td>ULTRA MARATHON OF THE ATLANTIC 2019</td>
-                                               <td>marathone</td>
-                                               <td>3h40</td>
-                                               <td>39</td>
-                                           </tr>
-                                           <tr>
-                                               <td>CORFU HALF MARATHON</td>
-                                               <td>Half marathone</td>
-                                               <td>2h30</td>
-                                               <td>30</td>
-                                           </tr>
+                                           {
+                                                userResult.length !== 0 ? userResult.map(result => <tr key={result._id}>
+                                                        <td>{result.event.title}</td>
+                                                        <td>{result.eventUser.distance}</td>
+                                                        <td>{result.time}</td>
+                                                        <td>{result.event.eventType}</td>
+                                                    </tr>
+                                                ) : <tr><td colSpan="5"><p className="not-found">Not found results</p></td></tr>
+                                           }
                                        </tbody>
                                    </table>
                                </div>
                             </div>
-
-                            {/*<div className="tab-item" id="content2">
-                                <div className="settings">
-                                </div>
-                            </div>*/}
                         </div>
                     </div>
                 </div>
@@ -109,11 +97,12 @@ export class Profile extends React.Component {
 
 const mapStateToProps = state => {
     return {
-        user: state.userInfo.userProfile
+        user: state.userInfo.userProfile,
+        results: state.results.results
     };
 };
 
 export default connect(
     mapStateToProps,
-    { getUserInfo }
+    { getUserInfo, getResults }
 )(Profile);

+ 1 - 55
src/conteiners/profile/profile.scss

@@ -58,52 +58,6 @@
         }
     }
 
-    /*&-tabs-wrap {
-        padding-bottom: 5rem;
-        text-align: center;
-
-        .tabs-main {
-            max-width: 100%;
-    
-            .tab-item {
-                display: none;
-                padding: 2rem;
-                border: 1px solid $color-mint;
-                border-bottom: 0;
-                text-align: left;
-            }
-    
-            .tab-label {
-                display: inline-block;
-                margin: 0 0 -1px;
-                padding: 1.5rem 5rem;
-                font-weight: $semi-bold;
-                text-align: center;
-                color: $color-grey-3;
-                border: 1px solid transparent;
-                font-size: 1.6rem;
-                width: 30%;
-    
-                &:hover {
-                    color: $color-mint;
-                    cursor: pointer;
-                }
-            }
-    
-            input:checked + .tab-label {
-                color: $color-blue;
-                border: 1px solid $color-mint;
-                border-top: 3px solid $color-mint;
-                border-bottom: 1px solid $color-white;
-            }
-    
-            #tab1:checked ~ #content1,
-            #tab2:checked ~ #content2 {
-                display: block;
-            }
-        }
-    }*/
-
     @media screen and (max-width: $medium) {
         h5 {
             text-align: center;
@@ -146,14 +100,6 @@
                     }
                 }
             }
-        }
-        /*&-tabs-wrap {
-            .tabs-main {
-                .tab-label {
-                    padding: 1.5rem;
-                    width: 50%;
-                }
-            }
-        }  */      
+        }    
     }
 }

+ 18 - 17
src/conteiners/result/Result.js

@@ -2,29 +2,36 @@ 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;
         return (
             <>
                 <Sidebar/>
                 <div className="container-wrap events">
                     <div className="caption-page">
-                        <h2>Result page</h2>
+                        <h2>Results page</h2>
                     </div>
                 </div>
 
                 <div className="container-wrap">
+                    <div className="events-filters">
+                        <h4>Result 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 +43,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 +71,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 +110,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);

+ 6 - 9
src/conteiners/reviews/Reviews.js

@@ -18,11 +18,7 @@ export class Reviews extends React.Component {
     }
 
     render() {
-        const { postReviewSubmit, events, reviews, getAllReviews } = this.props;
-        const eventsArr = events.map(event => ({
-            title: event.title,
-            id: event._id
-        }));
+        const { postReviewSubmit, reviews, getAllReviews, eventsArr } = this.props;
         
         return (
             <>
@@ -35,19 +31,19 @@ export class Reviews extends React.Component {
                 <div className="container-wrap">
 
                     <div className="events-filters">
-                        <h4>Events filter</h4>
+                        <h4>Reviews filter</h4>
                         <FiltersReviews labelType="Event Title" getRequest={getAllReviews} eventTypes={eventsArr} />
                     </div>
 
                     <div className="reviews-wrap">
                         {
-                            reviews.length !== 0 ? Array.from(reviews).reverse().map((reviewer, ind) => ind < 10 &&
+                            reviews.length !== 0 ? reviews.map((reviewer, ind) => ind < 10 &&
                                 <div className="reviews-item" key={ind}>
                                     <div className="review-content">
                                         <div className="reviews-name">{reviewer.name}</div>
                                         <div className="reviews-date">
                                             <i className="fa fa-calendar-o" aria-hidden="true"></i>
-                                        { new Date(reviewer.date).toDateString().slice(4) }
+                                            { reviewer.date }
                                         </div>
                                         <div className="reviews-text">{reviewer.text}</div>
                                     </div>
@@ -69,7 +65,8 @@ export class Reviews extends React.Component {
 const mapStateToProps = state => {
     return {
         reviews: state.allReviews.reviews,
-        events: state.getEvents.events
+        events: state.getEvents.events,
+        eventsArr: state.getEvents.eventsArrShort
     };
 };
 

+ 31 - 24
src/reducers/adminMainPageReducer.js

@@ -1,13 +1,10 @@
-import * as types from "../actionTypes/actionTypes"
-import initialState from "../state/addEventInitialValue";
-
+import * as types from '../actionTypes/actionTypes';
+import initialState from '../state/addEventInitialValue';
 
 export default (state = initialState, action) => {
-
 	switch (action.type) {
-
 		case types.EDIT_EVENT: {
-			const eventFormInitialValue = state.eventList.find(el => el._id === action.payload);
+			const eventFormInitialValue = state.eventList.find((el) => el._id === action.payload);
 			return {
 				...state,
 				eventFormInitialValue: eventFormInitialValue,
@@ -15,32 +12,39 @@ export default (state = initialState, action) => {
 			};
 		}
 
+		case types.CHANGE_EDIT_FLAG: {
+			return {
+				...state,
+				eventFormInitialValue: initialState.eventFormInitialValue,
+				editFormFlag: false
+			};
+		}
+
 		//POST
 		case types.POST_NEW_EVENT_REQUEST_SUCCESS: {
-			console.log('reducer add event success', action.payload)
+			console.log('reducer add event success', action.payload);
 			return {
 				...state,
-				addEventMessage: "New event has been added"
-			}
+				addEventMessage: 'New event has been added'
+			};
 		}
 		case types.POST_NEW_EVENT_REQUEST_FAIL: {
-			console.log('reducer add event fail', action.payload)
-			return { ...state, error: action.payload }
+			console.log('reducer add event fail', action.payload);
+			return { ...state, error: action.payload };
 		}
 
 		//PUT
 		case types.EDIT_EVENT_REQUEST_SUCCESS: {
-			console.log('reducer edit event success', action.payload)
+			console.log('reducer edit event success', action.payload);
 			return {
 				...state,
-				addEventMessage: "Event has been changed",
-				// eventFormInitialValue: eventFormInitialValue,
-				// editFormFlag: false
-			}
+				eventFormInitialValue: initialState.eventFormInitialValue,
+				editFormFlag: false
+			};
 		}
 		case types.EDIT_EVENT_REQUEST_FAIL: {
-			console.log('reducer edit event fail', action.payload)
-			return { ...state, error: action.payload }
+			console.log('reducer edit event fail', action.payload);
+			return { ...state, error: action.payload };
 		}
 
 		// GET ALL EVENTS
@@ -49,21 +53,24 @@ export default (state = initialState, action) => {
 		}
 		case types.GET_EVENTS_REQUEST_SUCCESS: {
 			const { data } = action.payload;
-			const eventList = data.events
+			const eventList = data.events.map((event) => ({
+				...event,
+				eventDate: new Date(event.eventDate).toDateString().split(' ').slice(1, 4)
+			}));
 			return { ...state, eventList };
 		}
 		case types.GET_EVENTS_REQUEST_FAIL: {
 			return state;
 		}
 
-		// GET EVENT BY TITLE 
+		// GET EVENT BY TITLE
 		case types.GET_EVENT_BY_TITLE: {
 			return state;
 		}
 		case types.GET_EVENT_BY_TITLE_SUCCESS: {
 			const { data } = action.payload;
-			console.log('reducer data eventByTitle', data)
-			const eventByTitle = data
+			console.log('reducer data eventByTitle', data);
+			const eventByTitle = data;
 			return { ...state, eventByTitle };
 		}
 		case types.GET_EVENT_BY_TITLE_FAIL: {
@@ -78,7 +85,7 @@ export default (state = initialState, action) => {
 			const { _id } = action.payload;
 			return {
 				...state,
-				eventList: state.eventList.filter(el => el._id !== _id)
+				eventList: state.eventList.filter((el) => el._id !== _id)
 			};
 		}
 
@@ -89,4 +96,4 @@ export default (state = initialState, action) => {
 		default:
 			return state;
 	}
-}
+};

+ 3 - 1
src/reducers/combineReducers.js

@@ -13,6 +13,7 @@ import allReviews from "./reviews";
 import adminResultsReduser from "./adminResultsReduser"
 import userInfo from "./getUserInfo"
 import results from "./getResults";
+import registrationEvent from "./registrationEvent";
 
 export default combineReducers({
 	form: formReducer,
@@ -27,5 +28,6 @@ export default combineReducers({
     logout,
     adminResultsReduser,
     userInfo,
-    results
+    results,
+    registrationEvent
 });

+ 20 - 4
src/reducers/getAllEvents.js

@@ -1,7 +1,9 @@
 import * as types from "../actionTypes/actionTypes";
 
 const initialState = {
-    events: []
+    events: [],
+    eventsArrTitles: [],
+    eventsArrShort: []
 }
 
 export default (state = initialState, action) => {
@@ -10,11 +12,25 @@ export default (state = initialState, action) => {
             return state;
         }
 
-        case types.GET_REQUEST_SUCCESS_EVENTS: {
-            //console.log('events',action.payload.events);
+        case types.GET_REQUEST_SUCCESS_EVENTS: {            
+            const allEvents = action.payload.events.reverse().map( event => ({
+                    ...event,
+                    eventDate: new Date(event.eventDate).toDateString().split(' ').slice(1,4)
+                })
+            )
+
+            const eventsTitles = allEvents.map(event => event.title); 
+
+            const eventsArr = allEvents.map(event => ({
+                title: event.title,
+                id: event._id
+            }));
+
             return {
                 ...state,
-                events: action.payload.events
+                events: allEvents,
+                eventsArrTitles: eventsTitles,
+                eventsArrShort: eventsArr
             };
         }
 

+ 4 - 2
src/reducers/getRequestEvent.js

@@ -11,10 +11,12 @@ export default (state = initialState, action) => {
         }
 
         case types.GET_REQUEST_SUCCESS_EVENT_CARD: {
-            //console.log('event', action.payload.events[0]);
             return {
                 ...state,
-                event: action.payload.events[0]
+                event: {
+                    ...action.payload.events[0],
+                    eventDate: new Date(action.payload.events[0].eventDate).toDateString().split(' ').slice(1,4)
+                }
             };
         }
 

+ 3 - 7
src/reducers/getResults.js

@@ -12,16 +12,12 @@ export default (state = initialState, action) => {
             return state;
         }
 
-        case types.GET_RESULT_SUCCESS: {
-            //console.log('results',action.payload.results);
-            
-            //отфильтровать по рейтингу - ?
-            
+        case types.GET_RESULT_SUCCESS: {            
             const resultsArr = action.payload.results;
+            //console.log(resultsArr);
             const marathoneResultsArr = resultsArr.filter( elem => elem.eventUser.distance === "Marathone" );
-            //console.log('marathoneResults',marathoneResultsArr);
+            
             const halfMarathoneResultsArr = resultsArr.filter( elem => elem.eventUser.distance === "Half marathone" );
-            //console.log('halfMarathoneResults',halfMarathoneResultsArr);
 
             return {
                 ...state,

+ 1 - 3
src/reducers/getUserInfo.js

@@ -10,9 +10,7 @@ export default (state = initialState, action) => {
             return state;
         }
 
-        case types.GET_USERS_INFO_SUCCESS: {
-            //console.log('userprofile',action.payload.user);
-            
+        case types.GET_USERS_INFO_SUCCESS: {            
             return {
                 ...state,
                 userProfile: action.payload.user

+ 5 - 4
src/reducers/login.js

@@ -11,8 +11,7 @@ export default (state = initialState, action) => {
             return state;
         }
 
-        case types.POST_REQUEST_SUCCESS_LOGIN: {   
-            console.log('action.payload.message',action.payload.message);
+        case types.POST_REQUEST_SUCCESS_LOGIN: {
             return {
                 ...state,
                 user: action.payload.user,
@@ -21,8 +20,10 @@ export default (state = initialState, action) => {
         }
 
         case types.POST_REQUEST_ERROR_LOGIN: {
-            console.log('error', action.payload.message);
-            return state;
+            return {
+                ...state,
+                message: action.payload.message
+            };
         }
 
         default:

+ 1 - 3
src/reducers/logout.js

@@ -10,13 +10,11 @@ export default (state = initialState, action) => {
             return state;
         }
 
-        case types.GET_LOGOUT_USER_SUCCESS: {
-            //console.log('logout',action.payload.logOut);            
+        case types.GET_LOGOUT_USER_SUCCESS: {   
             return state
         }
 
         case types.GET_LOGOUT_USER_ERROR: {
-            console.log('error');
             return state;
         }
 

+ 4 - 3
src/reducers/registration.js

@@ -11,7 +11,6 @@ export default (state = initialState, action) => {
         }
 
         case types.POST_REQUEST_SUCCESS_CHECKIN: {
-            console.log('some', action.payload.message );
             return {
                 ...state,
                 message: action.payload.message
@@ -19,8 +18,10 @@ export default (state = initialState, action) => {
         }
 
         case types.POST_REQUEST_ERROR_CHECKIN: {
-            console.log('error');
-            return state;
+            return {
+                ...state,
+                message: action.payload.message
+            };
         }
 
         default:

+ 2 - 3
src/reducers/registrationEvent.js

@@ -1,7 +1,7 @@
 import * as types from "../actionTypes/actionTypes";
 
 const initialState = {
-    user: {}
+    eventUsers: []
 }
 
 export default (state = initialState, action) => {
@@ -11,12 +11,11 @@ export default (state = initialState, action) => {
         }
 
         case types.POST_REGISTRATION_EVENT_SUCCESS: {
-            console.log('regEventUser', action.payload );
             return state;
         }
 
         case types.POST_REGISTRATION_EVENT_ERROR: {
-            console.log('error');
+            console.log(action.payload.message);
             return state;
         }
 

+ 17 - 8
src/reducers/reviews.js

@@ -1,7 +1,8 @@
 import * as types from "../actionTypes/actionTypes";
 
 const initialState = {
-    reviews: []
+    reviews: [],
+    message: ''
 }
 
 export default (state = initialState, action) => {
@@ -11,16 +12,23 @@ export default (state = initialState, action) => {
         }
 
         case types.GET_REQUEST_SUCCESS_REVIEWS: {
-            //console.log('reviews', action.payload);
+            const allReviews = action.payload.results.reverse().map( res => ({
+                    ...res,
+                    date: new Date(res.date).toDateString().slice(4)
+                })
+            )
+
             return {
                 ...state,
-                reviews: action.payload.results
+                reviews: allReviews
             };
         }
 
         case types.GET_REQUEST_ERROR_REVIEWS: {
-            console.log('error reviews', action.payload.message);
-            return state;
+            return {
+                ...state,
+                message: action.payload.message
+            };
         }
 
         case types.POST_REQUEST_REVIEW: {
@@ -28,13 +36,14 @@ export default (state = initialState, action) => {
         }
 
         case types.POST_REQUEST_SUCCESS_REVIEW: {
-            //console.log('review', action.payload);
             return state;
         }
 
         case types.POST_REQUEST_ERROR_REVIEW: {
-            console.log('error reviews', action.payload.message);
-            return state;
+            return {
+                ...state,
+                message: action.payload.message
+            };
         }
 
         default:

+ 37 - 36
src/router.js

@@ -1,13 +1,13 @@
-import React, { useEffect } from "react";
-import { Switch, withRouter } from "react-router-dom";
-import { connect } from "react-redux";
-import { PrivateRoute } from "./private-router";
+import React, { useEffect } from 'react';
+import { Switch, withRouter } from 'react-router-dom';
+import { connect } from 'react-redux';
+import { PrivateRoute } from './private-router';
 
 import AdminMainPage from './conteiners/adminMainPage/adminMainPage';
 import AdminAddEventPage from './conteiners/adminAddEventPage/adminAddEventPage';
 import AdminMyEventsPage from './conteiners/adminMyEventsPage/adminMyEventsPage';
-import AdminAddPhotogalarytPage from "./conteiners/adminPhotogalaryPage/adminPhotogalaryPage"
-import AdminResultsPage from "./conteiners/adminResultsPage/adminResultsPage"
+import AdminAddPhotogalarytPage from './conteiners/adminPhotogalaryPage/adminPhotogalaryPage';
+import AdminResultsPage from './conteiners/adminResultsPage/adminResultsPage';
 
 import Home from './conteiners/home/Home';
 import Result from './conteiners/result/Result';
@@ -25,63 +25,63 @@ const route = [
 	{
 		id: 1,
 		exact: true,
-		path: "/",
+		path: '/',
 		protected: false,
 		component: Home
 	},
 	{
 		id: 2,
 		exact: true,
-		path: "/events",
+		path: '/events',
 		protected: false,
 		component: Events
 	},
 	{
 		id: 3,
 		exact: true,
-		path: "/events/:id",
+		path: '/events/:id',
 		protected: false,
 		component: EventCard
 	},
 	{
 		id: 4,
 		exact: true,
-		path: "/result",
+		path: '/results',
 		protected: false,
 		component: Result
 	},
 	{
 		id: 5,
 		exact: true,
-		path: "/gallery",
+		path: '/gallery',
 		protected: false,
 		component: Gallery
 	},
 	{
 		id: 6,
 		exact: true,
-		path: "/reviews",
+		path: '/reviews',
 		protected: false,
 		component: Reviews
 	},
 	{
 		id: 7,
 		exact: true,
-		path: "/login",
+		path: '/login',
 		protected: false,
 		component: Login
 	},
 	{
 		id: 8,
 		exact: true,
-		path: "/registration",
+		path: '/registration',
 		protected: false,
 		component: RegistrationPage
 	},
 	{
 		id: 9,
 		exact: true,
-		path: "/profile",
+		path: '/profile',
 		protected: true,
 		hasAccess: 'user',
 		component: Profile
@@ -89,7 +89,7 @@ const route = [
 	{
 		id: 10,
 		exact: true,
-		path: "/admin",
+		path: '/admin',
 		protected: true,
 		hasAccess: 'admin',
 		component: AdminMainPage
@@ -97,7 +97,7 @@ const route = [
 	{
 		id: 11,
 		exact: true,
-		path: "/admin/add_new_event",
+		path: '/admin/event',
 		protected: true,
 		hasAccess: 'admin',
 		component: AdminAddEventPage
@@ -105,7 +105,7 @@ const route = [
 	{
 		id: 12,
 		exact: true,
-		path: "/admin/photogalary",
+		path: '/admin/photogalary',
 		protected: true,
 		hasAccess: 'admin',
 		component: AdminAddPhotogalarytPage
@@ -113,7 +113,7 @@ const route = [
 	{
 		id: 13,
 		exact: true,
-		path: "/admin/results",
+		path: '/admin/results',
 		protected: true,
 		hasAccess: 'admin',
 		component: AdminResultsPage
@@ -121,7 +121,7 @@ const route = [
 	{
 		id: 14,
 		exact: true,
-		path: "/admin/my_events",
+		path: '/admin/my_events',
 		protected: true,
 		hasAccess: 'admin',
 		component: AdminMyEventsPage
@@ -133,26 +133,29 @@ const route = [
 ];
 
 const Router = withRouter(({ history, user }) => {
-	useEffect(() => {
-		const userl = localStorage.user ? JSON.parse(localStorage.user).user : null;
+	useEffect(
+		() => {
+			const userl = localStorage.user ? JSON.parse(localStorage.user).user : null;
 
-		if (userl) {
-			const userRole = userl.role;
+			if (userl) {
+				const userRole = userl.role;
 
-			if (userRole === 'admin') {
-				history.push("/admin");
-			}
+				if (userRole === 'admin') {
+					history.push('/admin');
+				}
 
-			if (userRole === 'user') {
-				history.push("/profile");
+				if (userRole === 'user') {
+					history.push('/profile');
+				}
 			}
-		}
-	}, [history, user]);
+		},
+		[ history, user ]
+	);
 
 	return (
 		<div className="container">
 			<Switch>
-				{route.map(el => (
+				{route.map((el) => (
 					<PrivateRoute
 						protectedRoute={el.protected}
 						key={el.id}
@@ -166,12 +169,10 @@ const Router = withRouter(({ history, user }) => {
 	);
 });
 
-const mapStateToProps = state => {
+const mapStateToProps = (state) => {
 	return {
 		user: state.login.user
 	};
 };
 
-export default connect(
-	mapStateToProps
-)(Router);
+export default connect(mapStateToProps)(Router);

+ 7 - 7
src/state/adminMenu.js

@@ -1,8 +1,8 @@
 export const adminMenu = [
-	{ path: "/admin/add_new_event", id: 1, text: "Add New Event", logout: false },
-	{ path: "/admin/my_events", id: 2, text: "My Events", logout: false },
-    { path: "/admin/photogalary", id: 3, text: "Add Photogalery", logout: false },
-	{ path: "/admin/results", id: 4, text: "Add Results", logout: false },
-	{ path: "/", id: 5, text: "Go to WebSite", logout: false },
-	{ path: "/", id: 6, text: "Log out", logout: true }
-];
+	{ path: '/admin/event', id: 1, text: 'Add New Event', logout: false },
+	{ path: '/admin/my_events', id: 2, text: 'My Events', logout: false },
+	{ path: '/admin/photogalary', id: 3, text: 'Add Photogalery', logout: false },
+	{ path: '/admin/results', id: 4, text: 'Add Results', logout: false },
+	{ path: '/', id: 5, text: 'Go to WebSite', logout: false },
+	{ path: '/', id: 6, text: 'Log out', logout: true }
+];

+ 0 - 9
src/styles/base.scss

@@ -17,15 +17,6 @@ html {
     @media (max-width: small) {
         font-size: 50% !important;
     }
-    // @include breakpoint(lg) {
-    // 	font-size: 56.25% !important;
-    // }
-    // @include breakpoint(md) {
-    // 	font-size: 50% !important;
-    // }
-    // @include breakpoint(sm) {
-    // 	font-size: 62.5% !important;
-    // }
 }
 
 body,

+ 2 - 39
src/styles/custom.scss

@@ -1,10 +1,6 @@
-/*html {
-    min-height: 100vh;
+html, body, #root {
     height: 100%;
 }
-body, #root {
-    height: 100vh;
-}*/
 
 .button-position-bottom {
 	max-width: 1000px;
@@ -19,7 +15,7 @@ body, #root {
 .container {
     display: flex;
     flex-direction: column;
-    height: 100%;
+    min-height: 100%;
 
     &-wrap {
         flex-grow: 1;
@@ -105,36 +101,3 @@ i {
     width: 100%;
     color: $color-blue;
 }
-
-//for the login and registration pages
-.form-quest {
-    font-size: 1.4rem;
-    margin-top:2rem;
-
-    a {
-        color: $color-mint;
-        transition: 0.5s;
-
-        &:hover {
-            color: $color-blue;
-        }
-    }
-}
-
-//input-box error message
-.input-box {
-    &__error {
-        color: $color-error;
-    }
-}
-
-//select error message
-.form-block {
-    &__select,
-    &__text-area {
-        .error {
-            font-size: 1.3rem;
-            color: $color-error;
-        }
-    }
-}

+ 12 - 0
src/styles/filters.scss

@@ -13,3 +13,15 @@
         font-size: 1.4rem;
     }
 }
+
+.form-filter {
+    .form-block__select {
+        width: 100%;
+    }
+
+    .btn-group {
+        text-align: center;
+        padding-top: 1rem;
+        padding-bottom: 0;
+    }
+}

+ 17 - 0
src/styles/form-field.scss

@@ -0,0 +1,17 @@
+//input-box error message
+.input-box {
+    &__error {
+        color: $color-error;
+    }
+}
+
+//select error message
+.form-block {
+    &__select,
+    &__text-area {
+        .error {
+            font-size: 1.3rem;
+            color: $color-error;
+        }
+    }
+}

+ 14 - 0
src/styles/login-reg.scss

@@ -0,0 +1,14 @@
+//for the login and registration pages
+.form-quest {
+    font-size: 1.4rem;
+    margin-top:2rem;
+
+    a {
+        color: $color-mint;
+        transition: 0.5s;
+
+        &:hover {
+            color: $color-blue;
+        }
+    }
+}

+ 2 - 0
src/styles/main.scss

@@ -3,6 +3,8 @@
 @import "base";
 @import "custom";
 @import "logo";
+@import "login-reg";
+@import "form-field";
 @import "filters";
 @import "reg-radio";
 @import "tabs";