arbret/frontend/app/utils/appointment.ts
counterweight 37de6f70e0
Add Prettier for TypeScript formatting
- Install prettier
- Configure .prettierrc.json and .prettierignore
- Add npm scripts: format, format:check
- Add Makefile target: format-frontend
- Format all frontend files
2025-12-21 21:59:26 +01:00

36 lines
1 KiB
TypeScript

/**
* Appointment-related utilities.
*/
export interface StatusDisplay {
text: string;
bgColor: string;
textColor: string;
}
/**
* Get display information for an appointment status.
*
* @param status - The appointment status string
* @param isOwnView - If true, uses "Cancelled by you" instead of "Cancelled by user"
*/
export function getStatusDisplay(status: string, isOwnView: boolean = false): StatusDisplay {
switch (status) {
case "booked":
return { text: "Booked", bgColor: "rgba(34, 197, 94, 0.2)", textColor: "#4ade80" };
case "cancelled_by_user":
return {
text: isOwnView ? "Cancelled by you" : "Cancelled by user",
bgColor: "rgba(239, 68, 68, 0.2)",
textColor: "#f87171",
};
case "cancelled_by_admin":
return {
text: "Cancelled by admin",
bgColor: "rgba(239, 68, 68, 0.2)",
textColor: "#f87171",
};
default:
return { text: status, bgColor: "rgba(255,255,255,0.1)", textColor: "rgba(255,255,255,0.6)" };
}
}