-
Notifications
You must be signed in to change notification settings - Fork 6
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
[FE] Fix/permission 토픽 권한 수정 오류 해결 #419
Changes from 5 commits
5448977
5508803
223df2d
582f984
38112f3
556657c
92f8d38
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 |
---|---|---|
|
@@ -3,7 +3,10 @@ import Text from '../common/Text'; | |
import Space from '../common/Space'; | ||
import Flex from '../common/Flex'; | ||
import { useContext, useEffect, useState } from 'react'; | ||
import { TopicAuthorMember, TopicAuthorMemberWithId } from '../../types/Topic'; | ||
import { | ||
TopicAuthorMember, | ||
TopicAuthorMemberWithAuthorId, | ||
} from '../../types/Topic'; | ||
import { ModalContext } from '../../context/ModalContext'; | ||
import Box from '../common/Box'; | ||
import Modal from '../Modal'; | ||
|
@@ -18,7 +21,7 @@ interface AuthorityRadioContainer { | |
setIsPrivate: React.Dispatch<React.SetStateAction<boolean>>; | ||
setIsAll: React.Dispatch<React.SetStateAction<boolean>>; | ||
setAuthorizedMemberIds: React.Dispatch<React.SetStateAction<number[]>>; | ||
permissionedMembers?: TopicAuthorMemberWithId[]; | ||
permissionedMembers?: TopicAuthorMemberWithAuthorId[]; | ||
} | ||
|
||
const AuthorityRadioContainer = ({ | ||
|
@@ -62,6 +65,10 @@ const AuthorityRadioContainer = ({ | |
); | ||
}; | ||
|
||
const whenViewingPreviousAuthorMember = () => { | ||
return authorizedMemberIds.length === 0 && !isAll; | ||
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. 이 부분은 UI에 대한 부분입니다. '이전에 권한을 지정한 인원' 영역이 '모두' 또는 '혼자' 를 클릭할 때 마다 보여서요. '모두' 또는 '혼자'를 선택했었으면 권한을 선택한 인원이 없었는데 UI 상으로 '이전에 권한을 지정한 인원' 영역이 보이게 되면 사용자가 혼란을 겪을 수도 있어 위와 같이 변경하였습니다. 스크린샷으로 보여드리고 싶은데 토큰 이슈가 있어서 텍스트로만 답변드린 점 양해부탁드립니다~~ |
||
}; | ||
|
||
return ( | ||
<> | ||
<Text color="black" $fontSize="default" $fontWeight="normal"> | ||
|
@@ -162,25 +169,31 @@ const AuthorityRadioContainer = ({ | |
</> | ||
)} | ||
|
||
{authorizedMemberIds.length === 0 && permissionedMembers && ( | ||
{permissionedMembers && whenViewingPreviousAuthorMember() && ( | ||
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. 이 부분도 이렇게 변경된 이유 한번 설명해주실 수 있으실까요?! permissionedMembers는 이해가 됐는데 whenViewingPreviousAuthorMember() 이 부분이 이해가 안되서 그런 것 같아요! 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. whenViewingPrevious~~ 함수는 true 또는 false를 반환하는 조건식입니다. 단순히 조건식을 바로 나열할 수도 있는데 && 연산자가 3번이나 쓰여서 가독성이 좋지 않을 것 같아서요. 그리고 조건식을 나열한 것만 봐서는 그 의미를 파악하기 힘들것 같아 함수로 빼버렸습니다. |
||
<> | ||
<Space size={5} /> | ||
<Space size={0} /> | ||
<Box> | ||
<Text color="black" $fontSize="default" $fontWeight="normal"> | ||
기존에 선택한 친구들 | ||
이전에 권한을 부여한 친구들 | ||
</Text> | ||
<Space size={1} /> | ||
{permissionedMembers.map((member) => ( | ||
<Text | ||
color="black" | ||
$fontSize="default" | ||
$fontWeight="normal" | ||
key={member.id} | ||
> | ||
• {member.memberResponse.nickName} | ||
{permissionedMembers.length > 0 ? ( | ||
permissionedMembers.map((member) => ( | ||
<Text | ||
color="black" | ||
$fontSize="default" | ||
$fontWeight="normal" | ||
key={member.id} | ||
> | ||
• {member.memberResponse.nickName} | ||
</Text> | ||
)) | ||
) : ( | ||
<Text color="black" $fontSize="default" $fontWeight="normal"> | ||
• 없음 | ||
</Text> | ||
))} | ||
)} | ||
</Box> | ||
</> | ||
)} | ||
|
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.
원래 있던 로직에 &&!isAll 부분만 추가됬는데 어떤 차이가 있는지 이해가 잘 안되네여...😅
해설 부탁드립니다
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.
#419 (comment)