Skip to content

New Fares v2 selector menu in editor - #1066

Merged
daniel-heppner-ibigroup merged 7 commits into
devfrom
faresv2-selector
Sep 24, 2026
Merged

daniel-heppner-ibigroup merged 7 commits into
devfrom
faresv2-selector

Conversation

@daniel-heppner-ibigroup

@daniel-heppner-ibigroup daniel-heppner-ibigroup commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Checklist

  • Appropriate branch selected (all PRs must first be merged to dev before they can be merged to master)
  • Any modified or new methods or classes have helpful JSDoc and code is thoroughly commented
  • The description lists all applicable issues this PR seeks to resolve
  • The description lists any configuration setting(s) that differ from the default settings
  • All tests and CI builds passing
  • The description lists all relevant PRs included in this release (remove this if not merging to master)
  • e2e tests are all passing (remove this if not merging to master)

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.
image

@daniel-heppner-ibigroup daniel-heppner-ibigroup changed the title Faresv2 selector New Fares v2 selector menu in editor Aug 27, 2026

@binh-dam-ibigroup binh-dam-ibigroup left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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')}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Very clever!


_invalidateSize = () => this.refs.map.leafletElement.invalidateSize()
_scheduleMapResize = () => {
if (this.refs.map) setTimeout(this._invalidateSize, 500)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be a debounce call? (might occur frequently on props update)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the return type should be void.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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'>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For tags with attributes over multiple lines, place the closing brackets >, /> on a new line (multiple instances).

}
<div style={{
position: 'fixed',
display: 'flex',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit - sort props

this.setState({width: window.innerWidth, height: window.innerHeight})
this.refs.map && setTimeout(this._invalidateSize, 500)
}
_invalidateSize = () => this.refs.map && this.refs.map.leafletElement.invalidateSize()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also very clever

Comment on lines +85 to +99
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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Extract a method to count/filter invalid rows, it is the kind of stuff that might be reused elsewhere.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah I was kinda thinking that when I wrote it, I'll go ahead and do it

}, 0)
return {
invalidRowCount,
component,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sort props.

@josh-willis-arcadis josh-willis-arcadis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Image Image

)

function getFieldErrors (
fields: ?Array<GtfsSpecField>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit. sort props

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

these are arguments- can't change the order

@josh-willis-arcadis josh-willis-arcadis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Error happens on git branch swap with server running. Not relevant to this PR.

@daniel-heppner-ibigroup
daniel-heppner-ibigroup merged commit 43412de into dev Sep 24, 2026
4 checks passed
@daniel-heppner-ibigroup
daniel-heppner-ibigroup deleted the faresv2-selector branch September 24, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants