feat(timeline): add pulse animation for in-flight drag mutations
Allocation bars that have active optimistic overrides (post-drag, awaiting server confirmation) now pulse subtly via animate-pulse. The pending set is derived from the existing optimisticAllocations map keys, requiring no additional state. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,7 @@ export function buildVacationBlocksByResource(
|
||||
toWidth: (start: Date, end: Date) => number,
|
||||
cellWidth: number,
|
||||
totalCanvasWidth: number,
|
||||
showWeekends = true,
|
||||
) {
|
||||
if (!showVacations) return new Map<string, VacationBlockInfo[]>();
|
||||
|
||||
@@ -38,6 +39,13 @@ export function buildVacationBlocksByResource(
|
||||
for (const vacation of vacations) {
|
||||
const start = new Date(vacation.startDate);
|
||||
const end = new Date(vacation.endDate);
|
||||
// When weekends are hidden, skip single-day entries that fall on a weekend
|
||||
// (e.g. Easter Sunday). They would otherwise render at Monday's column,
|
||||
// shadowing Monday's own holiday (e.g. Easter Monday).
|
||||
if (!showWeekends && start.toDateString() === end.toDateString()) {
|
||||
const dow = start.getDay();
|
||||
if (dow === 0 || dow === 6) continue;
|
||||
}
|
||||
const left = toLeft(start);
|
||||
const width = Math.max(cellWidth, toWidth(start, end));
|
||||
if (width <= 0 || left >= totalCanvasWidth) continue;
|
||||
@@ -126,18 +134,23 @@ export function renderOverbookingBlink(
|
||||
) {
|
||||
const overbooked: number[] = [];
|
||||
|
||||
const allocRanges = allocs.map((a) => {
|
||||
const s = new Date(a.startDate);
|
||||
s.setHours(0, 0, 0, 0);
|
||||
const e = new Date(a.endDate);
|
||||
e.setHours(0, 0, 0, 0);
|
||||
return { s: s.getTime(), e: e.getTime(), h: a.hoursPerDay };
|
||||
});
|
||||
|
||||
for (let i = 0; i < dates.length; i++) {
|
||||
const d = new Date(dates[i]!);
|
||||
d.setHours(0, 0, 0, 0);
|
||||
const t = d.getTime();
|
||||
let totalH = 0;
|
||||
for (const a of allocs) {
|
||||
const s = new Date(a.startDate);
|
||||
s.setHours(0, 0, 0, 0);
|
||||
const e = new Date(a.endDate);
|
||||
e.setHours(0, 0, 0, 0);
|
||||
if (t >= s.getTime() && t <= e.getTime()) {
|
||||
totalH += a.hoursPerDay * (bookingFactorsByDay?.[i] ?? 1);
|
||||
const factor = bookingFactorsByDay?.[i] ?? 1;
|
||||
for (const { s, e, h } of allocRanges) {
|
||||
if (t >= s && t <= e) {
|
||||
totalH += h * factor;
|
||||
}
|
||||
}
|
||||
if (totalH > (capacityHoursByDay?.[i] ?? 8)) overbooked.push(i);
|
||||
|
||||
Reference in New Issue
Block a user