Skip to content

Commit

Permalink
bring back functional stopviewer
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-heppner-ibigroup committed Oct 18, 2023
1 parent e88b88c commit 8a0ed77
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/actions/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ export function setViewedStop(payload, viewer = 'nearby') {
dispatch(setViewedNearbyCoords(payload))
} else {
dispatch(viewStop(payload))
const path = getPathFromParts('stop', payload.id)
const path = getPathFromParts('stop', payload.stopId)
console.log(path)
if (payload) dispatch(routeTo(path))
}
}
Expand Down Expand Up @@ -240,7 +241,7 @@ export function matchContentToUrl(map, location) {
break
case 'stop':
if (id) {
dispatch(setViewedStop({ stopId: id }))
dispatch(setViewedStop({ stopId: id }, 'stop'))
} else {
dispatch(setViewedStop(null))
dispatch(setMainPanelContent(MainPanelContent.STOP_VIEWER))
Expand Down
14 changes: 14 additions & 0 deletions lib/components/viewers/nearby/stop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import React from 'react'

import * as mapActions from '../../../actions/map'
import * as uiActions from '../../../actions/ui'
import { Calendar } from '@styled-icons/fa-solid'

import {
Card,
Expand All @@ -34,6 +35,7 @@ type PatternStopTime = {

type StopData = Place & {
code: string
gtfsId: string
stoptimesForPatterns: PatternStopTime[]
}

Expand Down Expand Up @@ -64,6 +66,7 @@ const getTimezoneWarning = (homeTimezone: string): JSX.Element => {
type Props = {
homeTimezone: string
setLocation: (args: any) => void
setViewedStop: (stop: any, nearby: string) => void
showOperatorLogo: boolean
stopData: StopData
zoomToPlace: (map: any, stopData: any) => void
Expand All @@ -72,6 +75,7 @@ type Props = {
const Stop = ({
homeTimezone,
setLocation,
setViewedStop,
stopData,
zoomToPlace
}: Props): JSX.Element => {
Expand Down Expand Up @@ -147,6 +151,15 @@ const Stop = ({
>
<Icon Icon={Search} style={{ marginLeft: '0.2em' }} />
</button>
<button
className="link-button pull-right"
onClick={() => setViewedStop({ stopId: stopData.gtfsId }, 'stop')}
style={{ fontSize: 'small' }}
>
<IconWithText Icon={Calendar}>
<FormattedMessage id="components.StopViewer.viewSchedule" />
</IconWithText>
</button>
</div>
<span role="group">
<FromToLocationPicker
Expand All @@ -167,6 +180,7 @@ const Stop = ({
const mapDispatchToProps = {
setLocation: mapActions.setLocation,
setMainPanelContent: uiActions.setMainPanelContent,
setViewedStop: uiActions.setViewedStop,
toggleAutoRefresh: uiActions.toggleAutoRefresh,
zoomToPlace: mapActions.zoomToPlace
}
Expand Down

0 comments on commit 8a0ed77

Please sign in to comment.