[fix]: 커밋 메시지 가독성 및 Detail 컴포넌트 UI 레이아웃 개선 #828#829
Conversation
### 관련 타입 수정 - LinkedMessage 타입 정의 및 적용 - Detail, Content 컴포넌트 타입 안정성 향상 ### 기능 수정 - 커밋 메시지 제목과 본문 분리 파싱 및 표시 - GitHub 이슈 링크 자동 변환 기능 복구 - 마우스 오버 시 본문 표시 기능 구현 ### 스타일 수정 - Detail 컴포넌트: 아바타를 제목 옆에 배치, 메타정보 한 줄 표시 - Summary 컴포넌트: 제목만 표시하도록 단순화 - 호버 효과 및 애니메이션 개선 - 불필요한 div 구조 정리 및 레이아웃 최적화 ### 개선 효과 - 커밋 메시지 가독성 대폭 향상 - UI 레이아웃의 직관성 개선 - 코드 구조 단순화 및 유지보수성 향상
ytaek
left a comment
There was a problem hiding this comment.
잘 정리되었으면!! 했던 가려운 부분을 팍 긁어주셨네요!!!
전체적으로 LGGGTM!!!입니다!!
@2Estella님,님, 추가로 중간중간에 구조적으로 refactoring할 부분들이 보이는 것 같은데용.
- refactoring 할 item들을 이슈로 등록하시고,
- 해당 PR merge 하신 다음에!
- 이슈에 본인 할 당 후 다음 PR로 refactoring 진행하시면 좋을 것 같습니다!
refactoring해서 별도의 ts logic들이 튀어나오면 거기에 대해 Test case를 추가하는 것도 별도의 추가 task 로 잡으면 좋을 것 같습니다 👍
|
|
||
| useEffect(() => { | ||
| const processMessage = (message: string) => { | ||
| // GitHub 이슈 번호 패턴: #123 또는 (#123) |
There was a problem hiding this comment.
에서도 얘기했지만, 주석은 영어로 하면 좋을 것 같습니다.
저는 필요없다면 주석 없이 코드로 얘기하는걸 선호하긴 합니다 : )
예을 들자면, regex 변수 이름을 githubIssuePatternRegex 라고 짓는다던지요 😸
| }; | ||
|
|
||
| useEffect(() => { | ||
| const processMessage = (message: string) => { |
There was a problem hiding this comment.
전체적으로 processMessage function이 길어져서
component를 읽기가 조금 힘들어지는 경향이 있는 것 같습니다.
요렇게 긴건 extract method해서 다른 곳에 옮겨놓는 것도 좋을 것 같습니다!!
(다음 PR에서 refactoring으로 새로/따로 올려주시면 리뷰하기 편할 것 같습니다!!!)
There was a problem hiding this comment.
함수 내 헬퍼함수를 만들면 내부로직을 보지 않아도 processMessage가 어떤 역할을 하는 함수인지 흐름을 따라가기 쉬워질 것 같아요!
주석으로 나눠진 코드 덩어리마다 헬퍼함수를 만드는 것도 좋을 것 같습니다! 추상화가 너무 과하다고 생각하신다면 두번째 주석만 헬퍼함수로 추출해도 좋을 것 같은데 어떻게 생각하시나요??
이슈 번호 앞의 텍스트 추가, 이슈 번호를 링크로 변환, 마지막 부분 추가
| const processedTitle = processMessage(title); | ||
| const processedBody = body ? processMessage(body) : null; | ||
|
|
||
| setLinkedMessage({ |
There was a problem hiding this comment.
LinkedMessage라는게 어떤 의미일까요?
git이나 github 쪽에서는 저는 잘 못 본 것 같아서 여쭤봅니당!!
| <div className="commit-item__message-container"> | ||
| <div className="commit-message"> | ||
| <div className="commit-message__header"> |
There was a problem hiding this comment.
(html 잘몰라서 여쭤봅니당,,,어려워요 ㅜ.ㅜ) div가 많이 중첩되는데, 줄일 수 있는 방법은 없을까요?
| const matchedStrNum: string = matchedStr.substring(1); | ||
| const linkIssues = `https://github.com/${owner}/${repo}/issues/${matchedStrNum}`; | ||
| acc.push( | ||
| const processMessage = (message: string) => { |
There was a problem hiding this comment.
에서도 동일한 내용이 있는 것 같습니다!!
공용화 시킬 수 있는 부분은 공용화 해도 좋을 것 같아요!!
| parts.push( | ||
| <a | ||
| href={linkIssues} | ||
| key={`issues-${matchedStr}`} | ||
| className="summary__commit-link" | ||
| key={`issue-${issueNumber}-${match.index}`} | ||
| href={issueLink} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| className="summary__commit-issue-link" | ||
| title={`GitHub Issue #${issueNumber}`} | ||
| > | ||
| {matchedStr} | ||
| {match[1]} | ||
| </a> | ||
| ); |
There was a problem hiding this comment.
useEffect안에 jsx 가 섞여 있긴 한데, 이런 경우는 따로 component로 빼는 것도 방법일 것 같습니다!
grapefruit13
left a comment
There was a problem hiding this comment.
UI가 많이 개선되었네요 고생하셨습니다!
다만 커밋양을 잘게 쪼개서 PR 올려주시면 더 좋을 것 같습니다 !!
코드보면서 궁금한 점들 코멘트 달았는데 시간되실 때 봐주십쇼👍🏻👍🏻
| {(() => { | ||
| const messageLines = message.split("\n"); | ||
| const title = messageLines[0]; | ||
| return linkedMessage.title.length > 0 ? linkedMessage.title : title; | ||
| })()} |
There was a problem hiding this comment.
여기서 즉시 실행 함수를 사용하신 이유가 궁금합니다!!
| .commit-item__right { | ||
| display: flex; | ||
| flex: 1; | ||
| margin-left: 0.125rem; // 아주 미세한 여백 |
There was a problem hiding this comment.
이 부분은 주석없이 코드만 봐도 이해가 충분할 것 같습니다 ㅎㅎ
| {(() => { | ||
| const messageLines = message.split("\n"); | ||
| const body = messageLines | ||
| .slice(1) | ||
| .filter((line: string) => line.trim()) | ||
| .join("\n"); | ||
|
|
||
| return body ? ( | ||
| <div className="commit-message__body">{linkedMessage.body ? linkedMessage.body : body}</div> | ||
| ) : null; | ||
| })()} |
There was a problem hiding this comment.
여기도 IIFE를 특별히 사용하신 이유가 있는지 궁금합니다 ㅎㅎ
| gap: 0.75rem; | ||
| margin-bottom: 0.5rem; | ||
|
|
||
| // 아바타를 맨 앞에 배치 |
| } | ||
|
|
||
| .commit-item__right { | ||
| display: none; // 오른쪽 레이아웃 숨김 |
There was a problem hiding this comment.
이 부분도 마찬가지입니다! css는 특히 주석없이도 이해가 어렵지 않아서 주석은 웬만하면 없어도 될 것 같습니다 ㅎㅎ
SingTheCode
left a comment
There was a problem hiding this comment.
githru 사용할 때마다 항상 눈에 걸리던 부분인데 깔끔하게 구현해주셨네요ㅎㅎ 사용성이 대폭 개선된 것 같아요ㅎㅎ 고생하셨습니다!!!
Detail.tsx, Content.tsx에 중복된 코드들이 조금 보여서 중복제거까지 해주시면 너무 좋을 것 같아요ㅎㅎ
추출할 수 있는 함수는 이정도 일 것 같아요!
- GitHub 이슈번호를 링크로 변환하는 함수
- 커밋 메세지를 제목과 본문으로 분리하는 함수
- 커밋 메시지에서 GitHub 이슈 링크를 처리하여
LinkedMessage객체를 생성하는 함수
| const messageLines = message.split("\n"); | ||
| const title = messageLines[0]; | ||
| return linkedMessage.title.length > 0 ? linkedMessage.title : title; | ||
| })()} |
There was a problem hiding this comment.
함수 추출해서 사용하는 것도 가독성에 좋을 것 같습니다ㅎㅎ 그리고 const title = message.split("\n")[0];로 바로 title을 사용해도 괜찮을 것 같아요ㅎㅎ
| }; | ||
|
|
||
| useEffect(() => { | ||
| const processMessage = (message: string) => { |
There was a problem hiding this comment.
함수 내 헬퍼함수를 만들면 내부로직을 보지 않아도 processMessage가 어떤 역할을 하는 함수인지 흐름을 따라가기 쉬워질 것 같아요!
주석으로 나눠진 코드 덩어리마다 헬퍼함수를 만드는 것도 좋을 것 같습니다! 추상화가 너무 과하다고 생각하신다면 두번째 주석만 헬퍼함수로 추출해도 좋을 것 같은데 어떻게 생각하시나요??
이슈 번호 앞의 텍스트 추가, 이슈 번호를 링크로 변환, 마지막 부분 추가
| const info = commitNodeList[circleIndex].commit.message; | ||
| tooltip.text(info); | ||
| const { message } = commitNodeList[circleIndex].commit; | ||
| const messageLines = message.split("\n"); |
There was a problem hiding this comment.
title과 body를 추출하는 로직이 중복되는 것 같은데 함수로 추출해서 중복을 제거하는 것이 좋을 것 같습니다ㅎㅎ
There was a problem hiding this comment.
추후 작업으로 Issue #880 에서 코드리뷰 달린 리팩토링 내용들 진행하겠습니다!
Related issue
Closes #828
Result
Before:
After:
Work list
Discussion
주요 변경사항
기술적 고려사항
테스트 시나리오