Skip to content

Commit

Permalink
feat: feeds page performance (#824)
Browse files Browse the repository at this point in the history
* feeds page performance
  • Loading branch information
Alessandro100 authored Nov 15, 2024
1 parent adcae57 commit b959531
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 13 deletions.
Binary file not shown.
6 changes: 4 additions & 2 deletions web-app/src/app/AppContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ const AppContainer: React.FC<ContextProviderProps> = ({ children }) => {
<LinearProgress />
</Box>
) : (
children
<>
{children}
<Footer />
</>
)}
<Footer />
</Box>
);
};
Expand Down
2 changes: 2 additions & 0 deletions web-app/src/app/components/ContentBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface ContentBoxProps {
outlineColor: string;
padding?: Partial<SxProps>;
margin?: string | number;
sx?: SxProps;
}

export const ContentBox = (
Expand All @@ -16,6 +17,7 @@ export const ContentBox = (
<Box
width={props.width}
sx={{
...props.sx,
background: '#FFFFFF',
borderRadius: '6px',
border: `2px solid ${props.outlineColor}`,
Expand Down
45 changes: 38 additions & 7 deletions web-app/src/app/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
AppBar,
Box,
Divider,
Avatar,
Drawer,
IconButton,
List,
Expand Down Expand Up @@ -70,10 +69,30 @@ const DrawerContent: React.FC<{
navigateTo('/');
}}
>
<Avatar src='/assets/MOBILTYDATA_logo_purple_M.png'></Avatar>
<picture style={{ display: 'flex' }}>
<source
media='(min-width: 50px)'
srcSet='/assets/MOBILTYDATA_logo_purple_M.webp'
width='50'
height='50'
/>
<source
src='/assets/MOBILTYDATA_logo_purple_M.png'
type='image/png'
/>
<img
alt='MobilityData logo'
src='/assets/MOBILTYDATA_logo_purple_M.png'
/>
</picture>
<Typography
variant='h6'
sx={{ my: 2, cursor: 'pointer', color: theme.palette.primary.main }}
sx={{
my: 2,
cursor: 'pointer',
color: theme.palette.primary.main,
fontWeight: 700,
}}
data-testid='websiteTile'
>
{websiteTile}
Expand Down Expand Up @@ -384,10 +403,22 @@ export default function DrawerAppBar(): React.ReactElement {
}}
className='btn-link'
>
<Avatar
alt='MobilityData logo'
src='/assets/MOBILTYDATA_logo_purple_M.png'
></Avatar>
<picture style={{ display: 'flex' }}>
<source
media='(min-width: 50px)'
srcSet='/assets/MOBILTYDATA_logo_purple_M.webp'
width='50'
height='50'
/>
<source
src='/assets/MOBILTYDATA_logo_purple_M.png'
type='image/png'
/>
<img
alt='MobilityData logo'
src='/assets/MOBILTYDATA_logo_purple_M.png'
/>
</picture>
<Typography
variant='h5'
component='div'
Expand Down
10 changes: 7 additions & 3 deletions web-app/src/app/screens/Feed/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,15 @@ export default function Feed(): React.ReactElement {
<Skeleton
animation='wave'
variant='rectangular'
sx={{ width: { xs: '100%', sm: '42%' }, height: '630px' }}
sx={{ width: { xs: '100%', sm: '475px' }, height: '630px' }}
/>
<Skeleton
animation='wave'
variant='rectangular'
sx={{ width: { xs: '100%', sm: '58%' }, height: '630px' }}
sx={{
width: { xs: '100%', sm: 'calc(100% - 475px)' },
height: '630px',
}}
/>
</Box>
</Box>,
Expand Down Expand Up @@ -487,8 +490,9 @@ export default function Feed(): React.ReactElement {
>
{feed?.data_type === 'gtfs' && (
<ContentBox
sx={{ flex: 'none' }}
title={t('boundingBoxTitle')}
width={{ xs: '100%', md: 'auto' }}
width={{ xs: '100%', md: '475px' }}
outlineColor={theme.palette.primary.dark}
padding={2}
>
Expand Down
23 changes: 22 additions & 1 deletion web-app/src/app/screens/Feeds/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
Grid,
InputAdornment,
Pagination,
Skeleton,
TableContainer,
TextField,
Typography,
Expand Down Expand Up @@ -293,7 +294,27 @@ export default function Feed(): React.ReactElement {
<Grid item xs={12} md={10}>
{feedStatus === 'loading' && (
<Grid item xs={12}>
<h3>{t('common:loading')}</h3>
<Skeleton
animation='wave'
variant='text'
sx={{ fontSize: '1rem', width: '200px' }}
/>
<Skeleton
animation='wave'
variant='text'
sx={{ fontSize: '2rem', width: '100%' }}
/>
<Skeleton
animation='wave'
variant='rectangular'
width={'100%'}
height={'1118px'}
/>
<Skeleton
animation='wave'
variant='text'
sx={{ fontSize: '2rem', width: '320px' }}
/>
</Grid>
)}

Expand Down

0 comments on commit b959531

Please sign in to comment.