Skip to content

Commit

Permalink
убирает Nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
denispan committed Mar 22, 2024
1 parent 5f10f86 commit 2d449b6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
5 changes: 2 additions & 3 deletions src/components/map/map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<OfferShortInfo>;
activeOffer: OfferShortInfo | null;
container: string;
};

Expand Down Expand Up @@ -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
)
Expand Down
3 changes: 1 addition & 2 deletions src/pages/main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -17,7 +16,7 @@ export type MainProps = {

function Main({offers, offersCount, title = 'Main'}: MainProps) {
useDocumentTitle(title);
const [activeOffer, setActiveOffer] = useState<Nullable<OfferShortInfo>>(null);
const [activeOffer, setActiveOffer] = useState<OfferShortInfo | null>(null);
const location = useLocation();
const [citySlug, setCitySlug] = useState(location.pathname.split('/').pop());
useEffect(() => {
Expand Down
3 changes: 1 addition & 2 deletions src/pages/offer/offer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -25,7 +24,7 @@ interface OfferProps {
function Offer({title = 'Offer', userAuth}: OfferProps) {
useDocumentTitle(title);
const {offerId} = useParams();
const [activeNearOffer, setActiveNearOffer] = useState<Nullable<OfferShortInfo>>(null);
const [activeNearOffer, setActiveNearOffer] = useState<OfferShortInfo | null>(null);


if (!offerId) {
Expand Down

0 comments on commit 2d449b6

Please sign in to comment.