diff --git a/mpwo_client/src/actions/activities.js b/mpwo_client/src/actions/activities.js index 2e3b3a4c..0479fc4b 100644 --- a/mpwo_client/src/actions/activities.js +++ b/mpwo_client/src/actions/activities.js @@ -5,6 +5,7 @@ import mpwoApi from '../mwpoApi/activities' import { history } from '../index' import { formatChartData } from '../utils' import { setError, setLoading } from './index' +import { loadProfile } from './user' export const pushActivities = activities => ({ type: 'PUSH_ACTIVITIES', @@ -33,8 +34,10 @@ export const addActivity = form => dispatch => mpwoApi if (ret.data.activities.length === 0) { dispatch(setError('activities: no correct file')) } else if (ret.data.activities.length === 1) { + dispatch(loadProfile()) history.push(`/activities/${ret.data.activities[0].id}`) } else { // ret.data.activities.length > 1 + dispatch(loadProfile()) history.push('/') } } else { @@ -49,6 +52,7 @@ export const addActivityWithoutGpx = form => dispatch => mpwoApi .addActivityWithoutGpx(form) .then(ret => { if (ret.status === 'created') { + dispatch(loadProfile()) history.push(`/activities/${ret.data.activities[0].id}`) } else { dispatch(setError(`activities: ${ret.message}`)) @@ -95,6 +99,7 @@ export const deleteActivity = id => dispatch => mpwoGenericApi .deleteData('activities', id) .then(ret => { if (ret.status === 204) { + dispatch(loadProfile()) history.push('/') } else { dispatch(setError(`activities: ${ret.status}`)) @@ -107,6 +112,7 @@ export const editActivity = form => dispatch => mpwoGenericApi .updateData('activities', form) .then(ret => { if (ret.status === 'success') { + dispatch(loadProfile()) history.push(`/activities/${ret.data.activities[0].id}`) } else { dispatch(setError(`activities: ${ret.message}`)) diff --git a/mpwo_client/src/components/App.css b/mpwo_client/src/components/App.css index 47ed1f3b..36ce15a3 100644 --- a/mpwo_client/src/components/App.css +++ b/mpwo_client/src/components/App.css @@ -94,6 +94,10 @@ input, textarea { color: goldenrod; } +.fa-color { + color: #405976; +} + .leaflet-container { height: 400px; } @@ -161,6 +165,10 @@ input, textarea { max-height: 35px; } +.huge { + font-size: 25px; +} + .inactive-link { color: lightgrey; } diff --git a/mpwo_client/src/components/Dashboard/UserStatistics.jsx b/mpwo_client/src/components/Dashboard/UserStatistics.jsx new file mode 100644 index 00000000..80a9f87a --- /dev/null +++ b/mpwo_client/src/components/Dashboard/UserStatistics.jsx @@ -0,0 +1,64 @@ +import React from 'react' + + +export default function UserStatistics (props) { + const { user } = props + return ( +