From 58e6f18594e9a7579c0985559427109d1ec444c3 Mon Sep 17 00:00:00 2001 From: Olga Stogova Date: Fri, 24 May 2024 13:06:40 +0200 Subject: [PATCH] fix: styles for the schedule component, make it mobile-friendly (#15178) * fix styles for the schedule component, make it mobile-friendly * CR changes * no need that condition --- .../schedules/components/Schedule.tsx | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/packages/features/schedules/components/Schedule.tsx b/packages/features/schedules/components/Schedule.tsx index ffb304a3ba..0d09c34af5 100644 --- a/packages/features/schedules/components/Schedule.tsx +++ b/packages/features/schedules/components/Schedule.tsx @@ -74,7 +74,7 @@ export const ScheduleDay = ({ return (
@@ -102,8 +102,9 @@ export const ScheduleDay = ({
<> - {watchDayRange ? ( -
+ {!watchDayRange && } + {watchDayRange.length > 0 && ( +
({ timeRangeField: className?.timeRangeField, }} /> - {!!watchDayRange.length && !disabled &&
{CopyButton}
} + {!disabled &&
{CopyButton}
}
- ) : ( - )}
@@ -215,7 +214,7 @@ export const ScheduleComponent = < const { i18n } = useLocale(); return ( -
+
{/* First iterate for each day */} {weekdayNames(i18n.language, weekStart, "long").map((weekday, num) => { const weekdayIndex = (num + weekStart) % 7; @@ -271,11 +270,13 @@ export const DayRanges = ({ name, }); + if (!fields.length) return null; + return ( -
+
{fields.map((field, index: number) => ( -
+
( @@ -291,7 +292,7 @@ export const DayRanges = ({ disabled={disabled} data-testid="add-time-availability" tooltip={labels?.addTime ?? t("add_time_availability")} - className="text-default mx-2" + className="text-default" type="button" color="minimal" variant="icon" @@ -314,7 +315,7 @@ export const DayRanges = ({ /> )} {index !== 0 && ( - + )}
@@ -364,10 +365,10 @@ const TimeRangeField = ({ } & ControllerRenderProps) => { // this is a controlled component anyway given it uses LazySelect, so keep it RHF agnostic. return ( -
+
- - + -