feat: disable agent-to-agent connections and update navigation for agent role

This commit is contained in:
pradeepkumar
2026-04-29 14:49:38 +05:30
parent 8f2a131336
commit 8f75a2528e
3 changed files with 25 additions and 3 deletions

View File

@@ -53,8 +53,10 @@ export function CommonHeader() {
// Use fetched profile image, fallback to session image // Use fetched profile image, fallback to session image
const userImage = profileImage || session?.user?.image; const userImage = profileImage || session?.user?.image;
// Determine dashboard link based on user role // Logo destination based on role:
const dashboardLink = userRole === 'AGENT' ? '/agent/dashboard' : '/user/dashboard'; // - AGENT logged in → Agent Listing Page (/user/profiles) so they can browse the directory
// - everyone else → /user/dashboard
const dashboardLink = userRole === 'AGENT' ? '/user/profiles' : '/user/dashboard';
return ( return (
<header className="bg-[#648188] rounded-[20px] px-4 md:px-8 relative" ref={mobileMenuRef}> <header className="bg-[#648188] rounded-[20px] px-4 md:px-8 relative" ref={mobileMenuRef}>
@@ -223,6 +225,17 @@ export function CommonHeader() {
<p className="font-fractul text-[16px] leading-[18px] text-black">Notification Settings</p> <p className="font-fractul text-[16px] leading-[18px] text-black">Notification Settings</p>
</Link> </Link>
{userRole === 'AGENT' && (
<Link
href="/agent/dashboard"
className="flex items-center gap-3 px-4 py-3 border-b border-black/10 hover:bg-black/5 transition-colors"
onClick={() => setShowProfileMenu(false)}
>
<Image src="/assets/icons/edit-icon.svg" alt="Edit Page" width={24} height={24} />
<p className="font-fractul text-[16px] leading-[18px] text-black">Edit Page</p>
</Link>
)}
<button <button
onClick={() => { onClick={() => {
setShowProfileMenu(false); setShowProfileMenu(false);

View File

@@ -51,6 +51,9 @@ export function ProfileCard({
const pathname = usePathname(); const pathname = usePathname();
const [isUnlinking, setIsUnlinking] = useState(false); const [isUnlinking, setIsUnlinking] = useState(false);
const [showLocationModal, setShowLocationModal] = useState(false); const [showLocationModal, setShowLocationModal] = useState(false);
// Hide the Connect/Pending/Unlink button entirely when the viewer is an AGENT —
// the platform does not support agent-to-agent connections.
const viewerIsAgent = (session?.user as { role?: string } | undefined)?.role === 'AGENT';
// Split location into parts and limit display // Split location into parts and limit display
const locationParts = location.split(',').map(s => s.trim()).filter(Boolean); const locationParts = location.split(',').map(s => s.trim()).filter(Boolean);
@@ -209,7 +212,7 @@ export function ProfileCard({
</span> </span>
)} )}
</Link> </Link>
) : ( ) : viewerIsAgent ? null : (
// Public view - show Connect/Pending/Unlink button based on connection status // Public view - show Connect/Pending/Unlink button based on connection status
connectionStatus === 'PENDING' ? ( connectionStatus === 'PENDING' ? (
<button <button

View File

@@ -54,8 +54,14 @@ export function StatusButtons({
} }
}; };
// Hide the connection button entirely when the viewer is an AGENT —
// the platform does not support agent-to-agent connections.
const viewerIsAgent = (session?.user as { role?: string } | undefined)?.role === 'AGENT';
// Render the appropriate button based on connection status // Render the appropriate button based on connection status
const renderConnectionButton = () => { const renderConnectionButton = () => {
if (viewerIsAgent) return null;
// If PENDING - show yellow Pending button (disabled) // If PENDING - show yellow Pending button (disabled)
if (connectionStatus === 'PENDING') { if (connectionStatus === 'PENDING') {
return ( return (