33 lines
996 B
TypeScript
33 lines
996 B
TypeScript
/**
|
|
* Berth area color mapping based on the Port Nimara layout
|
|
*/
|
|
export const berthAreaColors: Record<string, string> = {
|
|
'A': '#E67E22', // Orange/Brown
|
|
'B': '#F1C40F', // Yellow
|
|
'C': '#27AE60', // Green
|
|
'D': '#3498DB', // Blue
|
|
'E': '#E91E63', // Pink
|
|
'F': '#9B59B6', // Purple (if exists)
|
|
'G': '#1ABC9C', // Teal (if exists)
|
|
};
|
|
|
|
/**
|
|
* Get the color for a berth area
|
|
* @param area - The area letter
|
|
* @returns The hex color code for the area
|
|
*/
|
|
export function getBerthAreaColor(area: string): string {
|
|
return berthAreaColors[area?.toUpperCase()] || '#757575'; // Grey fallback
|
|
}
|
|
|
|
/**
|
|
* Get the color from a mooring number (e.g., "A1" -> orange)
|
|
* @param mooringNumber - The full mooring number
|
|
* @returns The hex color code for the area
|
|
*/
|
|
export function getBerthColorFromMooringNumber(mooringNumber: string): string {
|
|
if (!mooringNumber) return '#757575'; // Grey fallback
|
|
const area = mooringNumber.charAt(0).toUpperCase();
|
|
return getBerthAreaColor(area);
|
|
}
|