From 37ed5405bb478f0aa23030728b74ee2bbf2489a2 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 2 May 2018 19:02:39 +0200 Subject: [PATCH] Client: Activity page init --- mpwo_client/public/index.html | 5 + .../{AddActivity.jsx => ActivityAdd.jsx} | 0 .../components/Activities/ActivityDisplay.jsx | 98 +++++++++++++++++++ .../src/components/Activities/index.jsx | 35 +++++++ mpwo_client/src/components/App.jsx | 4 +- mpwo_client/src/reducers/index.js | 4 + mpwo_client/src/reducers/initial.js | 3 + 7 files changed, 147 insertions(+), 2 deletions(-) rename mpwo_client/src/components/Activities/{AddActivity.jsx => ActivityAdd.jsx} (100%) create mode 100644 mpwo_client/src/components/Activities/ActivityDisplay.jsx create mode 100644 mpwo_client/src/components/Activities/index.jsx diff --git a/mpwo_client/public/index.html b/mpwo_client/public/index.html index f8443a15..53866d43 100644 --- a/mpwo_client/public/index.html +++ b/mpwo_client/public/index.html @@ -16,6 +16,11 @@ integrity="sha256-MGU/JUq/40CFrfxjXb5pZjpoZmxiP2KuICN5ElLFNd8=" crossorigin="anonymous" > + + mpwo diff --git a/mpwo_client/src/components/Activities/AddActivity.jsx b/mpwo_client/src/components/Activities/ActivityAdd.jsx similarity index 100% rename from mpwo_client/src/components/Activities/AddActivity.jsx rename to mpwo_client/src/components/Activities/ActivityAdd.jsx diff --git a/mpwo_client/src/components/Activities/ActivityDisplay.jsx b/mpwo_client/src/components/Activities/ActivityDisplay.jsx new file mode 100644 index 00000000..e8dc565c --- /dev/null +++ b/mpwo_client/src/components/Activities/ActivityDisplay.jsx @@ -0,0 +1,98 @@ +import React from 'react' +import { Helmet } from 'react-helmet' +import { connect } from 'react-redux' + +import { getData } from '../../actions/index' + +class ActivityDisplay extends React.Component { + componentDidMount() { + this.props.loadActivity( + this.props.location.pathname.replace('/activities/', '') + ) + } + render() { + const { activities, message, sports } = this.props + const [activity] = activities + return ( +
+ + mpwo - Activity + +

+ Activity +

+ {message ? ( + {message} + ) : ( +
+ {activity && sports.length > 0 && ( +
+
+
+
+ {sports.filter(sport => sport.id === activity.sport_id) + .map(sport => sport.label)} -{' '} + {activity.activity_date} +
+
+
+
+

+