-
Notifications
You must be signed in to change notification settings - Fork 82
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
Changes from all commits
318ee6a
4b2ce4d
33a9ae8
0cd5ae6
e3406fa
2832c04
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,8 @@ | ||
@import "styles/app"; | ||
|
||
.selected-container { | ||
.selected__author { | ||
display: flex; | ||
align-items: center; | ||
gap: 15px; | ||
width: 100%; | ||
|
||
p { | ||
font-size: $font-size-title; | ||
font-weight: $font-weight-semibold; | ||
} | ||
} | ||
|
||
.selected-content { | ||
display: flex; | ||
flex-wrap: wrap; | ||
box-sizing: border-box; | ||
align-items: center; | ||
gap: 5px; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
@import "styles/app"; | ||
|
||
.selected__cluster { | ||
& .MuiMenu-paper { | ||
max-height: 250px; | ||
overflow-y: auto; | ||
} | ||
|
||
& .MuiMenu-list { | ||
display: flex; | ||
flex-direction: column; | ||
padding: 5px; | ||
} | ||
|
||
& .MuiChip-root { | ||
width: 200px; | ||
text-overflow: ellipsis; | ||
justify-content: space-between; | ||
margin: 5px; | ||
background-color: $gray-300; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { useState } from "react"; | ||
import type { MouseEvent } from "react"; | ||
import Button from "@mui/material/Button"; | ||
import Menu from "@mui/material/Menu"; | ||
import Chip from "@mui/material/Chip"; | ||
import ArrowDropDownRoundedIcon from "@mui/icons-material/ArrowDropDownRounded"; | ||
|
||
import { selectedDataUpdater } from "components/VerticalClusterList/VerticalClusterList.util"; | ||
import { getInitData, getClusterById } from "components/VerticalClusterList/Summary/Summary.util"; | ||
import { useGlobalData } from "hooks"; | ||
|
||
import "./FilteredClusters.scss"; | ||
|
||
const FilteredClusters = () => { | ||
const { selectedData, setSelectedData } = useGlobalData(); | ||
const selectedClusters = getInitData(selectedData); | ||
|
||
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. El 이 Element를 얘기하는거라면, full name으로 적어주시면 감사하겠습니다. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ytaek props로만 사용되는 경우(지금 같은 상황!)에도 가급적 full name으로 적는게 코드 유지보수 관점에서 더 나은 건가요? 궁금합니다! 💭💭 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
그러네요. 지금보니 MUI Element의 Menu component에 딸려있는 mui 고유값이군요. 방금까지 적은 답변은 이랬는데,
라고 쓰고 보니 MUI 의존성이 높은 코드라서, 어차피 MUI를 안 쓰면 컴포넌트가 통쨰로 변경될 것 같은 느낌적인 느낌이군요 :) 어쨋든 저는 처음에 anchorEl 이라고 적힌 변수명이 이해가 안가서 리뷰 시간이 약간 더 느려지긴 했으니까요 (5초 정도? ㅋㅋ)
매우 잘 통용되는 term 들 (예를 들어 Identification => ID) 등이 아니라면 가급적 full로 풀어쓰는걸 권장하는 추세입니다. 너무 길거나, 아니면 용어집 or 유비쿼터스 언어(도메인 주도 개발 참조)에서 약어로 결정하지 않은, 변수 이름 하나가지고 좀 장황하게 말하긴 했는데 😈 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 확실히 MUI Menu의 prop이라는 걸 모르는 상황에서는 알아보기 쉽지 않을 것 같네요 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 오오 그렇군요! 흥미롭네요 👍 변수명 짓는데 시간이 많이 드는 이유가 조금이나마 이해됐습니다🫡 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 일단 머지하고, 이슈 등록해놓고 정리해주셔도 좋을 것 같습니다 :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 앗 그러면 우선 머지하고 전반적인 naming에 대한 이슈 등록해두겠습니다! |
||
const isOpen = Boolean(anchorEl); | ||
|
||
const openSelectedList = (event: MouseEvent<HTMLButtonElement>) => { | ||
setAnchorEl(event.currentTarget); | ||
}; | ||
|
||
const closeSelectedList = () => { | ||
setAnchorEl(null); | ||
}; | ||
|
||
const deselectCluster = (clusterId: number) => () => { | ||
const selected = getClusterById(selectedData, clusterId); | ||
setSelectedData(selectedDataUpdater(selected, clusterId)); | ||
}; | ||
|
||
return ( | ||
<div className="selected__content"> | ||
<Button | ||
id="selected-list-button" | ||
aria-controls={isOpen ? "selected-list" : undefined} | ||
aria-expanded={isOpen ? "true" : undefined} | ||
aria-haspopup="true" | ||
sx={{ color: "inherit", padding: 0, textTransform: "none" }} | ||
onClick={openSelectedList} | ||
> | ||
<p>Clusters</p> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cluster라는 코드 용어보다는 사용자가 이해할 수 있는 단어로 표현하면 좋을 것 같습니다. |
||
<ArrowDropDownRoundedIcon /> | ||
</Button> | ||
<Menu | ||
className="selected__cluster" | ||
id="selected-list" | ||
anchorEl={anchorEl} | ||
open={isOpen} | ||
MenuListProps={{ | ||
"aria-labelledby": "selected-list-button", | ||
}} | ||
onClose={closeSelectedList} | ||
> | ||
{selectedClusters.map((selectedCluster) => { | ||
return ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (사소) return 없어도 괜찮지 않을까요? 😄 |
||
<li key={selectedCluster.clusterId}> | ||
<Chip | ||
label={selectedCluster.summary.content.message} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 추~~~후 고민해보면 좋을 요소들 나열해봅니다.
좀 디테일하긴 한데, 실제 UI 디자인에 대한 고민 practice라고 생각하셔도 좋습니다 😺 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 우와 전부 좋은 이슈들이네요! 제안해주신 내용은 UI Renewal 팀 회의에서 논의해보겠습니다! 🫡 |
||
onDelete={deselectCluster(selectedCluster.clusterId)} | ||
/> | ||
</li> | ||
); | ||
})} | ||
</Menu> | ||
</div> | ||
); | ||
}; | ||
|
||
export default FilteredClusters; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as FilteredClusters } from "./FilteredClusters"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이게 Filtering된건지, Selection(선택)된건지 헷갈리는데, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ytaek There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
아. 그랬군요. 정확하게 동일한 부분이면 통일하는게 맞을것 같구요. "selection"이 맞고 "filter"가 틀리다는 얘기라기 보다, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (사소하지만 또 생각나서) 말씀듣고보니, FilteredAuthors는 단순히 author list만 보여주는 것이고, 목적이나 기능이 현재이름에서 뭔가 더 들어가면 좋을 것 같긴합니다 : ) 뭔가 이번 리뷰는 naming에 진심인 리뷰가 되었는데, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 클러스터 노드를 선택했을 때 보여주다보니 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
엄청 엄청 유익했습니다 🔥🔥🔥🔥🔥🔥 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,11 @@ const Summary = () => { | |
clusterSizes={[clusterSizes[index]]} | ||
/> | ||
</div> | ||
<div className="cluster-summary__info-wrapper"> | ||
<div | ||
className={`cluster-summary__info-wrapper ${ | ||
selectedClusterId.includes(cluster.clusterId) ? "selected" : "" | ||
}`} | ||
> | ||
Comment on lines
+52
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이렇게 조건에 맞는 경우에만 class 명을 추가할 수도 있군요 😲
|
||
<button | ||
type="button" | ||
className="toggle-contents-button" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,26 @@ | ||
@import "styles/app"; | ||
|
||
.vertical-cluster-list { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.vertical-cluster-list__content { | ||
.selected__container { | ||
display: flex; | ||
height: 100%; | ||
overflow-x: hidden; | ||
overflow-y: scroll; | ||
flex-grow: 1; | ||
justify-content: space-between; | ||
align-items: center; | ||
column-gap: 20px; | ||
padding: 0 10px 20px; | ||
width: 100%; | ||
|
||
& .selected__content { | ||
display: flex; | ||
align-items: center; | ||
column-gap: 10px; | ||
|
||
p { | ||
font-size: $font-size-title; | ||
font-weight: $font-weight-semibold; | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
import "./VerticalClusterList.scss"; | ||
|
||
import { useGlobalData } from "hooks"; | ||
import { FilteredAuthors } from "components/FilteredAuthors"; | ||
import { FilteredClusters } from "components/FilteredClusters"; | ||
|
||
import { Summary } from "./Summary"; | ||
|
||
import "./VerticalClusterList.scss"; | ||
|
||
const VerticalClusterList = () => { | ||
const { selectedData } = useGlobalData(); | ||
|
||
return ( | ||
<div className="vertical-cluster-list"> | ||
<FilteredAuthors /> | ||
<div className="vertical-cluster-list__content"> | ||
<Summary /> | ||
</div> | ||
{selectedData.length > 0 && ( | ||
<div className="selected__container"> | ||
<FilteredAuthors /> | ||
<FilteredClusters /> | ||
</div> | ||
)} | ||
<Summary /> | ||
Comment on lines
+14
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 훨씬 일목요연해진 것 같습니다!! 🫢🤭 |
||
</div> | ||
); | ||
}; | ||
|
There was a problem hiding this comment.
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 도 정하면 좋을 것 같습니다.
해당 부분 이슈로 생성부탁드리겠습니다!
(아 이미 만들어져있나요? ;; )