-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: SSE 및 관리자 전용 참여 현황 열람 기능 추가 및 관련 수정 (#28)
- SSE 핸들러 추가로 실시간 데이터 처리 기능 구현 - SSE 관련 타입 정의 및 관련 로직 수정 - 관리자 전용 참여 현황 열람 기능 추가 - 스타일 구조 수정으로 가독성 및 유지보수성 개선 - 상태 관리 로직 수정 및 최적화
- Loading branch information
1 parent
e53ce7a
commit 061937e
Showing
14 changed files
with
452 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react'; | ||
import { useAtom } from 'jotai'; | ||
import { sseDataAtom } from '../../../store/sseStore'; | ||
import { useAuth } from '../../../context/AuthContext'; | ||
|
||
const ParticipantList: React.FC = () => { | ||
const [sseData] = useAtom(sseDataAtom); | ||
const { isAdmin } = useAuth(); | ||
|
||
if (!isAdmin) { | ||
// 관리자가 아니면 아무것도 표시하지 않음 | ||
return null; | ||
} | ||
|
||
if (!sseData || !sseData.participants.length) { | ||
return <div>참여자 데이터가 없습니다.</div>; | ||
} | ||
|
||
return ( | ||
<div> | ||
<h2>참여자 목록 (관리자 전용)</h2> | ||
<ul> | ||
{sseData.participants.map((participant) => ( | ||
<li key={participant.userId}> | ||
<p> | ||
닉네임: {participant.nickname} | 수량: {participant.quantity} |{' '} | ||
{participant.isCancelled ? '취소됨' : '참여 중'} |{' '} | ||
{participant.isPaymentCompleted ? '결제 완료' : '결제 대기'} |{' '} | ||
</p> | ||
</li> | ||
))} | ||
</ul> | ||
<p>참여 인원: {sseData.participationCount}</p> | ||
<p>결제 완료 인원: {sseData.paymentCount}</p> | ||
<p>환불 완료 인원: {sseData.refundedCount}</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ParticipantList; |
Oops, something went wrong.