Skip to content

Commit

Permalink
Merge pull request #124 from Deep-Consulting-Solutions/cal-improvemen…
Browse files Browse the repository at this point in the history
…ts-22

fix: mountCount issues
  • Loading branch information
Bastieno authored Dec 11, 2024
2 parents d3c690c + 7fea0b5 commit d0ed58e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
19 changes: 11 additions & 8 deletions packages/atoms/booker/wrappers/BookerWebWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export const BookerWebWrapper = (props: BookerWebWrapperAtomProps) => {
org: props.entity.orgSlug,
});

const [bookerState, _] = useBookerStore((state) => [state.state, state.setState], shallow);
const [dayCount] = useBookerStore((state) => [state.dayCount, state.setDayCount], shallow);
const { data: session } = useSession();
const routerQuery = useRouterQuery();
Expand Down Expand Up @@ -100,13 +99,17 @@ export const BookerWebWrapper = (props: BookerWebWrapperAtomProps) => {
});
const slots = useSlots(event);

const monthCount =
((bookerLayout.layout !== BookerLayouts.WEEK_VIEW && bookerState === "selecting_time") ||
bookerLayout.layout === BookerLayouts.COLUMN_VIEW) &&
dayjs(date).add(1, "month").month() !==
dayjs(date).add(bookerLayout.columnViewExtraDays.current, "day").month()
? 2
: undefined;
const monthCount = useMemo(() => {
if (
bookerLayout.layout === BookerLayouts.COLUMN_VIEW &&
dayjs(date).add(1, "month").month() !==
dayjs(date).add(bookerLayout.columnViewExtraDays.current, "day").month()
) {
return 2;
}

return undefined;
}, [bookerLayout.columnViewExtraDays, bookerLayout.layout, date]);
/**
* Prioritize dateSchedule load
* Component will render but use data already fetched from here, and no duplicate requests will be made
Expand Down
3 changes: 1 addition & 2 deletions packages/features/calendars/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,7 @@ const Days = ({
<DayComponent
date={day}
onClick={() => {
const dayIsInNextMonth = day?.month() === browsingDate.add(1, "month").month();
props.onChange(day, dayIsInNextMonth);
props.onChange(day);
}}
disabled={disabled}
active={isActive(day)}
Expand Down

0 comments on commit d0ed58e

Please sign in to comment.