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;
|
||||
email: string;
|
||||
phone: string;
|
||||
location: string;
|
||||
}) => {
|
||||
console.log('Saving agent profile settings:', data);
|
||||
};
|
||||
|
||||
@@ -9,7 +9,6 @@ export default function UserProfileSettingsPage() {
|
||||
career: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
location: string;
|
||||
}) => {
|
||||
console.log('Saving user profile settings:', data);
|
||||
};
|
||||
|
||||
@@ -14,7 +14,6 @@ interface ProfileSettingsFormProps {
|
||||
career: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
location: string;
|
||||
avatar?: string;
|
||||
};
|
||||
onSave?: (data: {
|
||||
@@ -23,7 +22,6 @@ interface ProfileSettingsFormProps {
|
||||
career: string;
|
||||
email: string;
|
||||
phone: string;
|
||||
location: string;
|
||||
}) => void;
|
||||
descriptionText?: string;
|
||||
}
|
||||
@@ -42,7 +40,6 @@ export function ProfileSettingsForm({
|
||||
career: initialData?.career || '',
|
||||
email: initialData?.email || '',
|
||||
phone: initialData?.phone || '',
|
||||
location: initialData?.location || '',
|
||||
});
|
||||
|
||||
const [avatarUrl, setAvatarUrl] = useState<string | null>(null);
|
||||
@@ -81,7 +78,6 @@ export function ProfileSettingsForm({
|
||||
career: profile.headline || profile.agentType?.name || 'Real Estate Agent',
|
||||
email: profile.email || session?.user?.email || '',
|
||||
phone: profile.phone || '',
|
||||
location: [profile.state, profile.city, profile.country].filter(Boolean).join(', '),
|
||||
};
|
||||
setFormData(profileData);
|
||||
setOriginalData(profileData); // Store original for cancel
|
||||
@@ -102,7 +98,6 @@ export function ProfileSettingsForm({
|
||||
career: '', // Users don't have career/agent type
|
||||
email: profile.email || session?.user?.email || '',
|
||||
phone: profile.phone || '',
|
||||
location: [profile.state, profile.city, profile.country].filter(Boolean).join(', '),
|
||||
};
|
||||
setFormData(profileData);
|
||||
setOriginalData(profileData); // Store original for cancel
|
||||
@@ -287,27 +282,18 @@ export function ProfileSettingsForm({
|
||||
const role = (session?.user as any)?.role;
|
||||
|
||||
// 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') {
|
||||
await agentsService.updateProfile({
|
||||
firstName: formData.firstName,
|
||||
lastName: formData.lastName,
|
||||
phone: formData.phone,
|
||||
headline: formData.career,
|
||||
state: locationParts[0] || '',
|
||||
city: locationParts[1] || '',
|
||||
country: locationParts[2] || '',
|
||||
});
|
||||
} else {
|
||||
await usersService.updateProfile({
|
||||
firstName: formData.firstName,
|
||||
lastName: formData.lastName,
|
||||
phone: formData.phone,
|
||||
state: locationParts[0] || undefined,
|
||||
city: locationParts[1] || undefined,
|
||||
country: locationParts[2] || undefined,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -496,28 +482,6 @@ export function ProfileSettingsForm({
|
||||
</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>
|
||||
|
||||
{/* Action Buttons */}
|
||||
|
||||
Reference in New Issue
Block a user