Compare commits

..

No commits in common. "bd726592153590bfc81160b12738026e6165b109" and "1f3ad14be003bc7ff7f80a03dd76714416598bc7" have entirely different histories.

2 changed files with 17 additions and 44 deletions

View file

@ -4,14 +4,8 @@ import { useParams } from 'react-router-dom';
import { import {
convertResultsToSpeedFlowchartResult, convertResultsToSpeedFlowchartResult,
SpeedFlowchartResult, SpeedFlowchartResult,
SpeedRoundPair,
} from '../data/SpeedFlowchart'; } from '../data/SpeedFlowchart';
import { Card, CardContent, Grid, Skeleton, Typography } from '@mui/material'; import { Card, CardContent, Grid, Skeleton, Typography } from '@mui/material';
import { theme } from '../utils/Theme';
interface SpeedRoundPairDummy extends SpeedRoundPair {
dummy: boolean;
}
/** /**
* *
@ -43,17 +37,7 @@ export default function SpeedFlowchartPage() {
console.log('loading false'); console.log('loading false');
const flowchartResult = convertResultsToSpeedFlowchartResult(r); const flowchartResult = convertResultsToSpeedFlowchartResult(r);
const l = flowchartResult.rounds.length; console.log(flowchartResult);
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); setFlowchartResult(flowchartResult);
}); });
}, []); }, []);
@ -72,7 +56,7 @@ export default function SpeedFlowchartPage() {
xs={12} xs={12}
md={12 / flowchartResult.rounds.length} md={12 / flowchartResult.rounds.length}
> >
<Grid item className='center-children' xs={12}> <Grid item xs={12}>
<Typography variant='h6' fontWeight={'bold'} gutterBottom> <Typography variant='h6' fontWeight={'bold'} gutterBottom>
{round.roundName} {round.roundName}
</Typography> </Typography>
@ -86,18 +70,7 @@ export default function SpeedFlowchartPage() {
> >
{round.pairs.map((pair, pairKey) => ( {round.pairs.map((pair, pairKey) => (
<Grid key={`flowchart-column-${roundKey}-pair-${pairKey}`} item> <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> <CardContent>
<Typography <Typography
sx={{ sx={{

View file

@ -1,7 +1,15 @@
import { CssBaseline } from '@mui/material'; import { CssBaseline } from '@mui/material';
import { ThemeProvider, createTheme } from '@mui/material/styles'; import { ThemeProvider, createTheme } from '@mui/material/styles';
export const theme = createTheme({ /**
* 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({
components: { components: {
MuiToggleButton: { MuiToggleButton: {
defaultProps: { defaultProps: {
@ -13,16 +21,8 @@ export const theme = createTheme({
mode: 'dark', 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 ( return (
<ThemeProvider theme={theme}> <ThemeProvider theme={Theme}>
<CssBaseline /> <CssBaseline />
{children} {children}
</ThemeProvider> </ThemeProvider>