Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[view] 선택된 클러스터의 정보 표시 #664

Merged
merged 6 commits into from
Aug 25, 2024
Merged

Conversation

lxxmnmn
Copy link
Contributor

@lxxmnmn lxxmnmn commented Aug 23, 2024

Related issue

#564

Result

githru-564

Work list

1. 선택된 클러스터 강조

선택된 클러스터를 더 명확하게 구분할 수 있도록 배경 색상을 부여하고 여백을 조절했습니다.

2. 선택된 클러스터 정보 표시

선택된 클러스터의 정보를 모아서 보여주기 위해 Summary 목록 상단에 FilteredClusters 컴포넌트를 추가했습니다.

  • "Clusters" 버튼을 클릭하면 드롭다운 리스트가 보여집니다.
  • 리스트 항목의 ❌ 버튼을 클릭하면 선택을 해제할 수 있습니다.

3. 태그 구조 변경

FilteredClusters 컴포넌트를 추가함에 따라 HTML 태그 구조를 변경했습니다.

  • Summary 컴포넌트를 불필요하게 감싸고 있던 div를 제거했습니다.
  • 목적이 동일한 FilteredAuthorsFilteredClusters를 하나의 div에 담았습니다.
    • 이 컨테이너는 선택된 클러스터가 있을 경우에만 표시합니다.

Discussion

  1. 클러스터를 일괄 선택 해제하는 기능을 나중에 추가해도 좋을 것 같습니다.
  2. message의 길이가 대체로 길기 때문에 여러 개를 선택할 경우를 고려하여 드롭다운 리스트 형태로 구현했습니다.
    더 적합한 UI가 있다면 편하게 제안해주세요! 👐

@lxxmnmn lxxmnmn added this to the v0.7.1 milestone Aug 23, 2024
@lxxmnmn lxxmnmn self-assigned this Aug 23, 2024
@lxxmnmn lxxmnmn requested review from a team as code owners August 23, 2024 06:50
Copy link
Contributor

@ytaek ytaek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사용자의 선택을 명시적으로 보여주는 아주 필요했던 기능인 것 같습니다!!! 👍👍👍

몇가지 comment남겼는데, 주로 naming에 관한 comment 이고,
요즘은 별도 주석없이 코드에 context를 다 녹여서 얘기하자.. 코드로 말하자.. 이런 추세이기도 하고
타인이 코드 해석할 때에도 이름으로 기능들을 유추하기 때문에,
naming은 조금 신경써서 작업하면 좋을 것 같습니다 😸

<div className="selected-container">
{selectedClusters.length > 0 && <p>Authors:</p>}
<div className="selected-content">
<div className="selected__content">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pcwadarong 님하고도 잠깐 얘기한 것 같은데,
이번 기회에 className등의 scss 관련 naming convention 도 정하면 좋을 것 같습니다.
해당 부분 이슈로 생성부탁드리겠습니다!
(아 이미 만들어져있나요? ;; )

const { selectedData, setSelectedData } = useGlobalData();
const selectedClusters = getInitData(selectedData);

const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

El 이 Element를 얘기하는거라면, full name으로 적어주시면 감사하겠습니다.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ytaek
mui Menu의 props 명이 anchorEl이라 mui에 사용되는 state인지 쉽게 알 수 있어서 저는 full name이 아니더라도 좋은 것 같더라구요 🧐

props로만 사용되는 경우(지금 같은 상황!)에도 가급적 full name으로 적는게 코드 유지보수 관점에서 더 나은 건가요? 궁금합니다! 💭💭

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ytaek mui Menu의 props 명이 anchorEl이라 mui에 사용되는 state인지 쉽게 알 수 있어서 저는 full name이 아니더라도 좋은 것 같더라구요 🧐

그러네요. 지금보니 MUI Element의 Menu component에 딸려있는 mui 고유값이군요.
이럴 경우 조금 애매하긴 하네요 😺

방금까지 적은 답변은 이랬는데,

저희가 만약 MUI 말고 다른 UI framework 을 사용하게 된다면, 
UI와 관계없는 state값의 변수이름도 변경을 해줘야 하지 않을까요?
재사용성이란건 결국 의존성을 잘 분리한다는 얘기이기 때문에,
결국 현재 기준에서 관계가 없는(의존하지 않는) 부분에 부가적인 의존성을 달지 않도록 하는게 좋구요. 

라고 쓰고 보니 MUI 의존성이 높은 코드라서, 어차피 MUI를 안 쓰면 컴포넌트가 통쨰로 변경될 것 같은 느낌적인 느낌이군요 :)
원론적으로는 full name으로 element라고 하면 쉽게 알아들을 수 있어서 좋다 까지만 얘기해야겠군요!

어쨋든 저는 처음에 anchorEl 이라고 적힌 변수명이 이해가 안가서 리뷰 시간이 약간 더 느려지긴 했으니까요 (5초 정도? ㅋㅋ)

props로만 사용되는 경우(지금 같은 상황!)에도 가급적 full name으로 적는게 코드 유지보수 관점에서 더 나은 건가요? 궁금합니다! 💭💭

매우 잘 통용되는 term 들 (예를 들어 Identification => ID) 등이 아니라면 가급적 full로 풀어쓰는걸 권장하는 추세입니다.
옛날에 변수명 길이 제한이 있다거나, 변수 자동완성 같은 IDE 기능들이 없을 때라면 모르지만,
지금은 full name으로 안할 이유가 사실 없긴 하죠. 😸

너무 길거나, 아니면 용어집 or 유비쿼터스 언어(도메인 주도 개발 참조)에서 약어로 결정하지 않은,
다시 말하면 전체 개발팀의 협의가 이뤄진게 아니라면 (다른 사람이 봐서 이해를 못 할 가능성이 있다면)
원칙을 지키는게 좋을 것입니다.

변수 이름 하나가지고 좀 장황하게 말하긴 했는데 😈
이런게 하나하나 모여서 코드의 가독성을 결정하는 것이니까요 ㅎㅎ

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확실히 MUI Menu의 prop이라는 걸 모르는 상황에서는 알아보기 쉽지 않을 것 같네요 😅
더 직관적인 변수명으로 수정해보겠습니다!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오오 그렇군요! 흥미롭네요 👍

변수명 짓는데 시간이 많이 드는 이유가 조금이나마 이해됐습니다🫡
자세한 답변 감사합니다!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

일단 머지하고, 이슈 등록해놓고 정리해주셔도 좋을 것 같습니다 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 그러면 우선 머지하고 전반적인 naming에 대한 이슈 등록해두겠습니다!

onClose={closeSelectedList}
>
{selectedClusters.map((selectedCluster) => {
return (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(사소) return 없어도 괜찮지 않을까요? 😄

@@ -0,0 +1 @@
export { default as FilteredClusters } from "./FilteredClusters";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이게 Filtering된건지, Selection(선택)된건지 헷갈리는데,
naming을 명확히 하면 좋을 것 같습니다. select이 맞는것 같아 보이는데
(scss에는 selected_cluster라고 되어 있으니까요)

Copy link
Contributor Author

@lxxmnmn lxxmnmn Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ytaek
기존에 존재하던 FilteredAuthors 컴포넌트와 목적이 동일하기에 "Filtered"를 차용했습니다!
두 컴포넌트 모두 select 되었음을 나타내는 이름으로 변경하는 게 좋을까요?

Copy link
Contributor

@ytaek ytaek Aug 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ytaek 기존에 존재하던 FilteredAuthors 컴포넌트와 목적이 동일하기에 "Filtered"를 차용했습니다! 두 컴포넌트 모두 select 되었음을 나타내는 이름으로 변경하는 게 좋을까요?

아. 그랬군요.
그런데, 현재 Author같은 경우는, 사용자의 "selection"으로 filtering된건 아니지 않나요?
(selection한 cluster라는 조건으로 filtering된 author list 같은 느낌인데)
지금 수정한 컴포넌트는 cluster 들이 "selection" 된 것들이구요.

정확하게 동일한 부분이면 통일하는게 맞을것 같구요.
그렇지 않다면 구분하면 좋을 것 같습니다.

"selection"이 맞고 "filter"가 틀리다는 얘기라기 보다,
같은 기능은 같은 단어/표현을 쓰자 에 포커스 된 말이라고 보시면 좋을 것 같습니다 🦈

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(사소하지만 또 생각나서) 말씀듣고보니,

FilteredAuthors는 단순히 author list만 보여주는 것이고,
Filtered(?Selected)Clusters는 단순 리스트를 보여준다기보다 현재 list를 삭제하는 기능도 들어가있는 컴포넌트네요!

목적이나 기능이 현재이름에서 뭔가 더 들어가면 좋을 것 같긴합니다 : )
SelectedClusterListBox 라던지? ㅎㅎ


뭔가 이번 리뷰는 naming에 진심인 리뷰가 되었는데,
이번 기회에 한번 요런걸 더 고민해보면 좋겠다! 라는 취지로 이해해주시면 더 좋을 것 같습니다 : )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

클러스터 노드를 선택했을 때 보여주다보니 FilteredAuthors의 의미를 잘못 이해했네요 ㅎㅎ,,
목적과 기능을 잘 나타낼 수 있는 naming에 대해 더 고민하고 수정해보겠습니다
꼼꼼한 리뷰 감사합니다!!! ✨

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

뭔가 이번 리뷰는 naming에 진심인 리뷰가 되었는데,
이번 기회에 한번 요런걸 더 고민해보면 좋겠다! 라는 취지로 이해해주시면 더 좋을 것 같습니다 : )

엄청 엄청 유익했습니다 🔥🔥🔥🔥🔥🔥

Copy link
Member

@seungineer seungineer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수정된 부분이 많아 보여 살짝 쫄았는데, 하나 하나 읽어보니 엄청 잘 읽혔어요 👍👍
LGGGGTM 🚀🚀🚀🚀

Comment on lines +14 to +20
{selectedData.length > 0 && (
<div className="selected__container">
<FilteredAuthors />
<FilteredClusters />
</div>
)}
<Summary />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

훨씬 일목요연해진 것 같습니다!! 🫢🤭

Comment on lines +52 to +56
<div
className={`cluster-summary__info-wrapper ${
selectedClusterId.includes(cluster.clusterId) ? "selected" : ""
}`}
>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이렇게 조건에 맞는 경우에만 class 명을 추가할 수도 있군요 😲

selectedcluster summary info 임을 쉽게 알 수 있네요(대박) 👍

const { selectedData, setSelectedData } = useGlobalData();
const selectedClusters = getInitData(selectedData);

const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ytaek
mui Menu의 props 명이 anchorEl이라 mui에 사용되는 state인지 쉽게 알 수 있어서 저는 full name이 아니더라도 좋은 것 같더라구요 🧐

props로만 사용되는 경우(지금 같은 상황!)에도 가급적 full name으로 적는게 코드 유지보수 관점에서 더 나은 건가요? 궁금합니다! 💭💭

Copy link
Contributor

@ytaek ytaek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

몇가지 comment들 더 추가했습니다.

sx={{ color: "inherit", padding: 0, textTransform: "none" }}
onClick={openSelectedList}
>
<p>Clusters</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cluster라는 코드 용어보다는 사용자가 이해할 수 있는 단어로 표현하면 좋을 것 같습니다.
거기에 "selected"를 붙이면 더 좋겠구요. Selected Nodes 정도?

return (
<li key={selectedCluster.clusterId}>
<Chip
label={selectedCluster.summary.content.message}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

추~~~후 고민해보면 좋을 요소들 나열해봅니다.
이슈로 등록해주시고, 추후에 한번 view팀원분들과 같이 얘기해봐도 좋을 것 같아요.

  • 지금 label 표시란이 좀 짧은데, message가 들어가면 충분할지,
  • 아니면 다른 ID 같은 걸 표시할만한게 있는지 (commit ID같은?)
  • 그리고, selection이 보여주는 부분에 sorting이 필요할지
  • 만약에 ID 등으로 구분이 안되는 거라면, 해당 chip selected box 부분이 필요하지 않을 수도 있구요.
  • 삭제(deselection) 기능이 좋긴 한데, 정말 필요한 부분일까?
  • select box의 item을 눌렀을 때 해당 cluster로 스크롤링 하는건 어떨까?

좀 디테일하긴 한데, 실제 UI 디자인에 대한 고민 practice라고 생각하셔도 좋습니다 😺

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

우와 전부 좋은 이슈들이네요!
특히 message 길이가 꽤 길어서 다른 요소를 사용하면 좋겠다 싶었는데 commit ID도 괜찮을 것 같습니다

제안해주신 내용은 UI Renewal 팀 회의에서 논의해보겠습니다! 🫡

@lxxmnmn lxxmnmn merged commit f3546aa into githru:main Aug 25, 2024
2 checks passed
lxxmnmn added a commit that referenced this pull request Aug 29, 2024
#664 refactoring

* fix(view): 선택된 클러스터 목록 컴포넌트 naming 수정

* fix(view): 불필요한 return 제거
HIITMEMARIO pushed a commit to HIITMEMARIO/githru-vscode-ext that referenced this pull request Sep 27, 2024
githru#664 refactoring

* fix(view): 선택된 클러스터 목록 컴포넌트 naming 수정

* fix(view): 불필요한 return 제거
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants