import type { EmploymentStatus, NoteCategory } from "./types"; // Die Initialen stehen in Weiss darauf, jeder Ton braucht also 4.5:1 gegen // Weiss — nachgerechnet liegt der schwaechste bei 6.11:1. Die Reihe beginnt // bei den beiden Markenfarben (Blau direkt, Rosa in der dunklen Stufe, weil // #F69686 selbst nur 2.18:1 traegt) und faechert von dort auf, damit zwei // Personen nebeneinander nicht denselben Kreis bekommen. const AVATAR_PALETTE = [ "#164194", // Manner Blau "#0d2857", "#a8402e", // dunkles Manner Rosa "#5c2e91", "#0e700e", "#835b00", "#00666d", "#8a2740", ]; // 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", // Rosa statt Blau: „Geplant" ist kein Hinweis und keine Warnung, sondern // der Normalfall ohne besondere Faerbung — und dafuer ist die Markenfarbe // die richtige. Blau wuerde hier nach Bedienelement aussehen. Geplant: "bg-accent-200 text-brand-700", Ausgetreten: "bg-danger-bg text-danger-text", }; type ColorCategory = "success" | "danger" | "warning" | "info" | "purple" | "brand"; export 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", // Der Chip ohne eigene Bedeutung. Auf accent-200 statt accent-100, weil // die hellere Stufe dem Fehler-Chip zu nahe kommt (dE 5.6 gegen 13.7). brand: "bg-accent-200 text-brand-700", }; // Audit-log / activity-feed action -> badge color, per the action list in // dem Kommentar an audit_log in der ersten Migration. 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"]; } export const NOTE_CATEGORY_STYLES: Record = { Vertraulich: CATEGORY_STYLES.purple, "Personalgespräch": CATEGORY_STYLES.info, Wiedervorlage: CATEGORY_STYLES.warning, "Lob / Anerkennung": CATEGORY_STYLES.success, Allgemein: "bg-surface text-ink-muted", };