Compare commits
2 commits
1f3ad14be0
...
bd72659215
Author | SHA1 | Date | |
---|---|---|---|
bd72659215 | |||
d493777de3 |
2 changed files with 44 additions and 17 deletions
|
@ -4,8 +4,14 @@ import { useParams } from 'react-router-dom';
|
|||
import {
|
||||
convertResultsToSpeedFlowchartResult,
|
||||
SpeedFlowchartResult,
|
||||
SpeedRoundPair,
|
||||
} from '../data/SpeedFlowchart';
|
||||
import { Card, CardContent, Grid, Skeleton, Typography } from '@mui/material';
|
||||
import { theme } from '../utils/Theme';
|
||||
|
||||
interface SpeedRoundPairDummy extends SpeedRoundPair {
|
||||
dummy: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -37,7 +43,17 @@ export default function SpeedFlowchartPage() {
|
|||
console.log('loading false');
|
||||
|
||||
const flowchartResult = convertResultsToSpeedFlowchartResult(r);
|
||||
console.log(flowchartResult);
|
||||
const l = flowchartResult.rounds.length;
|
||||
const dummy: SpeedRoundPairDummy = { dummy: true };
|
||||
flowchartResult.rounds[l - 2].pairs = [
|
||||
dummy,
|
||||
...flowchartResult.rounds[l - 1].pairs,
|
||||
...flowchartResult.rounds[l - 2].pairs,
|
||||
];
|
||||
flowchartResult.rounds[l - 2].roundName = `${
|
||||
flowchartResult.rounds[l - 1].roundName
|
||||
} / ${flowchartResult.rounds[l - 2].roundName}`;
|
||||
flowchartResult.rounds.pop();
|
||||
setFlowchartResult(flowchartResult);
|
||||
});
|
||||
}, []);
|
||||
|
@ -56,7 +72,7 @@ export default function SpeedFlowchartPage() {
|
|||
xs={12}
|
||||
md={12 / flowchartResult.rounds.length}
|
||||
>
|
||||
<Grid item xs={12}>
|
||||
<Grid item className='center-children' xs={12}>
|
||||
<Typography variant='h6' fontWeight={'bold'} gutterBottom>
|
||||
{round.roundName}
|
||||
</Typography>
|
||||
|
@ -70,7 +86,18 @@ export default function SpeedFlowchartPage() {
|
|||
>
|
||||
{round.pairs.map((pair, pairKey) => (
|
||||
<Grid key={`flowchart-column-${roundKey}-pair-${pairKey}`} item>
|
||||
<Card>
|
||||
<Card
|
||||
sx={{
|
||||
opacity: (pair as SpeedRoundPairDummy).dummy ? 0 : 1,
|
||||
[theme.breakpoints.down('md')]: (
|
||||
pair as SpeedRoundPairDummy
|
||||
).dummy
|
||||
? {
|
||||
display: 'none',
|
||||
}
|
||||
: undefined,
|
||||
}}
|
||||
>
|
||||
<CardContent>
|
||||
<Typography
|
||||
sx={{
|
||||
|
|
|
@ -1,15 +1,7 @@
|
|||
import { CssBaseline } from '@mui/material';
|
||||
import { ThemeProvider, createTheme } from '@mui/material/styles';
|
||||
|
||||
/**
|
||||
* Sets a MaterialUi theme for its children
|
||||
* @param {any} props accepts JSX elements to wrap theme in
|
||||
* @return {JSX.Element}
|
||||
*/
|
||||
export default function Theme(props: { children: JSX.Element }) {
|
||||
const { children } = props;
|
||||
|
||||
const Theme = createTheme({
|
||||
export const theme = createTheme({
|
||||
components: {
|
||||
MuiToggleButton: {
|
||||
defaultProps: {
|
||||
|
@ -20,9 +12,17 @@ export default function Theme(props: { children: JSX.Element }) {
|
|||
palette: {
|
||||
mode: 'dark',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Sets a MaterialUi theme for its children
|
||||
* @param {any} props accepts JSX elements to wrap theme in
|
||||
* @return {JSX.Element}
|
||||
*/
|
||||
export default function Theme(props: { children: JSX.Element }) {
|
||||
const { children } = props;
|
||||
return (
|
||||
<ThemeProvider theme={Theme}>
|
||||
<ThemeProvider theme={theme}>
|
||||
<CssBaseline />
|
||||
{children}
|
||||
</ThemeProvider>
|
||||
|
|
Loading…
Reference in a new issue