feat: Enable agents to set a custom headline and manage location via distinct city, state, and country fields, and enhance contract count display logic.
This commit is contained in:
@@ -38,18 +38,30 @@ function mapYearsValueToLabel(value: string | undefined): string {
|
||||
}
|
||||
|
||||
// Helper to format contracts count
|
||||
// Backend stores this as a RADIO field with range labels: "<3", "3-10", "10-20", "20-50", "50+"
|
||||
function formatContractsCount(value: unknown): string {
|
||||
if (!value) return '-';
|
||||
|
||||
const num = typeof value === 'number' ? value : parseInt(String(value), 10);
|
||||
if (isNaN(num)) return '-';
|
||||
const str = String(value).trim();
|
||||
if (!str) return '-';
|
||||
|
||||
if (num >= 100) return '100+ Contracts';
|
||||
if (num >= 50) return '50+ Contracts';
|
||||
if (num >= 20) return '20+ Contracts';
|
||||
if (num >= 10) return '10+ Contracts';
|
||||
if (num >= 5) return '5+ Contracts';
|
||||
return `${num} Contract${num !== 1 ? 's' : ''}`;
|
||||
// Map known range labels to display strings
|
||||
const rangeMapping: Record<string, string> = {
|
||||
'<3': 'Less than 3 Contracts',
|
||||
'3-10': '3-10 Contracts',
|
||||
'10-20': '10-20 Contracts',
|
||||
'20-50': '20-50 Contracts',
|
||||
'50+': '50+ Contracts',
|
||||
};
|
||||
|
||||
if (rangeMapping[str]) return rangeMapping[str];
|
||||
|
||||
// Fallback: if it's a plain number, format it
|
||||
const num = parseInt(str, 10);
|
||||
if (!isNaN(num)) return `${num} Contract${num !== 1 ? 's' : ''}`;
|
||||
|
||||
// Fallback: return the raw value as-is (e.g. "Less than 3")
|
||||
return str;
|
||||
}
|
||||
|
||||
// Parse expertise areas with years (format: "Area Name - X yrs" or just "Area Name")
|
||||
|
||||
Reference in New Issue
Block a user