Skip to content

Commit

Permalink
feat: 在比赛详情页面增加筛选条件下的名次
Browse files Browse the repository at this point in the history
  • Loading branch information
renbaoshuo committed Nov 23, 2024
1 parent e77b345 commit aea47a0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/pages/contest/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,12 @@ const Contest: React.FC = () => {
<Table basic="very" unstackable>
<Table.Header>
<Table.Row>
<Table.HeaderCell width={1}>#</Table.HeaderCell>
<Table.HeaderCell width={1}>
{grade || province ? `总排名` : '#'}
</Table.HeaderCell>
{Boolean(grade || province) && (
<Table.HeaderCell>#</Table.HeaderCell>
)}
<Table.HeaderCell>姓名</Table.HeaderCell>
<Table.HeaderCell width={2}>年级</Table.HeaderCell>
<Table.HeaderCell>成绩</Table.HeaderCell>
Expand All @@ -195,13 +200,18 @@ const Contest: React.FC = () => {
<Table.Body>
{data
.slice((page - 1) * perPage, page * perPage)
.map((contestant) => (
.map((contestant, index) => (
<PersonCard
key={`CONTEST${contest.id}-${contestant.oier.uid}`}
oier={contestant.oier}
trigger={
<>
<Table.Cell>{contestant.rank}</Table.Cell>
{Boolean(grade || province) && (
<Table.Cell width={1}>
{(page - 1) * perPage + index + 1}
</Table.Cell>
)}
<Table.Cell>{contestant.oier.name}</Table.Cell>
<Table.Cell>
{getGrade(
Expand Down

0 comments on commit aea47a0

Please sign in to comment.