Skip to content

Commit

Permalink
feat: show team bio on scoreboard
Browse files Browse the repository at this point in the history
  • Loading branch information
GZTimeWalker committed Apr 9, 2023
1 parent f53e00f commit 94c2f41
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
2 changes: 2 additions & 0 deletions GZCTF/ClientApp/src/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,8 @@ export interface ScoreboardItem {
id?: number
/** 队伍名称 */
name?: string
/** 队伍 Bio */
bio?: string | null
/** 参赛所属组织 */
organization?: string | null
/** 队伍头像 */
Expand Down
22 changes: 14 additions & 8 deletions GZCTF/ClientApp/src/components/ScoreboardItemModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
LoadingOverlay,
Avatar,
Title,
Badge,
} from '@mantine/core'
import { BloodsTypes, BonusLabel } from '@Utils/ChallengeItem'
import { useTableStyles } from '@Utils/ThemeOverride'
Expand Down Expand Up @@ -69,14 +70,19 @@ const ScoreboardItemModal: FC<ScoreboardItemModalProps> = (props) => {
{item?.name?.slice(0, 1) ?? 'T'}
</Avatar>
<Stack spacing={0}>
<Title order={4} lineClamp={1}>
{item?.name ?? 'Team'}
</Title>
{item?.organization && (
<Text size="sm" lineClamp={1}>
{item.organization}
</Text>
)}
<Group spacing={4}>
<Title order={4} lineClamp={1}>
{item?.name ?? 'Team'}
</Title>
{item?.organization && (
<Badge size="sm" variant="outline">
{item.organization}
</Badge>
)}
</Group>
<Text size="sm" lineClamp={1}>
{item?.bio ?? '这只队伍很懒,什么都没留下'}
</Text>
</Stack>
</Group>
}
Expand Down
5 changes: 5 additions & 0 deletions GZCTF/Models/Request/Game/ScoreboardModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ public partial class ScoreboardItem
/// </summary>
public string Name { get; set; } = string.Empty;

/// <summary>
/// 队伍 Bio
/// </summary>
public string? Bio { get; set; } = string.Empty;

/// <summary>
/// 参赛所属组织
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions GZCTF/Repositories/GameRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ private static IEnumerable<ScoreboardItem> GenScoreboardItems(Data[] data, Game
return new ScoreboardItem
{
Id = j.Key.Team.Id,
Bio = j.Key.Team.Bio,
Name = j.Key.Team.Name,
Avatar = j.Key.Team.AvatarUrl,
Organization = j.Key.Organization,
Expand Down

0 comments on commit 94c2f41

Please sign in to comment.