Feat: Show startnumber and improove style
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
db4365351a
commit
62f9d3c5d9
2 changed files with 87 additions and 25 deletions
|
@ -5,6 +5,7 @@ export interface ParticipantFromApi {
|
||||||
PerId: string;
|
PerId: string;
|
||||||
firstname: string;
|
firstname: string;
|
||||||
lastname: string;
|
lastname: string;
|
||||||
|
start_number: string;
|
||||||
result_rank?: number;
|
result_rank?: number;
|
||||||
['result_rank0']?: string;
|
['result_rank0']?: string;
|
||||||
['result_rank1']?: string;
|
['result_rank1']?: string;
|
||||||
|
@ -21,6 +22,7 @@ export interface Participant {
|
||||||
lastName: string;
|
lastName: string;
|
||||||
results: Result[];
|
results: Result[];
|
||||||
overallRank?: number;
|
overallRank?: number;
|
||||||
|
startNumber: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Result {
|
export interface Result {
|
||||||
|
@ -73,5 +75,6 @@ export function participantFromApiParticipant(
|
||||||
lastName: fromApi.lastname,
|
lastName: fromApi.lastname,
|
||||||
results: results,
|
results: results,
|
||||||
overallRank: fromApi.result_rank,
|
overallRank: fromApi.result_rank,
|
||||||
|
startNumber: parseInt(fromApi.start_number),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,19 @@ import { useParams } from 'react-router-dom';
|
||||||
import {
|
import {
|
||||||
convertResultsToSpeedFlowchartResult,
|
convertResultsToSpeedFlowchartResult,
|
||||||
SpeedFlowchartResult,
|
SpeedFlowchartResult,
|
||||||
|
SpeedLane,
|
||||||
SpeedRoundPair,
|
SpeedRoundPair,
|
||||||
} from '../data/SpeedFlowchart';
|
} from '../data/SpeedFlowchart';
|
||||||
import { Card, CardContent, Grid, Skeleton, Typography } from '@mui/material';
|
import {
|
||||||
|
Card,
|
||||||
|
CardContent,
|
||||||
|
Chip,
|
||||||
|
Grid,
|
||||||
|
Skeleton,
|
||||||
|
Typography,
|
||||||
|
} from '@mui/material';
|
||||||
import { theme } from '../utils/Theme';
|
import { theme } from '../utils/Theme';
|
||||||
import { QRCode } from 'react-qrcode-logo';
|
import { QRCode } from 'react-qrcode-logo';
|
||||||
import { bgcolor } from '@mui/system';
|
|
||||||
|
|
||||||
import '../css/SpeedFlowchartPage.css';
|
|
||||||
interface SpeedRoundPairDummy extends SpeedRoundPair {
|
interface SpeedRoundPairDummy extends SpeedRoundPair {
|
||||||
dummy: boolean;
|
dummy: boolean;
|
||||||
}
|
}
|
||||||
|
@ -137,27 +142,81 @@ export default function SpeedFlowchartPage() {
|
||||||
: undefined,
|
: undefined,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CardContent>
|
<CardContent
|
||||||
<Typography
|
sx={{
|
||||||
sx={{
|
padding: '10px !important',
|
||||||
fontWeight: pair.winner === 'A' ? 'bold' : 'plain',
|
}}
|
||||||
color: pair.winner === 'A' ? '#4CAF50' : '',
|
>
|
||||||
}}
|
<Grid container spacing={2}>
|
||||||
>
|
{[
|
||||||
A: {pair.laneA?.participant.firstName}{' '}
|
['A', pair.laneA],
|
||||||
{pair.laneA?.participant.lastName}:{' '}
|
['B', pair.laneB],
|
||||||
{pair.laneA?.result?.result}
|
].map(([letter, lane]) => {
|
||||||
</Typography>
|
lane = lane as SpeedLane;
|
||||||
<Typography
|
const textStyle = {
|
||||||
sx={{
|
fontWeight:
|
||||||
fontWeight: pair.winner === 'B' ? 'bold' : 'plain',
|
pair.winner === letter ? 'bold' : 'plain',
|
||||||
color: pair.winner === 'B' ? '#4CAF50' : '',
|
color: pair.winner === letter ? '#4CAF50' : '',
|
||||||
}}
|
fontSize: '25px',
|
||||||
>
|
};
|
||||||
B: {pair.laneB?.participant.firstName}{' '}
|
|
||||||
{pair.laneB?.participant.lastName}:{' '}
|
const gridItemStyle = {
|
||||||
{pair.laneB?.result?.result}
|
paddingTop:
|
||||||
</Typography>
|
letter === 'B' ? '0 !important' : undefined,
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Grid sx={gridItemStyle} xs={1} item>
|
||||||
|
<Typography sx={textStyle}>
|
||||||
|
{lane?.participant.results[0].rank}{' '}
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid
|
||||||
|
sx={{ ...gridItemStyle, display: 'flex' }}
|
||||||
|
xs={8.5}
|
||||||
|
item
|
||||||
|
>
|
||||||
|
<Typography
|
||||||
|
sx={{
|
||||||
|
...textStyle,
|
||||||
|
overflow: 'clip',
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
maxWidth: '80%',
|
||||||
|
textOverflow: 'ellipsis',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{lane?.participant.firstName}{' '}
|
||||||
|
{lane?.participant.lastName}
|
||||||
|
</Typography>
|
||||||
|
<Chip
|
||||||
|
label={lane?.participant.startNumber}
|
||||||
|
sx={{
|
||||||
|
height: '26px',
|
||||||
|
marginLeft: '10px',
|
||||||
|
}}
|
||||||
|
variant='outlined'
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Grid sx={gridItemStyle} xs={2} item>
|
||||||
|
<Typography sx={textStyle}>
|
||||||
|
{' '}
|
||||||
|
{lane?.result?.result}
|
||||||
|
</Typography>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
{letter === 'A' && (
|
||||||
|
<Grid
|
||||||
|
xs={12}
|
||||||
|
item
|
||||||
|
sx={{ height: 0, paddingTop: '0 !important' }}
|
||||||
|
></Grid>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Grid>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
Loading…
Reference in a new issue