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

#837 채팅창에서 메세지별로 안 읽은 사람 수 보여주기 #846

Open
wants to merge 13 commits into
base: dev
Choose a base branch
from

Conversation

Hyogyeong8
Copy link
Contributor

Summary

It closes #837

Images or Screenshots

image

@Hyogyeong8 Hyogyeong8 self-assigned this Feb 4, 2025
@Hyogyeong8 Hyogyeong8 linked an issue Feb 4, 2025 that may be closed by this pull request
3 tasks
Copy link

netlify bot commented Feb 4, 2025

Deploy Preview for taxi-dev-preview ready!

Name Link
🔨 Latest commit 0affedf
🔍 Latest deploy log https://app.netlify.com/sites/taxi-dev-preview/deploys/67ae12c5ab35ee0008eb60c0
😎 Deploy Preview https://deploy-preview-846--taxi-dev-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Hyogyeong8 Hyogyeong8 changed the title Add: posting for upadate readAt time 채팅창에서 메세지별로 안 읽은 사람 수 보여주기 Feb 4, 2025
@Hyogyeong8 Hyogyeong8 changed the title 채팅창에서 메세지별로 안 읽은 사람 수 보여주기 #837 채팅창에서 메세지별로 안 읽은 사람 수 보여주기 Feb 4, 2025
Copy link
Member

@kmc7468 kmc7468 left a 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}`, {}, [
Copy link
Member

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)} />
Copy link
Member

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(
Copy link
Member

Choose a reason for hiding this comment

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

useCallback을 사용하는 것보다는, useMemo를 이용해서 안 읽은 사람 수 자체를 메모이제이션 하는게 성능상 더 유리할 것 같습니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

채팅창에서 메세지별로 안 읽은 사람 수 보여주기
2 participants