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

알림 컴포넌트 구현 #51

Merged
merged 18 commits into from
Nov 7, 2023
Merged

Conversation

dudwns
Copy link
Contributor

@dudwns dudwns commented Nov 5, 2023

📑 이슈 번호

#50

🚧 구현 내용

  • 알림 컴포넌트를 구현하였습니다.
스크린샷 2023-11-06 오전 4 39 24 스크린샷 2023-11-06 오전 4 38 07

🚨 특이 사항

Notification Props

interface NotificationProps {
  notificationId: number // 알림 id
  type: 'follow' | 'comment' | 'space' // 알림 타입
  userId: number // 알림을 보내는 유저 id
  userName: string // 알림을 보내는 유저 이름
  spaceId?: number // 스페이스 id
  spaceName?: string // 스페이스 이름
  isRead?: boolean // 읽음 처리 여부
  isAccept?: boolean // 스페이스 초대 수락 여부
  onAccept?: (e?: React.MouseEvent<HTMLButtonElement>) => void // 스페이스 초대 수락 함수
  onClose?: (e?: React.MouseEvent<HTMLButtonElement>) => void // 알림 삭제 함수
}

사용 예시 코드

export default function NotificationPage() {
  const notifications = mock_notificationData

  return (
    <div className="flex flex-col gap-4 px-6">
      {notifications.map((notification) => (
        <Notification
          key={notification.id}
          notificationId={notification.id}
          type={notification.type}
          userId={notification.userId}
          userName={notification.userName}
          spaceId={notification.spaceId}
          spaceName={notification.spaceName}
          onAccept={() => console.log('스페이스 수락')}
          onClose={() => console.log('알람 닫기')}
        />
      ))}
    </div>
  )
}

알림 컴포넌트에서 사용되는 커스텀 스타일을 추가하였습니다.

emerald05

  • light: rgb(239, 252, 245)
  • dark: rgb(20, 42, 46)

리뷰 반영 사항

  • 중복 로직을 제거하였습니다.

  • 페이지 이동과 읽음 처리 로직을 추가하였습니다. (useNotification 훅 구현)

    • 유저 네임을 클릭 시 해당 유저의 프로필 페이지로 이동
    • 스페이스를 클릭 시 해당 스페이스 페이지로 이동
    • 댓글을 클릭 시 해당 스페이스의 댓글 페이지로 이동 (기존 UI에서 댓글 Text에 bold 처리를 추가하였습니다.)
스크린샷 2023-11-07 오후 6 08 11

@dudwns dudwns added the ✨ Feature 기능 개발 label Nov 5, 2023
@dudwns dudwns added this to the 2차 스프린트 milestone Nov 5, 2023
@dudwns dudwns self-assigned this Nov 5, 2023
@dudwns dudwns linked an issue Nov 5, 2023 that may be closed by this pull request
1 task
<span className="font-bold">{spaceName}</span>
{NOTIFICATION_MSG.COMMENT}
</div>
)}
Copy link
Contributor

Choose a reason for hiding this comment

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

type이 follow와 comment일때는 각각 팔로우 신청한 사람의 프로필 페이지, 댓글이 달린 해당 스페이스 댓글페이지로 라우팅시키는건 어떠신가요..!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

반영했습니다! 😀

Copy link
Member

@eeseung eeseung left a comment

Choose a reason for hiding this comment

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

고생하셨습니다! 같이가요 영준님..~~ 🏃‍♀️

onClose,
}: NotificationProps) => {
return (
<div
Copy link
Member

Choose a reason for hiding this comment

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

알림을 눌렀을 때 읽음 처리와 페이지 이동을 해줘야 하는데 이 부분이 빠진 것 같습니다! 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

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

반영했습니다! 😀

Comment on lines 76 to 80
{type !== 'space' && 'comment' && (
<Button onClick={onClose}>
<XMarkIcon className="h-5 w-5 p-0.5 text-slate6" />
</Button>
)}
Copy link
Member

Choose a reason for hiding this comment

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

별건 아니지만 레이아웃을 수정하면 x 버튼을 타입별로 나누지 않을 수 있을 것 같아요..!! 💡

Copy link
Contributor Author

Choose a reason for hiding this comment

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

반영했습니다! 😀

Copy link
Member

@eeseung eeseung left a comment

Choose a reason for hiding this comment

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

LGTM 입니다!! 👏

@dudwns dudwns merged commit 38c1c74 into develop Nov 7, 2023
1 check passed
@dudwns dudwns deleted the feature/#50/component-notification branch November 7, 2023 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature 기능 개발
Projects
None yet
Development

Successfully merging this pull request may close these issues.

알림 컴포넌트 구현
3 participants