Skip to content

Commit cb09c31

Browse files
committed
DT-6951 show error if no stops or stations to show
1 parent 4459031 commit cb09c31

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

src/ui/Monitor.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { ConfigContext, MonitorContext } from '../contexts';
1010
import { stopsAndStationsFromViews } from '../util/monitorUtils';
1111
import { getStopIcon } from '../util/stopCardUtil';
1212
import MonitorMapContainer from '../MonitorMapContainer';
13+
import NoMonitorsFound from './NoMonitorsFound';
1314

1415
const getWindowDimensions = () => {
1516
const { innerWidth: width, innerHeight: height } = window;
@@ -129,6 +130,24 @@ const Monitor: FC<IProps> = ({
129130
stopsForMap.forEach(c => {
130131
c.coords.flat();
131132
});
133+
if (stopsForMap.length === 0) {
134+
return (
135+
<div
136+
style={style}
137+
className={cx('main-content-container', {
138+
preview: isPreview,
139+
portrait: !isLandscapeByLayout,
140+
})}
141+
onMouseMove={() => {
142+
setShowOverlay(true);
143+
clearTimeout(to);
144+
to = setTimeout(() => setShowOverlay(false), 3000);
145+
}}
146+
>
147+
<NoMonitorsFound />
148+
</div>
149+
);
150+
}
132151
return (
133152
<div
134153
style={style}

src/ui/MonitorTitleBar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ const MonitorTitlebar: FC<IProps> = ({
2626
const lat =
2727
view.type === 'map'
2828
? view.stops[0].coords[0]
29-
: view.columns.left.stops[0].lat;
29+
: view.columns.left.stops[0]?.lat;
3030
const lon =
3131
view.type === 'map'
3232
? view.stops[0].coords[1]
33-
: view.columns.left.stops[0].lon;
33+
: view.columns.left.stops[0]?.lon;
3434

3535
const showWeather = !isMultiDisplay && isLandscape && lat && lon;
3636

0 commit comments

Comments
 (0)