import type { EmploymentStatus } from "./supabase/types"; const AVATAR_PALETTE = [ "#d6046e", "#00666d", "#5c2e91", "#835b00", "#0e700e", "#b0035a", "#2b6cb0", "#a30354", ]; // Stable per-employee avatar color when employees.avatar_color isn't set. export function avatarColorFor(seed: string): string { let hash = 0; for (let i = 0; i < seed.length; i++) { hash = (hash << 5) - hash + seed.charCodeAt(i); hash |= 0; } return AVATAR_PALETTE[Math.abs(hash) % AVATAR_PALETTE.length]; } export const STATUS_STYLES: Record = { Aktiv: "bg-success-bg text-success-text", Karenz: "bg-warning-bg text-warning-text", Geplant: "bg-brand-100 text-brand-700", Ausgetreten: "bg-danger-bg text-danger-text", }; type ColorCategory = "success" | "danger" | "warning" | "info" | "purple" | "brand"; const CATEGORY_STYLES: Record = { success: "bg-success-bg text-success-text", danger: "bg-danger-bg text-danger-text", warning: "bg-warning-bg text-warning-text", info: "bg-info-bg text-info-text", purple: "bg-purple-bg text-purple-text", brand: "bg-brand-100 text-brand-700", }; // Audit-log / activity-feed action -> badge color, per the action list in // supabase/schema.sql's audit_log comment. const ACTION_CATEGORY: Record = { Neueinstellung: "success", Wiedereinstellung: "success", Rückkehr: "success", Austritt: "danger", Versetzung: "info", Ausschreibung: "info", "Interne Besetzung": "info", Beförderung: "purple", Reorganisation: "purple", "Reorganisation rückgängig": "purple", Karenz: "warning", Vertragsänderung: "warning", Stammdatenänderung: "warning", Gehaltsanpassung: "warning", }; export function actionBadgeStyle(action: string): string { return CATEGORY_STYLES[ACTION_CATEGORY[action] ?? "brand"]; }