feat: project colors, timeline filters, sidebar fix, GitLooper agent, and misc improvements
- Fix sidebar double-highlight on /vacations/my (Gitea #6): add isNavItemActive() helper - Add project color picker (schema + API + modal + timeline rendering) - Add ProjectCombobox/ResourceCombobox to timeline toolbar - Show PENDING vacations on timeline with dashed/dimmed style - Add "show demand projects" preference with localStorage persistence - Add ProjectAssignmentsTable with total hours/cost columns - Extend vacation API to accept status arrays - Add GitLooper formal YAML agent configuration - Extend user admin with permission overrides UI - Add delete-assignment use case tests - Add status-styles.ts shared badge constants - Centralize formatMoney/formatCents in format.ts Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
@@ -30,11 +30,24 @@ export function formatDateLong(d: Date | string): string {
|
||||
|
||||
/**
|
||||
* Format integer cents as a currency string (e.g. "1.234 €").
|
||||
* Defaults to EUR with no decimal places.
|
||||
* Defaults to EUR with no decimal places. Pass `fractionDigits: 2` for precise display.
|
||||
*/
|
||||
export function formatMoney(cents: number | null | undefined, currency = "EUR"): string {
|
||||
export function formatMoney(cents: number | null | undefined, currency = "EUR", fractionDigits = 0): string {
|
||||
const value = (cents ?? 0) / 100;
|
||||
return new Intl.NumberFormat("de-DE", { style: "currency", currency, maximumFractionDigits: 0 }).format(value);
|
||||
return new Intl.NumberFormat("de-DE", {
|
||||
style: "currency",
|
||||
currency,
|
||||
minimumFractionDigits: fractionDigits,
|
||||
maximumFractionDigits: fractionDigits,
|
||||
}).format(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a date as "16 Mar 2026" for compact display with year.
|
||||
*/
|
||||
export function formatDateMedium(d: Date | string | null | undefined): string {
|
||||
if (!d) return "";
|
||||
return new Date(d).toLocaleDateString("en-GB", { year: "numeric", month: "short", day: "numeric" });
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,13 @@ export const VACATION_TYPE_LABELS: Record<string, string> = {
|
||||
OTHER: "Other",
|
||||
};
|
||||
|
||||
export const VACATION_TYPE_BADGE: Record<string, string> = {
|
||||
ANNUAL: "bg-brand-100 text-brand-700 dark:bg-brand-900/30 dark:text-brand-400",
|
||||
SICK: "bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",
|
||||
PUBLIC_HOLIDAY: "bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400",
|
||||
OTHER: "bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-400",
|
||||
};
|
||||
|
||||
export const PROJECT_STATUS_BADGE: Record<string, string> = {
|
||||
DRAFT: "bg-gray-100 text-gray-700",
|
||||
ACTIVE: "bg-green-100 text-green-700",
|
||||
@@ -32,3 +39,10 @@ export const PROJECT_STATUS_BADGE: Record<string, string> = {
|
||||
COMPLETED: "bg-blue-100 text-blue-700",
|
||||
CANCELLED: "bg-red-100 text-red-700",
|
||||
};
|
||||
|
||||
export const ORDER_TYPE_BADGE: Record<string, string> = {
|
||||
BD: "bg-purple-100 text-purple-700",
|
||||
CHARGEABLE: "bg-green-100 text-green-700",
|
||||
INTERNAL: "bg-blue-100 text-blue-700",
|
||||
OVERHEAD: "bg-gray-100 text-gray-700",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user