Skip to content

Commit

Permalink
changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
dzonidoo committed Oct 24, 2024
1 parent 912d837 commit 25d59c0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions client/components/Events/EventDateTime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface IProps {
item: IEventItem;
ignoreAllDay?: boolean;
displayLocalTimezone?: boolean;
planningItem?: IPlanningListItemProps;
planningProps?: IPlanningListItemProps;
}

export class EventDateTime extends React.PureComponent<IProps> {
Expand All @@ -24,7 +24,7 @@ export class EventDateTime extends React.PureComponent<IProps> {
const end = eventUtils.getEndDate(item);
const isAllDay = eventUtils.isEventAllDay(start, end);
const multiDay = !eventUtils.isEventSameDay(start, end);
const showEventStartDate = eventUtils.showEventStartDate(start, this.props.planningItem?.date);
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);
Expand Down Expand Up @@ -81,7 +81,7 @@ export class EventDateTime extends React.PureComponent<IProps> {
</span>
)}
<DateTime
withDate={(showEventStartDate || multiDay)}
withDate={showEventStartDate}
withYear={withYear}
date={start}
{...commonProps}
Expand Down
4 changes: 2 additions & 2 deletions client/components/Events/EventDateTimeColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {EventDateTime} from './EventDateTime';
interface IProps {
item: IEventItem;
multiRow?: boolean;
planningItem?: IPlanningListItemProps;
planningProps?: IPlanningListItemProps;
}

export class EventDateTimeColumn extends React.PureComponent<IProps> {
Expand All @@ -24,7 +24,7 @@ export class EventDateTimeColumn extends React.PureComponent<IProps> {
return (
<Column border={false} className="flex-justify--start sd-padding-t--1">
<Row classes="sd-margin--0">
<EventDateTime item={this.props.item} planningItem={this.props.planningItem} />
<EventDateTime item={this.props.item} planningProps={this.props.planningProps} />
</Row>
</Column>
);
Expand Down
2 changes: 1 addition & 1 deletion client/components/Events/EventItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ class EventItemComponent extends React.Component<IProps, IState> {
<EventDateTimeColumn
item={item}
multiRow={listViewType === LIST_VIEW_TYPE.LIST}
planningItem={this.props.planningItem}
planningProps={this.props.planningProps}
/>
{listViewType === LIST_VIEW_TYPE.SCHEDULE ? null : (
<CreatedUpdatedColumn
Expand Down
2 changes: 1 addition & 1 deletion client/components/Planning/PlanningItemWithEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class PlanningItemWithEvents extends React.Component<IProps, IState> {
{...this.props.getEventProps(event)}
multiSelectDisabled
key={event._id}
planningItem={planningProps}
planningProps={planningProps}
/>
);
})
Expand Down
2 changes: 1 addition & 1 deletion client/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,7 @@ export interface IAssignmentItem extends IBaseRestApiResponse {

export interface IBaseListItemProps<T> {
item: T;
planningItem?: IPlanningListItemProps;
planningProps?: IPlanningListItemProps;
lockedItems: ILockedItems;
session: ISession;
privileges: {[key: string]: number};
Expand Down
4 changes: 2 additions & 2 deletions client/utils/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ function isEventSameDay(startingDate: IDateTime, endingDate: IDateTime): boolean
return moment(startingDate).format('DD/MM/YYYY') === moment(endingDate).format('DD/MM/YYYY');
}

function showEventStartDate(eventDate: IDateTime, planningDate?: IDateTime): boolean {
function showEventStartDate(eventDate: IDateTime, multiDay: boolean, planningDate?: IDateTime): boolean {
if (planningDate == null) {
return true;
}
return moment(eventDate).format('DD/MM/YYYY') != moment(planningDate).format('DD/MM/YYYY');
return (!moment(eventDate).isSame(planningDate, 'day') || multiDay);
}

function eventHasPlanning(event: IEventItem): boolean {
Expand Down

0 comments on commit 25d59c0

Please sign in to comment.