feat: 선택된 조직명 표시#554
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces an OrgName component to display the current organization name in the header and refactors the OrgSwitcher component, including state renaming and memoization of filtered lists. Review feedback highlights a potential regression in the shared Header.Root component where removing a gap class could affect other pages. Additionally, it is recommended to rename selectedOrg to selectedOrgId across the components to more accurately reflect that the state stores a numeric ID, ensuring better code clarity and consistency.
| <header className="sticky top-0 z-header h-12 w-full shrink-0 border-b border-neutral-100 bg-white"> | ||
| <div className="row-between relative h-full w-full px-5"> | ||
| <div className="center-y gap-4">{left}</div> | ||
| <div className="center-y">{left}</div> |
There was a problem hiding this comment.
Header.Root 컴포넌트에서 gap-4를 제거하면 이 컴포넌트를 사용하는 다른 페이지들에서 left 슬롯에 여러 요소를 전달할 경우 요소 간의 간격이 사라지는 회귀 버그(Regression)가 발생할 수 있습니다. 공통 컴포넌트의 기본 스타일을 변경하기보다는, Header.Root에 gap 관련 prop을 추가하거나 현재처럼 LeftSlot 내부에서 별도의 컨테이너로 간격을 조절하는 방식을 유지하되 기존의 기본값은 보존하는 것이 안전합니다.
| <div className="center-y">{left}</div> | |
| <div className="center-y gap-4">{left}</div> |
There was a problem hiding this comment.
기존에 left 속성에 둘 이상의 노드를 전달하는 경우가 없으므로, 회귀 버그 발생하지 않음
그리고 right 속성과 마찬가지로 gap을 추가하지 않고, 이는 사용단에서 관리하는 게 확장성 측면에서 우수함
|
|
||
| export const OrgSwitcher = () => { | ||
| const [selectedId, setSelectedId] = useState<number | null>(null); | ||
| const [selectedOrg, setSelectedOrg] = useState<number | null>(null); |
There was a problem hiding this comment.
selectedOrg 상태는 조직 객체가 아닌 ID(number)를 저장하고 있습니다. 변수명을 selectedOrgId로 변경하여 데이터의 성격을 명확히 하고, organizationId와 같은 기존 명명 규칙과 일관성을 유지하는 것이 좋습니다. (해당 파일 내의 모든 selectedOrg 참조를 함께 변경해 주세요.)
| const [selectedOrg, setSelectedOrg] = useState<number | null>(null); | |
| const [selectedOrgId, setSelectedOrgId] = useState<number | null>(null); |
| selectedOrg: number | null; | ||
| handleSelectedOrg: (org: number) => void; |
There was a problem hiding this comment.
✅ 작업 내용
📝 참고 자료
♾️ 기타