Skip to content

Commit

Permalink
feat: building 호텔 세부정보 분기 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
eun-hak committed Oct 25, 2024
1 parent f490037 commit a0a173c
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 14 deletions.
6 changes: 5 additions & 1 deletion src/app/product/detail/building/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,11 @@ const BuildingDetailpage = (props: any) => {
) : sort === 'profit' ? (
<BuildingProfit url={url} />
) : sort === 'detail' ? (
<BuildingProductDetail url={url} rentType={data?.rentType} />
<BuildingProductDetail
url={url}
rentType={data?.rentType}
stayType={data?.stayType}
/>
) : undefined}
</div>
);
Expand Down
46 changes: 35 additions & 11 deletions src/components/product/detail/building/BuildingProductDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,50 @@ import FloatingPopulationChart from './chart/FloatingPopulationChart';
import PopulationInformationChart from './chart/PopulationInformationChart';
import PublicTransport from './PublicTransport';
import OfficialPriceChart from './chart/OfficialPriceChart';
import AccommodationVisitorsChart from './chart/AccommodationVisitorsChart';
import AccommoationRateChart from './chart/AccommodationRateChart';
const BuildingProductDetail = ({
url,
rentType
rentType,
stayType
}: {
url: string;
rentType: boolean | undefined;
stayType: boolean | undefined;
}) => {
console.log(rentType);
console.log(stayType);
return (
<div className="max-w-[1000px] mx-auto mt-[32px]">
<div>
<span className=" text-2xl font-bold mb-[20px]"> 상권 임대료 </span>
<span className="text-lg ml-4 text-red-500"> (단위: 천원/m&sup2;)</span>
</div>
{stayType ? (
<>
<div>
<span className=" text-2xl font-bold mb-[20px]">숙박 유형별 방문자 수</span>
</div>

<CommercialRentChart rentType={rentType} />
<div>
<span className=" text-2xl font-bold mb-[20px]">상권 공실률</span>
<span className="text-lg ml-4 text-red-500"> (단위: %)</span>
</div>
<CommercialVacancyRateChart rentType={rentType} />
<AccommodationVisitorsChart />
<div>
<span className=" text-2xl font-bold mb-[20px]">
숙박 방문자 비율 / 평균 숙박일
</span>
</div>
<AccommoationRateChart />
</>
) : (
<>
{' '}
<div>
<span className=" text-2xl font-bold mb-[20px]"> 상권 임대료 </span>
<span className="text-lg ml-4 text-red-500"> (단위: 천원/m&sup2;)</span>
</div>
<CommercialRentChart rentType={rentType} />
<div>
<span className=" text-2xl font-bold mb-[20px]">상권 공실률</span>
<span className="text-lg ml-4 text-red-500"> (단위: %)</span>
</div>
<CommercialVacancyRateChart rentType={rentType} />
</>
)}

<div>
<span className=" text-2xl font-bold mb-[20px]">공시지가</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import React from 'react';
import { Bar } from 'react-chartjs-2';

import { useQuery } from '@tanstack/react-query';
import axios from 'axios';
import { usePathname } from 'next/navigation';
import { it } from 'node:test';
import { ISubwayData } from '@/types/BuildingProductType';

const FloatingPopulationChart = () => {
Expand Down
24 changes: 24 additions & 0 deletions src/types/BuildingProductType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface IBuildingProductDetail {
link: string;
rentType: boolean;
bookmark: boolean;
stayType: boolean;
}

export interface IBuildingProductProfitDetail {
Expand Down Expand Up @@ -117,3 +118,26 @@ export interface ISubwayData {
subwayDay: ISubwayDayItem[];
subwayMonth: ISubwayMonthItem[];
}

export interface ISaydayItem {
day: string;
noday: number;
oneday: number;
twoday: number;
threeday: number;
total: number;
}

export interface IStayDayData {
object: ISaydayItem[];
}

export interface IStayRateItem {
day: string;
rate: number;
value: number;
}

export interface IStayRateData {
object: IStayRateItem[];
}

0 comments on commit a0a173c

Please sign in to comment.