refactor: remove location field from user and agent profile settings forms
This commit is contained in:
@@ -9,7 +9,6 @@ export default function ProfileSettingsPage() {
|
|||||||
career: string;
|
career: string;
|
||||||
email: string;
|
email: string;
|
||||||
phone: string;
|
phone: string;
|
||||||
location: string;
|
|
||||||
}) => {
|
}) => {
|
||||||
console.log('Saving agent profile settings:', data);
|
console.log('Saving agent profile settings:', data);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ export default function UserProfileSettingsPage() {
|
|||||||
career: string;
|
career: string;
|
||||||
email: string;
|
email: string;
|
||||||
phone: string;
|
phone: string;
|
||||||
location: string;
|
|
||||||
}) => {
|
}) => {
|
||||||
console.log('Saving user profile settings:', data);
|
console.log('Saving user profile settings:', data);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ interface ProfileSettingsFormProps {
|
|||||||
career: string;
|
career: string;
|
||||||
email: string;
|
email: string;
|
||||||
phone: string;
|
phone: string;
|
||||||
location: string;
|
|
||||||
avatar?: string;
|
avatar?: string;
|
||||||
};
|
};
|
||||||
onSave?: (data: {
|
onSave?: (data: {
|
||||||
@@ -23,7 +22,6 @@ interface ProfileSettingsFormProps {
|
|||||||
career: string;
|
career: string;
|
||||||
email: string;
|
email: string;
|
||||||
phone: string;
|
phone: string;
|
||||||
location: string;
|
|
||||||
}) => void;
|
}) => void;
|
||||||
descriptionText?: string;
|
descriptionText?: string;
|
||||||
}
|
}
|
||||||
@@ -42,7 +40,6 @@ export function ProfileSettingsForm({
|
|||||||
career: initialData?.career || '',
|
career: initialData?.career || '',
|
||||||
email: initialData?.email || '',
|
email: initialData?.email || '',
|
||||||
phone: initialData?.phone || '',
|
phone: initialData?.phone || '',
|
||||||
location: initialData?.location || '',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const [avatarUrl, setAvatarUrl] = useState<string | null>(null);
|
const [avatarUrl, setAvatarUrl] = useState<string | null>(null);
|
||||||
@@ -81,7 +78,6 @@ export function ProfileSettingsForm({
|
|||||||
career: profile.headline || profile.agentType?.name || 'Real Estate Agent',
|
career: profile.headline || profile.agentType?.name || 'Real Estate Agent',
|
||||||
email: profile.email || session?.user?.email || '',
|
email: profile.email || session?.user?.email || '',
|
||||||
phone: profile.phone || '',
|
phone: profile.phone || '',
|
||||||
location: [profile.state, profile.city, profile.country].filter(Boolean).join(', '),
|
|
||||||
};
|
};
|
||||||
setFormData(profileData);
|
setFormData(profileData);
|
||||||
setOriginalData(profileData); // Store original for cancel
|
setOriginalData(profileData); // Store original for cancel
|
||||||
@@ -102,7 +98,6 @@ export function ProfileSettingsForm({
|
|||||||
career: '', // Users don't have career/agent type
|
career: '', // Users don't have career/agent type
|
||||||
email: profile.email || session?.user?.email || '',
|
email: profile.email || session?.user?.email || '',
|
||||||
phone: profile.phone || '',
|
phone: profile.phone || '',
|
||||||
location: [profile.state, profile.city, profile.country].filter(Boolean).join(', '),
|
|
||||||
};
|
};
|
||||||
setFormData(profileData);
|
setFormData(profileData);
|
||||||
setOriginalData(profileData); // Store original for cancel
|
setOriginalData(profileData); // Store original for cancel
|
||||||
@@ -287,27 +282,18 @@ export function ProfileSettingsForm({
|
|||||||
const role = (session?.user as any)?.role;
|
const role = (session?.user as any)?.role;
|
||||||
|
|
||||||
// Update profile based on role (email is not editable - tied to auth)
|
// Update profile based on role (email is not editable - tied to auth)
|
||||||
// Parse location into state, city, country (display order is state first)
|
|
||||||
const locationParts = formData.location.split(',').map(s => s.trim());
|
|
||||||
|
|
||||||
if (role === 'AGENT') {
|
if (role === 'AGENT') {
|
||||||
await agentsService.updateProfile({
|
await agentsService.updateProfile({
|
||||||
firstName: formData.firstName,
|
firstName: formData.firstName,
|
||||||
lastName: formData.lastName,
|
lastName: formData.lastName,
|
||||||
phone: formData.phone,
|
phone: formData.phone,
|
||||||
headline: formData.career,
|
headline: formData.career,
|
||||||
state: locationParts[0] || '',
|
|
||||||
city: locationParts[1] || '',
|
|
||||||
country: locationParts[2] || '',
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
await usersService.updateProfile({
|
await usersService.updateProfile({
|
||||||
firstName: formData.firstName,
|
firstName: formData.firstName,
|
||||||
lastName: formData.lastName,
|
lastName: formData.lastName,
|
||||||
phone: formData.phone,
|
phone: formData.phone,
|
||||||
state: locationParts[0] || undefined,
|
|
||||||
city: locationParts[1] || undefined,
|
|
||||||
country: locationParts[2] || undefined,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -496,28 +482,6 @@ export function ProfileSettingsForm({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Row 3: Location */}
|
|
||||||
<div>
|
|
||||||
<label className="block text-[12px] font-bold text-[#00293D] font-serif mb-2">
|
|
||||||
Location
|
|
||||||
</label>
|
|
||||||
<div className="relative">
|
|
||||||
<div className="absolute left-4 top-1/2 -translate-y-1/2">
|
|
||||||
<Image
|
|
||||||
src="/assets/icons/location-icon.svg"
|
|
||||||
alt="Location"
|
|
||||||
width={16}
|
|
||||||
height={16}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
value={formData.location}
|
|
||||||
onChange={(e) => handleChange('location', e.target.value)}
|
|
||||||
className="w-full sm:w-1/2 h-[44px] pl-10 pr-4 border border-[#00293D]/20 rounded-[10px] text-[14px] font-serif text-[#00293D] focus:outline-none focus:border-[#E58625]"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Action Buttons */}
|
{/* Action Buttons */}
|
||||||
|
|||||||
Reference in New Issue
Block a user