From c8e3aaea98f16623ccb8e2889d5e1386ec586fe2 Mon Sep 17 00:00:00 2001 From: syam babu Date: Thu, 5 Sep 2024 12:27:08 +0530 Subject: [PATCH 1/5] fix: fixed calender component year stops displaying when zoomed in. closes #84 --- src/components/RecurringEvents/recurringEvents.css | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/components/RecurringEvents/recurringEvents.css b/src/components/RecurringEvents/recurringEvents.css index a18e4dfe7..d196be3ec 100644 --- a/src/components/RecurringEvents/recurringEvents.css +++ b/src/components/RecurringEvents/recurringEvents.css @@ -135,6 +135,13 @@ color: #222732; } +.calendar .calendar-header .year-neighbor { + display: none !important; +} +.calendar .calendar-header .year-neighbor2 { + display: none !important; +} + @media screen and (max-width: 480px) { .custom-date-column { height: 200px; From 38abbea246e16722a95ac5386dc6c93ad8f95c63 Mon Sep 17 00:00:00 2001 From: syam babu Date: Thu, 5 Sep 2024 12:30:57 +0530 Subject: [PATCH 2/5] changed css modifier --- src/components/RecurringEvents/recurringEvents.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/RecurringEvents/recurringEvents.css b/src/components/RecurringEvents/recurringEvents.css index d196be3ec..a0b163f93 100644 --- a/src/components/RecurringEvents/recurringEvents.css +++ b/src/components/RecurringEvents/recurringEvents.css @@ -135,10 +135,10 @@ color: #222732; } -.calendar .calendar-header .year-neighbor { +.recurring-modal .calendar .calendar-header .year-neighbor { display: none !important; } -.calendar .calendar-header .year-neighbor2 { +.recurring-modal .calendar .calendar-header .year-neighbor2 { display: none !important; } From 5ed4683ff909916eff94e62d468e33172b3a4bb8 Mon Sep 17 00:00:00 2001 From: syam babu Date: Wed, 18 Sep 2024 16:22:02 +0530 Subject: [PATCH 3/5] feat: during moving from one date type to other, current date type's date picker value is shown as startdate of other date type's datepicker. closes #84 --- src/pages/Dashboard/AddEvent/AddEvent.jsx | 44 ++++++++++++++++++++--- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/src/pages/Dashboard/AddEvent/AddEvent.jsx b/src/pages/Dashboard/AddEvent/AddEvent.jsx index 923814567..b99b5f8cc 100644 --- a/src/pages/Dashboard/AddEvent/AddEvent.jsx +++ b/src/pages/Dashboard/AddEvent/AddEvent.jsx @@ -2585,12 +2585,46 @@ function AddEvent() { promptText={type.tooltip} secondaryIcon={} onClick={() => { + let currentPartialDateValue; + const fieldMap = { + [dateTypes.SINGLE]: 'datePicker', + [dateTypes.RANGE]: 'dateRangePicker', + [dateTypes.MULTIPLE]: 'startDateRecur', + }; + + const activeField = fieldMap[type.type]; + + // to ensure during moving from one date type to other, current date type's date picker value is shown as startdate of other date type's datepicker + if (dateType === dateTypes.SINGLE) { + currentPartialDateValue = form.getFieldValue('datePicker'); + } else if (dateType === dateTypes.RANGE || dateType === dateTypes.MULTIPLE) { + const fieldValue = form.getFieldValue(fieldMap[dateType]); + if (Array.isArray(fieldValue) && fieldValue.length > 0) { + currentPartialDateValue = fieldValue[0] ?? undefined; + } + } + setDateType(type.type); - form.setFieldsValue({ - datePicker: undefined, - dateRangePicker: undefined, - startDateRecur: undefined, - }); + + if (currentPartialDateValue) { + form.setFieldValue( + activeField, + activeField === 'datePicker' + ? currentPartialDateValue + : [currentPartialDateValue, null], + ); + + Object.keys(fieldMap).forEach((key) => { + if (fieldMap[key] !== activeField) { + form.setFieldsValue({ [fieldMap[key]]: undefined }); + } + }); + } else { + Object.keys(fieldMap).forEach((key) => { + form.setFieldsValue({ [fieldMap[key]]: undefined }); + }); + } + form.resetFields(['frequency']); setFormValue(null); }} From 622dd22779410ac620b9f73f173b62904e7e4450 Mon Sep 17 00:00:00 2001 From: syam babu Date: Wed, 18 Sep 2024 16:41:38 +0530 Subject: [PATCH 4/5] fix: made date memorizing feature work only during creation of events --- src/pages/Dashboard/AddEvent/AddEvent.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Dashboard/AddEvent/AddEvent.jsx b/src/pages/Dashboard/AddEvent/AddEvent.jsx index b99b5f8cc..7301a208b 100644 --- a/src/pages/Dashboard/AddEvent/AddEvent.jsx +++ b/src/pages/Dashboard/AddEvent/AddEvent.jsx @@ -2606,7 +2606,7 @@ function AddEvent() { setDateType(type.type); - if (currentPartialDateValue) { + if (currentPartialDateValue && !eventId) { form.setFieldValue( activeField, activeField === 'datePicker' From a775108e71d48b2e83d04a2c25346c9a6d48c592 Mon Sep 17 00:00:00 2001 From: syam babu Date: Thu, 19 Sep 2024 17:10:14 +0530 Subject: [PATCH 5/5] feat: persit both dates across date type selection from range to multiple. fixed previous start date getting disabled after switching date type --- src/pages/Dashboard/AddEvent/AddEvent.jsx | 69 ++++++++++++----------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/src/pages/Dashboard/AddEvent/AddEvent.jsx b/src/pages/Dashboard/AddEvent/AddEvent.jsx index 7301a208b..85bef3958 100644 --- a/src/pages/Dashboard/AddEvent/AddEvent.jsx +++ b/src/pages/Dashboard/AddEvent/AddEvent.jsx @@ -2585,44 +2585,45 @@ function AddEvent() { promptText={type.tooltip} secondaryIcon={} onClick={() => { - let currentPartialDateValue; - const fieldMap = { - [dateTypes.SINGLE]: 'datePicker', - [dateTypes.RANGE]: 'dateRangePicker', - [dateTypes.MULTIPLE]: 'startDateRecur', - }; - - const activeField = fieldMap[type.type]; - - // to ensure during moving from one date type to other, current date type's date picker value is shown as startdate of other date type's datepicker + let currentActiveDateValue; + let activeDateType = type.type; if (dateType === dateTypes.SINGLE) { - currentPartialDateValue = form.getFieldValue('datePicker'); - } else if (dateType === dateTypes.RANGE || dateType === dateTypes.MULTIPLE) { - const fieldValue = form.getFieldValue(fieldMap[dateType]); - if (Array.isArray(fieldValue) && fieldValue.length > 0) { - currentPartialDateValue = fieldValue[0] ?? undefined; - } + const datePickerValue = form.getFieldValue('datePicker'); + currentActiveDateValue = datePickerValue ? [datePickerValue, undefined] : undefined; + } else if (dateType === dateTypes.RANGE) { + setStartDate(undefined); + setEndDate(undefined); + currentActiveDateValue = form.getFieldValue('dateRangePicker') ?? undefined; + } else if (dateType === dateTypes.MULTIPLE) { + setStartDate(undefined); + setEndDate(undefined); + currentActiveDateValue = form.getFieldValue('startDateRecur') ?? undefined; } - setDateType(type.type); - if (currentPartialDateValue && !eventId) { - form.setFieldValue( - activeField, - activeField === 'datePicker' - ? currentPartialDateValue - : [currentPartialDateValue, null], - ); - - Object.keys(fieldMap).forEach((key) => { - if (fieldMap[key] !== activeField) { - form.setFieldsValue({ [fieldMap[key]]: undefined }); - } - }); - } else { - Object.keys(fieldMap).forEach((key) => { - form.setFieldsValue({ [fieldMap[key]]: undefined }); - }); + if (currentActiveDateValue) { + if (activeDateType === dateTypes.SINGLE) { + form.setFieldValue( + 'datePicker', + Array.isArray(currentActiveDateValue) ? currentActiveDateValue[0] : undefined, + ); + form.setFieldsValue({ + dateRangePicker: undefined, + startDateRecur: undefined, + }); + } else if (activeDateType === dateTypes.RANGE) { + form.setFieldValue('dateRangePicker', currentActiveDateValue); + form.setFieldsValue({ + datePicker: undefined, + startDateRecur: undefined, + }); + } else if (activeDateType === dateTypes.MULTIPLE) { + form.setFieldValue('startDateRecur', currentActiveDateValue); + form.setFieldsValue({ + datePicker: undefined, + dateRangePicker: undefined, + }); + } } form.resetFields(['frequency']);