feat: disable agent-to-agent connections and update navigation for agent role
This commit is contained in:
@@ -53,8 +53,10 @@ export function CommonHeader() {
|
||||
// Use fetched profile image, fallback to session image
|
||||
const userImage = profileImage || session?.user?.image;
|
||||
|
||||
// Determine dashboard link based on user role
|
||||
const dashboardLink = userRole === 'AGENT' ? '/agent/dashboard' : '/user/dashboard';
|
||||
// Logo destination based on role:
|
||||
// - 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 (
|
||||
<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>
|
||||
</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
|
||||
onClick={() => {
|
||||
setShowProfileMenu(false);
|
||||
|
||||
@@ -51,6 +51,9 @@ export function ProfileCard({
|
||||
const pathname = usePathname();
|
||||
const [isUnlinking, setIsUnlinking] = 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
|
||||
const locationParts = location.split(',').map(s => s.trim()).filter(Boolean);
|
||||
@@ -209,7 +212,7 @@ export function ProfileCard({
|
||||
</span>
|
||||
)}
|
||||
</Link>
|
||||
) : (
|
||||
) : viewerIsAgent ? null : (
|
||||
// Public view - show Connect/Pending/Unlink button based on connection status
|
||||
connectionStatus === 'PENDING' ? (
|
||||
<button
|
||||
|
||||
@@ -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
|
||||
const renderConnectionButton = () => {
|
||||
if (viewerIsAgent) return null;
|
||||
|
||||
// If PENDING - show yellow Pending button (disabled)
|
||||
if (connectionStatus === 'PENDING') {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user