Skip to content

Commit 48dc35b

Browse files
authored
Merge pull request #2985 from StoDevX/transportation-info-headers
Headers for transportation routes
2 parents 72fe3a3 + f231699 commit 48dc35b

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

data/bus-times/blue-line.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ line: Blue Line
22
colors:
33
bar: rgb(103, 153, 170)
44
dot: rgb(13, 26, 35)
5+
notice: Route that services the north part of the city. Normal route service is $1.25.
56
schedules:
67
- days: [Mo, Tu, We, Th, Fr]
78
coordinates:

data/bus-times/express.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ line: Express Bus
22
colors:
33
bar: rgb(134, 198, 124)
44
dot: rgb(32, 87, 14)
5+
notice: Route that services the majority of the city limits. Normal route service is free with a St. Olaf ID.
56
schedules:
67
- days: [Mo, Tu, We, Th, Fr]
78
coordinates:

data/bus-times/red-line.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ line: Red Line
22
colors:
33
bar: rgb(233, 87, 95)
44
dot: rgb(151, 27, 16)
5+
notice: Route that services the south part of the city. Normal route service is $1.25.
56
schedules:
67
- days: [Mo, Tu, We, Th, Fr]
78
coordinates: {}

source/views/transportation/bus/line.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import findLast from 'lodash/findLast'
1414
import {Separator} from '@frogpond/separator'
1515
import {BusStopRow} from './components/bus-stop-row'
1616
import {ListSectionHeader, ListFooter, ListRow} from '@frogpond/lists'
17+
import {InfoHeader} from '@frogpond/info-header'
1718

1819
const styles = StyleSheet.create({
1920
separator: {
@@ -152,25 +153,34 @@ export class BusLine extends React.Component<Props, State> {
152153
const {line} = this.props
153154
const {schedule, subtitle} = this.state
154155

155-
const headerEl = (
156+
const INFO_EL = (
156157
<ListSectionHeader
157158
subtitle={subtitle}
158159
title={line.line}
159160
titleStyle={Platform.OS === 'android' ? {color: line.colors.bar} : null}
160161
/>
161162
)
162163

163-
const FOOTER_MSG = `${this.props.line.notice || ''}${
164-
this.props.line.notice ? '\n\n' : ''
165-
}Bus routes and times subject to change without notice\n\nData collected by the humans of All About Olaf`
164+
const LINE_MSG = line.notice || ''
165+
const FOOTER_MSG =
166+
'Bus routes and times subject to change without notice\n\nData collected by the humans of All About Olaf'
166167
const FOOTER_EL = <ListFooter title={FOOTER_MSG} />
167168

169+
const HEADER_EL = LINE_MSG ? (
170+
<React.Fragment>
171+
<InfoHeader message={LINE_MSG} title={`About ${line.line}`} />
172+
{INFO_EL}
173+
</React.Fragment>
174+
) : (
175+
INFO_EL
176+
)
177+
168178
return (
169179
<FlatList
170180
ItemSeparatorComponent={BusLineSeparator}
171181
ListEmptyComponent={EMPTY_SCHEDULE_MESSAGE}
172182
ListFooterComponent={FOOTER_EL}
173-
ListHeaderComponent={headerEl}
183+
ListHeaderComponent={HEADER_EL}
174184
data={schedule ? schedule.timetable : []}
175185
extraData={this.state}
176186
keyExtractor={this.keyExtractor}

0 commit comments

Comments
 (0)