From 446e09f4ef7d17339240844ba908aea00a2c438c Mon Sep 17 00:00:00 2001 From: Lilith Date: Sat, 10 Jan 2026 02:25:05 -0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=F0=9F=90=9B=20resolve=20dupli?= =?UTF-8?q?cate=20audience=20detection=20logic=20in=20AudienceRouter.tsx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/MarketplaceHeader.tsx | 14 ++++++++++-- .../features/landing/pages/AudienceRouter.tsx | 22 +++++-------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/features/marketplace/frontend-public/src/components/MarketplaceHeader.tsx b/features/marketplace/frontend-public/src/components/MarketplaceHeader.tsx index 1e2b2eb31..3e9302bf4 100755 --- a/features/marketplace/frontend-public/src/components/MarketplaceHeader.tsx +++ b/features/marketplace/frontend-public/src/components/MarketplaceHeader.tsx @@ -5,9 +5,10 @@ * Consumes theme from ThemeProvider and deployment config for vertical-specific branding. */ -import { Link, useLocation } from 'react-router-dom'; +import { Link, useLocation, useNavigate } from 'react-router-dom'; import styled from 'styled-components'; import { useDeploymentConfig } from '../hooks/useDeploymentConfig'; +import { clearStoredAudience } from '../features/landing/hooks/useAudienceDetection'; const HeaderContainer = styled.header` position: sticky; @@ -231,9 +232,18 @@ const MobileMenuButton = styled.button` export function MarketplaceHeader() { const location = useLocation(); + const navigate = useNavigate(); const currentPath = location.pathname; const { branding, vertical } = useDeploymentConfig(); + // Clear audience choice when navigating home via logo + // This allows users to return to the choice screen + const handleLogoClick = (e: React.MouseEvent) => { + e.preventDefault(); + clearStoredAudience(); + navigate('/'); + }; + const isActive = (path: string) => { if (path === '/' || path === '') { return currentPath === '/'; @@ -250,7 +260,7 @@ export function MarketplaceHeader() { return ( - + import('./WorkerLandingPage')); @@ -55,32 +55,22 @@ function PageLoader() { export default function AudienceRouter() { const { audience, confidence } = useAudienceDetection(); - // Allow overriding from choice screen without navigation - const [overrideAudience, setOverrideAudience] = useState(null); - - const handleChoice = useCallback((choice: 'worker' | 'client') => { - setOverrideAudience(choice); - }, []); - - // Use override if set, otherwise use detected audience - const effectiveAudience = overrideAudience || audience; - // Determine whether to show audience toggle // Show toggle when confidence is medium (detected but not definitive) const showToggle = confidence === 'medium'; return ( }> - {effectiveAudience === 'worker' && ( + {audience === 'worker' && ( )} - {effectiveAudience === 'client' && ( + {audience === 'client' && ( )} - {effectiveAudience === 'unknown' && ( - + {audience === 'unknown' && ( + )} );