diff --git a/src/App.tsx b/src/App.tsx index fe7ebe3..87c602a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -11,10 +11,22 @@ type Offer = { rating: number; type: string; isPremium: boolean; - previewImage: string; + isFavorite: boolean; NumberOfPlaces: number; - latitude: number; - longitude:number; + previewImage: string; + city: { + name: string; + location: { + latitude: number; + longitude: number; + zoom: number; + }; + }; + location: { + latitude: number; + longitude: number; + zoom: number; + }; }; type AppProps = { diff --git a/src/components/Favorites/Favorite.tsx b/src/components/Favorites/Favorite.tsx index b7525f0..c8d4033 100644 --- a/src/components/Favorites/Favorite.tsx +++ b/src/components/Favorites/Favorite.tsx @@ -6,8 +6,22 @@ type Offer = { rating: number; type: string; isPremium: boolean; - previewImage: string; + isFavorite: boolean; NumberOfPlaces: number; + previewImage: string; + city: { + name: string; + location: { + latitude: number; + longitude: number; + zoom: number; + }; + }; + location: { + latitude: number; + longitude: number; + zoom: number; + }; }; type FavoriteProps = { offers: Offer[]; diff --git a/src/components/MainPage/MainPage.tsx b/src/components/MainPage/MainPage.tsx index 4cd30d9..90845e8 100644 --- a/src/components/MainPage/MainPage.tsx +++ b/src/components/MainPage/MainPage.tsx @@ -8,10 +8,22 @@ type Offer = { rating: number; type: string; isPremium: boolean; - previewImage: string; + isFavorite: boolean; NumberOfPlaces: number; - latitude: number; - longitude:number; + previewImage: string; + city: { + name: string; + location: { + latitude: number; + longitude: number; + zoom: number; + }; + }; + location: { + latitude: number; + longitude: number; + zoom: number; + }; }; type MainPageProps = { offers: Offer[]; diff --git a/src/components/Map/Map.tsx b/src/components/Map/Map.tsx index 6ce1321..631251f 100644 --- a/src/components/Map/Map.tsx +++ b/src/components/Map/Map.tsx @@ -9,10 +9,22 @@ type Offer = { rating: number; type: string; isPremium: boolean; - previewImage: string; + isFavorite: boolean; NumberOfPlaces: number; - latitude: number; - longitude:number; + previewImage: string; + city: { + name: string; + location: { + latitude: number; + longitude: number; + zoom: number; + }; + }; + location: { + latitude: number; + longitude: number; + zoom: number; + }; }; const defaultCustomIcon = new Icon({ iconUrl: 'https://assets.htmlacademy.ru/content/intensive/javascript-1/demo/interactive-map/pin.svg', @@ -41,8 +53,8 @@ function Map(props: MainPageProps): JSX.Element { const markerLayer = layerGroup().addTo(map); offers.forEach((offer) => { const marker = new Marker({ - lat: offer.latitude, - lng: offer.longitude + lat: offer.location.latitude, + lng: offer.location.longitude }); marker .setIcon( diff --git a/src/components/Offer/Offer.tsx b/src/components/Offer/Offer.tsx index 6c9511b..9d5bd83 100644 --- a/src/components/Offer/Offer.tsx +++ b/src/components/Offer/Offer.tsx @@ -207,116 +207,7 @@ export default function Offer () {
diff --git a/src/components/Offer/OfferCard.tsx b/src/components/Offer/OfferCard.tsx index f872325..f644358 100644 --- a/src/components/Offer/OfferCard.tsx +++ b/src/components/Offer/OfferCard.tsx @@ -7,8 +7,22 @@ type Offer = { rating: number; type: string; isPremium: boolean; - previewImage: string; + isFavorite: boolean; NumberOfPlaces: number; + previewImage: string; + city: { + name: string; + location: { + latitude: number; + longitude: number; + zoom: number; + }; + }; + location: { + latitude: number; + longitude: number; + zoom: number; + }; }; type OfferCardProps = { diff --git a/src/components/Offer/OfferList.tsx b/src/components/Offer/OfferList.tsx index d84aa13..32825f3 100644 --- a/src/components/Offer/OfferList.tsx +++ b/src/components/Offer/OfferList.tsx @@ -8,8 +8,22 @@ type Offer = { rating: number; type: string; isPremium: boolean; - previewImage: string; + isFavorite: boolean; NumberOfPlaces: number; + previewImage: string; + city: { + name: string; + location: { + latitude: number; + longitude: number; + zoom: number; + }; + }; + location: { + latitude: number; + longitude: number; + zoom: number; + }; }; type OfferListProps = { diff --git a/src/mock/offers.ts b/src/mock/offers.ts index 1f92cfd..b253cd2 100644 --- a/src/mock/offers.ts +++ b/src/mock/offers.ts @@ -8,8 +8,20 @@ export const offers = [ isPremium: true, previewImage: 'img/apartment-01.jpg', NumberOfPlaces: 1, - latitude: 52.3909553943508, - longitude: 4.85309666406198, + location: { + latitude: 52.3909553943508, + longitude: 4.85309666406198, + zoom: 0, + }, + city: { + name: 'Amsterdam', + location: { + latitude: 52.35514938496378, + longitude: 4.673877537499948, + zoom: 8, + }, + }, + isFavorite: false, }, { id: 2, @@ -20,8 +32,20 @@ export const offers = [ isPremium: false, previewImage: 'img/apartment-02.jpg', NumberOfPlaces: 1, - latitude: 52.3609553943508, - longitude: 4.85309666406198, + location: { + latitude: 52.3609553943508, + longitude: 4.85309666406198, + zoom: 0, + }, + city: { + name: 'Amsterdam', + location: { + latitude: 52.35514938496378, + longitude: 4.673877537499948, + zoom: 8, + }, + }, + isFavorite: false, }, { id: 3, @@ -32,8 +56,20 @@ export const offers = [ isPremium: false, previewImage: 'img/studio-01.jpg', NumberOfPlaces: 1, - latitude: 52.3909553943508, - longitude: 4.929309666406198, + location: { + latitude: 52.3909553943508, + longitude: 4.929309666406198, + zoom: 0, + }, + city: { + name: 'Amsterdam', + location: { + latitude: 52.35514938496378, + longitude: 4.673877537499948, + zoom: 8, + }, + }, + isFavorite: false, }, { id: 4, @@ -44,7 +80,19 @@ export const offers = [ isPremium: true, previewImage: 'img/studio-01.jpg', NumberOfPlaces: 1, - latitude: 52.3809553943508, - longitude: 4.939309666406198, + location: { + latitude: 52.3809553943508, + longitude: 4.939309666406198, + zoom: 0, + }, + city: { + name: 'Amsterdam', + location: { + latitude: 52.35514938496378, + longitude: 4.673877537499948, + zoom: 8, + }, + }, + isFavorite: false, }, ];