Skip to content

Commit b959531

Browse files
feat: feeds page performance (#824)
* feeds page performance
1 parent adcae57 commit b959531

File tree

6 files changed

+73
-13
lines changed

6 files changed

+73
-13
lines changed
31.6 KB
Loading

web-app/src/app/AppContainer.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ const AppContainer: React.FC<ContextProviderProps> = ({ children }) => {
2323
<LinearProgress />
2424
</Box>
2525
) : (
26-
children
26+
<>
27+
{children}
28+
<Footer />
29+
</>
2730
)}
28-
<Footer />
2931
</Box>
3032
);
3133
};

web-app/src/app/components/ContentBox.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export interface ContentBoxProps {
77
outlineColor: string;
88
padding?: Partial<SxProps>;
99
margin?: string | number;
10+
sx?: SxProps;
1011
}
1112

1213
export const ContentBox = (
@@ -16,6 +17,7 @@ export const ContentBox = (
1617
<Box
1718
width={props.width}
1819
sx={{
20+
...props.sx,
1921
background: '#FFFFFF',
2022
borderRadius: '6px',
2123
border: `2px solid ${props.outlineColor}`,

web-app/src/app/components/Header.tsx

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
AppBar,
44
Box,
55
Divider,
6-
Avatar,
76
Drawer,
87
IconButton,
98
List,
@@ -70,10 +69,30 @@ const DrawerContent: React.FC<{
7069
navigateTo('/');
7170
}}
7271
>
73-
<Avatar src='/assets/MOBILTYDATA_logo_purple_M.png'></Avatar>
72+
<picture style={{ display: 'flex' }}>
73+
<source
74+
media='(min-width: 50px)'
75+
srcSet='/assets/MOBILTYDATA_logo_purple_M.webp'
76+
width='50'
77+
height='50'
78+
/>
79+
<source
80+
src='/assets/MOBILTYDATA_logo_purple_M.png'
81+
type='image/png'
82+
/>
83+
<img
84+
alt='MobilityData logo'
85+
src='/assets/MOBILTYDATA_logo_purple_M.png'
86+
/>
87+
</picture>
7488
<Typography
7589
variant='h6'
76-
sx={{ my: 2, cursor: 'pointer', color: theme.palette.primary.main }}
90+
sx={{
91+
my: 2,
92+
cursor: 'pointer',
93+
color: theme.palette.primary.main,
94+
fontWeight: 700,
95+
}}
7796
data-testid='websiteTile'
7897
>
7998
{websiteTile}
@@ -384,10 +403,22 @@ export default function DrawerAppBar(): React.ReactElement {
384403
}}
385404
className='btn-link'
386405
>
387-
<Avatar
388-
alt='MobilityData logo'
389-
src='/assets/MOBILTYDATA_logo_purple_M.png'
390-
></Avatar>
406+
<picture style={{ display: 'flex' }}>
407+
<source
408+
media='(min-width: 50px)'
409+
srcSet='/assets/MOBILTYDATA_logo_purple_M.webp'
410+
width='50'
411+
height='50'
412+
/>
413+
<source
414+
src='/assets/MOBILTYDATA_logo_purple_M.png'
415+
type='image/png'
416+
/>
417+
<img
418+
alt='MobilityData logo'
419+
src='/assets/MOBILTYDATA_logo_purple_M.png'
420+
/>
421+
</picture>
391422
<Typography
392423
variant='h5'
393424
component='div'

web-app/src/app/screens/Feed/index.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,12 +311,15 @@ export default function Feed(): React.ReactElement {
311311
<Skeleton
312312
animation='wave'
313313
variant='rectangular'
314-
sx={{ width: { xs: '100%', sm: '42%' }, height: '630px' }}
314+
sx={{ width: { xs: '100%', sm: '475px' }, height: '630px' }}
315315
/>
316316
<Skeleton
317317
animation='wave'
318318
variant='rectangular'
319-
sx={{ width: { xs: '100%', sm: '58%' }, height: '630px' }}
319+
sx={{
320+
width: { xs: '100%', sm: 'calc(100% - 475px)' },
321+
height: '630px',
322+
}}
320323
/>
321324
</Box>
322325
</Box>,
@@ -487,8 +490,9 @@ export default function Feed(): React.ReactElement {
487490
>
488491
{feed?.data_type === 'gtfs' && (
489492
<ContentBox
493+
sx={{ flex: 'none' }}
490494
title={t('boundingBoxTitle')}
491-
width={{ xs: '100%', md: 'auto' }}
495+
width={{ xs: '100%', md: '475px' }}
492496
outlineColor={theme.palette.primary.dark}
493497
padding={2}
494498
>

web-app/src/app/screens/Feeds/index.tsx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
Grid,
1313
InputAdornment,
1414
Pagination,
15+
Skeleton,
1516
TableContainer,
1617
TextField,
1718
Typography,
@@ -293,7 +294,27 @@ export default function Feed(): React.ReactElement {
293294
<Grid item xs={12} md={10}>
294295
{feedStatus === 'loading' && (
295296
<Grid item xs={12}>
296-
<h3>{t('common:loading')}</h3>
297+
<Skeleton
298+
animation='wave'
299+
variant='text'
300+
sx={{ fontSize: '1rem', width: '200px' }}
301+
/>
302+
<Skeleton
303+
animation='wave'
304+
variant='text'
305+
sx={{ fontSize: '2rem', width: '100%' }}
306+
/>
307+
<Skeleton
308+
animation='wave'
309+
variant='rectangular'
310+
width={'100%'}
311+
height={'1118px'}
312+
/>
313+
<Skeleton
314+
animation='wave'
315+
variant='text'
316+
sx={{ fontSize: '2rem', width: '320px' }}
317+
/>
297318
</Grid>
298319
)}
299320

0 commit comments

Comments
 (0)