From 8c985de42b9e79a0545c4f4ed1490a6c2e486eee Mon Sep 17 00:00:00 2001 From: Petr Jasek Date: Fri, 15 Nov 2024 19:59:35 +0100 Subject: [PATCH 1/4] allow creation of events without start/end time STT-40 --- client/components/Events/EventDateTime.tsx | 4 + .../components/Events/EventDateTimeColumn.tsx | 6 +- .../components/Events/EventEditor/index.tsx | 2 + client/components/UI/DateTime.tsx | 4 +- .../UI/Form/DateInput/DateInputPopup.tsx | 46 ++-- client/components/UI/Form/DateInput/index.tsx | 40 ++-- .../UI/Form/DateTimeInput/index.tsx | 161 +++++++++----- .../UI/Form/TimeInput/TimeInputPopup.tsx | 77 ++++--- client/components/UI/Form/TimeInput/index.tsx | 6 +- client/components/UI/utils.ts | 1 + .../components/fields/editor/EndDateTime.tsx | 1 + .../fields/editor/EventSchedule.tsx | 210 +++++++++--------- .../fields/editor/StartDateTime.tsx | 1 + .../fields/editor/base/dateTime.tsx | 10 +- client/utils/events.tsx | 10 +- client/utils/time.ts | 2 +- client/validators/events.ts | 22 +- client/validators/index.ts | 4 +- e2e/cypress/e2e/events/edit_event.cy.ts | 13 +- .../e2e/events/event_action_duplicate.cy.ts | 1 + e2e/cypress/e2e/events/event_all_day.cy.ts | 111 +++++++++ .../e2e/events/event_embedded_coverage.cy.ts | 2 - .../support/planning/events/eventEditor.ts | 1 - e2e/cypress/support/utils/time.ts | 12 +- e2e/package.json | 2 +- e2e/server/Procfile | 2 +- package-lock.json | 21 +- server/planning/events/events.py | 21 +- 28 files changed, 506 insertions(+), 287 deletions(-) create mode 100644 e2e/cypress/e2e/events/event_all_day.cy.ts diff --git a/client/components/Events/EventDateTime.tsx b/client/components/Events/EventDateTime.tsx index 0ae46d122..e61e70b0d 100644 --- a/client/components/Events/EventDateTime.tsx +++ b/client/components/Events/EventDateTime.tsx @@ -82,6 +82,7 @@ export class EventDateTime extends React.PureComponent { date={start} {...commonProps} withTime={false} + testId="event-start-date" /> )} {gettext('All day')} @@ -95,9 +96,11 @@ export class EventDateTime extends React.PureComponent { )} {showDash && <>–} @@ -106,6 +109,7 @@ export class EventDateTime extends React.PureComponent { withYear={withYear} isEndEventDateTime={true} date={end} + testId="event-end-date" {...commonProps} /> {isRemoteTimeZone && ( diff --git a/client/components/Events/EventDateTimeColumn.tsx b/client/components/Events/EventDateTimeColumn.tsx index 0e63fa10c..fc342a56f 100644 --- a/client/components/Events/EventDateTimeColumn.tsx +++ b/client/components/Events/EventDateTimeColumn.tsx @@ -52,6 +52,7 @@ export class EventDateTimeColumn extends React.PureComponent { withYear={!isThisYear} withTime={false} date={start} + testId="event-start-date" {...commonProps} /> {!multiDay ? null : ( @@ -62,13 +63,14 @@ export class EventDateTimeColumn extends React.PureComponent { withYear={!isThisYear} withTime={false} date={end} + testId="event-end-date" {...commonProps} /> )} {!isRemoteTimeZone ? null : ( ( - + {tzCode} ) @@ -85,6 +87,7 @@ export class EventDateTimeColumn extends React.PureComponent { withDate={false} withYear={false} date={start} + testId="event-start-date" {...commonProps} /> – @@ -92,6 +95,7 @@ export class EventDateTimeColumn extends React.PureComponent { withDate={false} withYear={false} date={end} + testId="event-end-date" {...commonProps} /> diff --git a/client/components/Events/EventEditor/index.tsx b/client/components/Events/EventEditor/index.tsx index ab4779001..6ef235d09 100644 --- a/client/components/Events/EventEditor/index.tsx +++ b/client/components/Events/EventEditor/index.tsx @@ -121,6 +121,8 @@ class EventEditorComponent extends React.PureComponent { start: value['dates.start'], end: value['dates.end'], tz: value['dates.tz'], + all_day: value['dates.all_day'], + no_end_time: value['dates.no_end_time'], }); this.props.onChangeHandler(value); diff --git a/client/components/UI/DateTime.tsx b/client/components/UI/DateTime.tsx index 9c279a45c..f3065a2c7 100644 --- a/client/components/UI/DateTime.tsx +++ b/client/components/UI/DateTime.tsx @@ -19,6 +19,7 @@ interface IPropsDateTime { isEndEventDateTime?: boolean, noEndTime?: boolean, multiDay?: boolean, + testId?: string, } /** @@ -37,6 +38,7 @@ function DateTime({ isEndEventDateTime, noEndTime, multiDay, + testId, }: IPropsDateTime) { const {gettext} = superdeskApi.localization; const dateFormat = appConfig.planning.dateformat; @@ -78,7 +80,7 @@ function DateTime({ const tz = timeUtils.getTimeZoneAbbreviation(date.format('z')) + ' '; return ( -