Repository navigation
New Fares v2 selector menu in editor - #1066
Conversation
binh-dam-ibigroup
left a comment
There was a problem hiding this comment.
Just a few formatting nits, but the new entity column looks really nice, and the changes are clean.
| id | ||
| rider_category_id | ||
| } | ||
| ${getFaresV2Query('fareproduct', 'fare_product')} |
|
|
||
| _invalidateSize = () => this.refs.map.leafletElement.invalidateSize() | ||
| _scheduleMapResize = () => { | ||
| if (this.refs.map) setTimeout(this._invalidateSize, 500) |
There was a problem hiding this comment.
Should this be a debounce call? (might occur frequently on props update)
There was a problem hiding this comment.
I don't think prop updates will cause it to be called frequently, since that only triggers when hidden/activeComponent/sidebarExpanded change.
The resize handler is a lot more likely to cause frequent updates, I think, but that's no different from before.
| active: boolean, | ||
| component: string, | ||
| fileStatus: FaresV2FileStatus, | ||
| onClick: () => any |
There was a problem hiding this comment.
I think the return type should be void.
There was a problem hiding this comment.
I started with void here but then flow gives errors because the actual return type is something else. Since the consuming function here doesn't care about the return type, I think any is okay.
| className={className} | ||
| data-test-id={`fares-v2-file-${component}-button`} | ||
| onClick={onClick} | ||
| type='button'> |
There was a problem hiding this comment.
For tags with attributes over multiple lines, place the closing brackets >, /> on a new line (multiple instances).
| } | ||
| <div style={{ | ||
| position: 'fixed', | ||
| display: 'flex', |
| this.setState({width: window.innerWidth, height: window.innerHeight}) | ||
| this.refs.map && setTimeout(this._invalidateSize, 500) | ||
| } | ||
| _invalidateSize = () => this.refs.map && this.refs.map.leafletElement.invalidateSize() |
| const invalidRowCount = entities.reduce((count, entity) => { | ||
| const errors = table.fields | ||
| .map(field => validate( | ||
| field, | ||
| entity[field.name], | ||
| entities, | ||
| entity, | ||
| tableData | ||
| )) | ||
| // $FlowFixMe Flow doesn't recognize #flat on arrays | ||
| .flat() // Exceptions can return multiple errors in one call | ||
| .filter(e => e) | ||
|
|
||
| return errors.length ? count + 1 : count | ||
| }, 0) |
There was a problem hiding this comment.
Extract a method to count/filter invalid rows, it is the kind of stuff that might be reused elsewhere.
There was a problem hiding this comment.
yeah I was kinda thinking that when I wrote it, I'll go ahead and do it
| }, 0) | ||
| return { | ||
| invalidRowCount, | ||
| component, |
josh-willis-arcadis
left a comment
There was a problem hiding this comment.
UI looks really good. I am getting some weird behavior when selecting any of the rule files. Pictured below shows farelegjoinrule as the active component. I clicked on fare_leg_rule.txt and leg rules entities are showing, however the "Create new" button shows leg join rule and the fare_leg_join_rules.txt is still active.
| ) | ||
|
|
||
| function getFieldErrors ( | ||
| fields: ?Array<GtfsSpecField>, |
There was a problem hiding this comment.
nit. sort props
There was a problem hiding this comment.
these are arguments- can't change the order
josh-willis-arcadis
left a comment
There was a problem hiding this comment.
Error happens on git branch swap with server running. Not relevant to this PR.
Checklist
devbefore they can be merged tomaster)Description
This PR adds a new sidebar menu to replace the old drop down for selecting which Fairs V2 file you want to edit. It also shows some helpful information about the validation state of each file.

To add the new sidebar, I removed a lot of old code that calculates the width of each sidebar and offsets them with a simple flexbox based layout.