diff --git a/src/entities/discovery/model/index.ts b/src/entities/discovery/model/index.ts index 0c1c15f..2466b9e 100644 --- a/src/entities/discovery/model/index.ts +++ b/src/entities/discovery/model/index.ts @@ -1,2 +1,2 @@ export { DiscoveryData } from './constants'; -export type { Weather, DuplicatedWeeklyWeather, Discovery, Vote, WeeklyWeather, WeatherResponse, Resort } from './model'; +export type { Weather, Discovery, Vote, WeeklyWeather, WeatherResponse, Resort, Url } from './model'; diff --git a/src/entities/discovery/model/model.d.ts b/src/entities/discovery/model/model.d.ts index 05e4c8d..44536f6 100644 --- a/src/entities/discovery/model/model.d.ts +++ b/src/entities/discovery/model/model.d.ts @@ -8,15 +8,17 @@ export type DuplicatedWeeklyWeather = { }; }; +export type Url = { + bus: string; + homepage: string; +}; + export type Discovery = { id: number; name: string; map: string; slope: number | null; - url: { - bus: string; - homepage: string; - }; + url: Url; weather: { weather: Weather; temperature: number; diff --git a/src/widgets/discovery/lib/getWeatherFromDescription.ts b/src/shared/lib/getWeatherFromDescription.ts similarity index 92% rename from src/widgets/discovery/lib/getWeatherFromDescription.ts rename to src/shared/lib/getWeatherFromDescription.ts index a9bb7a4..5006f66 100644 --- a/src/widgets/discovery/lib/getWeatherFromDescription.ts +++ b/src/shared/lib/getWeatherFromDescription.ts @@ -1,3 +1,4 @@ +// eslint-disable-next-line boundaries/element-types import type { Weather } from "@/entities/discovery"; const weatherDescription = { diff --git a/src/views/discovery-detail/ui/discovery-detail-page.tsx b/src/views/discovery-detail/ui/discovery-detail-page.tsx index 50d9cc2..122a92b 100644 --- a/src/views/discovery-detail/ui/discovery-detail-page.tsx +++ b/src/views/discovery-detail/ui/discovery-detail-page.tsx @@ -26,6 +26,8 @@ const DiscoveryDetailPage = ({ params }: { params: { resortId: string } }) => { const discovery = DiscoveryData.find( (discovery) => discovery.id === +params?.resortId ) as Discovery; + const { data: resortsData } = useQuery(discoveryApi.resortQueries.list()); + const resort = resortsData?.find((resort) => resort.resortId === +params?.resortId); const { data: voteData } = useQuery(discoveryApi.discoveryQueries.vote(+params?.resortId)); const data = RESORT_DOMAIN[discovery?.map as keyof typeof RESORT_DOMAIN]; const [selectedTab, setSelectedTab] = useState('webcam'); @@ -72,12 +74,12 @@ const DiscoveryDetailPage = ({ params }: { params: { resortId: string } }) => { } }, [isPositive, mutateAsync, params?.resortId]); - if (!discovery) return; + if (!discovery || !resort) return; return (
{name}
-{weather.temperature}°
++ {currentWeather.temperature}° +
- {slope ? `운행중인 슬로프 ${slope}개` : '개장일이 곧 공개될 예정이에요'} + {openSlopes ? `운행중인 슬로프 ${openSlopes}개` : '개장일이 곧 공개될 예정이에요'}
-{weather.description}
+{currentWeather.description}