fix
This commit is contained in:
@@ -120,8 +120,12 @@ function ProfileCard({ profile, resolvedAvatarUrl }: ProfileCardProps) {
|
||||
let cityValue: string | null = null;
|
||||
let stateValue: string | null = null;
|
||||
|
||||
// Helper to format snake_case to Title Case
|
||||
const formatValue = (v: string) => v.split('_').map(w => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(' ');
|
||||
// Helper to format snake_case to Title Case, with uppercase for 2-letter state codes
|
||||
const formatValue = (v: string) => {
|
||||
const trimmed = v.trim();
|
||||
if (/^[a-z]{2}$/i.test(trimmed)) return trimmed.toUpperCase();
|
||||
return trimmed.split('_').map(w => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(' ');
|
||||
};
|
||||
|
||||
// First, check fieldValues for state and city (dynamic profile fields)
|
||||
if (profile.fieldValues && profile.fieldValues.length > 0) {
|
||||
@@ -131,7 +135,6 @@ function ProfileCard({ profile, resolvedAvatarUrl }: ProfileCardProps) {
|
||||
if (stateField && stateField.jsonValue) {
|
||||
const value = stateField.jsonValue;
|
||||
if (Array.isArray(value) && value.length > 0) {
|
||||
// For multiselect, join all selected values
|
||||
stateValue = value.map(v => formatValue(String(v))).join(', ');
|
||||
} else if (typeof value === 'string' && value.trim()) {
|
||||
stateValue = formatValue(value);
|
||||
|
||||
Reference in New Issue
Block a user