diff --git a/src/game_pages/detail/components/Participants/index.tsx b/src/game_pages/detail/components/Participants/index.tsx index 64761bb..bc2ec8e 100644 --- a/src/game_pages/detail/components/Participants/index.tsx +++ b/src/game_pages/detail/components/Participants/index.tsx @@ -73,6 +73,7 @@ export default function Participants(props) { }>({ show: () => {} }); const userInfo = useUserInfo(); const participants = detail.participants || []; + const substitute_members = detail.substitute_members || []; // const participants = Array(10) // .fill(0) // .map((_, index) => ({ @@ -92,6 +93,8 @@ export default function Participants(props) { const { participant_count, max_participants, + substitute_count, + max_substitute_players, user_action_status = {}, start_time, price, @@ -293,6 +296,13 @@ export default function Participants(props) { const { action = () => {} } = generateTextAndAction(user_action_status)!; const leftCount = max_participants - participant_count; + const leftSubstituteCount = (max_substitute_players || 0) - (substitute_count || 0); + const showSubstituteApplicationEntry = + [can_pay, can_join, is_substituting, waiting_start].every( + (item) => !item + ) && + can_substitute && + dayjs(start_time).isAfter(dayjs()); return ( <> @@ -389,6 +399,98 @@ export default function Participants(props) { "" )} + {/* 候补区域 */} + {max_substitute_players > 0 && (substitute_count > 0 || showSubstituteApplicationEntry) && ( + + + 候补 + · + {leftSubstituteCount > 0 ? `剩余空位 ${leftSubstituteCount}` : "已满员"} + + + {/* 候补申请入口 */} + {showSubstituteApplicationEntry && ( + { + action?.(); + }} + > + + + 申请候补 + + + )} + {/* 候补成员列表 */} + + + {substitute_members.map((substitute) => { + const { + is_organizer, + user: { + avatar_url, + nickname, + level, + ntrp_level, + id: substitute_user_id, + }, + } = substitute; + const role = is_organizer ? "组织者" : "参与者"; + // 优先使用 ntrp_level,如果没有则使用 level + const ntrpValue = ntrp_level || level; + // 格式化显示 NTRP,如果没有值则显示"初学者" + const displayNtrp = ntrpValue + ? formatNtrpDisplay(ntrpValue) + : "初学者"; + return ( + + + + {nickname || "未知"} + + + {displayNtrp} + + + {role} + + + ); + })} + + + + + )} );