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:
@@ -1,5 +1,42 @@
|
||||
import type { WeekdayAvailability } from "../types/resource.js";
|
||||
|
||||
export * from "./germanStates.js";
|
||||
export * from "./publicHolidays.js";
|
||||
|
||||
export const MILLISECONDS_PER_DAY = 86_400_000;
|
||||
|
||||
export function toIsoDate(value: Date | string): string {
|
||||
if (typeof value === "string") return value.slice(0, 10);
|
||||
return value.toISOString().slice(0, 10);
|
||||
}
|
||||
|
||||
export function toIsoDateOrNull(value: Date | string | null | undefined): string | null {
|
||||
if (!value) return null;
|
||||
return toIsoDate(value);
|
||||
}
|
||||
|
||||
export function round1(value: number): number {
|
||||
return Math.round(value * 10) / 10;
|
||||
}
|
||||
|
||||
export function averagePerWorkingDay(totalHours: number, workingDays: number): number {
|
||||
if (workingDays <= 0) return 0;
|
||||
return round1(totalHours / workingDays);
|
||||
}
|
||||
|
||||
export const DAY_KEYS: readonly (keyof WeekdayAvailability)[] = [
|
||||
"sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday",
|
||||
] as const;
|
||||
|
||||
export function normalizeCityName(cityName?: string | null): string | null {
|
||||
const normalized = cityName?.trim().toLowerCase();
|
||||
return normalized && normalized.length > 0 ? normalized : null;
|
||||
}
|
||||
|
||||
export function normalizeStateCode(stateCode?: string | null): string | null {
|
||||
const normalized = stateCode?.trim().toUpperCase();
|
||||
return normalized && normalized.length > 0 ? normalized : null;
|
||||
}
|
||||
export * from "./columns.js";
|
||||
export * from "./dispo-import.js";
|
||||
export * from "./data-classification.js";
|
||||
|
||||
@@ -19,3 +19,4 @@ export * from "./client.js";
|
||||
export * from "./management-level.js";
|
||||
export * from "./dispo-import.js";
|
||||
export * from "./calculation-rules.js";
|
||||
export * from "./tool-manifest.js";
|
||||
|
||||
@@ -51,6 +51,10 @@ export const ROLE_DEFAULT_PERMISSIONS: Record<SystemRole, PermissionKey[]> = {
|
||||
VIEWER: [],
|
||||
};
|
||||
|
||||
export function isAdminOrManager(role: string | null | undefined): boolean {
|
||||
return role === SystemRole.ADMIN || role === SystemRole.MANAGER;
|
||||
}
|
||||
|
||||
export function resolvePermissions(
|
||||
systemRole: SystemRole,
|
||||
overrides?: PermissionOverrides | null,
|
||||
|
||||
Reference in New Issue
Block a user