@licklist/design 0.44.486-dev.18 → 0.44.486-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/collapsible-input-group/CollapsibleInputGroup.js +1 -1
- package/dist/date-time-button/DateTimeButton.js +1 -1
- package/dist/events/edit-event-modal/IntervalInput.d.ts.map +1 -1
- package/dist/events/edit-event-modal/IntervalInput.js +1 -1
- package/dist/events/event-venue-map/hooks/useImage.d.ts.map +1 -1
- package/dist/events/event-venue-map/hooks/useImage.js +1 -1
- package/dist/iframe/activity-cards/activity-card/ActivityCard.d.ts +12 -0
- package/dist/iframe/activity-cards/activity-card/ActivityCard.d.ts.map +1 -0
- package/dist/iframe/activity-cards/activity-card/ActivityCard.js +1 -0
- package/dist/iframe/activity-cards/index.d.ts +3 -0
- package/dist/iframe/activity-cards/index.d.ts.map +1 -0
- package/dist/iframe/activity-cards/list-activity-card/ListActivityCard.d.ts +12 -0
- package/dist/iframe/activity-cards/list-activity-card/ListActivityCard.d.ts.map +1 -0
- package/dist/iframe/activity-cards/list-activity-card/ListActivityCard.js +1 -0
- package/dist/iframe/event/event-calendar/EventCalendar.d.ts +3 -5
- package/dist/iframe/event/event-calendar/EventCalendar.d.ts.map +1 -1
- package/dist/iframe/event/event-calendar/EventCalendar.js +1 -1
- package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.d.ts +2 -3
- package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.d.ts.map +1 -1
- package/dist/iframe/event/event-calendar/components/CalendarDate/CalendarDate.js +1 -1
- package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.d.ts +3 -5
- package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.d.ts.map +1 -1
- package/dist/iframe/event/event-calendar/components/CalendarDates/CalendarDates.js +1 -1
- package/dist/iframe/index.d.ts +1 -1
- package/dist/iframe/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +0 -1
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.d.ts +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.js +1 -1
- package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts +2 -3
- package/dist/iframe/order-process/components/utils/useCategoryVerification.d.ts.map +1 -1
- package/dist/iframe/order-process/components/utils/useCategoryVerification.js +1 -1
- package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.d.ts.map +1 -1
- package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.js +1 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.d.ts.map +1 -1
- package/dist/iframe/payment/order-items-table/hooks/useTableData.js +1 -1
- package/dist/iframe/payment/order-items-table/types/index.d.ts +1 -7
- package/dist/iframe/payment/order-items-table/types/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.d.ts.map +1 -1
- package/dist/notification/email-template/control/EmailTemplateControl.js +1 -1
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +1 -1
- package/dist/product-set/form/ProductsControl.d.ts +1 -3
- package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductsControl.js +1 -1
- package/dist/product-set/product/ProductControl.d.ts +1 -2
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.js +1 -1
- package/dist/product-set/product/duration/ProductDurationControl.js +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.js +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +1 -1
- package/dist/recurrence-input/RecurrenceEndInput.d.ts +1 -2
- package/dist/recurrence-input/RecurrenceEndInput.d.ts.map +1 -1
- package/dist/recurrence-input/RecurrenceEndInput.js +1 -1
- package/dist/recurrence-input/RecurrenceInput.d.ts +1 -2
- package/dist/recurrence-input/RecurrenceInput.d.ts.map +1 -1
- package/dist/recurrence-input/RecurrenceInput.js +1 -1
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts +1 -4
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.js +1 -1
- package/dist/snippet/snippet-template/preview/Preview.js +1 -1
- package/dist/static/CountryCodeSelect.d.ts.map +1 -1
- package/dist/static/CountryCodeSelect.js +1 -1
- package/dist/static/form-number-input/FormNumberInput.d.ts +1 -2
- package/dist/static/form-number-input/FormNumberInput.d.ts.map +1 -1
- package/dist/static/form-number-input/FormNumberInput.js +1 -1
- package/dist/styles/{activity-card/GridActivitiesCard.scss → iframe-customers-journey/ActivitiesCard.scss} +1 -1
- package/dist/styles/{activity-card/ListActivitiesCard.scss → iframe-customers-journey/ActivitiesSelectedCard.scss} +1 -2
- package/dist/styles/iframe-customers-journey/_index.scss +3 -0
- package/dist/styles/iframe-events/Calendar.scss +14 -14
- package/dist/styles/iframe-page/PageBody.scss +2 -3
- package/dist/styles/notification/Notification.scss +0 -4
- package/dist/styles/packages.scss +1 -2
- package/dist/styles/resources-blocking/_index.scss +0 -5
- package/dist/styles/themes/bookedit/_index.scss +0 -1
- package/dist/zone/form/components/AvailableTimesControl.d.ts.map +1 -1
- package/dist/zone/form/components/AvailableTimesControl.js +1 -1
- package/dist/zone/form/components/ZoneControl.d.ts.map +1 -1
- package/dist/zone/form/components/ZoneControl.js +1 -1
- package/dist/zone/form/components/ZoneRecurrencesControl.d.ts.map +1 -1
- package/dist/zone/form/components/ZoneRecurrencesControl.js +1 -1
- package/dist/zone/form/utils/dates.d.ts.map +1 -1
- package/dist/zone/form/utils/dates.js +1 -1
- package/package.json +1 -1
- package/src/collapsible-input-group/CollapsibleInputGroup.tsx +1 -1
- package/src/date-time-button/DateTimeButton.tsx +1 -1
- package/src/events/edit-event-modal/IntervalInput.tsx +0 -3
- package/src/events/event-venue-map/hooks/useImage.tsx +8 -17
- package/src/iframe/{activity-card → activity-cards/activity-card}/ActivityCard.stories.tsx +1 -24
- package/src/iframe/activity-cards/activity-card/ActivityCard.tsx +38 -0
- package/src/iframe/activity-cards/index.ts +2 -0
- package/src/iframe/activity-cards/list-activity-card/ListActivityCard.stories.tsx +52 -0
- package/src/iframe/activity-cards/list-activity-card/ListActivityCard.tsx +49 -0
- package/src/iframe/event/event-calendar/EventCalendar.stories.tsx +21 -20
- package/src/iframe/event/event-calendar/EventCalendar.tsx +3 -10
- package/src/iframe/event/event-calendar/components/CalendarDate/CalendarDate.tsx +2 -10
- package/src/iframe/event/event-calendar/components/CalendarDates/CalendarDates.tsx +2 -6
- package/src/iframe/index.ts +1 -1
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +0 -2
- package/src/iframe/order-process/components/BookingSummary/types/index.ts +0 -1
- package/src/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.tsx +2 -2
- package/src/iframe/order-process/components/utils/useCategoryVerification.ts +29 -28
- package/src/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.tsx +1 -6
- package/src/iframe/payment/order-items-table/hooks/useTableData.tsx +99 -11
- package/src/iframe/payment/order-items-table/types/index.ts +1 -18
- package/src/notification/email-template/control/EmailTemplateControl.tsx +1 -26
- package/src/product-set/form/ProductCategoriesControl.tsx +0 -2
- package/src/product-set/form/ProductSetForm.stories.tsx +0 -1
- package/src/product-set/form/ProductsControl.tsx +0 -10
- package/src/product-set/product/ProductControl.tsx +8 -31
- package/src/product-set/product/duration/ProductDurationControl.tsx +1 -1
- package/src/product-set/product-category/ProductCategoryControl.tsx +5 -15
- package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +8 -10
- package/src/recurrence-input/RecurrenceEndInput.tsx +9 -27
- package/src/recurrence-input/RecurrenceInput.tsx +0 -3
- package/src/recurring-date-picker-input/RecurrenceIntervalAndFrequencyInput.tsx +13 -23
- package/src/static/CountryCodeSelect.tsx +5 -3
- package/src/static/form-number-input/FormNumberInput.tsx +1 -8
- package/src/styles/{activity-card/GridActivitiesCard.scss → iframe-customers-journey/ActivitiesCard.scss} +1 -1
- package/src/styles/{activity-card/ListActivitiesCard.scss → iframe-customers-journey/ActivitiesSelectedCard.scss} +1 -2
- package/src/styles/iframe-customers-journey/_index.scss +3 -0
- package/src/styles/iframe-events/Calendar.scss +14 -14
- package/src/styles/iframe-page/PageBody.scss +2 -3
- package/src/styles/notification/Notification.scss +0 -4
- package/src/styles/packages.scss +1 -2
- package/src/styles/resources-blocking/_index.scss +0 -5
- package/src/styles/themes/bookedit/_index.scss +0 -1
- package/src/zone/form/components/AvailableTimesControl.tsx +9 -4
- package/src/zone/form/components/ZoneControl.tsx +0 -2
- package/src/zone/form/components/ZoneRecurrencesControl.tsx +35 -27
- package/src/zone/form/utils/dates.ts +36 -29
- package/dist/iframe/activity-card/ActivityCard.d.ts +0 -17
- package/dist/iframe/activity-card/ActivityCard.d.ts.map +0 -1
- package/dist/iframe/activity-card/ActivityCard.js +0 -1
- package/dist/iframe/activity-card/index.d.ts +0 -2
- package/dist/iframe/activity-card/index.d.ts.map +0 -1
- package/dist/iframe/payment/order-items-table/types/index.js +0 -1
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts +0 -3
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.d.ts.map +0 -1
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +0 -1
- package/dist/styles/activity-card/_index.scss +0 -2
- package/dist/styles/date-time-button/_index.scss +0 -1
- package/dist/zone/form/components/GameDurationControl.d.ts +0 -7
- package/dist/zone/form/components/GameDurationControl.d.ts.map +0 -1
- package/dist/zone/form/components/GameDurationControl.js +0 -1
- package/src/iframe/activity-card/ActivityCard.tsx +0 -77
- package/src/iframe/activity-card/index.ts +0 -1
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +0 -118
- package/src/styles/activity-card/_index.scss +0 -2
- package/src/styles/date-time-button/_index.scss +0 -1
- package/src/zone/form/components/GameDurationControl.tsx +0 -46
- /package/dist/styles/{date-time-button → iframe-customers-journey}/DateTimeButton.scss +0 -0
- /package/src/styles/{date-time-button → iframe-customers-journey}/DateTimeButton.scss +0 -0
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useRef } from "react";
|
|
2
2
|
import { useId } from "@react-aria/utils";
|
|
3
3
|
import { DateTime, DurationUnit } from "luxon";
|
|
4
4
|
import { Col, Form, InputGroup, Row } from "react-bootstrap";
|
|
5
5
|
import RRule from "rrule";
|
|
6
|
-
|
|
7
|
-
import { useTranslation } from "react-i18next";
|
|
6
|
+
|
|
8
7
|
import { SupportedFrequency } from "./utils";
|
|
9
8
|
import HTMLInputDateElement from "../types/static/HTMLInputDateElement";
|
|
10
9
|
|
|
11
10
|
interface Props {
|
|
12
11
|
disabled?: boolean;
|
|
13
|
-
date: string;
|
|
14
|
-
minDate?: string; // should be in yyyy-mm-dd format
|
|
12
|
+
date: string;
|
|
15
13
|
frequency: SupportedFrequency;
|
|
16
|
-
until?: string;
|
|
14
|
+
until?: string;
|
|
17
15
|
count?: number;
|
|
18
16
|
onChange: (values: { until?: string; count?: number }) => void;
|
|
19
17
|
}
|
|
@@ -25,31 +23,16 @@ function RecurrenceEndInput({
|
|
|
25
23
|
until,
|
|
26
24
|
count,
|
|
27
25
|
onChange,
|
|
28
|
-
minDate,
|
|
29
26
|
}: Props) {
|
|
30
|
-
const { t } = useTranslation("Design");
|
|
31
27
|
// unique ids for radios
|
|
32
28
|
const neverId = useId();
|
|
33
29
|
const onId = useId();
|
|
34
30
|
const afterId = useId();
|
|
35
31
|
const dateInput = useRef<HTMLInputDateElement | null>(null);
|
|
36
32
|
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
const untilDatetime = DateTime.fromFormat(
|
|
39
|
-
until ?? getUntil({ date, frequency }),
|
|
40
|
-
DATE_FORMAT
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
const minDatetime = DateTime.fromFormat(minDate, DATE_FORMAT);
|
|
44
|
-
|
|
45
|
-
if (minDatetime > untilDatetime) {
|
|
46
|
-
onChange({ until: minDate });
|
|
47
|
-
}
|
|
48
|
-
}, [minDate, onChange, until, date, frequency]);
|
|
49
|
-
|
|
50
33
|
return (
|
|
51
34
|
<Form.Group>
|
|
52
|
-
<Form.Label>
|
|
35
|
+
<Form.Label>Ends</Form.Label>
|
|
53
36
|
|
|
54
37
|
<Form.Check type="radio" id={neverId} custom className="mt-3">
|
|
55
38
|
<Form.Check.Input
|
|
@@ -58,7 +41,7 @@ function RecurrenceEndInput({
|
|
|
58
41
|
onChange={() => onChange({ count: 500 })}
|
|
59
42
|
disabled={disabled}
|
|
60
43
|
/>
|
|
61
|
-
<Form.Check.Label>
|
|
44
|
+
<Form.Check.Label>Never</Form.Check.Label>
|
|
62
45
|
</Form.Check>
|
|
63
46
|
|
|
64
47
|
<Form.Check type="radio" id={onId} custom className="mt-3">
|
|
@@ -72,12 +55,11 @@ function RecurrenceEndInput({
|
|
|
72
55
|
}
|
|
73
56
|
disabled={disabled}
|
|
74
57
|
/>
|
|
75
|
-
<Form.Check.Label>
|
|
58
|
+
<Form.Check.Label>On</Form.Check.Label>
|
|
76
59
|
</Col>
|
|
77
60
|
<Col>
|
|
78
61
|
<Form.Control
|
|
79
62
|
type="date"
|
|
80
|
-
min={minDate}
|
|
81
63
|
disabled={disabled || !until}
|
|
82
64
|
aria-label="Date on which the recurrence ends"
|
|
83
65
|
value={until ?? getUntil({ date, frequency })}
|
|
@@ -101,7 +83,7 @@ function RecurrenceEndInput({
|
|
|
101
83
|
}
|
|
102
84
|
disabled={disabled}
|
|
103
85
|
/>
|
|
104
|
-
<Form.Check.Label>
|
|
86
|
+
<Form.Check.Label>After</Form.Check.Label>
|
|
105
87
|
</Col>
|
|
106
88
|
<Col>
|
|
107
89
|
<InputGroup>
|
|
@@ -117,7 +99,7 @@ function RecurrenceEndInput({
|
|
|
117
99
|
}
|
|
118
100
|
/>
|
|
119
101
|
<InputGroup.Append>
|
|
120
|
-
<InputGroup.Text>
|
|
102
|
+
<InputGroup.Text>occurrences</InputGroup.Text>
|
|
121
103
|
</InputGroup.Append>
|
|
122
104
|
</InputGroup>
|
|
123
105
|
</Col>
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
export interface RecurrenceInputProps {
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
date: string;
|
|
19
|
-
minDate?: string;
|
|
20
19
|
value?: string;
|
|
21
20
|
onChange: (value: string) => void;
|
|
22
21
|
initialFrequency?: Frequency;
|
|
@@ -25,7 +24,6 @@ export interface RecurrenceInputProps {
|
|
|
25
24
|
export function RecurrenceInput({
|
|
26
25
|
disabled = false,
|
|
27
26
|
date,
|
|
28
|
-
minDate,
|
|
29
27
|
value,
|
|
30
28
|
onChange,
|
|
31
29
|
initialFrequency = Frequency.WEEKLY,
|
|
@@ -84,7 +82,6 @@ export function RecurrenceInput({
|
|
|
84
82
|
)}
|
|
85
83
|
<RecurrenceEndInput
|
|
86
84
|
date={date}
|
|
87
|
-
minDate={minDate}
|
|
88
85
|
frequency={state.freq}
|
|
89
86
|
until={state.until && DateTime.fromJSDate(state.until).toISODate()}
|
|
90
87
|
count={state.count}
|
|
@@ -2,8 +2,8 @@ import React, { useEffect } from "react";
|
|
|
2
2
|
import { DateTime } from "luxon";
|
|
3
3
|
import { Col, Form, Row } from "react-bootstrap";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
import {
|
|
6
|
-
import { DATE_FORMAT } from "@licklist/core/dist/Config";
|
|
5
|
+
import { useFormContext } from "react-hook-form";
|
|
6
|
+
import { DATE_FORMAT, TIME_FULL_FORMAT } from "@licklist/core/dist/Config";
|
|
7
7
|
import { RecurringDatePickerInputValues } from "./RecurringDatePickerInput";
|
|
8
8
|
|
|
9
9
|
interface RecurrenceIntervalAndFrequencyInputProps {
|
|
@@ -13,14 +13,6 @@ interface RecurrenceIntervalAndFrequencyInputProps {
|
|
|
13
13
|
startTimeLabel?: string;
|
|
14
14
|
endDateLabel?: string;
|
|
15
15
|
endTimeLabel?: string;
|
|
16
|
-
startTimeRules?: Pick<
|
|
17
|
-
RegisterOptions,
|
|
18
|
-
"max" | "min" | "validate" | "required" | "pattern"
|
|
19
|
-
>;
|
|
20
|
-
endTimeRules?: Pick<
|
|
21
|
-
RegisterOptions,
|
|
22
|
-
"max" | "min" | "validate" | "required" | "pattern"
|
|
23
|
-
>;
|
|
24
16
|
}
|
|
25
17
|
|
|
26
18
|
function RecurrenceIntervalAndFrequencyInput({
|
|
@@ -30,8 +22,6 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
30
22
|
startTimeLabel,
|
|
31
23
|
endDateLabel,
|
|
32
24
|
endTimeLabel,
|
|
33
|
-
startTimeRules,
|
|
34
|
-
endTimeRules,
|
|
35
25
|
}: RecurrenceIntervalAndFrequencyInputProps) {
|
|
36
26
|
const { t } = useTranslation(["Design", "Notification", "App"]);
|
|
37
27
|
|
|
@@ -57,9 +47,6 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
57
47
|
}, [startDate]);
|
|
58
48
|
|
|
59
49
|
useEffect(() => {
|
|
60
|
-
if (!startTime || !endTime) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
50
|
trigger("endTime");
|
|
64
51
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
65
52
|
}, [startTime]);
|
|
@@ -131,18 +118,15 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
131
118
|
</Form.Label>
|
|
132
119
|
<Form.Control
|
|
133
120
|
type="time"
|
|
134
|
-
{...register("startTime", { required: false
|
|
121
|
+
{...register("startTime", { required: false })}
|
|
135
122
|
onChange={({ target: { value } }) => {
|
|
136
|
-
setValue("startTime", `${value}:00
|
|
123
|
+
setValue("startTime", `${value}:00`);
|
|
137
124
|
}}
|
|
138
125
|
placeholder="hh:mm"
|
|
139
126
|
defaultValue={startTime}
|
|
140
127
|
disabled={disabled}
|
|
141
128
|
isInvalid={Boolean(errors.startTime)}
|
|
142
129
|
/>
|
|
143
|
-
<Form.Control.Feedback type="invalid">
|
|
144
|
-
{errors.startTime?.message}
|
|
145
|
-
</Form.Control.Feedback>
|
|
146
130
|
</Form.Group>
|
|
147
131
|
</Col>
|
|
148
132
|
|
|
@@ -157,8 +141,15 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
157
141
|
if (!startTime || !time) {
|
|
158
142
|
return true;
|
|
159
143
|
}
|
|
160
|
-
const currentStartTime = DateTime.
|
|
161
|
-
|
|
144
|
+
const currentStartTime = DateTime.fromFormat(
|
|
145
|
+
startTime,
|
|
146
|
+
TIME_FULL_FORMAT
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
const currentEndTime = DateTime.fromFormat(
|
|
150
|
+
time,
|
|
151
|
+
TIME_FULL_FORMAT
|
|
152
|
+
);
|
|
162
153
|
|
|
163
154
|
return currentEndTime?.diff(currentStartTime, ["seconds"])
|
|
164
155
|
?.seconds > 0
|
|
@@ -168,7 +159,6 @@ function RecurrenceIntervalAndFrequencyInput({
|
|
|
168
159
|
min: t("Design:startTimeSmall"),
|
|
169
160
|
})}`;
|
|
170
161
|
},
|
|
171
|
-
...endTimeRules,
|
|
172
162
|
})}
|
|
173
163
|
onChange={({ target: { value } }) => {
|
|
174
164
|
setValue("endTime", `${value}:59`, { shouldValidate: true });
|
|
@@ -52,9 +52,11 @@ function CountryCodeSelect({
|
|
|
52
52
|
{t("chooseCountry")}
|
|
53
53
|
</option>
|
|
54
54
|
{sortedCountries.map((key: keyof typeof en) => (
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
|
|
55
|
+
<>
|
|
56
|
+
<option key={key as string} value={key as string}>
|
|
57
|
+
{en[key]}
|
|
58
|
+
</option>
|
|
59
|
+
</>
|
|
58
60
|
))}
|
|
59
61
|
</Form.Control>
|
|
60
62
|
<Form.Control.Feedback type="invalid">{error}</Form.Control.Feedback>
|
|
@@ -15,7 +15,6 @@ interface FormNumberInputProps {
|
|
|
15
15
|
label: string;
|
|
16
16
|
fieldName: string;
|
|
17
17
|
step?: number;
|
|
18
|
-
onChange?: (value: number) => void;
|
|
19
18
|
disabled?: boolean;
|
|
20
19
|
rules?: Pick<
|
|
21
20
|
RegisterOptions,
|
|
@@ -29,7 +28,6 @@ export const FormNumberInput = ({
|
|
|
29
28
|
step = 1,
|
|
30
29
|
rules,
|
|
31
30
|
disabled,
|
|
32
|
-
onChange,
|
|
33
31
|
}: FormNumberInputProps) => {
|
|
34
32
|
const controlId = useId();
|
|
35
33
|
const { t } = useTranslation("Validation");
|
|
@@ -78,12 +76,7 @@ export const FormNumberInput = ({
|
|
|
78
76
|
disabled={disabled}
|
|
79
77
|
isInvalid={HookFormService.isInvalid(fieldName, errors)}
|
|
80
78
|
{...field}
|
|
81
|
-
onChange={(event) =>
|
|
82
|
-
if (onChange) {
|
|
83
|
-
onChange(Number(event.target.value));
|
|
84
|
-
}
|
|
85
|
-
field.onChange(Number(event.target.value));
|
|
86
|
-
}}
|
|
79
|
+
onChange={(event) => field.onChange(Number(event.target.value))}
|
|
87
80
|
onFocus={onFocus}
|
|
88
81
|
/>
|
|
89
82
|
)}
|
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
align-items: center;
|
|
7
7
|
cursor: pointer;
|
|
8
8
|
height: 5rem;
|
|
9
|
-
padding: 0.375rem;
|
|
10
9
|
border: 2px solid transparent;
|
|
11
|
-
border
|
|
10
|
+
border: 2px solid transparent;
|
|
12
11
|
background-color: $snippet-product-set-background-color;
|
|
13
12
|
color: $snippet-product-set-font-color;
|
|
14
13
|
transition: $color-transition;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
.calendar-wrapper {
|
|
2
3
|
display: flex;
|
|
3
4
|
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
background-color: transparent;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
&:focus
|
|
24
|
+
&:focus{
|
|
24
25
|
box-shadow: none;
|
|
25
26
|
}
|
|
26
27
|
}
|
|
@@ -72,9 +73,10 @@
|
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
75
|
|
|
76
|
+
|
|
77
|
+
|
|
75
78
|
.calendar-dates-wrapper {
|
|
76
|
-
.calendar-weekdays,
|
|
77
|
-
.calendar-dates {
|
|
79
|
+
.calendar-weekdays, .calendar-dates {
|
|
78
80
|
display: grid;
|
|
79
81
|
grid-template-columns: repeat(7, auto);
|
|
80
82
|
grid-gap: 0.5rem 1rem;
|
|
@@ -96,17 +98,17 @@
|
|
|
96
98
|
margin-top: 0.75rem;
|
|
97
99
|
|
|
98
100
|
.calendar-date {
|
|
101
|
+
height: 2rem;
|
|
99
102
|
display: flex;
|
|
100
|
-
flex-direction: column;
|
|
101
103
|
align-items: center;
|
|
102
104
|
justify-content: center;
|
|
103
|
-
padding: 0
|
|
105
|
+
padding: 0;
|
|
104
106
|
border-radius: 0.25rem;
|
|
105
107
|
background-color: $snippet-calendar-button-background-color;
|
|
106
108
|
color: $snippet-calendar-button-font-color;
|
|
107
109
|
font-size: 0.875rem;
|
|
108
110
|
line-height: 1.3125rem;
|
|
109
|
-
border: 1px solid $snippet-calendar-button-border-color
|
|
111
|
+
border: 1px solid $snippet-calendar-button-border-color;;
|
|
110
112
|
|
|
111
113
|
&.selected-date {
|
|
112
114
|
background-color: $snippet-calendar-active-button-background-color;
|
|
@@ -136,7 +138,7 @@
|
|
|
136
138
|
&:hover {
|
|
137
139
|
border-color: $snippet-calendar-active-button-border-color;
|
|
138
140
|
}
|
|
139
|
-
|
|
141
|
+
|
|
140
142
|
&:focus {
|
|
141
143
|
box-shadow: none;
|
|
142
144
|
}
|
|
@@ -165,11 +167,11 @@
|
|
|
165
167
|
justify-content: center;
|
|
166
168
|
width: 3.75rem;
|
|
167
169
|
height: 2.5rem;
|
|
168
|
-
background-color: #
|
|
170
|
+
background-color: #F2F2F2;
|
|
169
171
|
color: $black;
|
|
170
172
|
font-size: 0.75rem;
|
|
171
173
|
border-radius: 0.25rem;
|
|
172
|
-
|
|
174
|
+
|
|
173
175
|
&.selected-time {
|
|
174
176
|
background-color: $blue;
|
|
175
177
|
color: $white;
|
|
@@ -187,16 +189,14 @@
|
|
|
187
189
|
flex-direction: column;
|
|
188
190
|
align-items: center;
|
|
189
191
|
|
|
190
|
-
.calendar,
|
|
191
|
-
.start-time-wrapper {
|
|
192
|
+
.calendar, .start-time-wrapper {
|
|
192
193
|
min-width: 20.75rem;
|
|
193
194
|
|
|
194
195
|
.calendar-dates-wrapper {
|
|
195
|
-
.calendar-weekdays,
|
|
196
|
-
.calendar-dates {
|
|
196
|
+
.calendar-weekdays, .calendar-dates {
|
|
197
197
|
grid-gap: 0.5rem;
|
|
198
198
|
}
|
|
199
|
-
|
|
199
|
+
|
|
200
200
|
.calendar-dates {
|
|
201
201
|
.calendar-date {
|
|
202
202
|
width: 2.5rem;
|
|
@@ -199,8 +199,7 @@
|
|
|
199
199
|
color: $snippet-elements-button-color;
|
|
200
200
|
border: none;
|
|
201
201
|
background-color: $snippet-elements-button-background-color;
|
|
202
|
-
box-shadow: 0 0 0 $input-btn-focus-width
|
|
203
|
-
$snippet-elements-button-background-color;
|
|
202
|
+
box-shadow: 0 0 0 $input-btn-focus-width $snippet-elements-button-background-color;
|
|
204
203
|
}
|
|
205
204
|
|
|
206
205
|
&:disabled {
|
|
@@ -235,7 +234,7 @@
|
|
|
235
234
|
font-weight: 500;
|
|
236
235
|
border-radius: 0.25rem;
|
|
237
236
|
font-size: 0.875rem;
|
|
238
|
-
|
|
237
|
+
height: 2.25rem;
|
|
239
238
|
|
|
240
239
|
&:focus {
|
|
241
240
|
box-shadow: unset;
|
package/src/styles/packages.scss
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
@import "./static";
|
|
14
14
|
@import "./table";
|
|
15
15
|
@import "./back-button";
|
|
16
|
+
@import "./iframe-customers-journey";
|
|
16
17
|
@import "./custom-fields";
|
|
17
18
|
@import "./file-upload";
|
|
18
19
|
@import "./iframe-events";
|
|
@@ -40,5 +41,3 @@
|
|
|
40
41
|
@import "./striped-static-table/";
|
|
41
42
|
@import "./image-radio-input/";
|
|
42
43
|
@import "./radio-card/";
|
|
43
|
-
@import "./activity-card/";
|
|
44
|
-
@import "./date-time-button/";
|
|
@@ -9,6 +9,7 @@ import { Form } from "react-bootstrap";
|
|
|
9
9
|
import { UseFormSetError, useForm } from "react-hook-form";
|
|
10
10
|
import { useId } from "@react-aria/utils";
|
|
11
11
|
import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
|
|
12
|
+
import { calculateTimeWithOffset } from "@licklist/plugins/dist/utils/time";
|
|
12
13
|
import { getCheckboxesByWorkHours } from "../utils/dates";
|
|
13
14
|
|
|
14
15
|
export type AvailableTimesControlRef = {
|
|
@@ -61,18 +62,20 @@ export const AvailableTimesControl = forwardRef<
|
|
|
61
62
|
});
|
|
62
63
|
|
|
63
64
|
const onChange = (option: string) => {
|
|
64
|
-
const
|
|
65
|
+
const timeWithOffset = calculateTimeWithOffset(option);
|
|
66
|
+
|
|
67
|
+
const isAlreadyChecked = availableTimes.includes(timeWithOffset);
|
|
65
68
|
|
|
66
69
|
if (isAlreadyChecked) {
|
|
67
70
|
setValue(
|
|
68
71
|
"availableTimes",
|
|
69
|
-
availableTimes.filter((value) => value !==
|
|
72
|
+
availableTimes.filter((value) => value !== timeWithOffset)
|
|
70
73
|
);
|
|
71
74
|
|
|
72
75
|
return;
|
|
73
76
|
}
|
|
74
77
|
|
|
75
|
-
setValue("availableTimes", [...availableTimes,
|
|
78
|
+
setValue("availableTimes", [...availableTimes, timeWithOffset]);
|
|
76
79
|
};
|
|
77
80
|
|
|
78
81
|
useEffect(() => {
|
|
@@ -92,7 +95,9 @@ export const AvailableTimesControl = forwardRef<
|
|
|
92
95
|
<Form.Check.Input
|
|
93
96
|
type="checkbox"
|
|
94
97
|
value={option}
|
|
95
|
-
checked={availableTimes.includes(
|
|
98
|
+
checked={availableTimes.includes(
|
|
99
|
+
calculateTimeWithOffset(option)
|
|
100
|
+
)}
|
|
96
101
|
onChange={() => onChange(option)}
|
|
97
102
|
disabled={isLoading}
|
|
98
103
|
/>
|
|
@@ -7,7 +7,6 @@ import { SortControl } from "./SortControl";
|
|
|
7
7
|
import { ZoneRecurrencesControl } from "./ZoneRecurrencesControl";
|
|
8
8
|
import { DescriptionControl } from "./DescriptionControl";
|
|
9
9
|
import { ZoneImageControl } from "./ZoneImageControl";
|
|
10
|
-
import { GameDurationControl } from "./GameDurationControl";
|
|
11
10
|
|
|
12
11
|
export type ZoneControlProps = {
|
|
13
12
|
isLoading: boolean;
|
|
@@ -28,7 +27,6 @@ export const ZoneControl = ({
|
|
|
28
27
|
<Col md={6} sm={6}>
|
|
29
28
|
<ZoneTypeControl isLoading={isLoading} />
|
|
30
29
|
<SortControl isLoading={isLoading} />
|
|
31
|
-
<GameDurationControl isLoading={isLoading} />
|
|
32
30
|
</Col>
|
|
33
31
|
<Col md={6} sm={6}>
|
|
34
32
|
<ZoneImageControl isLoading={isLoading} />
|
|
@@ -12,8 +12,11 @@ import {
|
|
|
12
12
|
import { DndContext } from "@dnd-kit/core";
|
|
13
13
|
import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
|
|
14
14
|
import { DateTime } from "luxon";
|
|
15
|
-
import { TIME_FORMAT } from "@licklist/core/dist/Config";
|
|
16
|
-
|
|
15
|
+
import { TIME_FORMAT, TIME_FULL_FORMAT } from "@licklist/core/dist/Config";
|
|
16
|
+
import {
|
|
17
|
+
calculateTimeWithOffset,
|
|
18
|
+
DIRECTION_TO_LOCAL,
|
|
19
|
+
} from "@licklist/plugins/dist/utils/time";
|
|
17
20
|
import { CONFIRM_MODAL_ACTIONS } from "../../../modals/confirmation/ConfirmModal";
|
|
18
21
|
import { Icon } from "../../../static";
|
|
19
22
|
import {
|
|
@@ -64,6 +67,7 @@ export const ZoneRecurrencesControl = ({
|
|
|
64
67
|
});
|
|
65
68
|
const clearEditState = () => setEditState({ index: null, values: null });
|
|
66
69
|
const [availableTimes, setAvailableTimes] = useState<string[]>([]);
|
|
70
|
+
|
|
67
71
|
const popoverRef = useRef<HTMLDivElement>();
|
|
68
72
|
const availableTimesFormRef = useRef<AvailableTimesControlRef>();
|
|
69
73
|
|
|
@@ -93,29 +97,30 @@ export const ZoneRecurrencesControl = ({
|
|
|
93
97
|
if (!isAvailableTimesFormValid) {
|
|
94
98
|
return;
|
|
95
99
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
)
|
|
100
|
+
const startTime = DateTime.fromFormat(next.startTime, TIME_FULL_FORMAT);
|
|
101
|
+
const endTime = DateTime.fromFormat(next.endTime, TIME_FULL_FORMAT);
|
|
102
|
+
const { availableTimes } = availableTimesFormRef.current.getValues();
|
|
103
|
+
const validAvalilableTimes = availableTimes.every((time) => {
|
|
104
|
+
const currentAvailableTime = DateTime.fromFormat(
|
|
105
|
+
calculateTimeWithOffset(time, DIRECTION_TO_LOCAL),
|
|
106
|
+
TIME_FORMAT
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
currentAvailableTime.diff(startTime, "minutes").minutes >= 0 &&
|
|
111
|
+
currentAvailableTime.diff(endTime, "minutes").minutes <= 0
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
if (!validAvalilableTimes) {
|
|
115
|
+
availableTimesFormRef.current.setError("availableTimes", {
|
|
116
|
+
message: t("Validation:fieldTimeBetween", {
|
|
117
|
+
attribute: t("Design:startTimesSmall"),
|
|
118
|
+
min: startTime.toFormat(TIME_FORMAT),
|
|
119
|
+
max: endTime.toFormat(TIME_FORMAT),
|
|
120
|
+
}),
|
|
107
121
|
});
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
message: t("Validation:fieldTimeBetween", {
|
|
111
|
-
attribute: t("Design:startTimesSmall"),
|
|
112
|
-
min: startTime.toFormat(TIME_FORMAT),
|
|
113
|
-
max: endTime.toFormat(TIME_FORMAT),
|
|
114
|
-
}),
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
122
|
+
|
|
123
|
+
return;
|
|
119
124
|
}
|
|
120
125
|
const values = {
|
|
121
126
|
rrule: next.rrule,
|
|
@@ -143,9 +148,12 @@ export const ZoneRecurrencesControl = ({
|
|
|
143
148
|
const handleOnEdit = (next: Partial<ZoneRecurrence>, index) => {
|
|
144
149
|
clearEditState();
|
|
145
150
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
151
|
+
// Hotfix for an issue with Popover close & open actions
|
|
152
|
+
setTimeout(() => {
|
|
153
|
+
setEditState({ index, values: next });
|
|
154
|
+
setAvailableTimes(next.availableTimes || []);
|
|
155
|
+
setIsDatePopoverVisible(() => true);
|
|
156
|
+
}, 100);
|
|
149
157
|
};
|
|
150
158
|
|
|
151
159
|
const handleOnAdd = () => {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { TIME_SEPARATOR } from "@licklist/core/dist/Services/Date";
|
|
1
|
+
import { datetime, TIME_SEPARATOR } from "@licklist/core/dist/Services/Date";
|
|
2
2
|
import { WorkHour } from "@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper";
|
|
3
|
-
import { DateTime } from "luxon";
|
|
4
|
-
import { TIME_FORMAT } from "@licklist/core/dist/Config";
|
|
5
3
|
|
|
6
4
|
const DEFAULT_START_DAY_TIME = "00:00";
|
|
7
5
|
const DEFAULT_END_DAY_TIME = "23:59";
|
|
@@ -15,37 +13,46 @@ export const getTimeCheckboxRanges = (
|
|
|
15
13
|
const [startHour, startMinutes] = startTime.split(TIME_SEPARATOR);
|
|
16
14
|
const [endHour, endMinutes] = endTime.split(TIME_SEPARATOR);
|
|
17
15
|
|
|
18
|
-
let startDate =
|
|
19
|
-
.
|
|
20
|
-
.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
second: 0,
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const checkboxes: string[] = [startDate.toFormat(TIME_FORMAT)];
|
|
16
|
+
let startDate = datetime(
|
|
17
|
+
today.getFullYear(),
|
|
18
|
+
today.getMonth() + 1,
|
|
19
|
+
today.getDate(),
|
|
20
|
+
Number(startHour),
|
|
21
|
+
Number(startMinutes)
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const endDate = datetime(
|
|
25
|
+
today.getFullYear(),
|
|
26
|
+
today.getMonth() + 1,
|
|
27
|
+
today.getDate(),
|
|
28
|
+
Number(endHour),
|
|
29
|
+
Number(endMinutes)
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const dateSlices: { [key: string]: Date } = {
|
|
33
|
+
0: startDate,
|
|
34
|
+
};
|
|
41
35
|
let count = 0;
|
|
42
36
|
|
|
43
|
-
while (endDate
|
|
44
|
-
startDate = startDate.
|
|
37
|
+
while (endDate >= startDate) {
|
|
38
|
+
startDate = new Date(startDate.getTime() + range * 60 * 1000);
|
|
45
39
|
count += 1;
|
|
46
|
-
|
|
40
|
+
dateSlices[count] = startDate;
|
|
47
41
|
}
|
|
48
42
|
|
|
43
|
+
const checkboxes = Object.keys(dateSlices)
|
|
44
|
+
.map((key) => {
|
|
45
|
+
const date = dateSlices[key];
|
|
46
|
+
if (date < endDate) {
|
|
47
|
+
const [, time] = date.toISOString().split("T");
|
|
48
|
+
const [selectedHours, selectedMinutes] = time.split(TIME_SEPARATOR);
|
|
49
|
+
|
|
50
|
+
return [selectedHours, selectedMinutes].join(TIME_SEPARATOR);
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
})
|
|
54
|
+
.filter(Boolean);
|
|
55
|
+
|
|
49
56
|
return checkboxes;
|
|
50
57
|
};
|
|
51
58
|
|