From 2d449b6fd03885264ca54336eb66a6e30daceb74 Mon Sep 17 00:00:00 2001 From: denispan <6231990@gmail.com> Date: Fri, 22 Mar 2024 17:35:34 +0100 Subject: [PATCH] =?UTF-8?q?=D1=83=D0=B1=D0=B8=D1=80=D0=B0=D0=B5=D1=82=20Nu?= =?UTF-8?q?llable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/map/map.tsx | 5 ++--- src/pages/main/main.tsx | 3 +-- src/pages/offer/offer.tsx | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/components/map/map.tsx b/src/components/map/map.tsx index 4811399..62e8d92 100644 --- a/src/components/map/map.tsx +++ b/src/components/map/map.tsx @@ -5,12 +5,11 @@ import {CITIES, URL_MARKER_CURRENT, URL_MARKER_DEFAULT} from '../../const'; import 'leaflet/dist/leaflet.css'; import useMap from '../../hooks/use-map.tsx'; import {OfferShortInfo} from '../../types/offer.ts'; -import {Nullable} from 'vitest'; type MapProps = { city: typeof CITIES[number]; offers: OfferShortInfo[]; - activeOffer: Nullable; + activeOffer: OfferShortInfo | null; container: string; }; @@ -42,7 +41,7 @@ function Map({container, city, offers, activeOffer}: MapProps) { marker .setIcon( - activeOffer !== undefined && activeOffer !== null && offer.id === activeOffer.id + activeOffer !== null && offer.id === activeOffer.id ? currentCustomIcon : defaultCustomIcon ) diff --git a/src/pages/main/main.tsx b/src/pages/main/main.tsx index a723ffd..5f7fa40 100644 --- a/src/pages/main/main.tsx +++ b/src/pages/main/main.tsx @@ -3,7 +3,6 @@ import Header from '../../components/header/header.tsx'; import LocationTab from '../../components/location-tab/location-tab.tsx'; import {OfferShortInfo} from '../../types/offer.ts'; import {useDocumentTitle} from '../../hooks/document-title.ts'; -import {Nullable} from 'vitest'; import {CITIES} from '../../const.ts'; import {useEffect, useState} from 'react'; import Map from '../../components/map/map.tsx'; @@ -17,7 +16,7 @@ export type MainProps = { function Main({offers, offersCount, title = 'Main'}: MainProps) { useDocumentTitle(title); - const [activeOffer, setActiveOffer] = useState>(null); + const [activeOffer, setActiveOffer] = useState(null); const location = useLocation(); const [citySlug, setCitySlug] = useState(location.pathname.split('/').pop()); useEffect(() => { diff --git a/src/pages/offer/offer.tsx b/src/pages/offer/offer.tsx index 31da4f0..da78cf2 100644 --- a/src/pages/offer/offer.tsx +++ b/src/pages/offer/offer.tsx @@ -14,7 +14,6 @@ import {AuthorizationStatus, CITIES} from '../../const.ts'; import Map from '../../components/map/map.tsx'; import OfferCard from '../../components/offer-card/offer-card.tsx'; import {useState} from 'react'; -import {Nullable} from 'vitest'; import {OfferShortInfo} from '../../types/offer.ts'; interface OfferProps { @@ -25,7 +24,7 @@ interface OfferProps { function Offer({title = 'Offer', userAuth}: OfferProps) { useDocumentTitle(title); const {offerId} = useParams(); - const [activeNearOffer, setActiveNearOffer] = useState>(null); + const [activeNearOffer, setActiveNearOffer] = useState(null); if (!offerId) {