-
Notifications
You must be signed in to change notification settings - Fork 2
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
#837 채팅창에서 메세지별로 안 읽은 사람 수 보여주기 #846
base: dev
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for taxi-dev-preview ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
수고하셨습니다..! 동작 엄청 잘 되네요! 드디어 숙원 사업 중 하나가 완료되는군요. 몇 가지 코멘트 남겼는데 확인 부탁드립니다
@@ -34,12 +35,31 @@ const Chat = ({ roomId, layoutType }: ChatProps) => { | |||
roomInfoToken, | |||
]); | |||
|
|||
// 각 사용자가 언제 마지막으로 채팅을 읽었는지 알려주는 readAtList 조회 | |||
const [readAtListToken, fetchReadAtList] = useDateToken(); | |||
const [, roomInfoForReadAt] = useQuery.get(`/rooms/info?id=${roomId}`, {}, [ |
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.
위에서 이미 roomInfo를 받아오는데.. roomInfo에서 readAt만 추출해서 사용하는게 더 좋을 것 같습니다!
)} | ||
<div css={styleMessageDetail}> | ||
{unreadUsersNum(chat.time) > 0 && ( | ||
<UnreadUsers value={unreadUsersNum(chat.time)} /> |
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.
UnreadUsers 컴포넌트를 별도로 분리하신 이유가 있나요?? 그냥 div를 바로 사용해도 좋을 것 같습니다
@@ -74,6 +81,24 @@ const MessageSet = ({ chats, layoutType, roomInfo }: MessageSetProps) => { | |||
const isBot = authorId === "bot"; | |||
const isAlone = roomInfo.part.length === 1; | |||
|
|||
// Chat의 time에 따라 안 읽은 사람 수 설정 | |||
const unreadUsersNum = useCallback( |
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.
useCallback을 사용하는 것보다는, useMemo를 이용해서 안 읽은 사람 수 자체를 메모이제이션 하는게 성능상 더 유리할 것 같습니다!
Summary
It closes #837
Images or Screenshots