From ee61f7ce482a89a8b09e1a4fd5e7292c958a32e9 Mon Sep 17 00:00:00 2001
From: Fanna Lautenbach <lautenbach@astron.nl>
Date: Fri, 4 Aug 2023 14:44:37 +0200
Subject: [PATCH] MR comments; use UIConstants everywhere for time formatting,
 remove wierd styleAddition setter, change name in test

---
 .../src/routes/Timeline/components/DateTimeNavigator.js   | 8 ++++----
 .../src/routes/Timeline/components/TimelineItemPopover.js | 5 ++---
 .../Timeline/components/TimelineItemPopover.test.js       | 2 +-
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/DateTimeNavigator.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/DateTimeNavigator.js
index 26cfd5d8d8f..521a3fb3e1d 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/DateTimeNavigator.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/DateTimeNavigator.js
@@ -19,8 +19,8 @@ function getDateTimeElement(title, time, formatter) {
 
 function getDateTimeInfo(currentUTC, currentLST) {
     return <div className="datetime-info-container">
-        {getDateTimeElement("Date", currentUTC, "YYYY-MM-DD")}
-        {getDateTimeElement("UTC", currentUTC, "HH:mm:ss")}
+        {getDateTimeElement("Date", currentUTC, UIConstants.CALENDAR_DEFAULTDATE_FORMAT)}
+        {getDateTimeElement("UTC", currentUTC, UIConstants.CALENDAR_TIME_FORMAT)}
         {getDateTimeElement("LST", currentLST, UIConstants.CALENDAR_TIME_FORMAT)}
     </div>
 }
@@ -169,9 +169,9 @@ export default function DateTimeNavigator(props) {
                 .then((utcString) => {
                     UtilService.getLST(utcString)
                         .then(lstString => {
-                            const utcDay = moment.utc(utcString).format('DD-MMM-YYYY ');
+                            const utcDay = moment.utc(utcString).format(UIConstants.CALENDAR_DEFAULTDATE_FORMAT);
                             const lstTime = lstString.split('.')[0];
-                            setCurrentLST(moment(utcDay + lstTime, 'DD-MMM-YYYY HH:mm:ss'))
+                            setCurrentLST(moment(utcDay + lstTime, UIConstants.CALENDAR_DATETIME_FORMAT))
                         }).catch(error => {
                         console.error("Cannot retrieve the LST and thus cannot render the date time navigator: ", error)
                     })
diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/TimelineItemPopover.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/TimelineItemPopover.js
index 3d4f9c4d90d..d9ec2995217 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/TimelineItemPopover.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/TimelineItemPopover.js
@@ -1,13 +1,12 @@
 import UIConstants from "../../../utils/ui.constants";
 import React from "react";
 
-export function getFieldsHtml(fields, status = undefined, style = undefined) {
+export function getFieldsHtml(fields, status = undefined, style = {}) {
     const labelClassName = status ? `col-5 su-${status}-icon` : 'col-5'
-    const styleAddition = style ? style : null
 
     return fields.map((field, index) => (
         <div key={index} className="entry">
-            <label className={labelClassName} style={styleAddition}>{field.label}</label>
+            <label className={labelClassName} style={style}>{field.label}</label>
             <div className="col-7">{field.value}</div>
         </div>
     ))
diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/TimelineItemPopover.test.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/TimelineItemPopover.test.js
index 4aca63389de..a001a50c3d3 100644
--- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/TimelineItemPopover.test.js
+++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/TimelineItemPopover.test.js
@@ -58,7 +58,7 @@ describe("TimelineItemPopover", () => {
             bgColor: "#ffffff",
             color: "#000000",
             name: "Grass mowing",
-            desc: "By Henk Mulder",
+            desc: "By Fanna Lautenbach",
             activity_type: "Very intense",
             stations: {
                 groups: 2,
-- 
GitLab