diff --git a/assets/agenda/components/AgendaPreview.jsx b/assets/agenda/components/AgendaPreview.jsx
index 059e1da15..76c6833d9 100644
--- a/assets/agenda/components/AgendaPreview.jsx
+++ b/assets/agenda/components/AgendaPreview.jsx
@@ -31,7 +31,7 @@ class AgendaPreview extends React.PureComponent {
}
render() {
- const {item, user, actions, openItemDetails, requestCoverage} = this.props;
+ const {item, user, actions, openItemDetails, requestCoverage, previewGroup} = this.props;
const isWatching = get(item, 'watches', []).includes(user);
@@ -55,7 +55,7 @@ class AgendaPreview extends React.PureComponent {
this.preview = preview}>
-
+
@@ -83,6 +83,7 @@ AgendaPreview.propTypes = {
closePreview: PropTypes.func,
openItemDetails: PropTypes.func,
requestCoverage: PropTypes.func,
+ previewGroup: PropTypes.string,
};
export default AgendaPreview;
diff --git a/assets/agenda/components/AgendaTime.jsx b/assets/agenda/components/AgendaTime.jsx
index 9fe43d5af..559c5c7d9 100644
--- a/assets/agenda/components/AgendaTime.jsx
+++ b/assets/agenda/components/AgendaTime.jsx
@@ -2,16 +2,22 @@ import React from 'react';
import PropTypes from 'prop-types';
import {bem} from 'ui/utils';
-import {formatDate} from 'utils';
+import {formatAgendaDate} from 'utils';
import AgendaListItemLabels from './AgendaListItemLabels';
-import MetaTime from 'ui/components/MetaTime';
-export default function AgendaTime({item}) {
+export default function AgendaTime({item, group}) {
+ const getDates = () => {
+ const dates = formatAgendaDate(item.dates, group);
+ if (dates[1]) {
+ return [
{dates[0]}
, dates[1]];
+ }
+ return dates[0];
+ };
+
return (
-
-
{formatDate(item.dates.start)}
+
{getDates()}
);
@@ -19,4 +25,5 @@ export default function AgendaTime({item}) {
AgendaTime.propTypes = {
item: PropTypes.object.isRequired,
+ group: PropTypes.string,
};
\ No newline at end of file
diff --git a/assets/agenda/reducers.js b/assets/agenda/reducers.js
index 4e0b52e75..0ffee4b69 100644
--- a/assets/agenda/reducers.js
+++ b/assets/agenda/reducers.js
@@ -19,6 +19,7 @@ const initialState = {
aggregations: null,
activeItem: null,
previewItem: null,
+ previewGroup: null,
openItem: null,
isLoading: false,
resultsFiltered: false,
diff --git a/assets/reducers.js b/assets/reducers.js
index 79ad3b4a8..c88fae9f1 100644
--- a/assets/reducers.js
+++ b/assets/reducers.js
@@ -103,12 +103,13 @@ export function defaultReducer(state, action) {
};
case PREVIEW_ITEM: {
- const readItems = getReadItems(state, action.item);
+ const readItems = getReadItems(state, action.item, action.group);
return {
...state,
readItems,
previewItem: action.item ? action.item._id : null,
+ previewGroup: action.group,
};
}
@@ -125,6 +126,7 @@ export function defaultReducer(state, action) {
readItems,
itemsById,
openItem: action.item || null,
+ previewGroup: action.group || null,
};
}
diff --git a/assets/styles/index.scss b/assets/styles/index.scss
index 8a9749241..bd4ab1a1b 100644
--- a/assets/styles/index.scss
+++ b/assets/styles/index.scss
@@ -2173,11 +2173,24 @@ a.wire-articles__versions {
font-size: .8125rem;
&.wire-column__preview__date--event {
- padding: 0 10px 10px 20px;
+ padding: 0 10px 10px 0px;
@include xl {
- padding: 0 10px 20px 20px;
- font-size: 1.125rem;
+ padding: 0 10px 20px 0px;
+ font-size: 1rem;
+ line-height: 1.5rem;
+ }
+ }
+
+ &.wire-column__preview__date--dashed-border {
+ margin-right: 8px;
+ padding-right: 8px;
+ border-right: 1px dotted #c4c4c4;
+ float: left;
+
+ @include xl {
+ padding-right: 10px;
+ font-size: 1rem;
line-height: 1.5rem;
}
}
diff --git a/assets/utils.js b/assets/utils.js
index aa0146af8..964db89cf 100644
--- a/assets/utils.js
+++ b/assets/utils.js
@@ -13,6 +13,8 @@ const TIME_FORMAT = getConfig('time_format');
const DATE_FORMAT = getConfig('date_format', 'DD-MM-YYYY');
const COVERAGE_DATE_FORMAT = getConfig('coverage_date_format');
const DATETIME_FORMAT = `${TIME_FORMAT} ${DATE_FORMAT}`;
+const DAY_IN_MINUTES = 24 * 60 - 1;
+
/**
* Create redux store with default middleware
@@ -185,6 +187,39 @@ export function formatDate(dateString) {
return parseDate(dateString).format(DATE_FORMAT);
}
+/**
+ * Format agenda item start and end dates
+ *
+ * @param {String} dateString
+ * @param {String} group: date of the selected event group
+ * @return {Array} [time string, date string]
+ */
+export function formatAgendaDate(agendaDate, group) {
+ const start = parseDate(agendaDate.start);
+ const end = parseDate(agendaDate.end);
+ const duration = end.diff(start, 'minutes');
+ const dateGroup = group ? moment(group, DATE_FORMAT) : null;
+
+ if (duration > DAY_IN_MINUTES) {
+ // Multi day event
+ return [`(${formatTime(start)} ${formatDate(start)} - ${formatTime(end)} ${formatDate(end)})`,
+ dateGroup ? formatDate(dateGroup) : ''];
+ }
+
+ if (duration == DAY_IN_MINUTES) {
+ // All day event
+ return [gettext('ALL DAY'), formatDate(start)];
+ }
+
+ if (duration == 0) {
+ // start and end times are the same
+ return [`${formatTime(start)} ${formatDate(start)}`, ''];
+ }
+
+ // single day event
+ return [`${formatTime(start)} - ${formatTime(end)}`, formatDate(start)];
+}
+
/**
* Format coverage date ('HH:mm DD/MM')
*