IO-1055 Blocked Day improvements.

This commit is contained in:
Patrick Fic
2021-05-10 15:55:33 -07:00
parent 5a40ce21ca
commit ef4d6de1fe
5 changed files with 56 additions and 24 deletions

View File

@@ -43,6 +43,12 @@ export function ScheduleCalendarHeaderComponent({
);
}, [events, date]);
const isDayBlocked = useMemo(() => {
return events.filter(
(e) => moment(date).isSame(moment(e.start), "day") && e.block
);
}, [events, date]);
const { t } = useTranslation();
const loadData = load[date.toISOString().substr(0, 10)];
@@ -136,9 +142,9 @@ export function ScheduleCalendarHeaderComponent({
<div>
<ul style={{ listStyleType: "none", columns: "2 auto", padding: 0 }}>
{Object.keys(ATSToday).map((key, idx) => (
<li key={idx}>{`${key === "null" ? "N/A" : key}: ${
ATSToday[key].length
}`}</li>
<li key={idx}>{`${
key === "null" || key === "undefined" ? "N/A" : key
}: ${ATSToday[key].length}`}</li>
))}
</ul>
</div>
@@ -179,7 +185,11 @@ export function ScheduleCalendarHeaderComponent({
return (
<div className="imex-calendar-load">
<ScheduleBlockDay date={date} refetch={refetch}>
<ScheduleBlockDay
alreadyBlocked={isDayBlocked.length > 0}
date={date}
refetch={refetch}
>
<div style={{ color: isShopOpen(date) ? "" : "tomato" }}>
{label}
{calculating ? <LoadingSkeleton /> : LoadComponent}