Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @Dobbymin, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request significantly enhances the main page user interface by introducing three new sections: 'Alternative Properties', 'Landlord Properties', and 'Landlord Reliability'. These additions aim to provide users with a richer and more detailed view of property listings and landlord trust information. The changes include the development of new, reusable UI components such as a pagination system and property list boxes, alongside specialized components for visualizing landlord reliability data. The update also incorporates new data structures and utility functions for dynamic styling and data presentation, making the main page more informative and interactive.
Highlights
- Main Page UI Expansion: Three new dedicated sections have been added to the main page: 'Alternative Properties', 'Landlord Properties', and 'Landlord Reliability', significantly expanding the information available to users.
- Reusable Pagination Component: A reusable
Paginationcomponent has been implemented, enhancing navigation for property listings within the new sections. - Property Listing and Display: The
PropertyListBoxcomponent was developed to display property details, featuring dynamic color coding based on property types and integrating pagination. - Landlord Reliability Visualization: A suite of components (
GradeBox,MultiHouseBox,ReasonBox,SubrogationPaymentBox) has been introduced to visually represent various aspects of landlord reliability, including grades, multi-house ownership, and subrogation history. - Chart Component Reusability: The
RiskChartBoxcomponent was made more generic by adding a configurable title, allowing it to be reused across different risk assessment contexts. - Dynamic Styling and Color Utilities: New utility functions and CSS classes were added to dynamically assign colors to property types and to visually categorize landlord reliability metrics.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
메인 페이지 UI 개선을 위한 PR 잘 보았습니다. 대체 매물, 임대인 매물, 임대인 신뢰도 등 새로운 정보 섹션과 관련 컴포넌트들을 추가하여 사용자에게 더 풍부한 정보를 제공하려는 목표가 코드에 잘 반영되었습니다. 전반적으로 컴포넌트 분리와 재사용성이 좋지만, 몇 가지 개선점을 제안합니다. 특히, 페이지네이션 컴포넌트의 확장성, 일부 컴포넌트에서의 타입 안정성 및 일관성, 그리고 Tailwind CSS 클래스 사용법에 대한 검토가 필요해 보입니다. 자세한 내용은 아래 개별 코멘트를 참고해주세요.
| type Props = { | ||
| properties: Property[]; | ||
| title: string; | ||
| }; |
There was a problem hiding this comment.
properties prop으로 addColorsToProperties의 결과가 전달되므로, typeColor 속성이 포함되어 있습니다. 타입 안정성을 높이고 typeColor를 컴포넌트 내에서 사용하기 위해 prop 타입을 (Property & { typeColor: string })[]로 명시적으로 지정하는 것이 좋습니다.
| type Props = { | |
| properties: Property[]; | |
| title: string; | |
| }; | |
| type Props = { | |
| properties: (Property & { typeColor: string })[]; | |
| title: string; | |
| }; |
| className='flex h-6 w-16 items-center justify-center rounded-xs text-sm font-medium text-white' | ||
| style={{ | ||
| backgroundColor: | ||
| PROPERTY_TYPE_COLORS[property.type as keyof typeof PROPERTY_TYPE_COLORS], | ||
| }} | ||
| > | ||
| {property.type} | ||
| </span> |
There was a problem hiding this comment.
properties prop에 typeColor가 포함되어 있으므로, 이를 직접 사용하는 것이 좋습니다. 현재 방식은 as 키워드를 사용한 불안전한 타입 캐스팅이며, PROPERTY_TYPE_COLORS에 정의되지 않은 타입에 대한 처리가 누락되어 있습니다. property.typeColor를 사용하면 코드가 더 안전하고 일관성 있어집니다.
<span
className='flex h-6 w-16 items-center justify-center rounded-xs text-sm font-medium text-white'
style={{
backgroundColor: property.typeColor,
}}
>
{property.type}
</span>
| <span className='text-landlord-reliability font-bold text-blue-500'> | ||
| {LANDLORD_TRUST_DATA.ownedUnsoldCount} | ||
| </span> | ||
| <span className='mb-25 text-5xl font-semibold text-black'>채</span> |
| > | ||
| {LANDLORD_TRUST_DATA.subrogationCount} | ||
| </span> | ||
| <span className='mb-25 text-5xl font-semibold text-black'>회</span> |
| const riskScore = 70; | ||
|
|
||
| return ( | ||
| <div className='mx-auto my-10 w-full max-w-7xl rounded-lg bg-white px-15 py-10 shadow-[0px_4px_30px_0px_#0000001A]'> |
There was a problem hiding this comment.
.px-15 {
padding-inline: calc(var(--spacing) * 15) /* 3.75rem = 60px */;
}정의되어있는데?
There was a problem hiding this comment.
네, px-15 클래스가 커스텀 CSS로 정의되어 있다면 말씀하신 대로 정상적으로 동작합니다. 제 이전 코멘트는 Tailwind CSS의 기본 유틸리티 클래스 스케일에 해당 클래스가 포함되어 있지 않다는 점을 지적한 것이었습니다. 커스텀 유틸리티 클래스를 사용하시는 경우, 해당 정의가 tailwind.config.js 또는 전역 CSS 파일 등에서 명확하게 관리되고 다른 개발자들이 쉽게 찾을 수 있도록 하는 것이 좋습니다. 확인해주셔서 감사합니다.
There was a problem hiding this comment.
아니야 기본으로 정의되어있었어. 이건 너의 오류야.
|
|
||
| export const LandlordReliabilitySection = () => { | ||
| return ( | ||
| <div className='mx-auto my-10 w-full max-w-7xl rounded-lg bg-white px-15 py-10 shadow-[0px_4px_30px_0px_#0000001A]'> |
| {Array.from({ length: totalPages }, (_, i) => i + 1).map((page) => ( | ||
| <Button | ||
| variant='ghost' | ||
| key={page} | ||
| onClick={() => setCurrentPage(page)} | ||
| className={`size-8 rounded-full ${ | ||
| currentPage === page | ||
| ? 'bg-lighthouse-blue text-white' | ||
| : 'text-[#6B7684] hover:bg-[#E6E8EA]' | ||
| }`} | ||
| > | ||
| {page} | ||
| </Button> | ||
| ))} |
| <div> | ||
| <h1 className='text-3xl font-bold'>다주택자</h1> | ||
| <div className='flex w-full items-end justify-center'> | ||
| <span className='text-landlord-reliability font-bold text-blue-500'> |
There was a problem hiding this comment.
색상 값이 text-blue-500으로 하드코딩되어 있습니다. 다주택자 수에 따른 색상을 반환하는 getMultiHouseColorClass 유틸리티 함수가 이미 shared/utils/chart/chart-colors.ts에 구현되어 있으니, 이를 사용하여 일관성을 유지하고 향후 유지보수를 용이하게 하는 것이 좋습니다.
이 변경을 적용하려면 파일 상단에 import { getMultiHouseColorClass } from '@/shared';를 추가해야 합니다.
| <span className='text-landlord-reliability font-bold text-blue-500'> | |
| <span className={`text-landlord-reliability font-bold ${getMultiHouseColorClass(LANDLORD_TRUST_DATA.ownedUnsoldCount)}`}> |
| 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(); |
There was a problem hiding this comment.
generateDynamicColors 함수는 클로저를 사용하여 colorIndex 상태를 유지합니다. 이 방식은 함수 호출 순서에 따라 동일한 매물 타입에 다른 색상이 할당될 수 있어 예측 가능성이 떨어질 수 있습니다. 예를 들어, 렌더링 순서가 변경되면 색상이 달라질 수 있습니다. 매물 타입 문자열을 해시하여 FALLBACK_COLORS 배열의 인덱스를 결정하는 stateless한 방식으로 변경하면, 항상 동일한 타입에 동일한 색상을 보장하여 더 안정적인 구현이 될 것입니다.
const getColorForType = (type: string): string => {
// 이미 정의된 타입이면 해당 색상 반환
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];
};| result = 144 + ((normalized - 80) / 20) * 36; | ||
| } | ||
|
|
||
| console.log(`보정점수 : ${normalized} 바늘 위치: ${score}점 → ${result}도`); |
📝 요약 (Summary)
메인 페이지에 '대체 매물', '임대인 매물', '임대인 신뢰도' 등 새로운 정보 섹션과 관련 차트 및 컴포넌트들을 추가하여 사용자에게 더 풍부한 매물 및 임대인 신뢰도 정보를 제공합니다.
✅ 주요 변경 사항 (Key Changes)
💻 상세 구현 내용 (Implementation Details)
대체 매물 섹션,임대인 매물 섹션,임대인 신뢰도 섹션을 추가했습니다. 이를 통해 사용자에게 다양한 매물 정보와 임대인의 신뢰도 관련 데이터를 시각적으로 제공하여 서비스 활용도를 높였습니다.임대인 매물 섹션 컴포넌트,대체 매물 섹션 컴포넌트,임대인 신뢰도 섹션 컴포넌트를 독립적으로 구현했습니다.위험 점수 신뢰도 비교 차트 컴포넌트,매물 리스트 박스 컴포넌트,페이지네이션 컴포넌트등 재사용 가능한 UI 컴포넌트들을 개발하여 메인 페이지의 복잡성을 관리하고 코드의 모듈성을 향상시켰습니다.신뢰도 관련 컴포넌트들을 추가하여 임대인 신뢰도 섹션 내에서 다양한 신뢰도 정보를 구조화하고 효율적으로 표시할 수 있도록 지원합니다.