feat(scheduling,admin,today): week-range queries, file size limits, mobile nav UX
- Expand exceptional application query to Monday of start week - Add 20MB file size limit with visual feedback in ImageUpload - Reorder admin nav links, add burger badge, slide transition + backdrop - Fetch week-range working/available hours, add closing time indicator - Skip lunch protection for days <= 5h via shouldApplyLunchProtection - Extract formatDateISO to shared utils
This commit is contained in:
@@ -133,6 +133,15 @@ export function findLargestLunchGap(
|
||||
export const LUNCH_MINIMUM_USER = 60;
|
||||
export const LUNCH_MINIMUM_ADMIN = 30;
|
||||
export const LUNCH_WARNING_THRESHOLD = 60;
|
||||
export const LUNCH_MIN_DAY_DURATION = 5 * 60; // 300 minutes — skip lunch for days ≤ 5h
|
||||
|
||||
/**
|
||||
* Check lunch protection should apply at all for a day of this duration
|
||||
*/
|
||||
export function shouldApplyLunchProtection(dayStartTime: string, dayEndTime: string): boolean {
|
||||
const dayDuration = timeToMinutes(dayEndTime) - timeToMinutes(dayStartTime);
|
||||
return dayDuration > LUNCH_MIN_DAY_DURATION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a proposed booking slot violates lunch protection
|
||||
@@ -145,6 +154,9 @@ export function checkLunchProtection(
|
||||
proposedSlotEnd: string,
|
||||
isAdmin: boolean
|
||||
): LunchProtectionResult {
|
||||
if (!shouldApplyLunchProtection(dayStartTime, dayEndTime)) {
|
||||
return { isBlocked: false, showWarning: false };
|
||||
}
|
||||
const { windowStart, windowEnd } = calculateMiddleWindow(dayStartTime, dayEndTime);
|
||||
|
||||
const windowDuration = windowEnd - windowStart;
|
||||
@@ -288,6 +300,10 @@ export function getLunchProtectionForSlots(
|
||||
return results;
|
||||
}
|
||||
|
||||
if (!shouldApplyLunchProtection(dayStartTime, dayEndTime)) {
|
||||
return results;
|
||||
}
|
||||
|
||||
const dayStartMinutes = timeToMinutes(dayStartTime);
|
||||
const dayEndMinutes = timeToMinutes(dayEndTime);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user