From 73d2311c26e5e68d464b559b6112843115daadcb Mon Sep 17 00:00:00 2001 From: Nikola Stojanovic <68916411+dzonidoo@users.noreply.github.com> Date: Thu, 24 Oct 2024 12:00:29 +0200 Subject: [PATCH 1/2] Nested single day events always shown only with time (#2114) --- client/components/Events/EventDateTime.tsx | 6 ++++-- client/components/Events/EventDateTimeColumn.tsx | 5 +++-- client/components/Events/EventItem.tsx | 1 + client/components/Planning/PlanningItemWithEvents.tsx | 1 + client/interfaces.ts | 1 + client/utils/events.ts | 8 ++++++++ 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/client/components/Events/EventDateTime.tsx b/client/components/Events/EventDateTime.tsx index 3673d0b2e..6ed80b8a4 100644 --- a/client/components/Events/EventDateTime.tsx +++ b/client/components/Events/EventDateTime.tsx @@ -1,7 +1,7 @@ import React from 'react'; import {superdeskApi} from '../../superdeskApi'; -import {IEventItem} from '../../interfaces'; +import {IEventItem, IPlanningListItemProps} from '../../interfaces'; import {eventUtils, timeUtils} from '../../utils'; @@ -13,6 +13,7 @@ interface IProps { item: IEventItem; ignoreAllDay?: boolean; displayLocalTimezone?: boolean; + planningProps?: IPlanningListItemProps; } export class EventDateTime extends React.PureComponent { @@ -23,6 +24,7 @@ export class EventDateTime extends React.PureComponent { const end = eventUtils.getEndDate(item); const isAllDay = eventUtils.isEventAllDay(start, end); const multiDay = !eventUtils.isEventSameDay(start, end); + const showEventStartDate = eventUtils.showEventStartDate(start, multiDay, this.props.planningProps?.date); const isRemoteTimeZone = timeUtils.isEventInDifferentTimeZone(item); const withYear = multiDay && start.year() !== end.year(); const localStart = timeUtils.getLocalDate(start, item.dates.tz); @@ -79,7 +81,7 @@ export class EventDateTime extends React.PureComponent { )} { @@ -23,7 +24,7 @@ export class EventDateTimeColumn extends React.PureComponent { return ( - + ); diff --git a/client/components/Events/EventItem.tsx b/client/components/Events/EventItem.tsx index 2e5fee0aa..0d64a688c 100644 --- a/client/components/Events/EventItem.tsx +++ b/client/components/Events/EventItem.tsx @@ -305,6 +305,7 @@ class EventItemComponent extends React.Component { {listViewType === LIST_VIEW_TYPE.SCHEDULE ? null : ( { {...this.props.getEventProps(event)} multiSelectDisabled key={event._id} + planningProps={planningProps} /> ); }) diff --git a/client/interfaces.ts b/client/interfaces.ts index 894814743..9e3394e0b 100644 --- a/client/interfaces.ts +++ b/client/interfaces.ts @@ -906,6 +906,7 @@ export interface IAssignmentItem extends IBaseRestApiResponse { export interface IBaseListItemProps { item: T; + planningProps?: IPlanningListItemProps; lockedItems: ILockedItems; session: ISession; privileges: {[key: string]: number}; diff --git a/client/utils/events.ts b/client/utils/events.ts index 408af1f40..d136fea94 100644 --- a/client/utils/events.ts +++ b/client/utils/events.ts @@ -80,6 +80,13 @@ function isEventSameDay(startingDate: IDateTime, endingDate: IDateTime): boolean return moment(startingDate).format('DD/MM/YYYY') === moment(endingDate).format('DD/MM/YYYY'); } +function showEventStartDate(eventDate: IDateTime, multiDay: boolean, planningDate?: IDateTime): boolean { + if (planningDate == null) { + return true; + } + return (!moment(eventDate).isSame(planningDate, 'day') || multiDay); +} + function eventHasPlanning(event: IEventItem): boolean { return get(event, 'planning_ids', []).length > 0; } @@ -1355,6 +1362,7 @@ const self = { canConvertToRecurringEvent, canUpdateEventRepetitions, isEventSameDay, + showEventStartDate, isEventRecurring, getDateStringForEvent, getEventActions, From 421c19bc6375346d28a91b6bb7c5cae242c725ee Mon Sep 17 00:00:00 2001 From: Nikola Stojanovic <68916411+dzonidoo@users.noreply.github.com> Date: Fri, 25 Oct 2024 13:13:32 +0200 Subject: [PATCH 2/2] display contents (#2117) --- client/components/Planning/PlanningItemWithEvents.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/components/Planning/PlanningItemWithEvents.tsx b/client/components/Planning/PlanningItemWithEvents.tsx index b227e2e3b..adbdea107 100644 --- a/client/components/Planning/PlanningItemWithEvents.tsx +++ b/client/components/Planning/PlanningItemWithEvents.tsx @@ -59,7 +59,7 @@ export class PlanningItemWithEvents extends React.Component { return ( {([res]) => ( -
+
{ res._items.map((item) => { const event = eventUtils.modifyForClient(item);