Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Remove unused Alert component and update video title in Tim… #794

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
398 changes: 198 additions & 200 deletions src/locale/en.json

Large diffs are not rendered by default.

427 changes: 212 additions & 215 deletions src/locale/he.json

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions src/pages/components/YoutubeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ const InfoYoutubeModal = ({ videoUrl, label, title }: InfoYoutubeModalProps) =>
onCancel={() => {
setVisible(false)
}}>
<div className="modal-iframe-container">
<iframe allowFullScreen src={videoUrl} />
</div>
{videoUrl.includes('youtube') ? (
<div className="modal-iframe-container">
<iframe allowFullScreen src={videoUrl} />
</div>
) : (
<></>
)}
</Modal>
</>
)
}

export default InfoYoutubeModal
5 changes: 1 addition & 4 deletions src/pages/dashboard/DashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,10 @@ const DashboardPage = () => {
{t('dashboard_page_title')}
<InfoYoutubeModal
label="Open video about this page"
title={t('youtube_modal_info_title')}
title={t('dashboard_page_description')}
videoUrl="https://www.youtube.com/embed/bXg50_j_hTA?si=4rpSZwMRbMomE4g1"
/>
</Typography>
<Alert severity="info" variant="outlined" icon={false}>
{t('dashboard_page_description')}
</Alert>
{startDate > endDate ? (
<Alert severity="error" variant="outlined" sx={{ bgcolor: '#feeaea' }}>
{t('bug_date_alert')}
Expand Down
13 changes: 9 additions & 4 deletions src/pages/gaps/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import { FormControlLabel, Switch } from '@mui/material'
import Grid from '@mui/material/Unstable_Grid2' // Grid version 2
import CircularProgress from '@mui/material/CircularProgress'
import axios from 'axios'

Check failure on line 9 in src/pages/gaps/index.tsx

View workflow job for this annotation

GitHub Actions / build-outside-docker

Duplicate identifier 'axios'.

Check failure on line 9 in src/pages/gaps/index.tsx

View workflow job for this annotation

GitHub Actions / build

Duplicate identifier 'axios'.
import Typography from '@mui/material/Typography'

Check failure on line 10 in src/pages/gaps/index.tsx

View workflow job for this annotation

GitHub Actions / build-outside-docker

Duplicate identifier 'Typography'.

Check failure on line 10 in src/pages/gaps/index.tsx

View workflow job for this annotation

GitHub Actions / build

Duplicate identifier 'Typography'.
import Alert from '@mui/material/Alert'

Check failure on line 11 in src/pages/gaps/index.tsx

View workflow job for this annotation

GitHub Actions / local-tests

'Alert' is defined but never used
import { PageContainer } from '../components/PageContainer'
import { Row } from '../components/Row'
import { Label } from '../components/Label'
Expand All @@ -22,6 +22,9 @@
import { getRoutesAsync } from '../../api/gtfsService'
import { DateSelector } from '../components/DateSelector'
import DisplayGapsPercentage from '../components/DisplayGapsPercentage'
import axios from 'axios'

Check failure on line 25 in src/pages/gaps/index.tsx

View workflow job for this annotation

GitHub Actions / build-outside-docker

Duplicate identifier 'axios'.

Check failure on line 25 in src/pages/gaps/index.tsx

View workflow job for this annotation

GitHub Actions / local-tests

`axios` import should occur before import of `../components/PageContainer`

Check failure on line 25 in src/pages/gaps/index.tsx

View workflow job for this annotation

GitHub Actions / build

Duplicate identifier 'axios'.
import Typography from '@mui/material/Typography'

Check failure on line 26 in src/pages/gaps/index.tsx

View workflow job for this annotation

GitHub Actions / build-outside-docker

Duplicate identifier 'Typography'.

Check failure on line 26 in src/pages/gaps/index.tsx

View workflow job for this annotation

GitHub Actions / local-tests

`@mui/material/Typography` import should occur before import of `../components/PageContainer`

Check failure on line 26 in src/pages/gaps/index.tsx

View workflow job for this annotation

GitHub Actions / build

Duplicate identifier 'Typography'.
import InfoYoutubeModal from '../components/YoutubeModal'
import { INPUT_SIZE } from 'src/resources/sizes'

const Cell = styled.div`
Expand Down Expand Up @@ -116,12 +119,14 @@

return (
<PageContainer>
<Typography className="page-title" variant="h4">
<Typography variant="h4" className="page-title">
{t('gaps_page_title')}
<InfoYoutubeModal
label={t('open_video_about_this_page')}
title={t('gaps_page_description')}
videoUrl=""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the video url is empty

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is empty because as far as I have seen there is no suitable video to put in place. I thought that maybe down the road someone could produce a suitable video.
If you have another idea I would be happy, or even better if there is a suitable video that I missed.

I also thought of adding it so that it was clear, write me if you want to add it
Screenshot 2024-06-11 123406

the PR is ready for review.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the clarification!
so I guess we should / could remove the iframe if there's no video to be shown (?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to destroy the element
And thank you very much for the feedback

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean by destring the element?
I meant to say that if the modal component gets no url, it should not render an iframe inside of it

/>
</Typography>
<Alert severity="info" variant="outlined" icon={false}>
{t('gaps_page_description')}
</Alert>
<Grid container spacing={2} sx={{ maxWidth: INPUT_SIZE }}>
{/* choose date */}
<Grid xs={4}>
Expand Down
9 changes: 2 additions & 7 deletions src/pages/gapsPatterns/GapsPatternsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useContext, useEffect, useState } from 'react'
import './GapsPatternsPage.scss'
import { Moment } from 'moment'
import { Skeleton, Radio, RadioChangeEvent, Space } from 'antd'
import { Skeleton, Radio, RadioChangeEvent } from 'antd'
import CircularProgress from '@mui/material/CircularProgress'
import moment from 'moment/moment'
import Grid from '@mui/material/Unstable_Grid2' // Grid version 2
Expand Down Expand Up @@ -181,15 +181,10 @@ const GapsPatternsPage = () => {
{t('gaps_patterns_page_title')}
<InfoYoutubeModal
label={t('open_video_about_this_page')}
title={t('youtube_modal_info_title')}
title={t('gaps_patterns_page_description')}
videoUrl="https://www.youtube-nocookie.com/embed?v=-C_rZlbHBmk&list=PL6Rh06rT7uiX1AQE-lm55hy-seL3idx3T&index=4"
/>
</Typography>
<Space direction="vertical" size="middle" style={{ marginBottom: '22px' }}>
<Alert severity="info" variant="outlined" icon={false}>
{t('gaps_patterns_page_description')}
</Alert>
</Space>
{startDate > endDate ? (
<Alert severity="error" variant="outlined" sx={{ bgcolor: '#feeaea' }}>
{t('bug_date_alert')}
Expand Down
21 changes: 15 additions & 6 deletions src/pages/historicTimeline/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { useCallback, useContext, useEffect, useMemo, useState } from 'react'
import styled from 'styled-components'
import { useTranslation } from 'react-i18next'
import moment from 'moment'

Check failure on line 4 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / build-outside-docker

Duplicate identifier 'moment'.

Check failure on line 4 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / build

Duplicate identifier 'moment'.
import Grid from '@mui/material/Unstable_Grid2' // Grid version 2

Check failure on line 5 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / build-outside-docker

Duplicate identifier 'Grid'.

Check failure on line 5 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / build

Duplicate identifier 'Grid'.
import Typography from '@mui/material/Typography'

Check failure on line 6 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / build-outside-docker

Duplicate identifier 'Typography'.

Check failure on line 6 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / build

Duplicate identifier 'Typography'.
import Alert from '@mui/material/Alert'

Check failure on line 7 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / local-tests

'Alert' is defined but never used
import CircularProgress from '@mui/material/CircularProgress'

Check failure on line 8 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / build-outside-docker

Duplicate identifier 'CircularProgress'.

Check failure on line 8 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / build

Duplicate identifier 'CircularProgress'.
import { PageContainer } from '../components/PageContainer'

Check failure on line 9 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / build-outside-docker

Duplicate identifier 'PageContainer'.

Check failure on line 9 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / build

Duplicate identifier 'PageContainer'.
import { SearchContext, TimelinePageState } from '../../model/pageState'

Check failure on line 10 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / build-outside-docker

Duplicate identifier 'SearchContext'.

Check failure on line 10 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / build

Duplicate identifier 'SearchContext'.
import { NotFound } from '../components/NotFound'
import { DateSelector } from '../components/DateSelector'
import LineNumberSelector from 'src/pages/components/LineSelector'
Expand All @@ -24,8 +24,17 @@
import RouteSelector from 'src/pages/components/RouteSelector'
import { Label } from 'src/pages/components/Label'
import StopSelector from 'src/pages/components/StopSelector'
import Typography from '@mui/material/Typography'

Check failure on line 27 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / local-tests

`@mui/material/Typography` import should occur before import of `../components/PageContainer`
import CircularProgress from '@mui/material/CircularProgress'

Check failure on line 28 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / local-tests

`@mui/material/CircularProgress` import should occur before import of `../components/PageContainer`
import { getSiriStopHitTimesAsync } from 'src/api/siriService'
import { TimelineBoard } from 'src/pages/components/timeline/TimelineBoard'
import { PageContainer } from '../components/PageContainer'

Check failure on line 31 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / local-tests

`../components/PageContainer` import should occur before import of `src/pages/components/LineSelector`
import { SearchContext, TimelinePageState } from '../../model/pageState'

Check failure on line 32 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / local-tests

`../../model/pageState` import should occur before import of `src/pages/components/LineSelector`
import { NotFound } from '../components/NotFound'

Check failure on line 33 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / local-tests

`../components/NotFound` import should occur before import of `src/pages/components/LineSelector`
import moment from 'moment'

Check failure on line 34 in src/pages/historicTimeline/index.tsx

View workflow job for this annotation

GitHub Actions / local-tests

`moment` import should occur before import of `../components/PageContainer`
import { DateSelector } from '../components/DateSelector'
import Grid from '@mui/material/Unstable_Grid2' // Grid version 2
import InfoYoutubeModal from '../components/YoutubeModal'

const StyledTimelineBoard = styled(TimelineBoard)`
margin-top: ${MARGIN_MEDIUM * 3}px;
Expand Down Expand Up @@ -140,14 +149,14 @@

return (
<PageContainer>
<Typography variant="h4" gutterBottom>
<Typography variant="h4" className="page-title">
{t('timeline_page_title')}
<InfoYoutubeModal
label={t('open_video_about_this_page')}
title={t('timeline_page_description')}
videoUrl=""
/>
</Typography>

<Alert severity="info" variant="outlined" icon={false}>
{t('timeline_page_description')}
</Alert>

<Grid container spacing={2} sx={{ maxWidth: INPUT_SIZE }}>
{/* choose date */}
<Grid xs={4} className="hideOnMobile">
Expand Down
11 changes: 1 addition & 10 deletions src/pages/timeBasedMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useCallback, useEffect, useMemo, useState } from 'react'
import { MapContainer, Marker, Polyline, Popup, TileLayer, useMap } from 'react-leaflet'
import MarkerClusterGroup from 'react-leaflet-cluster'
import { useTranslation } from 'react-i18next'
import Alert from '@mui/material/Alert'
import Typography from '@mui/material/Typography'
import CircularProgress from '@mui/material/CircularProgress'
import IconButton from '@mui/material/IconButton'
Expand Down Expand Up @@ -102,20 +101,12 @@ export default function TimeBasedMapPage() {
{t('time_based_map_page_title')}
<InfoYoutubeModal
label={t('open_video_about_this_page')}
title={t('youtube_modal_info_title')}
title={t('time_based_map_page_description')}
videoUrl="https://www.youtube-nocookie.com/embed/bXg50_j_hTA?si=t8PiTrTA1budRZg-&amp;start=150"
/>
</Typography>
<Grid container spacing={2} sx={{ maxWidth: INPUT_SIZE }}>
<Grid xs={12} className="hideOnMobile">
<Alert severity="info" variant="outlined" icon={false}>
{t('time_based_map_page_description')}
</Alert>
</Grid>
{/* from date */}
<Grid xs={2} className="hideOnMobile">
<Label text={t('from_date')} />
</Grid>
<Grid sm={5} xs={6}>
<DateSelector
time={to}
Expand Down
Loading