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

feat: Link bus tooltip to line profile #463

Merged
11 changes: 10 additions & 1 deletion src/pages/components/map-related/MapLayers/BusToolTip.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect, useState } from 'react'
import { Link } from 'react-router-dom'
import { Point } from 'src/pages/realtimeMap'
import { Button } from '@mui/material'
import moment from 'moment-timezone'
Expand Down Expand Up @@ -28,6 +29,7 @@ export function BusToolTip({ position, icon }: BusToolTipProps) {
.then((siriRideRes: SiriRideWithRelatedPydanticModel) => setSiriRide(siriRideRes))
.finally(() => setIsLoading(false))
}, [position])

return (
<div className={cn({ 'extend-for-json': showJson }, 'bus-tooltip')}>
{isLoading ? (
YuvalMasada marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -39,7 +41,14 @@ export function BusToolTip({ position, icon }: BusToolTipProps) {
<>
<header className="header">
<h1 className="title">
{t('line')} :<span>{siriRide && siriRide.gtfsRouteRouteShortName}</span>
{t('line')} :
<span>
{siriRide ? (
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
{siriRide ? (

now this check isn't needed

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 left it like this because the whole file is written in this style, but maybe I'll remove it from the whole file since it's not needed inside the returned JSX. sounds good?

Copy link
Member

Choose a reason for hiding this comment

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

sounds great! let's keep things minimal wherever it's possible

Copy link
Member

Choose a reason for hiding this comment

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

(feel free to hit the merge button if you want to)

<Link to={`/profile/${siriRide.gtfsRouteRouteShortName}`}>
{siriRide && siriRide.gtfsRouteRouteShortName}
</Link>
) : null}
</span>
</h1>
<img src={icon} alt="bus icon" className="bus-icon" />
</header>
Expand Down
Loading