Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(connected-itinerary-body): make alert collapse configurable #1182

Merged
merged 5 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions example-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ itinerary:
renderRouteNamesInBlocks: true
# Whether the mode icons should be colored as well
fillModeIcons: true
# Allow user to collapse alerts in itinerary body
allowUserAlertCollapsing: true
# If multiple fares are returned by OTP, assign names to the fare keys here
#fareKeyNameMap:
# regular: "Transit Fare"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class ConnectedItineraryBody extends Component {
const clonedItinerary = clone(itinerary)

const showViewTripButton = !config?.itinerary?.hideViewTripButton
const allowUserAlertCollapsing = config?.itinerary?.allowUserAlertCollapsing

// Support OTP1 flex messages in Trip Details
// Adding empty pickupBookingInfo and dropOffBookingInfo objects
Expand Down Expand Up @@ -116,6 +117,7 @@ class ConnectedItineraryBody extends Component {
<ItineraryBodyContainer>
<StyledItineraryBody
accessibilityScoreGradationMap={accessibilityScoreGradationMap}
alwaysCollapseAlerts={allowUserAlertCollapsing}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
alwaysCollapseAlerts={allowUserAlertCollapsing}
alwaysCollapseAlerts={!allowUserAlertCollapsing}

Should this be flipped?

Copy link
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 so, I'm setting allowUserAlertCollapsing to true in the config!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unless we want alerts to collapse by default, which might be preferable?

Copy link
Collaborator

Choose a reason for hiding this comment

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

But as it is right now if allowUserAlertCollapsing is true, then they won't be allowed to collapse them right? Or am I forgetting how the behavior works

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, alwaysCollapseAlerts needs to be true for the alerts to collapse

config={config}
diagramVisible={diagramVisible}
itinerary={clonedItinerary}
Expand Down
1 change: 1 addition & 0 deletions lib/util/config-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ export interface ItineraryCostWeights {
}

export interface ItineraryConfig {
allowUserAlertCollapsing?: boolean
costs?: ItineraryCostConfig
customBatchUiBackground?: boolean
defaultFareType?: FareProductSelector
Expand Down
Loading