From 066a05c57f7663318a100831aea499ab8a1ffad6 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 13 Jun 2018 18:52:39 +0200 Subject: [PATCH] Client: add notes to activities - fix 10 + minor fix on weather --- .../migrations/versions/096dd0b43beb_.py | 2 +- .../Activity/ActivityDisplay/ActivityNotes.jsx | 15 +++++++++++++++ .../ActivityDisplay/ActivityWeather.jsx | 12 ++++++------ .../Activity/ActivityDisplay/index.jsx | 2 ++ .../Activity/ActivityForms/FormWithGpx.jsx | 17 ++++++++++++++++- .../Activity/ActivityForms/FormWithoutGpx.jsx | 12 ++++++++++++ fittrackee_client/src/components/App.css | 7 +++++++ 7 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 fittrackee_client/src/components/Activity/ActivityDisplay/ActivityNotes.jsx diff --git a/fittrackee_api/migrations/versions/096dd0b43beb_.py b/fittrackee_api/migrations/versions/096dd0b43beb_.py index 3932f03c..4f580518 100644 --- a/fittrackee_api/migrations/versions/096dd0b43beb_.py +++ b/fittrackee_api/migrations/versions/096dd0b43beb_.py @@ -1,4 +1,4 @@ -"""empty message +"""Add 'notes' column to 'Activity' table Revision ID: 096dd0b43beb Revises: 71093ac9ca44 diff --git a/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityNotes.jsx b/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityNotes.jsx new file mode 100644 index 00000000..dcd629dc --- /dev/null +++ b/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityNotes.jsx @@ -0,0 +1,15 @@ +import React from 'react' + +export default function ActivityNotes(props) { + const { notes } = props + return ( +
+
+ Notes +
+ {notes ? notes : 'No notes'} +
+
+
+ ) +} diff --git a/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityWeather.jsx b/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityWeather.jsx index 170b38db..8e3bbe55 100644 --- a/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityWeather.jsx +++ b/fittrackee_client/src/components/Activity/ActivityDisplay/ActivityWeather.jsx @@ -43,10 +43,10 @@ export default function ActivityWeather(props) { /> - {activity.weather_start.temperature}°C + {Number(activity.weather_start.temperature).toFixed(1)}°C - {activity.weather_end.temperature}°C + {Number(activity.weather_end.temperature).toFixed(1)}°C @@ -58,10 +58,10 @@ export default function ActivityWeather(props) { /> - {activity.weather_start.humidity * 100}% + {Number(activity.weather_start.humidity * 100).toFixed(1)}% - {activity.weather_end.humidity * 100}% + {Number(activity.weather_end.humidity * 100).toFixed(1)}% @@ -73,10 +73,10 @@ export default function ActivityWeather(props) { /> - {activity.weather_start.wind}m/s + {Number(activity.weather_start.wind).toFixed(1)}m/s - {activity.weather_end.wind}m/s + {Number(activity.weather_end.wind).toFixed(1)}m/s diff --git a/fittrackee_client/src/components/Activity/ActivityDisplay/index.jsx b/fittrackee_client/src/components/Activity/ActivityDisplay/index.jsx index eb8f1c97..fc10f852 100644 --- a/fittrackee_client/src/components/Activity/ActivityDisplay/index.jsx +++ b/fittrackee_client/src/components/Activity/ActivityDisplay/index.jsx @@ -6,6 +6,7 @@ import ActivityCardHeader from './ActivityCardHeader' import ActivityCharts from './ActivityCharts' import ActivityDetails from './ActivityDetails' import ActivityMap from './ActivityMap' +import ActivityNotes from './ActivityNotes' import CustomModal from './../../Others/CustomModal' import { getOrUpdateData } from '../../../actions' import { deleteActivity } from '../../../actions/activities' @@ -106,6 +107,7 @@ class ActivityDisplay extends React.Component { )} + )} diff --git a/fittrackee_client/src/components/Activity/ActivityForms/FormWithGpx.jsx b/fittrackee_client/src/components/Activity/ActivityForms/FormWithGpx.jsx index a30b3327..0eeeea3a 100644 --- a/fittrackee_client/src/components/Activity/ActivityForms/FormWithGpx.jsx +++ b/fittrackee_client/src/components/Activity/ActivityForms/FormWithGpx.jsx @@ -64,6 +64,18 @@ function FormWithGpx (props) { )} +
+