Files
cal.diy/packages/features/schedules/lib/use-schedule/useNonEmptyScheduleDays.ts
T
Dhairyashil Shinde 6e2e826001 fix(ooo): make show note publicly consistent across all booking views (#25827)
- Update weekly view to display OOO when showNotePublicly is true
- Update column view to include days with public notes in schedule
- Add notes and showNotePublicly props to weekly view calendar
- Disable show note publicly checkbox when notes field is empty
2025-12-15 10:24:10 +01:00

24 lines
616 B
TypeScript

import { useMemo } from "react";
import type { Slots } from "../use-schedule/types";
export const getNonEmptyScheduleDays = (slots?: Slots) => {
if (typeof slots === "undefined") return [];
const nonEmptyDays: string[] = [];
Object.keys(slots).forEach((date) => {
if (slots[date].some((slot) => !(slot?.away && !slot.toUser && !slot.showNotePublicly) && slots[date].length > 0)) {
nonEmptyDays.push(date);
}
});
return nonEmptyDays;
};
export const useNonEmptyScheduleDays = (slots?: Slots) => {
const days = useMemo(() => getNonEmptyScheduleDays(slots), [slots]);
return days;
};