Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayanzev committed May 3, 2024
1 parent 94c41f6 commit e0909ac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
23 changes: 11 additions & 12 deletions src/components/login-navigation/login-navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,36 +9,35 @@ function HeaderNavigation(): JSX.Element {
const favoriteOffers = offers.filter((offer) => offer.isFavorite);
const userData = useAppSelector((state) => state.userData);
const authorizationStatus = useAppSelector((state) => state.authorizationStatus);
const handleSignOut = () => {
dispatch(logoutAction());
};
return (
<nav className="header__nav">
{authorizationStatus === AuthorizationStatus.Auth ? (
<ul className="header__nav-list">
<li className="header__nav-item user">
<a className="header__nav-link header__nav-link--profile" >
<Link to={AppRoute.Favorites} className="header__nav-link header__nav-link--profile" >
<div className="header__avatar-wrapper user__avatar-wrapper">
</div>
<Link to={AppRoute.Favorites}>
<span className="header__user-name user__name">{userData?.email}</span>
<span className="header__favorite-count">{favoriteOffers.length}</span>
</Link>
</a>
<span className="header__favorite-count">{favoriteOffers.length}</span>
</Link>
</li>
<li className="header__nav-item">
<a className="header__nav-link" onClick={() => dispatch(logoutAction())}>
<Link to={AppRoute.Login} className="header__nav-link" onClick={handleSignOut}>
<span className="header__signout">Sign out</span>
</a>
</Link>
</li>
</ul>
) : (
<ul className="header__nav-list">
<li className="header__nav-item user">
<a className="header__nav-link header__nav-link--profile" >
<Link to={AppRoute.Login} className="header__nav-link header__nav-link--profile" >
<div className="header__avatar-wrapper user__avatar-wrapper">
</div>
<Link to={AppRoute.Login}>
<span className="header__login">Sign in</span>
</Link>
</a>
<span className="header__login">Sign in</span>
</Link>
</li>
</ul>
)}
Expand Down
12 changes: 5 additions & 7 deletions src/pages/login-screen/login-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ function LoginScreen(): JSX.Element {
<div className="container">
<div className="header__wrapper">
<div className="header__left">
<a className="header__logo-link" href="main.html">
<Link to={AppRoute.Main}>
<img className="header__logo" src="img/logo.svg" alt="6 cities logo" width="81" height="41" />
</Link>
</a>
<Link to={AppRoute.Main} className="header__logo-link">
<img className="header__logo" src="img/logo.svg" alt="6 cities logo" width="81" height="41" />
</Link>
</div>
</div>
</div>
</header>
</header >

<main className="page__main page__main--login">
<div className="page__login-container container">
Expand All @@ -62,7 +60,7 @@ function LoginScreen(): JSX.Element {
</section>
</div>
</main>
</div>
</div >
);
}
export default LoginScreen;

0 comments on commit e0909ac

Please sign in to comment.