From bf0f9b6a859d71bf157e7da2899ecf9c5859d4ed Mon Sep 17 00:00:00 2001 From: mayonnaise <90057279+Mayanzev@users.noreply.github.com> Date: Tue, 28 May 2024 20:39:40 +0300 Subject: [PATCH] final --- src/components/offer-card/offer-card.tsx | 12 ++--- src/components/offer-list/offer-list.tsx | 4 +- .../favorites-empty-screen.tsx | 52 ------------------- .../favorites-screen/favorites-screen.tsx | 4 +- src/pages/main-screen/main-screen.tsx | 4 +- src/pages/offer-screen/offer-screen.tsx | 4 +- src/utils.ts | 8 +-- 7 files changed, 18 insertions(+), 70 deletions(-) delete mode 100644 src/pages/favorites-empty-screen/favorites-empty-screen.tsx diff --git a/src/components/offer-card/offer-card.tsx b/src/components/offer-card/offer-card.tsx index c8ce50b..efd60f0 100644 --- a/src/components/offer-card/offer-card.tsx +++ b/src/components/offer-card/offer-card.tsx @@ -1,7 +1,7 @@ import { useAppDispatch } from '../../hooks'; import { Offer } from '../../types/offer'; import { Link } from 'react-router-dom'; -import { listToCard, ratingPercentage, typeOfCardList } from '../../utils'; +import { listToCard, ratingPercentage, TypeOfCardList } from '../../utils'; import { fetchNearbyAction, fetchOfferAction, fetchReviewsAction } from '../../store/api-actions'; import { changeHighlightedMarker } from '../../store/common-data/common-data'; import ChangeFavoriteButton from '../change-favorite-button/change-favorite-button'; @@ -16,7 +16,7 @@ function OfferCard({ offer, cardType }: OfferProps): JSX.Element { return (
dispatch(changeHighlightedMarker(offer.location)), onMouseLeave: () => dispatch(changeHighlightedMarker(undefined)) })} @@ -26,12 +26,12 @@ function OfferCard({ offer, cardType }: OfferProps): JSX.Element { Premium ) : null} -
- - Place image +
+ + Place image
-
+
€{offer.price} diff --git a/src/components/offer-list/offer-list.tsx b/src/components/offer-list/offer-list.tsx index 0282297..979704c 100644 --- a/src/components/offer-list/offer-list.tsx +++ b/src/components/offer-list/offer-list.tsx @@ -1,4 +1,4 @@ -import { getSortedOffers, listToCard, typeOfCardList } from '../../utils'; +import { getSortedOffers, listToCard, TypeOfCardList } from '../../utils'; import { useAppSelector } from '../../hooks'; import { Offer } from '../../types/offer'; import OfferCard from '../offer-card/offer-card'; @@ -6,7 +6,7 @@ import { getSortType } from '../../store/common-data/selectors'; type OfferListProps = { offers: Offer[]; - listType: typeOfCardList; + listType: TypeOfCardList; }; function OfferList({offers, listType}: OfferListProps): JSX.Element { diff --git a/src/pages/favorites-empty-screen/favorites-empty-screen.tsx b/src/pages/favorites-empty-screen/favorites-empty-screen.tsx deleted file mode 100644 index 9c6077a..0000000 --- a/src/pages/favorites-empty-screen/favorites-empty-screen.tsx +++ /dev/null @@ -1,52 +0,0 @@ -function FavoritesEmptyScreen(): JSX.Element { - return ( -
-
- -
- -
-
-
-

Favorites (empty)

-
- Nothing yet saved. -

Save properties to narrow down search or plan your future trips.

-
-
-
-
- -
- ); -} -export default FavoritesEmptyScreen; diff --git a/src/pages/favorites-screen/favorites-screen.tsx b/src/pages/favorites-screen/favorites-screen.tsx index 8a7e1bd..a5c6f0c 100644 --- a/src/pages/favorites-screen/favorites-screen.tsx +++ b/src/pages/favorites-screen/favorites-screen.tsx @@ -1,5 +1,5 @@ import { Link } from 'react-router-dom'; -import { typeOfCardList } from '../../utils'; +import { TypeOfCardList } from '../../utils'; import OfferList from '../../components/offer-list/offer-list'; import { useAppDispatch, useAppSelector } from '../../hooks'; import { AppRoute } from '../../const'; @@ -41,7 +41,7 @@ function FavoritesScreen(): JSX.Element {
- o.city.name === city)} listType={typeOfCardList.favourites} /> + o.city.name === city)} listType={TypeOfCardList.favourites} /> ))} diff --git a/src/pages/main-screen/main-screen.tsx b/src/pages/main-screen/main-screen.tsx index 62a5016..7b2805a 100644 --- a/src/pages/main-screen/main-screen.tsx +++ b/src/pages/main-screen/main-screen.tsx @@ -1,6 +1,6 @@ import OfferList from '../../components/offer-list/offer-list'; import Map from '../../components/map/map'; -import { typeOfCardList } from '../../utils'; +import { TypeOfCardList } from '../../utils'; import { useAppSelector } from '../../hooks'; import CityList from '../../components/city-list/city-list'; import { Header } from '../../components/header/header'; @@ -35,7 +35,7 @@ function MainScreen(): JSX.Element {

Places

{chosenOffers.length} places to stay in {city} - +
diff --git a/src/pages/offer-screen/offer-screen.tsx b/src/pages/offer-screen/offer-screen.tsx index 049e13e..c014513 100644 --- a/src/pages/offer-screen/offer-screen.tsx +++ b/src/pages/offer-screen/offer-screen.tsx @@ -1,7 +1,7 @@ import ReviewsList from '../../components/reviews-list/reviews-list'; import Map from '../../components/map/map'; import OfferList from '../../components/offer-list/offer-list'; -import { ratingPercentage, typeOfCardList } from '../../utils'; +import { ratingPercentage, TypeOfCardList } from '../../utils'; import { useAppDispatch, useAppSelector } from '../../hooks'; import { fetchNearbyAction, fetchOfferAction, fetchReviewsAction } from '../../store/api-actions'; import LoadingScreen from '../loading-screen/loading-screen'; @@ -138,7 +138,7 @@ function OfferScreen(): JSX.Element {

Other places in the neighbourhood

- +
diff --git a/src/utils.ts b/src/utils.ts index 698cfb4..182ca79 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,6 +1,6 @@ import { Offer } from './types/offer'; -export enum typeOfCardList { +export enum TypeOfCardList { favourites = 'favorites__places', nearest = 'near-places__list places__list', standart = 'cities__places-list places__list tabs__content', @@ -8,9 +8,9 @@ export enum typeOfCardList { export const listToCard = new Map( [ - [typeOfCardList.favourites, 'favorites__card place-card'], - [typeOfCardList.nearest, 'near-places__card place-card'], - [typeOfCardList.standart, 'cities__card place-card'] + [TypeOfCardList.favourites, 'favorites__card place-card'], + [TypeOfCardList.nearest, 'near-places__card place-card'], + [TypeOfCardList.standart, 'cities__card place-card'] ] );