Skip to content

Commit

Permalink
Merge pull request #181 from the-orange-alliance/show-cards-results
Browse files Browse the repository at this point in the history
Show cards on results screen
  • Loading branch information
kyle-flynn authored Sep 29, 2024
2 parents a6307e6 + f6b1120 commit be0e658
Showing 1 changed file with 23 additions and 3 deletions.
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

0 comments on commit be0e658

Please sign in to comment.