Skip to content

Commit cac3f55

Browse files
Merge pull request #73 from SSASINSA/refactor/sprint-fix(#68)
Refactor/행사 참여자 관리 페이지 수정(#68)
2 parents 55df036 + 87fa1ae commit cac3f55

File tree

3 files changed

+35
-119
lines changed

3 files changed

+35
-119
lines changed

src/components/pages/events/EventDetail/EventDetail.tsx

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -461,67 +461,6 @@ const EventDetail: React.FC = () => {
461461
}
462462
};
463463

464-
const findOptionById = (options: EventOption[], optionId: number): EventOption | null => {
465-
for (const option of options) {
466-
if (option.optionId === optionId) {
467-
return option;
468-
}
469-
if (option.children && option.children.length > 0) {
470-
const found = findOptionById(option.children, optionId);
471-
if (found) return found;
472-
}
473-
}
474-
return null;
475-
};
476-
477-
const getOptionPath = (options: EventOption[], optionId: number): string => {
478-
const findPath = (opts: EventOption[], targetId: number, path: string[]): string[] | null => {
479-
for (const opt of opts) {
480-
const currentPath = [...path, opt.name];
481-
if (opt.optionId === targetId) {
482-
return currentPath;
483-
}
484-
if (opt.children && opt.children.length > 0) {
485-
const found = findPath(opt.children, targetId, currentPath);
486-
if (found) return found;
487-
}
488-
}
489-
return null;
490-
};
491-
492-
const path = findPath(options, optionId, []);
493-
return path ? path.join(" > ") : "알 수 없음";
494-
};
495-
496-
const getApplicationStatusClass = (status: string): string => {
497-
switch (status.toUpperCase()) {
498-
case "APPLIED":
499-
return "applied";
500-
case "CHECKED_IN":
501-
return "checked-in";
502-
case "CANCELLED":
503-
return "cancelled";
504-
case "REJECTED":
505-
return "rejected";
506-
default:
507-
return "";
508-
}
509-
};
510-
511-
const getApplicationStatusText = (status: string): string => {
512-
switch (status.toUpperCase()) {
513-
case "APPLIED":
514-
return "신청됨";
515-
case "CHECKED_IN":
516-
return "체크인";
517-
case "CANCELLED":
518-
return "취소됨";
519-
case "REJECTED":
520-
return "거절됨";
521-
default:
522-
return status;
523-
}
524-
};
525464

526465
const OptionTreeItem: React.FC<{ option: EventOption; depth: number }> = ({ option, depth }) => {
527466
const hasChildren = option.children && option.children.length > 0;
@@ -770,45 +709,6 @@ const EventDetail: React.FC = () => {
770709
</div>
771710
</div>
772711
)}
773-
774-
{/* 신청 현황 섹션 */}
775-
{eventData.applications && eventData.applications.length > 0 && (
776-
<div className={styles["event-applications-section"]}>
777-
<h3 className={styles["section-title"]}>신청 현황</h3>
778-
<div className={styles["applications-table-container"]}>
779-
<table className={styles["applications-table"]}>
780-
<thead>
781-
<tr>
782-
<th>이름</th>
783-
<th>이메일</th>
784-
<th>옵션</th>
785-
<th>상태</th>
786-
<th>신청일</th>
787-
</tr>
788-
</thead>
789-
<tbody>
790-
{eventData.applications.map((application) => {
791-
const option = findOptionById(eventData.options, application.optionId);
792-
const optionPath = option ? getOptionPath(eventData.options, application.optionId) : "알 수 없음";
793-
return (
794-
<tr key={application.applicationId}>
795-
<td>{application.displayName}</td>
796-
<td>{application.email}</td>
797-
<td>{optionPath}</td>
798-
<td>
799-
<span className={`${styles["status-badge"]} ${styles[getApplicationStatusClass(application.status)]}`}>
800-
{getApplicationStatusText(application.status)}
801-
</span>
802-
</td>
803-
<td>{formatDateTime(application.appliedAt)}</td>
804-
</tr>
805-
);
806-
})}
807-
</tbody>
808-
</table>
809-
</div>
810-
</div>
811-
)}
812712
</div>
813713

814714
{/* 사이드바 - 스태프 코드 발급 */}

src/components/pages/events/EventParticipantManagement/EventParticipantManagement.module.css

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,7 @@
493493
text-align: center !important;
494494
padding: 16px 0 !important;
495495
width: 60px;
496-
display: flex !important;
497-
justify-content: center !important;
498-
align-items: center !important;
496+
vertical-align: middle;
499497
}
500498

501499
.participants-table tbody tr:hover {
@@ -662,9 +660,7 @@
662660
max-width: 80px !important;
663661
text-align: center !important;
664662
padding: 12px 8px !important;
665-
display: flex !important;
666-
justify-content: center !important;
667-
align-items: center !important;
663+
vertical-align: middle;
668664
}
669665

670666
.participants-section .dl-table-wrapper {
@@ -674,10 +670,16 @@
674670
.actions-cell {
675671
padding-right: 0 !important;
676672
padding-left: 0 !important;
677-
display: flex !important;
678-
justify-content: center !important;
679-
align-items: center !important;
680673
text-align: center !important;
674+
vertical-align: middle;
675+
}
676+
677+
.actions-wrapper {
678+
display: flex;
679+
justify-content: center;
680+
align-items: center;
681+
width: 100%;
682+
height: 100%;
681683
}
682684

683685
.action-btn {

src/components/pages/events/EventParticipantManagement/EventParticipantManagement.tsx

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ const EventParticipantManagement: React.FC = () => {
141141
}
142142
};
143143

144+
const isEventEnded = (status: string): boolean => {
145+
const displayStatus = mapApiStatusToDisplayStatus(status);
146+
return displayStatus === "completed" || displayStatus === "deleted";
147+
};
148+
144149
const fetchEventInfo = useCallback(async () => {
145150
if (!eventId) return;
146151

@@ -705,16 +710,25 @@ const EventParticipantManagement: React.FC = () => {
705710
width: 80,
706711
align: "center",
707712
className: styles["actions-cell"],
708-
render: (p: Participant) => (
709-
(p.status === "APPLIED" || p.status === "CHECKED_IN") ? (
710-
<button
711-
className={`${styles["action-btn"]} ${styles["cancel"]}`}
712-
onClick={() => handleCancelClick(p.applicationId, p.name)}
713-
>
714-
취소
715-
</button>
716-
) : null
717-
),
713+
render: (p: Participant) => {
714+
const canCancel =
715+
(p.status === "APPLIED" || p.status === "CHECKED_IN") &&
716+
eventInfo &&
717+
!isEventEnded(eventInfo.status);
718+
719+
return (
720+
<div className={styles["actions-wrapper"]}>
721+
{canCancel ? (
722+
<button
723+
className={`${styles["action-btn"]} ${styles["cancel"]}`}
724+
onClick={() => handleCancelClick(p.applicationId, p.name)}
725+
>
726+
취소
727+
</button>
728+
) : null}
729+
</div>
730+
);
731+
},
718732
},
719733
]}
720734
data={isLoading ? [] : participants}

0 commit comments

Comments
 (0)