refactor: remove redundant agent profile section and consolidate agent details into the dynamic profile view
This commit is contained in:
@@ -499,95 +499,27 @@ export default function UserDetailPage() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Agent Details (only for AGENT role) */}
|
|
||||||
{user.role === 'AGENT' && user.agentProfile && (
|
|
||||||
<div className="bg-white rounded-xl shadow-sm border border-[#e5e7eb] mb-6">
|
|
||||||
<div className="px-6 py-4 border-b border-[#e5e7eb]">
|
|
||||||
<h2 className="text-lg font-semibold text-[#00293d] font-fractul">Agent Details</h2>
|
|
||||||
</div>
|
|
||||||
<div className="p-6">
|
|
||||||
{/* Agent Details Grid */}
|
|
||||||
<div className="grid grid-cols-2 md:grid-cols-4 gap-6">
|
|
||||||
{/* Agent Type - Read Only */}
|
|
||||||
<div>
|
|
||||||
<p className="text-sm text-[#666666]">Agent Type</p>
|
|
||||||
<p className="text-sm font-medium text-[#00293d]">
|
|
||||||
{user.agentProfile.agentType?.name || 'Not assigned'}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p className="text-sm text-[#666666]">Slug</p>
|
|
||||||
<p className="text-sm font-medium text-[#00293d]">
|
|
||||||
{user.agentProfile.slug || 'Not set'}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p className="text-sm text-[#666666]">Company</p>
|
|
||||||
<p className="text-sm font-medium text-[#00293d]">
|
|
||||||
{user.agentProfile.companyName || 'Not provided'}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p className="text-sm text-[#666666]">License Number</p>
|
|
||||||
<p className="text-sm font-medium text-[#00293d]">
|
|
||||||
{user.agentProfile.licenseNumber || 'Not provided'}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p className="text-sm text-[#666666]">Years of Experience</p>
|
|
||||||
<p className="text-sm font-medium text-[#00293d]">
|
|
||||||
{user.agentProfile.yearsOfExperience ?? 'Not provided'}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p className="text-sm text-[#666666]">Profile Status</p>
|
|
||||||
<p className="text-sm font-medium text-[#00293d]">
|
|
||||||
{user.agentProfile.profileCompleteness}%{' '}
|
|
||||||
<span
|
|
||||||
className={`ml-1 inline-flex px-2 py-0.5 text-xs font-semibold rounded-full ${
|
|
||||||
user.agentProfile.isProfileComplete
|
|
||||||
? 'bg-green-100 text-green-800'
|
|
||||||
: 'bg-yellow-100 text-yellow-800'
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
{user.agentProfile.isProfileComplete ? 'Complete' : 'Incomplete'}
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Headline & Bio */}
|
|
||||||
{(user.agentProfile.headline || user.agentProfile.bio) && (
|
|
||||||
<div className="mt-6 pt-6 border-t border-[#e5e7eb]">
|
|
||||||
{user.agentProfile.headline && (
|
|
||||||
<div className="mb-4">
|
|
||||||
<p className="text-sm text-[#666666] mb-1">Headline</p>
|
|
||||||
<p className="text-sm font-medium text-[#00293d]">
|
|
||||||
{user.agentProfile.headline}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{user.agentProfile.bio && (
|
|
||||||
<div>
|
|
||||||
<p className="text-sm text-[#666666] mb-1">Bio</p>
|
|
||||||
<p className="text-sm text-[#666666] whitespace-pre-wrap">
|
|
||||||
{user.agentProfile.bio}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Dynamic Profile Data (only for AGENT role) */}
|
{/* Dynamic Profile Data (only for AGENT role) */}
|
||||||
{user.role === 'AGENT' && agentFieldValues.length > 0 && (
|
{user.role === 'AGENT' && (
|
||||||
<div className="bg-white rounded-xl shadow-sm border border-[#e5e7eb] mb-6">
|
<div className="bg-white rounded-xl shadow-sm border border-[#e5e7eb] mb-6">
|
||||||
<div className="px-6 py-4 border-b border-[#e5e7eb]">
|
<div className="px-6 py-4 border-b border-[#e5e7eb]">
|
||||||
<h2 className="text-lg font-semibold text-[#00293d] font-fractul">Profile Details</h2>
|
<h2 className="text-lg font-semibold text-[#00293d] font-fractul">Profile Details</h2>
|
||||||
</div>
|
</div>
|
||||||
<div className="p-6 space-y-5">
|
<div className="p-6 space-y-5">
|
||||||
|
{/* Agent Type */}
|
||||||
|
{user.agentProfile && (
|
||||||
|
<div>
|
||||||
|
<h3 className="text-xs font-semibold text-[#00293d] uppercase tracking-wide mb-3 pb-2 border-b border-[#e5e7eb]">Agent Type</h3>
|
||||||
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||||
|
<div>
|
||||||
|
<p className="text-xs text-[#666666] mb-0.5">Type</p>
|
||||||
|
<p className="text-sm font-medium text-[#00293d]">
|
||||||
|
{user.agentProfile.agentType?.name || 'Not assigned'}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{Object.entries(
|
{Object.entries(
|
||||||
agentFieldValues
|
agentFieldValues
|
||||||
.filter((fv) => fv.sectionSlug !== 'upload-documents')
|
.filter((fv) => fv.sectionSlug !== 'upload-documents')
|
||||||
|
|||||||
Reference in New Issue
Block a user