From 9affec802bdab31509e3575705c08ac8c3bb04a1 Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 02:11:50 +0900 Subject: [PATCH 01/23] =?UTF-8?q?style:=20=EC=9E=84=EB=8C=80=EC=9D=B8=20?= =?UTF-8?q?=EC=8B=A0=EB=A2=B0=EC=84=B1=20=EA=B8=80=EA=BC=B4=20=ED=81=AC?= =?UTF-8?q?=EA=B8=B0=20=EB=B3=80=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.css b/src/index.css index e06becf..d0b87c2 100644 --- a/src/index.css +++ b/src/index.css @@ -74,9 +74,11 @@ --color-risk-good: var(--risk-good); --color-risk-safe: var(--risk-safe); --color-risk-very-safe: var(--risk-very-safe); + --text-landlord-reliability: var(--landlord-reliability-font-size); } :root { + --landlord-reliability-font-size: 250px; --chart-blue: #0c3165; --chart-orange: #f57a0c; --chart-green: #10b981; From b09a96db260094d41d2ecd1056d35f962ed66270 Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 02:12:34 +0900 Subject: [PATCH 02/23] =?UTF-8?q?feat:=20=EB=8C=80=EC=9C=84=EB=B3=80?= =?UTF-8?q?=EC=A0=9C=20=EC=9D=B4=EB=A0=A5=20=EB=B0=8F=20=EB=8B=A4=EC=A3=BC?= =?UTF-8?q?=ED=83=9D=EC=9E=90=20=EC=88=98,=20=EC=8B=A0=EB=A2=B0=EB=8F=84?= =?UTF-8?q?=20=EB=93=B1=EA=B8=89=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=83=89?= =?UTF-8?q?=EC=83=81=20=ED=81=B4=EB=9E=98=EC=8A=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shared/utils/chart/chart-colors.ts | 51 ++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/shared/utils/chart/chart-colors.ts b/src/shared/utils/chart/chart-colors.ts index 39e2b65..61cd998 100644 --- a/src/shared/utils/chart/chart-colors.ts +++ b/src/shared/utils/chart/chart-colors.ts @@ -66,3 +66,54 @@ export const getRiskBoxShadowClass = (hexColor: string): string => { * 차트 색상 개수 */ export const CHART_COLOR_COUNT = CHART_COLORS.length; + +/** + * 대위변제 이력에 따른 색상 클래스 반환 + * @param count - 대위변제 횟수 + * @returns Tailwind CSS 텍스트 색상 클래스 + */ +export const getSubrogationColorClass = (count: number): string => { + if (count === 0) { + return 'text-risk-very-safe'; // 초록색 #2cdf44 + } else if (count === 1) { + return 'text-risk-danger'; // 주황색 #ffba6f + } else { + return 'text-risk-very-danger'; // 빨간색 #ff6f6f + } +}; + +/** + * 다주택자 수에 따른 색상 클래스 반환 (임의 색상) + * @param count - 다주택자 수 + * @returns Tailwind CSS 텍스트 색상 클래스 + */ + +// TODO: 적절한 기준에 따른 색상 클래스 반환 +export const getMultiHouseColorClass = (count: number): string => { + if (count === 0) { + return 'text-risk-very-safe'; // 초록색 + } else if (count <= 2) { + return 'text-risk-good'; // 노란색 + } else if (count <= 5) { + return 'text-risk-danger'; // 주황색 + } else { + return 'text-risk-very-danger'; // 빨간색 + } +}; + +/** + * 신뢰도 등급에 따른 색상 클래스 반환 + * @param grade - 신뢰도 등급 (A~E) + * @returns Tailwind CSS 텍스트 색상 클래스 + */ +export const getTrustGradeColorClass = (grade: string): string => { + const gradeMap: Record = { + A: 'text-risk-very-safe', // 초록색 + B: 'text-risk-safe', // 연두색 + C: 'text-risk-good', // 노란색 + D: 'text-risk-danger', // 주황색 + E: 'text-risk-very-danger', // 빨간색 + }; + + return gradeMap[grade] || 'text-gray-600'; +}; From 22a38c56a6c96fa39c124cb6b488fb9807c0b011 Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 02:12:49 +0900 Subject: [PATCH 03/23] =?UTF-8?q?feat:=20=EC=9E=84=EB=8C=80=EC=9D=B8=20?= =?UTF-8?q?=EC=8B=A0=EB=A2=B0=EB=8F=84=20=EA=B4=80=EB=A0=A8=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EB=B0=8F=20=EC=9D=B4=EC=9C=A0=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/features/main/mock/index.ts | 1 + .../main/mock/landlord-reliability.mock.ts | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/features/main/mock/landlord-reliability.mock.ts diff --git a/src/features/main/mock/index.ts b/src/features/main/mock/index.ts index 5627d49..d38240a 100644 --- a/src/features/main/mock/index.ts +++ b/src/features/main/mock/index.ts @@ -1,2 +1,3 @@ export * from './chart-data.mock'; export * from './risk-analysis.mock'; +export * from './landlord-reliability.mock'; diff --git a/src/features/main/mock/landlord-reliability.mock.ts b/src/features/main/mock/landlord-reliability.mock.ts new file mode 100644 index 0000000..2ae0920 --- /dev/null +++ b/src/features/main/mock/landlord-reliability.mock.ts @@ -0,0 +1,33 @@ +// 임대인 신뢰도 등급, 대위변제 이력, 다주택자 +export const LANDLORD_TRUST_DATA = { + trustScore: 85, + subrogationCount: 0, + arrearsCount: 0, + litigationCount: 0, + ownedUnsoldCount: 2, + grade: 'A', +}; + +// 임대인 신뢰도 등급 사유 +export const RELIABILITY_REASONS = [ + { + name: '임대인 신뢰도 등급 사유', + percent: 25, + }, + { + name: '임대인 신뢰도 등급 사유', + percent: 20, + }, + { + name: '임대인 신뢰도 등급 사유', + percent: 18, + }, + { + name: '임대인 신뢰도 등급 사유', + percent: 15, + }, + { + name: '임대인 신뢰도 등급 사유', + percent: 12, + }, +]; From b853215e1926d8dfebd5c6bc2c28a923e4a21e3c Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 02:13:10 +0900 Subject: [PATCH 04/23] =?UTF-8?q?feat:=20=EC=8B=A0=EB=A2=B0=EB=8F=84=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/components/features/index.ts | 1 + .../features/reliability/GradeBox.tsx | 23 +++++++++++++++++++ .../features/reliability/MultiHouseBox.tsx | 15 ++++++++++++ .../features/reliability/ReasonBox.tsx | 21 +++++++++++++++++ .../reliability/SubrogationPaymentBox.tsx | 19 +++++++++++++++ .../components/features/reliability/index.ts | 4 ++++ 6 files changed, 83 insertions(+) create mode 100644 src/features/main/components/features/reliability/GradeBox.tsx create mode 100644 src/features/main/components/features/reliability/MultiHouseBox.tsx create mode 100644 src/features/main/components/features/reliability/ReasonBox.tsx create mode 100644 src/features/main/components/features/reliability/SubrogationPaymentBox.tsx create mode 100644 src/features/main/components/features/reliability/index.ts diff --git a/src/features/main/components/features/index.ts b/src/features/main/components/features/index.ts index 13bd4e4..3a01a28 100644 --- a/src/features/main/components/features/index.ts +++ b/src/features/main/components/features/index.ts @@ -1,2 +1,3 @@ export * from './form'; export * from './chart'; +export * from './reliability'; diff --git a/src/features/main/components/features/reliability/GradeBox.tsx b/src/features/main/components/features/reliability/GradeBox.tsx new file mode 100644 index 0000000..6a8aea1 --- /dev/null +++ b/src/features/main/components/features/reliability/GradeBox.tsx @@ -0,0 +1,23 @@ +import { getTrustGradeColorClass } from '@/shared'; + +import { LANDLORD_TRUST_DATA } from '../../../mock'; + +export const GradeBox = () => { + return ( +
+

임대인 신뢰도 등급

+ + 위험점수 : + {LANDLORD_TRUST_DATA.trustScore} + + +
+ + {LANDLORD_TRUST_DATA.grade} + +
+
+ ); +}; diff --git a/src/features/main/components/features/reliability/MultiHouseBox.tsx b/src/features/main/components/features/reliability/MultiHouseBox.tsx new file mode 100644 index 0000000..2a34b74 --- /dev/null +++ b/src/features/main/components/features/reliability/MultiHouseBox.tsx @@ -0,0 +1,15 @@ +import { LANDLORD_TRUST_DATA } from '../../../mock'; + +export const MultiHouseBox = () => { + return ( +
+

다주택자

+
+ + {LANDLORD_TRUST_DATA.ownedUnsoldCount} + + +
+
+ ); +}; diff --git a/src/features/main/components/features/reliability/ReasonBox.tsx b/src/features/main/components/features/reliability/ReasonBox.tsx new file mode 100644 index 0000000..c3de46b --- /dev/null +++ b/src/features/main/components/features/reliability/ReasonBox.tsx @@ -0,0 +1,21 @@ +import { RELIABILITY_REASONS } from '../../../mock'; + +export const ReasonBox = () => { + return ( +
+

임대인 신뢰도 등급 사유

+ {RELIABILITY_REASONS.map((reason) => ( +
+
+ + {reason.name} +
+ {reason.percent} + % +
+
+
+ ))} +
+ ); +}; diff --git a/src/features/main/components/features/reliability/SubrogationPaymentBox.tsx b/src/features/main/components/features/reliability/SubrogationPaymentBox.tsx new file mode 100644 index 0000000..c9977e8 --- /dev/null +++ b/src/features/main/components/features/reliability/SubrogationPaymentBox.tsx @@ -0,0 +1,19 @@ +import { getSubrogationColorClass } from '@/shared'; + +import { LANDLORD_TRUST_DATA } from '../../../mock'; + +export const SubrogationPaymentBox = () => { + return ( +
+

대위변제 이력

+
+ + {LANDLORD_TRUST_DATA.subrogationCount} + + +
+
+ ); +}; diff --git a/src/features/main/components/features/reliability/index.ts b/src/features/main/components/features/reliability/index.ts new file mode 100644 index 0000000..7b4eb68 --- /dev/null +++ b/src/features/main/components/features/reliability/index.ts @@ -0,0 +1,4 @@ +export * from './GradeBox'; +export * from './ReasonBox'; +export * from './SubrogationPaymentBox'; +export * from './MultiHouseBox'; From 07647652a2919757358ae8e210cdba1c46116987 Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 02:13:27 +0900 Subject: [PATCH 05/23] =?UTF-8?q?feat:=20=EC=9E=84=EB=8C=80=EC=9D=B8=20?= =?UTF-8?q?=EC=8B=A0=EB=A2=B0=EB=8F=84=20=EC=84=B9=EC=85=98=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20?= =?UTF-8?q?=EC=9D=B8=EB=8D=B1=EC=8A=A4=20=ED=8C=8C=EC=9D=BC=EC=97=90=20?= =?UTF-8?q?=EB=82=B4=EB=B3=B4=EB=82=B4=EA=B8=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/ui/LandlordReliabilitySection.tsx | 14 ++++++++++++++ src/features/main/ui/index.ts | 1 + 2 files changed, 15 insertions(+) create mode 100644 src/features/main/ui/LandlordReliabilitySection.tsx diff --git a/src/features/main/ui/LandlordReliabilitySection.tsx b/src/features/main/ui/LandlordReliabilitySection.tsx new file mode 100644 index 0000000..5e4c80e --- /dev/null +++ b/src/features/main/ui/LandlordReliabilitySection.tsx @@ -0,0 +1,14 @@ +import { GradeBox, MultiHouseBox, ReasonBox, SubrogationPaymentBox } from '../components'; + +export const LandlordReliabilitySection = () => { + return ( +
+
+ + + + +
+
+ ); +}; diff --git a/src/features/main/ui/index.ts b/src/features/main/ui/index.ts index d8dd51d..4d20ff4 100644 --- a/src/features/main/ui/index.ts +++ b/src/features/main/ui/index.ts @@ -2,3 +2,4 @@ export * from './ChartSection'; export * from './InputSection'; export * from './MapSection'; export * from './RiskAnalysisSummarySection'; +export * from './LandlordReliabilitySection'; From 93a4e5687e530cb6891e3f78191f7b5c2c2b8605 Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 02:13:41 +0900 Subject: [PATCH 06/23] =?UTF-8?q?feat:=20=EB=A9=94=EC=9D=B8=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=97=90=20=EC=9E=84=EB=8C=80=EC=9D=B8=20?= =?UTF-8?q?=EC=8B=A0=EB=A2=B0=EB=8F=84=20=EC=84=B9=EC=85=98=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/pages/main/MainPage.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pages/main/MainPage.tsx b/src/pages/main/MainPage.tsx index 3be8d11..105d252 100644 --- a/src/pages/main/MainPage.tsx +++ b/src/pages/main/MainPage.tsx @@ -1,4 +1,10 @@ -import { ChartSection, InputSection, MapSection, RiskAnalysisSummarySection } from '@/features'; +import { + ChartSection, + InputSection, + LandlordReliabilitySection, + MapSection, + RiskAnalysisSummarySection, +} from '@/features'; export default function MainPage() { return ( @@ -9,6 +15,7 @@ export default function MainPage() {
+ ); } From 986b7428592657047979c39f5b47318dff1d5a6b Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 02:20:37 +0900 Subject: [PATCH 07/23] =?UTF-8?q?refactor:=20=EC=9C=84=ED=97=98=EB=8F=84?= =?UTF-8?q?=20=EC=B0=A8=ED=8A=B8=20=EB=B0=95=EC=8A=A4=EC=97=90=20=EC=A0=9C?= =?UTF-8?q?=EB=AA=A9=20=EC=86=8D=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/main/components/features/chart/RiskChartBox.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/features/main/components/features/chart/RiskChartBox.tsx b/src/features/main/components/features/chart/RiskChartBox.tsx index 559e0bf..3ba5f26 100644 --- a/src/features/main/components/features/chart/RiskChartBox.tsx +++ b/src/features/main/components/features/chart/RiskChartBox.tsx @@ -13,9 +13,10 @@ import { Needle } from '../../common'; type Props = { riskScore: number; + title: string; }; -export const RiskChartBox = ({ riskScore }: Props) => { +export const RiskChartBox = ({ riskScore, title }: Props) => { const gaugeData: GaugeData = getGaugeData(riskScore); const scoreColorClass = getRiskScoreColorClass(riskScore); @@ -24,7 +25,7 @@ export const RiskChartBox = ({ riskScore }: Props) => { return (
-

전세 계약 최종 위험도

+

{title}

위험 점수 : {riskScore} From 081aeb0cd7627dbf6d855e2959950c314329181b Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 03:21:41 +0900 Subject: [PATCH 08/23] =?UTF-8?q?chore:=20=EB=A9=94=EC=9D=B8=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=97=90=20=ED=99=88=20=EC=95=84=EC=9D=B4?= =?UTF-8?q?=EC=BD=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/main/_assets/Home.webp | Bin 0 -> 282 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/features/main/_assets/Home.webp diff --git a/src/features/main/_assets/Home.webp b/src/features/main/_assets/Home.webp new file mode 100644 index 0000000000000000000000000000000000000000..bce6dcffd63b0dcb0c4e3408a0dd487343655ff3 GIT binary patch literal 282 zcmV+#0pg>^Wkmlc0D2Gp z84IrBo7>Q{Az5-Xz9g@)b)y^`Q|dV-|1#!*Sko>6sC^vU5IED@M3?^D^M^72*Qt79 zJyoH0E?KBnP&goV0001R1OS}@DjonP06ujtkw>JWp`kjc0FVxeWdOdwQ7=^Po0Zj8c`}b-SEAP g(RKqg{#{&=TASdhywio13I0L7Ad+yDRo literal 0 HcmV?d00001 From cc336d893568c7b0c257341cc80d2bdd66ce2f53 Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 03:21:55 +0900 Subject: [PATCH 09/23] =?UTF-8?q?feat:=20=EB=A7=A4=EB=AC=BC=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=EC=83=89=EC=83=81=20=EC=A0=95=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/main/constants/index.ts | 1 + src/features/main/constants/property-type.ts | 24 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 src/features/main/constants/property-type.ts diff --git a/src/features/main/constants/index.ts b/src/features/main/constants/index.ts index 5636141..ba50c60 100644 --- a/src/features/main/constants/index.ts +++ b/src/features/main/constants/index.ts @@ -1,2 +1,3 @@ export * from './form-type'; export * from './house-type'; +export * from './property-type'; diff --git a/src/features/main/constants/property-type.ts b/src/features/main/constants/property-type.ts new file mode 100644 index 0000000..d96f334 --- /dev/null +++ b/src/features/main/constants/property-type.ts @@ -0,0 +1,24 @@ +// 기본 매물 타입별 색상 정의 +export const PROPERTY_TYPE_COLORS = { + 오피스텔: '#B27373', // 적갈색 + 원룸: '#73B286', // 연한 초록색 + 투룸: '#7573B2', // 보라색 + 아파트: '#B273AE', // 연한 분홍색 + 복층: '#739EB2', // 청록색 + 빌라: '#FFA500', // 주황색 + 단독주택: '#32CD32', // 라임색 +} as const; + +// 동적 색상 생성을 위한 fallback 색상 배열 +export const FALLBACK_COLORS = [ + '#FF6B6B', // 빨간색 + '#4ECDC4', // 청록색 + '#45B7D1', // 파란색 + '#96CEB4', // 연한 초록색 + '#FFEAA7', // 연한 노란색 + '#DDA0DD', // 연한 보라색 + '#98D8C8', // 민트색 + '#F7DC6F', // 노란색 + '#BB8FCE', // 연한 보라색 + '#85C1E9', // 하늘색 +] as const; From 00df347e0e1c1e5949885efdfeda1fa94c0f4805 Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 03:22:10 +0900 Subject: [PATCH 10/23] =?UTF-8?q?feat:=20=ED=8E=98=EC=9D=B4=EC=A7=80?= =?UTF-8?q?=EB=84=A4=EC=9D=B4=EC=85=98=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/components/common/Pagination.tsx | 50 +++++++++++++++++++ src/features/main/components/common/index.ts | 1 + 2 files changed, 51 insertions(+) create mode 100644 src/features/main/components/common/Pagination.tsx diff --git a/src/features/main/components/common/Pagination.tsx b/src/features/main/components/common/Pagination.tsx new file mode 100644 index 0000000..5fc6f1a --- /dev/null +++ b/src/features/main/components/common/Pagination.tsx @@ -0,0 +1,50 @@ +import { ChevronLeftIcon, ChevronRightIcon } from 'lucide-react'; + +import { Button } from '@/shared'; + +type Props = { + currentPage: number; + setCurrentPage: (page: number) => void; + totalPages: number; +}; + +export const Pagination = ({ currentPage, setCurrentPage, totalPages }: Props) => { + return ( +

+ + + {Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => ( + + ))} + + +
+ ); +}; diff --git a/src/features/main/components/common/index.ts b/src/features/main/components/common/index.ts index e70a782..b4699d7 100644 --- a/src/features/main/components/common/index.ts +++ b/src/features/main/components/common/index.ts @@ -3,3 +3,4 @@ export * from './ChartGrid'; export * from './ChartLineItem'; export * from './LegendLine'; export * from './Needle'; +export * from './Pagination'; From f0225c3dead24606f61e9130fd57cc2e4798d05c Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 03:22:25 +0900 Subject: [PATCH 11/23] =?UTF-8?q?feat:=20=EB=A7=A4=EB=AC=BC=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=EC=A0=95=EC=9D=98=20=EB=B0=8F=20=EC=9D=B8=EB=8D=B1?= =?UTF-8?q?=EC=8A=A4=20=ED=8C=8C=EC=9D=BC=EC=97=90=20=EB=82=B4=EB=B3=B4?= =?UTF-8?q?=EB=82=B4=EA=B8=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/main/types/index.ts | 1 + src/features/main/types/properties-type.type.ts | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 src/features/main/types/properties-type.type.ts diff --git a/src/features/main/types/index.ts b/src/features/main/types/index.ts index 24ae138..8aefa50 100644 --- a/src/features/main/types/index.ts +++ b/src/features/main/types/index.ts @@ -1 +1,2 @@ export * from './house-types.type'; +export * from './properties-type.type'; diff --git a/src/features/main/types/properties-type.type.ts b/src/features/main/types/properties-type.type.ts new file mode 100644 index 0000000..b406212 --- /dev/null +++ b/src/features/main/types/properties-type.type.ts @@ -0,0 +1,6 @@ +export type Property = { + id: number; + type: string; + buildingName: string; + address: string; +}; From af564b1f19a6577234258333366132fbe14efaee Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 03:22:41 +0900 Subject: [PATCH 12/23] =?UTF-8?q?feat:=20=EB=A7=A4=EB=AC=BC=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/main/mock/index.ts | 3 +- src/features/main/mock/property-data.mock.ts | 46 ++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 src/features/main/mock/property-data.mock.ts diff --git a/src/features/main/mock/index.ts b/src/features/main/mock/index.ts index d38240a..0d17208 100644 --- a/src/features/main/mock/index.ts +++ b/src/features/main/mock/index.ts @@ -1,3 +1,4 @@ export * from './chart-data.mock'; -export * from './risk-analysis.mock'; export * from './landlord-reliability.mock'; +export * from './property-data.mock'; +export * from './risk-analysis.mock'; diff --git a/src/features/main/mock/property-data.mock.ts b/src/features/main/mock/property-data.mock.ts new file mode 100644 index 0000000..29cb693 --- /dev/null +++ b/src/features/main/mock/property-data.mock.ts @@ -0,0 +1,46 @@ +import type { Property } from '../types'; + +export const SERVER_PROPERTIES: Property[] = [ + { + id: 1, + type: '오피스텔', + buildingName: '센텀시티 파크빌', + address: '부산 해운대구 센텀시티 대로 123', + }, + { + id: 2, + type: '원룸', + buildingName: '센텀시티 파크빌', + address: '부산 해운대구 센텀시티 대로 123', + }, + { + id: 3, + type: '투룸', + buildingName: '센텀시티 파크빌', + address: '부산 해운대구 센텀시티 대로 123', + }, + { + id: 4, + type: '아파트', + buildingName: '센텀시티 파크빌', + address: '부산 해운대구 센텀시티 대로 123', + }, + { + id: 5, + type: '복층', + buildingName: '센텀시티 파크빌', + address: '부산 해운대구 센텀시티 대로 123', + }, + { + id: 6, + type: '빌라', + buildingName: '센텀시티 파크빌', + address: '부산 해운대구 센텀시티 대로 123', + }, + { + id: 7, + type: '단독주택', + buildingName: '센텀시티 파크빌', + address: '부산 해운대구 센텀시티 대로 123', + }, +]; From 6745e8f0fa4ca587328387b3df567f1a3a465479 Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 03:23:01 +0900 Subject: [PATCH 13/23] =?UTF-8?q?feat:=20=EB=A7=A4=EB=AC=BC=20=EB=A6=AC?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20=EB=B0=95=EC=8A=A4=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/components/features/index.ts | 1 + .../features/property/PropertyListBox.tsx | 61 +++++++++++++++++++ .../components/features/property/index.ts | 1 + .../features/reliability/ReasonBox.tsx | 7 ++- 4 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 src/features/main/components/features/property/PropertyListBox.tsx create mode 100644 src/features/main/components/features/property/index.ts diff --git a/src/features/main/components/features/index.ts b/src/features/main/components/features/index.ts index 3a01a28..2528bb2 100644 --- a/src/features/main/components/features/index.ts +++ b/src/features/main/components/features/index.ts @@ -1,3 +1,4 @@ export * from './form'; export * from './chart'; export * from './reliability'; +export * from './property'; diff --git a/src/features/main/components/features/property/PropertyListBox.tsx b/src/features/main/components/features/property/PropertyListBox.tsx new file mode 100644 index 0000000..fcdca4d --- /dev/null +++ b/src/features/main/components/features/property/PropertyListBox.tsx @@ -0,0 +1,61 @@ +import { useState } from 'react'; + +import HomeIcon from '../../../_assets/Home.webp'; +import { PROPERTY_TYPE_COLORS } from '../../../constants'; +import type { Property } from '../../../types'; +import { Pagination } from '../../common'; + +type Props = { + properties: Property[]; + title: string; +}; + +export const PropertyListBox = ({ properties, title }: Props) => { + const [currentPage, setCurrentPage] = useState(1); + const itemsPerPage = 5; + const totalPages = Math.ceil(properties.length / itemsPerPage); + + const startIndex = (currentPage - 1) * itemsPerPage; + const endIndex = startIndex + itemsPerPage; + const currentProperties = properties.slice(startIndex, endIndex); + + return ( +
+

{title}

+ +
+ {currentProperties.map((property) => ( +
+ home + +
+ {/* 매물 타입 라벨 */} +
+ + {property.type} + + {property.buildingName} +
+ + {/* 상세 주소 */} + {property.address} +
+
+ ))} +
+ + {/* 페이지네이션 */} + +
+ ); +}; diff --git a/src/features/main/components/features/property/index.ts b/src/features/main/components/features/property/index.ts new file mode 100644 index 0000000..f341ae7 --- /dev/null +++ b/src/features/main/components/features/property/index.ts @@ -0,0 +1 @@ +export * from './PropertyListBox'; diff --git a/src/features/main/components/features/reliability/ReasonBox.tsx b/src/features/main/components/features/reliability/ReasonBox.tsx index c3de46b..63adbdd 100644 --- a/src/features/main/components/features/reliability/ReasonBox.tsx +++ b/src/features/main/components/features/reliability/ReasonBox.tsx @@ -4,8 +4,11 @@ export const ReasonBox = () => { return (

임대인 신뢰도 등급 사유

- {RELIABILITY_REASONS.map((reason) => ( -
+ {RELIABILITY_REASONS.map((reason, index) => ( +
{reason.name} From 6f03a70d66c03a1e74b6b71d69eee509a3ad56c5 Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 03:23:13 +0900 Subject: [PATCH 14/23] =?UTF-8?q?feat:=20=EB=A7=A4=EB=AC=BC=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=20=EC=83=89=EC=83=81=20=EC=83=9D=EC=84=B1=20=EB=B0=8F?= =?UTF-8?q?=20=EC=83=89=EC=83=81=20=EC=A0=95=EB=B3=B4=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=20=ED=95=A8=EC=88=98=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/main/utils/index.ts | 1 + src/features/main/utils/property-colors.ts | 41 ++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/features/main/utils/index.ts create mode 100644 src/features/main/utils/property-colors.ts diff --git a/src/features/main/utils/index.ts b/src/features/main/utils/index.ts new file mode 100644 index 0000000..6d2fd2e --- /dev/null +++ b/src/features/main/utils/index.ts @@ -0,0 +1 @@ +export * from './property-colors'; diff --git a/src/features/main/utils/property-colors.ts b/src/features/main/utils/property-colors.ts new file mode 100644 index 0000000..b3c0ace --- /dev/null +++ b/src/features/main/utils/property-colors.ts @@ -0,0 +1,41 @@ +import { FALLBACK_COLORS, PROPERTY_TYPE_COLORS } from '../constants'; + +// 동적 색상 생성 함수 (정의되지 않은 타입용) +const generateDynamicColors = () => { + let colorIndex = 0; + + return (type: string): string => { + // 이미 정의된 타입이면 해당 색상 반환 + if (type in PROPERTY_TYPE_COLORS) { + return PROPERTY_TYPE_COLORS[type as keyof typeof PROPERTY_TYPE_COLORS]; + } + + // 정의되지 않은 타입이면 동적 색상 할당 + const color = FALLBACK_COLORS[colorIndex % FALLBACK_COLORS.length]; + colorIndex++; + return color; + }; +}; + +const getColorForType = generateDynamicColors(); + +/** + * 매물 타입에 따른 색상을 반환하는 함수 + * @param type - 매물 타입 + * @returns 색상 코드 + */ +export const getPropertyTypeColor = (type: string): string => { + return getColorForType(type); +}; + +/** + * 매물 목록에 색상 정보를 추가하는 함수 + * @param properties - 매물 목록 + * @returns 색상 정보가 추가된 매물 목록 + */ +export const addColorsToProperties = (properties: T[]) => { + return properties.map((property) => ({ + ...property, + typeColor: getColorForType(property.type), + })); +}; From a2f379b5b1a049f387a4bbddb44c228ad94f5e4f Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 03:23:22 +0900 Subject: [PATCH 15/23] =?UTF-8?q?chore:=20=EC=9C=84=ED=97=98=EB=8F=84=20?= =?UTF-8?q?=EC=B0=A8=ED=8A=B8=EC=97=90=EC=84=9C=20=EB=94=94=EB=B2=84?= =?UTF-8?q?=EA=B9=85=20=EB=A1=9C=EA=B7=B8=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shared/utils/chart/risk-chart.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/shared/utils/chart/risk-chart.ts b/src/shared/utils/chart/risk-chart.ts index c7ef34f..bcd5e80 100644 --- a/src/shared/utils/chart/risk-chart.ts +++ b/src/shared/utils/chart/risk-chart.ts @@ -87,7 +87,6 @@ export const getGaugeAngle = (score: number): number => { result = 144 + ((normalized - 80) / 20) * 36; } - console.log(`보정점수 : ${normalized} 바늘 위치: ${score}점 → ${result}도`); return result; }; From 785b7e0f476cd711d70696aaa8e5f59f80e49fdc Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 03:23:36 +0900 Subject: [PATCH 16/23] =?UTF-8?q?feat:=20=EB=8C=80=EC=B2=B4=20=EB=A7=A4?= =?UTF-8?q?=EB=AC=BC=20=EC=84=B9=EC=85=98=20=EB=B0=8F=20=EC=9C=84=ED=97=98?= =?UTF-8?q?=20=EC=A0=90=EC=88=98=20=EC=8B=A0=EB=A2=B0=EB=8F=84=20=EB=B9=84?= =?UTF-8?q?=EA=B5=90=20=EC=B0=A8=ED=8A=B8=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/main/ui/AlternativeSection.tsx | 22 +++++++++++++++++++++ src/features/main/ui/index.ts | 2 ++ 2 files changed, 24 insertions(+) create mode 100644 src/features/main/ui/AlternativeSection.tsx diff --git a/src/features/main/ui/AlternativeSection.tsx b/src/features/main/ui/AlternativeSection.tsx new file mode 100644 index 0000000..891bfe8 --- /dev/null +++ b/src/features/main/ui/AlternativeSection.tsx @@ -0,0 +1,22 @@ +import { PropertyListBox, RiskChartBox } from '../components'; +import { SERVER_PROPERTIES } from '../mock'; +import { addColorsToProperties } from '../utils'; + +export const AlternativeSection = () => { + const PROPERTIES_WITH_COLORS = addColorsToProperties(SERVER_PROPERTIES); + + // TODO: 위험 점수 신뢰도 비교 차트 데이터 추가 + const riskScore = 70; + + return ( +
+
+ {/* 왼쪽: 임대인 소유 매물 조회 */} + + + {/* 오른쪽: 임대인 매물별 위험 점수 신뢰도 비교 */} + +
+
+ ); +}; diff --git a/src/features/main/ui/index.ts b/src/features/main/ui/index.ts index 4d20ff4..eba819b 100644 --- a/src/features/main/ui/index.ts +++ b/src/features/main/ui/index.ts @@ -3,3 +3,5 @@ export * from './InputSection'; export * from './MapSection'; export * from './RiskAnalysisSummarySection'; export * from './LandlordReliabilitySection'; +export * from './LandlordPropertySection'; +export * from './AlternativeSection'; From 0e32223a4f7c576cb7fc60335ec678bd09d783bc Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 03:23:46 +0900 Subject: [PATCH 17/23] =?UTF-8?q?feat:=20=EC=9E=84=EB=8C=80=EC=9D=B8=20?= =?UTF-8?q?=EB=A7=A4=EB=AC=BC=20=EC=84=B9=EC=85=98=20=EB=B0=8F=20=EC=9C=84?= =?UTF-8?q?=ED=97=98=20=EC=A0=90=EC=88=98=20=EC=8B=A0=EB=A2=B0=EB=8F=84=20?= =?UTF-8?q?=EB=B9=84=EA=B5=90=20=EC=B0=A8=ED=8A=B8=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/ui/LandlordPropertySection.tsx | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/features/main/ui/LandlordPropertySection.tsx diff --git a/src/features/main/ui/LandlordPropertySection.tsx b/src/features/main/ui/LandlordPropertySection.tsx new file mode 100644 index 0000000..ddc1784 --- /dev/null +++ b/src/features/main/ui/LandlordPropertySection.tsx @@ -0,0 +1,23 @@ +import { PropertyListBox, RiskChartBox } from '../components'; +import { SERVER_PROPERTIES } from '../mock'; +import { addColorsToProperties } from '../utils'; + +export const LandlordPropertySection = () => { + // 서버 데이터에 색상 정보 추가 + const PROPERTIES_WITH_COLORS = addColorsToProperties(SERVER_PROPERTIES); + + // TODO: 위험 점수 신뢰도 비교 차트 데이터 추가 + const riskScore = 70; + + return ( +
+
+ {/* 왼쪽: 임대인 소유 매물 조회 */} + + + {/* 오른쪽: 임대인 매물별 위험 점수 신뢰도 비교 */} + +
+
+ ); +}; From 16bac0d38ec22a9f5bb5c54a0dda8514c7b69694 Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 03:23:57 +0900 Subject: [PATCH 18/23] =?UTF-8?q?feat:=20=EC=9C=84=ED=97=98=EB=8F=84=20?= =?UTF-8?q?=EC=B0=A8=ED=8A=B8=EC=97=90=20=EC=A0=9C=EB=AA=A9=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/features/main/ui/RiskAnalysisSummarySection.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/features/main/ui/RiskAnalysisSummarySection.tsx b/src/features/main/ui/RiskAnalysisSummarySection.tsx index 0a134cb..67a8987 100644 --- a/src/features/main/ui/RiskAnalysisSummarySection.tsx +++ b/src/features/main/ui/RiskAnalysisSummarySection.tsx @@ -10,7 +10,10 @@ export const RiskAnalysisSummarySection = () => { {/* 메인 위험도 분석 섹션 */}
{/* 왼쪽: 위험도 게이지 */} - + {/* 오른쪽: 핵심 위험 요인 */}
From 5b2b7c7ddf5f5fd57e36385286d5ce0c289b87f8 Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 03:24:08 +0900 Subject: [PATCH 19/23] =?UTF-8?q?feat:=20=EB=A9=94=EC=9D=B8=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=EC=97=90=20=EB=8C=80=EC=B2=B4=20=EB=A7=A4?= =?UTF-8?q?=EB=AC=BC=20=EC=84=B9=EC=85=98=20=EB=B0=8F=20=EC=9E=84=EB=8C=80?= =?UTF-8?q?=EC=9D=B8=20=EB=A7=A4=EB=AC=BC=20=EC=84=B9=EC=85=98=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/pages/main/MainPage.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pages/main/MainPage.tsx b/src/pages/main/MainPage.tsx index 105d252..8d07d37 100644 --- a/src/pages/main/MainPage.tsx +++ b/src/pages/main/MainPage.tsx @@ -1,6 +1,8 @@ import { + AlternativeSection, ChartSection, InputSection, + LandlordPropertySection, LandlordReliabilitySection, MapSection, RiskAnalysisSummarySection, @@ -16,6 +18,8 @@ export default function MainPage() { + +
); } From 631624d241211a32cdb35d7f195d58d74cbbb22d Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 03:28:23 +0900 Subject: [PATCH 20/23] =?UTF-8?q?deploy:=20PR=20=EC=83=9D=EC=84=B1=20?= =?UTF-8?q?=EC=8B=9C=20=EC=9D=91=EB=8B=B5=20=EA=B2=80=EC=A6=9D=20=EB=B0=8F?= =?UTF-8?q?=20=EB=8C=80=EA=B8=B0=20=EC=8B=9C=EA=B0=84=20=EC=A1=B0=EC=A0=95?= =?UTF-8?q?,=20=ED=83=80=EC=9E=84=EC=95=84=EC=9B=83=20=EC=8B=9C=EA=B0=84?= =?UTF-8?q?=20=EC=A6=9D=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto-pr.yml | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/.github/workflows/auto-pr.yml b/.github/workflows/auto-pr.yml index a76b8ab..2b67a13 100644 --- a/.github/workflows/auto-pr.yml +++ b/.github/workflows/auto-pr.yml @@ -157,7 +157,7 @@ jobs: // 429 에러 (Rate Limit)인 경우 재시도 대기 if (response.status === 429 && attempt < maxRetries) { - const waitTime = Math.pow(2, attempt) * 1000; // 지수 백오프 + const waitTime = Math.pow(2, attempt) * 2000; console.log(`Rate limit 초과. ${waitTime}ms 후 재시도...`); await new Promise(resolve => setTimeout(resolve, waitTime)); lastError = error; @@ -199,9 +199,20 @@ jobs: throw new Error(`Invalid or empty text response from Gemini.\nParts: ${JSON.stringify(candidate.content.parts)}`); } + // 응답 검증 - 최소 길이 확인 + if (aiResponse.length < 100) { + throw new Error(`Generated response is too short (${aiResponse.length} characters). This might indicate an incomplete response.`); + } + aiResponse = aiResponse.replace(/^```markdown\n/, '').replace(/\n```$/, ''); - console.log('Generated PR body:', aiResponse); + console.log('Generated PR body length:', aiResponse.length); + console.log('Generated PR body preview:', aiResponse.substring(0, 200) + '...'); + + // 출력 설정 전에 잠시 대기 + await new Promise(resolve => setTimeout(resolve, 1000)); + core.setOutput('body', aiResponse); + console.log('PR body successfully set to output'); return; // 성공 시 함수 종료 } catch (error) { @@ -213,7 +224,7 @@ jobs: } // 마지막 시도가 아니면 잠시 대기 - const waitTime = 1000 * attempt; + const waitTime = 2000 * attempt; // 대기 시간 증가 console.log(`${waitTime}ms 후 재시도...`); await new Promise(resolve => setTimeout(resolve, waitTime)); } @@ -224,6 +235,7 @@ jobs: return; env: GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} + timeout-minutes: 10 # 타임아웃 시간 증가 - name: Create Pull Request if: steps.check_pr.outputs.exists == 'false' @@ -231,9 +243,23 @@ jobs: GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} PR_BODY: ${{ steps.generate-body.outputs.body }} run: | + # PR body가 비어있는지 확인 + if [ -z "$PR_BODY" ]; then + echo "Error: PR body is empty. Skipping PR creation." + exit 1 + fi + + echo "PR body length: ${#PR_BODY}" + echo "PR body preview: ${PR_BODY:0:200}..." + + # 잠시 대기 후 PR 생성 + sleep 2 + gh pr create \ --base main \ --head ${{ github.ref_name }} \ --title "${{ github.ref_name }}" \ --body "$PR_BODY" \ - --assignee ${{ github.actor }} \ No newline at end of file + --assignee ${{ github.actor }} + + echo "Pull Request created successfully!" \ No newline at end of file From c9815faf55a78304427f7b2eb65891e3e7b57a66 Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 03:33:23 +0900 Subject: [PATCH 21/23] =?UTF-8?q?refactor:=20=EB=A7=A4=EB=AC=BC=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EB=B0=95=EC=8A=A4=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=A7=A4=EB=AC=BC=20=ED=83=80=EC=9E=85=20=EC=83=89?= =?UTF-8?q?=EC=83=81=20=EC=B2=98=EB=A6=AC=20=EB=B0=A9=EC=8B=9D=EC=9D=84=20?= =?UTF-8?q?=EC=83=81=EC=88=98=EC=97=90=EC=84=9C=20=EC=9C=A0=ED=8B=B8?= =?UTF-8?q?=EB=A6=AC=ED=8B=B0=20=ED=95=A8=EC=88=98=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/components/features/property/PropertyListBox.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/features/main/components/features/property/PropertyListBox.tsx b/src/features/main/components/features/property/PropertyListBox.tsx index fcdca4d..a2561c9 100644 --- a/src/features/main/components/features/property/PropertyListBox.tsx +++ b/src/features/main/components/features/property/PropertyListBox.tsx @@ -1,8 +1,8 @@ import { useState } from 'react'; import HomeIcon from '../../../_assets/Home.webp'; -import { PROPERTY_TYPE_COLORS } from '../../../constants'; import type { Property } from '../../../types'; +import { getPropertyTypeColor } from '../../../utils'; import { Pagination } from '../../common'; type Props = { @@ -34,8 +34,7 @@ export const PropertyListBox = ({ properties, title }: Props) => { {property.type} From 83ec6310210b13ae60951e1bed659d88b9b516ff Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 03:34:10 +0900 Subject: [PATCH 22/23] =?UTF-8?q?refactor:=20=EB=A7=A4=EB=AC=BC=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EB=B0=95=EC=8A=A4=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EC=83=89=EC=83=81=20=EC=A0=95=EB=B3=B4=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=EB=A5=BC=20=EC=A0=9C=EA=B1=B0=ED=95=98=EA=B3=A0=20?= =?UTF-8?q?=EC=84=9C=EB=B2=84=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/main/ui/LandlordPropertySection.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/features/main/ui/LandlordPropertySection.tsx b/src/features/main/ui/LandlordPropertySection.tsx index ddc1784..e038893 100644 --- a/src/features/main/ui/LandlordPropertySection.tsx +++ b/src/features/main/ui/LandlordPropertySection.tsx @@ -1,11 +1,7 @@ import { PropertyListBox, RiskChartBox } from '../components'; import { SERVER_PROPERTIES } from '../mock'; -import { addColorsToProperties } from '../utils'; export const LandlordPropertySection = () => { - // 서버 데이터에 색상 정보 추가 - const PROPERTIES_WITH_COLORS = addColorsToProperties(SERVER_PROPERTIES); - // TODO: 위험 점수 신뢰도 비교 차트 데이터 추가 const riskScore = 70; @@ -13,7 +9,7 @@ export const LandlordPropertySection = () => {
{/* 왼쪽: 임대인 소유 매물 조회 */} - + {/* 오른쪽: 임대인 매물별 위험 점수 신뢰도 비교 */} From 24480f89747824ce6869f92e41a06d596b248f0f Mon Sep 17 00:00:00 2001 From: Dobbymin Date: Fri, 22 Aug 2025 03:40:23 +0900 Subject: [PATCH 23/23] =?UTF-8?q?refactor:=20=EB=A7=A4=EB=AC=BC=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=20=EC=83=89=EC=83=81=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=EC=9D=84=20=EB=8F=99=EC=A0=81=20=ED=95=B4?= =?UTF-8?q?=EC=8B=9C=20=EA=B8=B0=EB=B0=98=EC=9C=BC=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/main/utils/property-colors.ts | 34 +++++++++------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/src/features/main/utils/property-colors.ts b/src/features/main/utils/property-colors.ts index b3c0ace..3ee1b6e 100644 --- a/src/features/main/utils/property-colors.ts +++ b/src/features/main/utils/property-colors.ts @@ -1,31 +1,23 @@ import { FALLBACK_COLORS, PROPERTY_TYPE_COLORS } from '../constants'; -// 동적 색상 생성 함수 (정의되지 않은 타입용) -const generateDynamicColors = () => { - let colorIndex = 0; - - return (type: string): string => { - // 이미 정의된 타입이면 해당 색상 반환 - if (type in PROPERTY_TYPE_COLORS) { - return PROPERTY_TYPE_COLORS[type as keyof typeof PROPERTY_TYPE_COLORS]; - } - - // 정의되지 않은 타입이면 동적 색상 할당 - const color = FALLBACK_COLORS[colorIndex % FALLBACK_COLORS.length]; - colorIndex++; - return color; - }; -}; - -const getColorForType = generateDynamicColors(); - /** * 매물 타입에 따른 색상을 반환하는 함수 * @param type - 매물 타입 * @returns 색상 코드 */ export const getPropertyTypeColor = (type: string): string => { - return getColorForType(type); + // 이미 정의된 타입이면 해당 색상 반환 + if (type in PROPERTY_TYPE_COLORS) { + return PROPERTY_TYPE_COLORS[type as keyof typeof PROPERTY_TYPE_COLORS]; + } + + // 정의되지 않은 타입이면 해시를 기반으로 동적 색상 할당 + let hash = 0; + for (let i = 0; i < type.length; i++) { + hash = type.charCodeAt(i) + ((hash << 5) - hash); + } + const index = Math.abs(hash) % FALLBACK_COLORS.length; + return FALLBACK_COLORS[index]; }; /** @@ -36,6 +28,6 @@ export const getPropertyTypeColor = (type: string): string => { export const addColorsToProperties = (properties: T[]) => { return properties.map((property) => ({ ...property, - typeColor: getColorForType(property.type), + typeColor: getPropertyTypeColor(property.type), })); };