From 381b86bc562983e5f33f4e49579f869c2c670b9f Mon Sep 17 00:00:00 2001 From: sangminlee98 Date: Sun, 18 Aug 2024 19:09:07 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=EB=86=8D=EA=B0=80=20=EA=B1=B0?= =?UTF-8?q?=EB=9E=98=20=EC=83=81=EC=84=B8=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EC=9C=A0=ED=98=95=20=EC=A0=95=EB=B3=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Trade/Info/index.tsx | 35 +++++++++++++---------------- src/pages/Trade/index.tsx | 1 + src/types/Board/tradeType.ts | 2 ++ src/utils/utils.ts | 14 ++++++++++++ 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/components/Trade/Info/index.tsx b/src/components/Trade/Info/index.tsx index d78ddf2..8f1f74e 100644 --- a/src/components/Trade/Info/index.tsx +++ b/src/components/Trade/Info/index.tsx @@ -1,6 +1,6 @@ import dayjs from 'dayjs'; import { TradeBoardDetailType } from '@/types/Board/tradeType'; -import { getRentalName } from '@/utils/utils'; +import { getHouseName, getRentalName } from '@/utils/utils'; import styles from './styles.module.scss'; // TODO: undefined 처리하기 @@ -12,28 +12,13 @@ function TradeBoardInfo({ info }: TradeBoardInfoProps) { return (
- 기본정보 -
- 위치

{info?.city}

-
-
- 면적{' '} -

- {info?.size}m2 -

-
-
- 용도

{info?.purpose}

-
+ 임대정보 및 판매자 정보
- 준공연도

{dayjs(info?.createdDate).format('YYYY')}년

+ 유형

{info?.houseType && getHouseName(info?.houseType)}

- 층수

{info?.floorNum === 0 ? '-' : `${info?.floorNum}층`}

+ 위치

{info?.city}

-
-
- 임대정보 및 판매자 정보
가격{' '}

@@ -50,6 +35,18 @@ function TradeBoardInfo({ info }: TradeBoardInfoProps) {

)}
+
+ 기본정보 +
+ 면적

{info?.size}㎡

+
+
+ 준공연도

{dayjs(info?.createdDate).format('YYYY')}년

+
+
+ 용도

{info?.purpose}

+
+
); } diff --git a/src/pages/Trade/index.tsx b/src/pages/Trade/index.tsx index 50b25a5..8574be3 100644 --- a/src/pages/Trade/index.tsx +++ b/src/pages/Trade/index.tsx @@ -124,6 +124,7 @@ export default function TradePage() { { } }; +// 매매 타입 이름 가져오기 +export const getHouseName = (house: HouseType) => { + switch (house) { + case 'LAND': + return '토지'; + case 'HOUSE': + return '주택'; + case 'FARM_HOUSE': + return '농가'; + default: + return ''; + } +}; + // 매매 타입 이름 가져오기 export const getRentalName = (rental: RentalType) => { switch (rental) { From b97e0076995d7ec98edef25a354400017b742106 Mon Sep 17 00:00:00 2001 From: sangminlee98 Date: Sun, 18 Aug 2024 19:22:03 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=EB=86=8D=EA=B0=80=20=EA=B1=B0?= =?UTF-8?q?=EB=9E=98=20=EA=B2=8C=EC=8B=9C=EA=B8=80=20=EC=A0=9C=EB=AA=A9=20?= =?UTF-8?q?=EC=9C=A0=ED=98=95=20=EB=A7=90=EB=A8=B8=EB=A6=AC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Trade/Board/index.tsx | 7 +++++-- src/pages/Trade/Board/index.tsx | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/components/Trade/Board/index.tsx b/src/components/Trade/Board/index.tsx index 2e662d3..9485109 100644 --- a/src/components/Trade/Board/index.tsx +++ b/src/components/Trade/Board/index.tsx @@ -2,13 +2,14 @@ import { useEffect, useRef, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import dayjs from 'dayjs'; import { RentalType, TradeBoardType } from '@/types/Board/tradeType'; -import { convertRentalTypeName, priceCount } from '@/utils/utils'; +import { convertRentalTypeName, getHouseName, priceCount } from '@/utils/utils'; import styles from './styles.module.scss'; type TradeBoardProps = Omit; export default function TradeBoard({ houseId, + houseType, rentalType, city, price, @@ -97,7 +98,9 @@ export default function TradeBoard({ )}
-

{title}

+

+ {getHouseName(houseType)} {title} +

위치 : {city}

diff --git a/src/pages/Trade/Board/index.tsx b/src/pages/Trade/Board/index.tsx index c933a1f..ff7e427 100644 --- a/src/pages/Trade/Board/index.tsx +++ b/src/pages/Trade/Board/index.tsx @@ -23,7 +23,7 @@ import { DeleteHouseAPI } from '@/apis/houses'; import userStore from '@/store/userStore'; import useModalState from '@/hooks/useModalState'; import useToastMessageType from '@/hooks/useToastMessageType'; -import { getMoveInType, getUserType } from '@/utils/utils'; +import { getHouseName, getMoveInType, getUserType } from '@/utils/utils'; import { ApiResponseWithDataType } from '@/types/apiResponseType'; import { opacityVariants } from '@/constants/variants'; import styles from './styles.module.scss'; @@ -104,7 +104,10 @@ export default function TradeBoardPage() { {getUserType(data?.data.userType || 'NONE')} -

{data?.data.title}

+

+ {data?.data.houseType && getHouseName(data?.data.houseType)}{' '} + {data?.data.title} +

{data?.data.nickName} From f927416b920d0fff37c3c03c7a17a6b364ea6cce Mon Sep 17 00:00:00 2001 From: sangminlee98 Date: Sun, 18 Aug 2024 19:54:11 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=EB=A7=A4=EB=AC=BC=20=EB=A7=90?= =?UTF-8?q?=EB=A8=B8=EB=A6=AC=20=EB=8C=80=EA=B4=84=ED=98=B8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Trade/Board/index.tsx | 2 +- src/pages/Trade/Board/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Trade/Board/index.tsx b/src/components/Trade/Board/index.tsx index 9485109..1f2762e 100644 --- a/src/components/Trade/Board/index.tsx +++ b/src/components/Trade/Board/index.tsx @@ -99,7 +99,7 @@ export default function TradeBoard({

- {getHouseName(houseType)} {title} + [{getHouseName(houseType)}] {title}

위치 : {city} diff --git a/src/pages/Trade/Board/index.tsx b/src/pages/Trade/Board/index.tsx index ff7e427..21c6746 100644 --- a/src/pages/Trade/Board/index.tsx +++ b/src/pages/Trade/Board/index.tsx @@ -105,7 +105,7 @@ export default function TradeBoardPage() {

- {data?.data.houseType && getHouseName(data?.data.houseType)}{' '} + {data?.data.houseType && `[${getHouseName(data?.data.houseType)}]`}{' '} {data?.data.title}