lynkedDispatch and territory map pages use same same status taxonomy also legend visible in lynked Dispatch now

This commit is contained in:
Mayur Shinde
2026-06-18 18:26:09 +05:30
parent d254fa0cec
commit 1dff3943a0
5 changed files with 214 additions and 67 deletions
+61
View File
@@ -0,0 +1,61 @@
// ─────────────────────────────────────────────────────────────────────────────
// Single source of truth for map status taxonomies & color tokens.
//
// The Territory Map (property canvassing lifecycle) and LynkDispatch (live
// dispatch ops) track different entities, so they keep separate taxonomies —
// but BOTH read their colors from the shared hue tokens below, so the palette
// never drifts or contradicts itself across the app.
//
// One hue = one meaning:
// red → urgent / hot amber → needs attention / busy
// emerald→ positive / converted blue → in progress / active
// violet → undecided / neutral slate → inactive / declined
// gray → low priority / idle
// ─────────────────────────────────────────────────────────────────────────────
export const STATUS_HUES = {
red: '#ef4444',
amber: '#f59e0b',
emerald: '#10b981',
blue: '#3b82f6',
violet: '#a78bfa',
slate: '#cbd5e1',
gray: '#6b7280',
};
// ── Territory Map — property canvassing lifecycle ───────────────────────────
// `color` — marker/polygon stroke & fill (hex)
// `fillOpacity` — polygon fill alpha
// `badge` — Tailwind classes for the status pill
// `dot` — Tailwind bg class for the legend swatch
export const CANVASSING_STATUS = {
'Hot Lead': { color: STATUS_HUES.red, fillOpacity: 0.40, badge: 'bg-red-500 text-white', dot: 'bg-red-500' },
'Customer': { color: STATUS_HUES.emerald, fillOpacity: 0.30, badge: 'bg-emerald-500 text-white', dot: 'bg-emerald-500' },
'Renovated': { color: STATUS_HUES.blue, fillOpacity: 0.20, badge: 'bg-blue-500 text-white', dot: 'bg-blue-500' },
'Neutral': { color: STATUS_HUES.violet, fillOpacity: 0.20, badge: 'bg-violet-400 text-white', dot: 'bg-violet-400' },
'Not Interested': { color: STATUS_HUES.slate, fillOpacity: 0.35, badge: 'bg-slate-300 text-slate-900', dot: 'bg-slate-300' },
};
// Render/legend order for the canvassing statuses.
export const CANVASSING_STATUS_ORDER = ['Hot Lead', 'Customer', 'Renovated', 'Neutral', 'Not Interested'];
// Fallback used when a property has no (or an unknown) canvassing status.
export const CANVASSING_STATUS_DEFAULT = CANVASSING_STATUS.Neutral;
// ── LynkDispatch — live dispatch operations ─────────────────────────────────
export const REP_STATUS = {
available: { color: STATUS_HUES.emerald, label: 'Available' },
en_route: { color: STATUS_HUES.blue, label: 'En Route' },
busy: { color: STATUS_HUES.amber, label: 'Busy' },
};
export const LEAD_URGENCY = {
emergency: { color: STATUS_HUES.red, label: 'Emergency' },
high: { color: STATUS_HUES.amber, label: 'High' },
standard: { color: STATUS_HUES.gray, label: 'Standard' },
};
// Flat id→value maps for existing call sites that index by status/urgency key.
export const REP_STATUS_COLORS = Object.fromEntries(Object.entries(REP_STATUS).map(([k, v]) => [k, v.color]));
export const REP_STATUS_LABELS = Object.fromEntries(Object.entries(REP_STATUS).map(([k, v]) => [k, v.label]));
export const URGENCY_COLORS = Object.fromEntries(Object.entries(LEAD_URGENCY).map(([k, v]) => [k, v.color]));