diff --git a/frontend/src/bundles/common/components/logo/logo.tsx b/frontend/src/bundles/common/components/logo/logo.tsx index 0151f569e..65eaa75db 100644 --- a/frontend/src/bundles/common/components/logo/logo.tsx +++ b/frontend/src/bundles/common/components/logo/logo.tsx @@ -1,8 +1,18 @@ import logoSvg from '~/assets/img/logo/logo.svg'; import logoLabelSvg from '~/assets/img/logo/logo-label.svg'; -import { AppRoute } from '~/bundles/common/enums/enums.js'; -import { getValidClassNames } from '~/bundles/common/helpers/helpers.js'; +import { AppRoute, UserRole } from '~/bundles/common/enums/enums.js'; +import { + configureString, + getValidClassNames, +} from '~/bundles/common/helpers/helpers.js'; +import { type RootReducer } from '~/framework/store/store.js'; +import { + useAppSelector, + useEffect, + useLocation, + useState, +} from '../../hooks/hooks.js'; import { Grid, Link } from '../components.js'; import styles from './styles.module.scss'; @@ -48,11 +58,43 @@ const Logo: React.FC = ({ isCollapsed = false, hasLink = false, }) => { + const { pathname } = useLocation(); + const role = useAppSelector( + (state: RootReducer) => state.auth.currentUser?.role, + ); + const [isProfileDisabled, setIsProfileDisabled] = useState(true); + + let logoLink = ''; + + switch (role) { + case UserRole.TALENT: { + logoLink = configureString('/:role/my/profile', { role }); + break; + } + case UserRole.EMPLOYER: { + logoLink = AppRoute.CANDIDATES; + break; + } + case UserRole.ADMIN: { + logoLink = AppRoute.ADMIN_VERIFICATIONS_PANEL; + break; + } + default: { + break; + } + } + + useEffect(() => { + pathname.includes('onboarding') && !pathname.includes('preview') + ? setIsProfileDisabled(true) + : setIsProfileDisabled(false); + }, [pathname]); + return ( {hasLink ? (