Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6236f13
fix(EditorInput.js gtfs.yml): Added missing GTFS Extended Route Types
Apr 8, 2021
07a06a6
refactor(gtfs.yml, EditorInput.js): Refactored code
Apr 20, 2021
5289c80
Merge branch 'dev' into add-gtfs-extended-route-types
Apr 20, 2021
c6989f8
refactor(EditorInput): suggest changes for #656
landonreed Apr 20, 2021
ec0d4c1
Merge pull request #659 from ibi-group/add-gtfs-extended-route-types-ltr
Apr 23, 2021
8bf1037
refactor: Apply suggestions from code review
landonreed May 7, 2021
ec1c526
fix(lib/types/index.js): Replaced the gtfs field option type from val…
Jul 19, 2021
da0bda5
fix(EditorInput.js): Refactored the argument to compare a number with…
Jul 19, 2021
d85268b
refactor(EditorInput.js): Aded a radix argunment to the parseInt
Jul 19, 2021
a86e8be
refactor(EditorInput): Extract route type rendering, pass route type …
binh-dam-ibigroup Sep 24, 2021
1061f1f
refactor(EditorInput): Reorder imports
binh-dam-ibigroup Sep 24, 2021
9b26e23
chore(gtfs.yml): Tweak route types.
binh-dam-ibigroup Feb 11, 2022
5509225
feat(RouteTypeSelect): Add route type selector with new extended GTFS…
binh-dam-ibigroup Feb 14, 2022
52d1c40
Merge branch 'dev' into add-gtfs-extended-route-types
binh-dam-ibigroup Feb 14, 2022
51f8848
improvement(RouteTypeSelect): Improve rendering.
binh-dam-ibigroup Feb 14, 2022
008d7e7
refactor(EditorInput): Do first refactor of class.
binh-dam-ibigroup Feb 14, 2022
73c48e0
refactor(EditorInput): Do a light refactor.
binh-dam-ibigroup Feb 14, 2022
7d7928f
test(e2e): Make e2e tests for route editing pass.
binh-dam-ibigroup Feb 15, 2022
bc14fed
refactor(lib/styles.css): Adjust styles for RouteTypeSelect.
binh-dam-ibigroup Feb 15, 2022
e78eb65
improvement(editor/util/validation): Add GTFS route type UI validation.
binh-dam-ibigroup Feb 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 150 additions & 0 deletions gtfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,156 @@
text: Gondola
- value: 7
text: Funicular
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you also add options 11 and 12 (they were recently added to the standard set)? See the spec for routes.txt: https://developers.google.com/transit/gtfs/reference#routestxt for more info

Copy link
Author

Choose a reason for hiding this comment

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

Done!

- value: 100
text: Railway Service
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this value duplicated?

Copy link
Author

Choose a reason for hiding this comment

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

Good spot. And there was a word missing. Going to check the rest now.

- value: 100
text: Railway Service
- value: 101
text: High Speed Rail Service
- value: 102
text: Long Distance Trains
- value: 103
text: Inter Regional Rail Service
- value: 104
text: Car Transport Rail Service
- value: 105
text: Sleeper Rail Service
- value: 106
text: Regional Rail Service
- value: 107
text: Tourist Railway Service
- value: 108
text: Rail Shuttle (Within Complex)
- value: 109
text: Suburban Railway
- value: 110
text: Replacement Rail Service
- value: 111
text: Special Rail Service
- value: 112
text: Lorry Transport Rail Service
- value: 113
text: All Rail Services
- value: 114
text: Cross-Country Rail Service
- value: 115
text: Vehicle Transport Rail Service
- value: 116
text: Rack and Pinion Railway
- value: 117
text: Additional Rail Service
- value: 200
text: Coach Service
- value: 201
text: International Coach Service
- value: 202
text: National Coach Service
- value: 203
text: Shuttle Coach Service
- value: 204
text: Regional Coach Service
- value: 205
text: Special Coach Service
- value: 206
text: Sightseeing Coach Service
- value: 207
text: Tourist Coach Service
- value: 208
text: Commuter Coach Service
- value: 209
text: All Coach Services
- value: 400
text: Urban Railway Service
- value: 401
text: Metro Service
- value: 402
text: Underground Service
- value: 403
text: Urban Railway Service
- value: 404
text: All Urban Railway Services
- value: 405
text: Monorail
- value: 700
text: Bus Service
- value: 701
text: Regional Bus Service
- value: 702
text: Express Bus Service
- value: 703
text: Stopping Bus Service
- value: 704
text: Local Bus Service
- value: 705
text: Night Bus Service
- value: 706
text: Post Bus Service
- value: 707
text: Special Needs Bus
- value: 708
text: Mobility Bus Service
- value: 709
text: Mobility Bus for Registered Disabled
- value: 710
text: Sightseeing Bus
- value: 711
text: Shuttle Bus
- value: 712
text: School Bus
- value: 713
text: School and Public Service Bus
- value: 714
text: Rail Replacement Bus Service
- value: 715
text: Demand and Response Bus Service
- value: 716
text: All Bus Services
- value: 800
text: Trolleybus Service
- value: 900
text: Tram Service
- value: 901
text: City Tram Service
- value: 902
text: Local Tram Service
- value: 903
text: Regional Tram Service
- value: 904
text: Sightseeing Tram Service
- value: 905
text: Shuttle Tram Service
- value: 906
text: All Tram Services
- value: 1000
text: Water Transport Service
- value: 1100
text: Air Service
- value: 1200
text: Ferry Service
- value: 1300
text: Aerial Lift Service
- value: 1400
text: Funicular Service
- value: 1500
text: Taxi Service
- value: 1501
text: Communal Taxi Service
- value: 1502
text: Water Taxi Service
- value: 1503
text: Rail Taxi Service
- value: 1504
text: Bike Taxi Service
- value: 1505
text: Licensed Taxi Service
- value: 1506
text: Private Hire Service Vehicle
- value: 1507
text: All Taxi Services
- value: 1700
text: Miscellaneous Service
- value: 1702
text: Horse-drawn Carriage
columnWidth: 6
helpContent: The route_type field describes the type of transportation used on a route. Valid values for this field are...
- name: route_sort_order
Expand Down
15 changes: 14 additions & 1 deletion lib/editor/components/EditorInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ export default class EditorInput extends Component<Props> {
</span>
)
case 'DROPDOWN':
const standard = 'Standard'
const extended = 'Extended'
return (
Copy link
Contributor

@landonreed landonreed Apr 8, 2021

Choose a reason for hiding this comment

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

To fix the flow type issues and simplify things, I would add something like the following:

if (!field.options) {
  console.warn(`Field `field.name` does not have options configured, but is marked as inputType=DROPDOWN`)
  return null
}

Then, you should be able to remove the field.options && ... checks on lines 315 and 330.

Copy link
Author

Choose a reason for hiding this comment

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

Where do you see the flow issues? When I load the project (before typing any code, I get these kind of squigglies from the beginning of the render method:
image

Copy link
Author

Choose a reason for hiding this comment

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

When I run flow status I get an error:
image

Copy link
Contributor

Choose a reason for hiding this comment

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

The flow errors are showing up in the GitHub builds: https://github.com/ibi-group/datatools-ui/pull/656/checks?check_run_id=2298915284

Locally, you should run yarn flow.

<FormGroup
{...formProps}
Expand All @@ -314,7 +316,18 @@ export default class EditorInput extends Component<Props> {
? <option disabled value=''>{field.required ? '-- select an option --' : '(optional)' }</option>
: null
}
{field.options && field.options.map(o => (<option value={o.value} key={o.value}>{o.text || o.value}</option>))}
{field.name === 'route_type' &&
<optgroup label={standard}>
{field.options.slice(0, 7).map(o => (
Copy link
Contributor

Choose a reason for hiding this comment

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

Because o shows up so many times, I would write .map(({ text, value }) => { ..., and maybe also extract the <optgroup> rendering to its own method because of repetition.

<option value={o.value} key={o.value}>{o.text} ({o.value})</option>))}
</optgroup>}
{field.name === 'route_type' &&
<optgroup label={extended}>
{field.options.slice(8).map(o => (
<option value={o.value} key={o.value}>{o.text} ({o.value})</option>))}
</optgroup>}
)}
{field.name !== 'route_type' && field.options && field.options.map(o => (<option value={o.value} key={o.value}>{o.text || o.value}</option>))}}
</FormControl>
</FormGroup>
)
Expand Down