Skip to content

Commit 5af2501

Browse files
committed
spacings + preview network expose + other
1 parent bb676c0 commit 5af2501

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

web/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
"type": "module",
77
"scripts": {
88
"deploy": "gh-pages -d build",
9-
"dev": "vite",
9+
"dev": "vite --host",
1010
"build": "tsc && vite build",
1111
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
12-
"preview": "vite preview"
12+
"preview": "vite preview --host"
1313
},
1414
"dependencies": {
1515
"@emotion/react": "^11.11.4",

web/src/chartModule/ChartPage.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,22 @@ import {ChartControlsCard} from "./components/ChartControlsCard.tsx";
1010
const ChartPage: React.FC = () => {
1111
const [numPoints, setNumPoints] = useState<number>(11);
1212
const {chartName, points, tracks, isLoading, error, fetchRoute} = useFetchRoute(numPoints);
13+
const spacingMobile = 2;
14+
const spacingAdaptive = 4;
1315

1416
return <Box sx={{display: 'flex', flexDirection: 'column', minHeight: '100vh'}}>
1517
<Topbar/>
16-
<Box sx={{py: 5, px: 5, flexGrow: 1}}>
17-
<Grid container spacing={5}>
18+
<Box sx={{
19+
py: {xs: spacingMobile, md: spacingAdaptive},
20+
px: {xs: spacingMobile, md: spacingAdaptive},
21+
flexGrow: 1
22+
}}>
23+
<Grid container spacing={{xs: spacingMobile, md: spacingAdaptive}}>
1824
<Grid item xs={12}>
1925
<DescriptionCard/>
2026
</Grid>
2127
<Grid item xs={12} md={8}>
22-
<ChartCard params={{points, tracks, isLoading, error}}/>
28+
<ChartCard points={points} tracks={tracks} isLoading={isLoading} error={error}/>
2329
</Grid>
2430
<Grid item xs={12} md={4}>
2531
<ChartControlsCard

web/src/chartModule/components/ChartCard.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface IChartProps {
1212
error: string | null;
1313
}
1414

15-
export const ChartCard: React.FC<{ params: IChartProps }> = ({params: {points, tracks, isLoading, error}}) => {
15+
export const ChartCard: React.FC<IChartProps> = ({points, tracks, isLoading, error}) => {
1616
return <StyledCard>
1717
<CardHeader title="Route Chart"/>
1818
<CardContent sx={{width: "100%", height: "100%", p: 0}}>
@@ -44,7 +44,7 @@ function renderChartCardContent({points, tracks, isLoading, error}: IChartProps)
4444
</Box>
4545
}
4646
if (error) {
47-
return <Card sx={{
47+
return <Box sx={{
4848
bgcolor: "pink",
4949
width: "100%",
5050
height: "100%",
@@ -54,7 +54,7 @@ function renderChartCardContent({points, tracks, isLoading, error}: IChartProps)
5454
alignItems: "center"
5555
}}>
5656
<Typography variant="h4" color="error">{error}</Typography>
57-
</Card>
57+
</Box>
5858
}
5959
return <Chart points={points} tracks={tracks}/>;
6060
}

0 commit comments

Comments
 (0)