Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

WV-2712 kiosk timestamp (#4320)

Tom Cariello1e41fcca41e8
diff --git a/web/js/components/timeline/kiosk-timestamp.js b/web/js/components/timeline/kiosk-timestamp.js
new file mode 100644
index 000000000..6ca63bad0
--- /dev/null
+++ b/web/js/components/timeline/kiosk-timestamp.js
@@ -0,0 +1,81 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+
+/**
+ * getIsDaylightSavingsTime()
+ *
+ * @returns bool indicating if it is daylight savings time on the US East coast
+ */
+function getIsDaylightSavingsTime() {
+ const date = new Date().toLocaleString('en-US', { timeZone: 'America/New_York' });
+ const dateObj = new Date(date);
+ const isDaylightSavingTime = dateObj.getTimezoneOffset() < new Date(dateObj.getFullYear(), 0, 1).getTimezoneOffset();
+ return isDaylightSavingTime;
+}
+
+function KioskTimeStamp({ date, subdaily }) {
+ const options = {
+ year: 'numeric',
+ month: 'long',
+ day: '2-digit',
+ hour: '2-digit',
+ minute: '2-digit',
+ hour12: false,
+ timeZone: 'America/New_York',
+ };
+
+ const isDaylightSavingsTime = getIsDaylightSavingsTime();
+ const formatter = new Intl.DateTimeFormat('en-US', options);
+ const dateParts = formatter.formatToParts(date);
+
+ const year = dateParts.find((part) => part.type === 'year').value;
+ const month = dateParts.find((part) => part.type === 'month').value.slice(0, 3);
+ const day = dateParts.find((part) => part.type === 'day').value;
+ const hours = dateParts.find((part) => part.type === 'hour').value;
+ const minutes = dateParts.find((part) => part.type === 'minute').value;
+ const timeZoneLabel = isDaylightSavingsTime ? 'EDT' : 'EST';
+
+ return (
+ <>
+ <div className="kiosk-day">
+ {day}
+ </div>
+ <div className="kiosk-month">
+ {month}
+ </div>
+ <div className="kiosk-year">
+ {year}
+ </div>
+
+ {subdaily && (
+ <>
+ <div className="kiosk-hours">
+ {hours}
+ </div>
+ <div className="kiosk-colon">
+ :
+ </div>
+ <div className="kiosk-minutes">
+ {minutes}
+ </div>
+ <div className="kiosk-colon">
+ :
+ </div>
+ <div className="kiosk-seconds">
+ 00
+ </div>
+ <div className="kiosk-timezone">
+ {timeZoneLabel}
+ </div>
+ </>
+ )}
+ </>
+ );
+}
+
+KioskTimeStamp.propTypes = {
+ date: PropTypes.object,
+ subdaily: PropTypes.bool,
+};
+
+export default KioskTimeStamp;
diff --git a/web/js/containers/timeline/timeline.js b/web/js/containers/timeline/timeline.js
index 1d6c0b7dc..67cedd84f 100644
--- a/web/js/containers/timeline/timeline.js
+++ b/web/js/containers/timeline/timeline.js
@@ -23,7 +23,7 @@ import DateChangeArrows from '../../components/timeline/timeline-controls/date-c
import AnimationButton from '../../components/timeline/timeline-controls/animation-button';
import AxisTimeScaleChange from '../../components/timeline/timeline-controls/axis-timescale-change';
import TimelineRangeSelector from '../../components/range-selection/range-selection';
-import { formatKioskDate } from '../../components/kiosk/util';
+import KioskTimeStamp from '../../components/timeline/kiosk-timestamp';
import {
getIsBetween,
@@ -1352,7 +1352,7 @@ class Timeline extends React.Component {
{ marginRight: isTimelineHidden ? '20px' : '0' }
}
>
- {formatKioskDate(selectedDate, hasSubdailyLayers)}
+ <KioskTimeStamp date={selectedDate} subdaily={hasSubdailyLayers} />
</div>
</section>
</ErrorBoundary>
diff --git a/web/scss/features/timeline.scss b/web/scss/features/timeline.scss
index 78660ed6b..acea96877 100644
--- a/web/scss/features/timeline.scss
+++ b/web/scss/features/timeline.scss
@@ -9,16 +9,38 @@ button:focus {
z-index: 3;
}
-#distraction-free-timeline {
- height: 50px;
+.kiosk-year, .kiosk-month, .kiosk-day, .kiosk-hours, .kiosk-minutes, .kiosk-seconds, .kiosk-timezone {
+ font-family: Helvetica, sans-serif;
+ font-size: 34px;
+ letter-spacing: initial;
+ min-width: 46px;
+ text-align: center;
}
-.timeline-inner {
- height: 67px;
+.kiosk-year, .kiosk-month {
+ min-width: 80px;
+}
+
+.kiosk-month {
+ padding: 0 8px;
+}
+
+.kiosk-hours {
+ margin-left: 8px;
+}
+
+.kiosk-colon {
+ font-family: Helvetica, sans-serif;
+ font-size: 37px;
+ letter-spacing: initial;
+}
+
+.kiosk-timezone {
+ padding-left: 8px;
}
-#distraction-free-timeline,
.timeline-inner {
+ height: 67px;
position: absolute;
border: $wv-dark-menu-border;
background: $wv-transparent-black;
@@ -30,13 +52,26 @@ button:focus {
bottom: 10px;
}
+#distraction-free-timeline {
+ position: absolute;
+ border: $wv-dark-menu-border;
+ background: rgba(35 31 32 / 60%);
+ display: flex;
+ flex-flow: row nowrap;
+ margin: 0;
+ bottom: 0;
+ left: 0;
+ border-radius: 0;
+ border-top-right-radius: 15px;
+}
+
#timeline-header {
min-width: 310px;
+ margin-top: 2px;
}
#distraction-free-timeline-header,
#timeline-header {
- margin-top: 2px;
display: inline-block;
&.subdaily {
@@ -829,12 +864,11 @@ button:focus {
#distraction-free-timeline-header {
color: #fff;
font-family: Helvetica, sans-serif;
- letter-spacing: 0.125em;
- font-size: 24px;
+ font-size: 37px;
display: flex;
justify-content: center;
align-items: center;
- padding: 5px;
+ padding: 33px 10px 34px 51px;
&.subdaily {
width: unset;