Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show cards on results screen #181

Merged
merged 2 commits into from
Sep 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Alliance,
BLUE_STATION,
Match,
MatchParticipant,
QUALIFICATION_LEVEL,
Ranking,
Team
Expand All @@ -20,6 +21,7 @@ import { Grid } from '@mui/material';
import BreakdownRow from './breakdown-row';
import { Block } from '@mui/icons-material';
import { CardStatus } from '@toa-lib/models/build/seasons/FeedingTheFuture';
import { CardStatus as CardStatusComponent } from './card-status';
import { useTournamentsForEvent } from 'src/api/use-tournament-data';

const Container = styled.div`
Expand Down Expand Up @@ -105,6 +107,7 @@ const TeamContainer = styled.div((props: { alliance: Alliance }) => ({
interface AllianceTeamProps {
alliance: Alliance;
team: Team;
station?: MatchParticipant;
rank?: Ranking;
}

Expand All @@ -120,7 +123,18 @@ const RankText = styled.div`
text-align: center;
`;

const AllianceTeam: FC<AllianceTeamProps> = ({ alliance, team, rank }) => {
const CardContainer = styled.div`
width: 3vh;
height: 3vh;
margin-left: auto;
`;

const AllianceTeam: FC<AllianceTeamProps> = ({
alliance,
team,
rank,
station
}) => {
const rankIcon = useMemo(() => {
if (!rank) return null;
if (rank.rankChange === 0) {
Expand All @@ -138,6 +152,11 @@ const AllianceTeam: FC<AllianceTeamProps> = ({ alliance, team, rank }) => {
<div>{team.teamNameShort}</div>
{rank && rankIcon && (
<RankContainer>
{station && (
<CardContainer>
<CardStatusComponent cardStatus={station.cardStatus} />
</CardContainer>
)}
<RankText>{rank.rank}</RankText>
<RankText style={{ marginTop: '8px' }}>{rankIcon}</RankText>
</RankContainer>
Expand Down Expand Up @@ -214,6 +233,7 @@ export const AllianceResult: FC<Props> = ({
key={p.station}
alliance={alliance}
team={p.team ?? teamsRecord[p.teamKey]}
station={p}
rank={rank}
/>
);
Expand Down Expand Up @@ -247,8 +267,8 @@ export const AllianceResult: FC<Props> = ({
{showZeroScore
? 0
: alliance === 'red'
? match.redScore
: match.blueScore}
? match.redScore
: match.blueScore}
</ScoreText>
</ScoreContainer>
</Container>
Expand Down
Loading