Skip to content

Fix nested horizontal scroll in schedule period form#1883

Open
iTzxMigz wants to merge 1 commit into
chairemobilite:mainfrom
thomasspina:fix-schedule-period-ui
Open

Fix nested horizontal scroll in schedule period form#1883
iTzxMigz wants to merge 1 commit into
chairemobilite:mainfrom
thomasspina:fix-schedule-period-ui

Conversation

@iTzxMigz

@iTzxMigz iTzxMigz commented Apr 4, 2026

Copy link
Copy Markdown
Contributor
  • Remove nested horizontal scroll by dropping _flex-container-row class from the period (kept on the parent list only), using inline flex styles instead.
  • Constrain period width with maxWidth on the form section and selects so long path names no longer stretch each column.
  • Allow clearing outbound/inbound path when only one choice is available (distinguish 'never set' vs 'user cleared').
  • Hide the Generate button when no outbound path is selected, since the backend rejects schedule generation without one.
  • Add optional style prop to InputSelect for per-usage width constraints.

We can see a preview here the main goal is to remove a scroll in a scroll horizontally and make generate trip without an outbound selection unavailable since it is not allowed:
Screenshot 2026-04-04 at 12 43 41 PM

Summary by CodeRabbit

  • Bug Fixes

    • Prevented schedule-generation button from appearing when outbound path is blank, avoiding invalid submissions.
  • Improvements

    • Select inputs now accept custom inline styling for greater layout flexibility.
    • Schedule period form layout refined with explicit flex row sizing, fit-content width and tighter inner width constraints for improved alignment and visual consistency.

@coderabbitai

coderabbitai Bot commented Apr 4, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d338f915-7c91-4245-afc7-756bf0e6a473

📥 Commits

Reviewing files that changed from the base of the PR and between d3f38d4 and 96e2769.

📒 Files selected for processing (2)
  • packages/chaire-lib-frontend/src/components/input/InputSelect.tsx
  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: pr-build-check
  • GitHub Check: build-and-run-UI-tests (24.x)
  • GitHub Check: test-sequential (24.x)
  • GitHub Check: code-lint
  • GitHub Check: build-and-test (24.x)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/project-rule.mdc)

**/*.{ts,tsx}: Use UUIDs as primary keys for most entities in the database
Use the Status/Result pattern from chaire-lib-common for service functions and handlers
Indent using 4 spaces
Do not use trailing spaces, even in comments or documentation; replace lines with only spaces with blank lines
Use parentheses for arrow function parameters
Document non-trivial functions and attributes using JSDoc or inline comments when short
Use Geographic data in GeoJSON format with coordinates as [longitude, latitude]
Use i18next and the t() function for all user-facing strings to support internationalization

Files:

  • packages/chaire-lib-frontend/src/components/input/InputSelect.tsx
  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
packages/transition-frontend/src/components/**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/project-rule.mdc)

React components should use Redux for state management, i18next for translations, and SCSS for styling

Files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
🧠 Learnings (15)
📓 Common learnings
Learnt from: CR
Repo: chairemobilite/transition PR: 0
File: .cursor/rules/project-rule.mdc:0-0
Timestamp: 2026-02-03T20:40:36.982Z
Learning: Applies to packages/transition-frontend/src/components/**/*.tsx : React components should use Redux for state management, i18next for translations, and SCSS for styling
Learnt from: kaligrafy
Repo: chairemobilite/transition PR: 1782
File: packages/transition-frontend/src/components/map/MapRenderer.tsx:131-142
Timestamp: 2026-04-06T16:24:55.134Z
Learning: In `packages/transition-frontend/src/components/map/TransitionMainMap.tsx`, the `MapStyleSwitch` progress notification is intentionally cleared inside `onStyleChange` after map layers are re-added following a style change, not inside the `style.load` handler in `MapRenderer.tsx`. Clearing it earlier (e.g., on `style.load`) would be premature because layers haven't been restored yet at that point.
📚 Learning: 2025-12-17T22:46:52.336Z
Learnt from: tahini
Repo: chairemobilite/transition PR: 1666
File: packages/chaire-lib-frontend/package.json:60-60
Timestamp: 2025-12-17T22:46:52.336Z
Learning: In packages/chaire-lib-frontend/package.json, the `testing-library/dom` devDependency is required for tests to pass even though it's not explicitly imported. It was previously provided as a transitive dependency through `react-select-event`, but after removing `react-select-event`, it must be explicitly declared.

Applied to files:

  • packages/chaire-lib-frontend/src/components/input/InputSelect.tsx
📚 Learning: 2026-02-03T20:40:36.982Z
Learnt from: CR
Repo: chairemobilite/transition PR: 0
File: .cursor/rules/project-rule.mdc:0-0
Timestamp: 2026-02-03T20:40:36.982Z
Learning: Applies to packages/transition-frontend/src/components/**/*.tsx : React components should use Redux for state management, i18next for translations, and SCSS for styling

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📚 Learning: 2026-02-03T20:40:36.982Z
Learnt from: CR
Repo: chairemobilite/transition PR: 0
File: .cursor/rules/project-rule.mdc:0-0
Timestamp: 2026-02-03T20:40:36.982Z
Learning: Applies to packages/transition-frontend/src/components/routers/*.tsx : Application routing should be defined in `TransitionRouter.tsx` using React Router with feature-based route organization

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📚 Learning: 2025-09-25T16:09:00.577Z
Learnt from: greenscientist
Repo: chairemobilite/transition PR: 1494
File: packages/transition-backend/src/services/transitRouting/TrAccessibilityMapBatch.ts:42-45
Timestamp: 2025-09-25T16:09:00.577Z
Learning: In packages/transition-backend/src/services/transitRouting/TrAccessibilityMapBatch.ts, greenscientist deferred adding input file validation using `if (!job.hasInputFile())` and requested to be reminded about it in a later PR.

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📚 Learning: 2025-11-04T19:35:10.045Z
Learnt from: tahini
Repo: chairemobilite/transition PR: 1554
File: packages/transition-common/src/services/simulation/simulationMethod/OdTripSimulationMethod.ts:23-36
Timestamp: 2025-11-04T19:35:10.045Z
Learning: In the OdTripSimulationMethod (packages/transition-common/src/services/simulation/simulationMethod/OdTripSimulationMethod.ts), the team plans to move away from the datasource path and use batch calculations instead. The current non-functional dataSourceId selector will be reworked as part of this architectural change.

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📚 Learning: 2026-01-28T18:00:30.001Z
Learnt from: kaligrafy
Repo: chairemobilite/transition PR: 1736
File: packages/transition-backend/src/services/generalizedCostFunction/GeneralizedCostFunction.ts:34-47
Timestamp: 2026-01-28T18:00:30.001Z
Learning: In packages/transition-backend/src/services/generalizedCostFunction/GeneralizedCostFunction.ts, the getHeadways method intentionally returns undefined if any leg is missing headway data (rather than handling missing headways per-leg) because applying headway penalties only to some legs could bias the calibration. This all-or-nothing approach ensures consistent treatment of incomplete data.

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📚 Learning: 2026-02-06T19:06:19.438Z
Learnt from: GabrielBruno24
Repo: chairemobilite/transition PR: 1767
File: packages/transition-frontend/src/components/forms/accessibilityComparison/AccessibilityComparisonStatsComponent.tsx:177-178
Timestamp: 2026-02-06T19:06:19.438Z
Learning: In the transition accessibility map API responses (packages/transition-frontend/src/components/forms/accessibilityComparison/AccessibilityComparisonStatsComponent.tsx), the populationData property is always present as an object with the structure { population: number | null; dataSourceAreaRatio: number }. Even when population calculation is disabled or the data source is missing, populationData is returned with population set to null rather than populationData being undefined. Therefore, accessing properties1.populationData.population without optional chaining is safe.

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📚 Learning: 2025-11-25T21:28:28.491Z
Learnt from: kaligrafy
Repo: chairemobilite/transition PR: 1604
File: packages/transition-backend/src/services/weighting/NodeWeightCalculator.ts:74-79
Timestamp: 2025-11-25T21:28:28.491Z
Learning: In packages/transition-backend/src/services/weighting/NodeWeightCalculator.ts, the maxBirdDistanceMeters, maxNetworkDistanceMeters, and maxTravelTimeSeconds parameters should not accept 0 or negative values, as they are semantically invalid for distance and time thresholds. Explicit validation should be preferred over relying on falsy coercion.

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📚 Learning: 2025-11-25T21:24:26.424Z
Learnt from: kaligrafy
Repo: chairemobilite/transition PR: 1604
File: packages/transition-backend/src/models/db/geometryUtils.db.queries.ts:13-16
Timestamp: 2025-11-25T21:24:26.424Z
Learning: In packages/transition-backend/src/models/db/geometryUtils.db.queries.ts and the node weighting feature, POI weights should default to 0 (not 1) when undefined or null, because decay functions can return very small values much smaller than 1, and defaulting to 1 would incorrectly dominate the calculation.

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📚 Learning: 2025-11-18T19:37:07.564Z
Learnt from: greenscientist
Repo: chairemobilite/transition PR: 1588
File: packages/transition-backend/src/services/transitRouting/TrRoutingBatchManager.ts:11-23
Timestamp: 2025-11-18T19:37:07.564Z
Learning: In the chairemobilite/transition repository TypeScript code, greenscientist prefers that reviews highlight when interfaces could be replaced with type aliases for stylistic consistency, especially when the structure is just a data shape.

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📚 Learning: 2026-02-03T20:40:36.982Z
Learnt from: CR
Repo: chairemobilite/transition PR: 0
File: .cursor/rules/project-rule.mdc:0-0
Timestamp: 2026-02-03T20:40:36.982Z
Learning: Applies to **/*.{ts,tsx} : Do not use trailing spaces, even in comments or documentation; replace lines with only spaces with blank lines

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📚 Learning: 2026-04-06T16:24:55.134Z
Learnt from: kaligrafy
Repo: chairemobilite/transition PR: 1782
File: packages/transition-frontend/src/components/map/MapRenderer.tsx:131-142
Timestamp: 2026-04-06T16:24:55.134Z
Learning: In `packages/transition-frontend/src/components/map/TransitionMainMap.tsx`, the `MapStyleSwitch` progress notification is intentionally cleared inside `onStyleChange` after map layers are re-added following a style change, not inside the `style.load` handler in `MapRenderer.tsx`. Clearing it earlier (e.g., on `style.load`) would be premature because layers haven't been restored yet at that point.

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📚 Learning: 2025-09-25T16:40:55.314Z
Learnt from: greenscientist
Repo: chairemobilite/transition PR: 1494
File: packages/transition-backend/src/services/executableJob/ExecutableJob.ts:152-158
Timestamp: 2025-09-25T16:40:55.314Z
Learning: In packages/transition-backend/src/services/executableJob/ExecutableJob.ts, greenscientist deferred improving the hasFile() method to check actual file existence on disk rather than just metadata, indicating it should be addressed in a later PR.

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📚 Learning: 2026-01-21T14:59:52.530Z
Learnt from: kaligrafy
Repo: chairemobilite/transition PR: 1592
File: packages/transition-frontend/src/components/map/CircleSpinnerExtension.tsx:37-44
Timestamp: 2026-01-21T14:59:52.530Z
Learning: In TSX files under packages/transition-frontend/src that currently rely on deck.gl's this.context.animationProps.time for animation timing, prefer window.performance.now() (or performance.now()) to measure elapsed time. Replace time-based calculations tied to deck.gl with direct high-resolution timestamps to improve accuracy and decouple from the rendering library. Ensure animations use delta = now - lastTime, and update lastTime accordingly for smooth, frame-rate-independent timing.

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
🔇 Additional comments (6)
packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx (5)

79-93: Treat null as unset alongside undefined.

Using !== undefined allows null to bypass the single-choice fallback. The codebase uses _isBlank() consistently elsewhere (validator, backend) which treats both null and undefined as blank. Consider using != null or _isBlank() for consistency.


180-186: Consider moving these styles to SCSS.

These inline styles conflict with the frontend styling guideline. This was already discussed in previous reviews - if keeping inline is acceptable given the overflow: auto issue with _flex-container-row, that reasoning could be captured in a comment.


197-197: Clarify the 300px constraint.

A comment explaining why 300px was chosen (or using a percentage/variable) would help future maintainability. This was already noted in a previous review.


207-207: Inline width: '100%' on InputSelect.

Part of the overall inline styles discussion. If the other styles move to SCSS, these could be handled via a class modifier as well.

Also applies to: 255-255


354-360: Good guard against missing outbound path.

Adding !_isBlank(outboundPathId) before showing the Generate button correctly prevents users from attempting schedule generation without an outbound path, matching the backend requirement.

packages/chaire-lib-frontend/src/components/input/InputSelect.tsx (1)

27-27: LGTM!

Clean addition of the optional style prop. Spreading after the defaults allows caller-provided values to override, which is the intended behavior.

Also applies to: 48-49, 96-101


Walkthrough

InputSelect.tsx adds an optional style?: React.CSSProperties prop and spreads ...style into the select element’s inline styles after existing defaults (overflow, whiteSpace, textOverflow), allowing caller-provided values to override those keys. TransitSchedulePeriod.tsx now distinguishes undefined when deriving outboundPathId/inboundPathId (preserves defined falsy values; falls back to single-choice defaults or ''/undefined as specified), requires !_isBlank(outboundPathId) before showing the schedule-generation button, replaces a class-based flex container with explicit inline flex/size styles, constrains an inner container to maxWidth: '300px', and sets InputSelect components to style={{ width: '100%' }}.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective of the pull request—fixing nested horizontal scroll in the schedule period form—which is confirmed by the detailed PR objectives and code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx`:
- Around line 181-187: The inline layout styles in the TransitSchedulePeriod
component (the JSX element with style={{ display:'flex', flexDirection:'row',
flexShrink:0, borderRight:'1px solid rgba(255,255,255,0.2)',
alignItems:'flex-start', width:'fit-content' }}) should be moved into SCSS:
create descriptive class(es) (e.g., .transit-schedule-period-row and variants
used in the same component) in the component's SCSS module, implement the
equivalent CSS (flex, flex-direction, flex-shrink, border-right, align-items,
width handling), replace the inline style props on the corresponding JSX
elements with className references, and apply the same refactor for the other
inline style occurrences in this file (the other similar style usages flagged in
the review). Ensure class names are unique to TransitSchedulePeriod to avoid
collisions.
- Around line 81-93: The code currently checks actualOutboundPathId and
actualInboundPathId with !== undefined which lets null bypass the single-choice
fallback; change the checks to treat null as unset—either use a
nullish-coalescing expression (e.g., use schedulePeriod.outbound_path_id ??
(outboundPathsChoices.length === 1 ? outboundPathsChoices[0].value : '')) and
similarly for inbound (schedulePeriod.inbound_path_id ??
(inboundPathsChoices.length === 1 ? inboundPathsChoices[0].value : undefined)),
or replace the !== undefined checks with != null for both actualOutboundPathId
and actualInboundPathId so the single-choice fallback on outboundPathsChoices
and inboundPathsChoices triggers when values are null.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9eefd364-9ae4-42e3-bd41-991a8e4f0f97

📥 Commits

Reviewing files that changed from the base of the PR and between 3dab47b and 617f7e4.

📒 Files selected for processing (2)
  • packages/chaire-lib-frontend/src/components/input/InputSelect.tsx
  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: test-sequential (24.x)
  • GitHub Check: code-lint
  • GitHub Check: build-and-test (24.x)
  • GitHub Check: pr-build-check
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/project-rule.mdc)

**/*.{ts,tsx}: Use UUIDs as primary keys for most entities in the database
Use the Status/Result pattern from chaire-lib-common for service functions and handlers
Indent using 4 spaces
Do not use trailing spaces, even in comments or documentation; replace lines with only spaces with blank lines
Use parentheses for arrow function parameters
Document non-trivial functions and attributes using JSDoc or inline comments when short
Use Geographic data in GeoJSON format with coordinates as [longitude, latitude]
Use i18next and the t() function for all user-facing strings to support internationalization

Files:

  • packages/chaire-lib-frontend/src/components/input/InputSelect.tsx
  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
packages/transition-frontend/src/components/**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/project-rule.mdc)

React components should use Redux for state management, i18next for translations, and SCSS for styling

Files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
🧠 Learnings (7)
📓 Common learnings
Learnt from: CR
Repo: chairemobilite/transition PR: 0
File: .cursor/rules/project-rule.mdc:0-0
Timestamp: 2026-02-03T20:40:36.982Z
Learning: Applies to packages/transition-frontend/src/components/**/*.tsx : React components should use Redux for state management, i18next for translations, and SCSS for styling
Learnt from: greenscientist
Repo: chairemobilite/transition PR: 1494
File: packages/transition-backend/src/services/transitRouting/TrAccessibilityMapBatch.ts:42-45
Timestamp: 2025-09-25T16:09:00.577Z
Learning: In packages/transition-backend/src/services/transitRouting/TrAccessibilityMapBatch.ts, greenscientist deferred adding input file validation using `if (!job.hasInputFile())` and requested to be reminded about it in a later PR.
📚 Learning: 2025-12-17T22:46:52.336Z
Learnt from: tahini
Repo: chairemobilite/transition PR: 1666
File: packages/chaire-lib-frontend/package.json:60-60
Timestamp: 2025-12-17T22:46:52.336Z
Learning: In packages/chaire-lib-frontend/package.json, the `testing-library/dom` devDependency is required for tests to pass even though it's not explicitly imported. It was previously provided as a transitive dependency through `react-select-event`, but after removing `react-select-event`, it must be explicitly declared.

Applied to files:

  • packages/chaire-lib-frontend/src/components/input/InputSelect.tsx
📚 Learning: 2026-02-03T20:40:36.982Z
Learnt from: CR
Repo: chairemobilite/transition PR: 0
File: .cursor/rules/project-rule.mdc:0-0
Timestamp: 2026-02-03T20:40:36.982Z
Learning: Applies to packages/transition-frontend/src/components/**/*.tsx : React components should use Redux for state management, i18next for translations, and SCSS for styling

Applied to files:

  • packages/chaire-lib-frontend/src/components/input/InputSelect.tsx
  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📚 Learning: 2026-02-03T20:40:36.982Z
Learnt from: CR
Repo: chairemobilite/transition PR: 0
File: .cursor/rules/project-rule.mdc:0-0
Timestamp: 2026-02-03T20:40:36.982Z
Learning: Applies to packages/transition-frontend/src/components/routers/*.tsx : Application routing should be defined in `TransitionRouter.tsx` using React Router with feature-based route organization

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📚 Learning: 2025-09-25T16:09:00.577Z
Learnt from: greenscientist
Repo: chairemobilite/transition PR: 1494
File: packages/transition-backend/src/services/transitRouting/TrAccessibilityMapBatch.ts:42-45
Timestamp: 2025-09-25T16:09:00.577Z
Learning: In packages/transition-backend/src/services/transitRouting/TrAccessibilityMapBatch.ts, greenscientist deferred adding input file validation using `if (!job.hasInputFile())` and requested to be reminded about it in a later PR.

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📚 Learning: 2025-11-04T19:35:10.045Z
Learnt from: tahini
Repo: chairemobilite/transition PR: 1554
File: packages/transition-common/src/services/simulation/simulationMethod/OdTripSimulationMethod.ts:23-36
Timestamp: 2025-11-04T19:35:10.045Z
Learning: In the OdTripSimulationMethod (packages/transition-common/src/services/simulation/simulationMethod/OdTripSimulationMethod.ts), the team plans to move away from the datasource path and use batch calculations instead. The current non-functional dataSourceId selector will be reworked as part of this architectural change.

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
📚 Learning: 2026-01-21T14:59:52.530Z
Learnt from: kaligrafy
Repo: chairemobilite/transition PR: 1592
File: packages/transition-frontend/src/components/map/CircleSpinnerExtension.tsx:37-44
Timestamp: 2026-01-21T14:59:52.530Z
Learning: In TSX files under packages/transition-frontend/src that currently rely on deck.gl's this.context.animationProps.time for animation timing, prefer window.performance.now() (or performance.now()) to measure elapsed time. Replace time-based calculations tied to deck.gl with direct high-resolution timestamps to improve accuracy and decouple from the rendering library. Ensure animations use delta = now - lastTime, and update lastTime accordingly for smooth, frame-rate-independent timing.

Applied to files:

  • packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx
🔇 Additional comments (2)
packages/chaire-lib-frontend/src/components/input/InputSelect.tsx (1)

27-27: Nice extension of InputSelect for per-instance sizing.

The optional style prop is integrated cleanly and keeps backward compatibility.

Also applies to: 48-50, 99-100

packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx (1)

354-359: Good guard on schedule generation eligibility.

Requiring a non-blank outbound path before showing Generate is the right UX and matches backend constraints.

Comment on lines +81 to +93
actualOutboundPathId !== undefined
? actualOutboundPathId
: outboundPathsChoices.length === 1
? outboundPathsChoices[0].value
: '';

const actualInboundPathId = schedulePeriod.inbound_path_id;
const inboundPathId =
actualInboundPathId || (inboundPathsChoices.length === 1 ? inboundPathsChoices[0].value : undefined);
actualInboundPathId !== undefined
? actualInboundPathId
: inboundPathsChoices.length === 1
? inboundPathsChoices[0].value
: undefined;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Handle null as unset in path selection fallback.

Using only !== undefined lets null pass through, so single-choice fallback is skipped for null-valued periods.

Suggested fix
 const outboundPathId =
-    actualOutboundPathId !== undefined
+    actualOutboundPathId !== undefined && actualOutboundPathId !== null
         ? actualOutboundPathId
         : outboundPathsChoices.length === 1
             ? outboundPathsChoices[0].value
             : '';

 const inboundPathId =
-    actualInboundPathId !== undefined
+    actualInboundPathId !== undefined && actualInboundPathId !== null
         ? actualInboundPathId
         : inboundPathsChoices.length === 1
             ? inboundPathsChoices[0].value
             : undefined;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx`
around lines 81 - 93, The code currently checks actualOutboundPathId and
actualInboundPathId with !== undefined which lets null bypass the single-choice
fallback; change the checks to treat null as unset—either use a
nullish-coalescing expression (e.g., use schedulePeriod.outbound_path_id ??
(outboundPathsChoices.length === 1 ? outboundPathsChoices[0].value : '')) and
similarly for inbound (schedulePeriod.inbound_path_id ??
(inboundPathsChoices.length === 1 ? inboundPathsChoices[0].value : undefined)),
or replace the !== undefined checks with != null for both actualOutboundPathId
and actualInboundPathId so the single-choice fallback on outboundPathsChoices
and inboundPathsChoices triggers when values are null.

Comment on lines +181 to 187
display: 'flex',
flexDirection: 'row',
flexShrink: 0,
borderRight: '1px solid rgba(255,255,255,0.2)',
alignItems: 'flex-start',
minWidth: '20rem'
width: 'fit-content'
}}

@coderabbitai coderabbitai Bot Apr 4, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Move these new layout/width styles to SCSS classes.

These inline styles conflict with the frontend styling rule for this path; please shift them to SCSS and keep TSX class-driven.

As per coding guidelines, "React components should use Redux for state management, i18next for translations, and SCSS for styling".

Also applies to: 197-197, 207-207, 255-255

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/transition-frontend/src/components/forms/schedules/TransitSchedulePeriod.tsx`
around lines 181 - 187, The inline layout styles in the TransitSchedulePeriod
component (the JSX element with style={{ display:'flex', flexDirection:'row',
flexShrink:0, borderRight:'1px solid rgba(255,255,255,0.2)',
alignItems:'flex-start', width:'fit-content' }}) should be moved into SCSS:
create descriptive class(es) (e.g., .transit-schedule-period-row and variants
used in the same component) in the component's SCSS module, implement the
equivalent CSS (flex, flex-direction, flex-shrink, border-right, align-items,
width handling), replace the inline style props on the corresponding JSX
elements with className references, and apply the same refactor for the other
inline style occurrences in this file (the other similar style usages flagged in
the review). Ensure class names are unique to TransitSchedulePeriod to avoid
collisions.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Est-ce qu'on voudrait mettre ça dans une classe scss? En aurait-on par hasard qui font déjà qqc de semblable?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for _flex-container-row and similar flex utility classes in SCSS files
rg '_flex-container-row' --type=scss -n -C3

echo "---"
# Also search more broadly for flex-container classes
rg 'flex-container' --type=scss -n -C3

echo "---"
# Check if there's a SCSS file for the TransitSchedulePeriod component
fd 'TransitSchedulePeriod' --extension=scss

echo "---"
# Look for existing SCSS flex-row patterns
rg 'flex-direction.*row|flexDirection.*row' --type=scss -n -C2

Length of output: 98


🏁 Script executed:

#!/bin/bash
# Search for _flex-container-row in SCSS files using glob
rg '_flex-container-row' -g '*.scss' -n -C3

echo "---"
# Also search more broadly for flex-container classes
rg 'flex-container' -g '*.scss' -n -C3

echo "---"
# Check if there's a SCSS file for the TransitSchedulePeriod component
fd 'TransitSchedulePeriod' -e scss

echo "---"
# Look for fit-content or flex-shrink in scss
rg 'fit-content|flex-shrink' -g '*.scss' -n -C2

Length of output: 2713


🏁 Script executed:

#!/bin/bash
# Check full definition of _flex-container-row
rg '_flex-container-row' -g '*.scss' -n -A5 -B2

echo "---"
# Look for schedule-related SCSS files
fd -e scss | xargs grep -l -i 'schedule\|period' 2>/dev/null

echo "---"
# Check what SCSS files exist near the TransitSchedulePeriod component
fd -e scss --search-path packages/transition-frontend/src

Length of output: 720


@tahini_flex-container-row does exist in packages/chaire-lib-frontend/src/styles/_base.scss and covers display: flex; flex-direction: row, but it also sets overflow: auto — which is precisely what was causing the nested horizontal scroll this PR is fixing! That's why the class had to be dropped.

The delta that the inline styles add on top of what _flex-container-row would provide:

  • align-items: flex-start (vs. stretch in the class)
  • flex-shrink: 0
  • border-right: 1px solid rgba(255,255,255,0.2)
  • width: fit-content

There is no dedicated SCSS file for this component (only transition.scss and _jobTables.scss exist under packages/transition-frontend/src/styles/). Moving these to SCSS would require either a new class in transition.scss or a new SCSS module for the schedule forms. That's doable but adds scope to the PR.

A lightweight middle ground would be to keep _flex-container-row with an explicit overflow: visible override class, but given that _flex-container-row + overrides would still end up as component-specific CSS, a dedicated class in transition.scss (e.g. .tr__schedule-period-column) is probably the cleanest path if we want to follow the SCSS guideline strictly.


🧠 Learnings used
Learnt from: CR
Repo: chairemobilite/transition PR: 0
File: .cursor/rules/project-rule.mdc:0-0
Timestamp: 2026-02-03T20:40:36.982Z
Learning: Applies to packages/transition-frontend/src/components/**/*.tsx : React components should use Redux for state management, i18next for translations, and SCSS for styling

Learnt from: greenscientist
Repo: chairemobilite/transition PR: 1588
File: packages/transition-backend/src/services/transitRouting/TrRoutingBatchManager.ts:11-23
Timestamp: 2025-11-18T19:37:07.564Z
Learning: In the chairemobilite/transition repository TypeScript code, greenscientist prefers that reviews highlight when interfaces could be replaced with type aliases for stylistic consistency, especially when the structure is just a data shape.

Learnt from: kaligrafy
Repo: chairemobilite/transition PR: 1592
File: packages/transition-frontend/src/components/map/CircleSpinnerExtension.tsx:37-44
Timestamp: 2026-01-21T14:59:52.530Z
Learning: In TSX files under packages/transition-frontend/src that currently rely on deck.gl's this.context.animationProps.time for animation timing, prefer window.performance.now() (or performance.now()) to measure elapsed time. Replace time-based calculations tied to deck.gl with direct high-resolution timestamps to improve accuracy and decouple from the rendering library. Ensure animations use delta = now - lastTime, and update lastTime accordingly for smooth, frame-rate-independent timing.

@iTzxMigz iTzxMigz force-pushed the fix-schedule-period-ui branch from 617f7e4 to d3f38d4 Compare April 4, 2026 17:08

@tahini tahini left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@kaligrafy, pourrais-tu reviewer, pour les styles, c'est plus dans ton domaine.

Comment on lines +181 to 187
display: 'flex',
flexDirection: 'row',
flexShrink: 0,
borderRight: '1px solid rgba(255,255,255,0.2)',
alignItems: 'flex-start',
minWidth: '20rem'
width: 'fit-content'
}}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Est-ce qu'on voudrait mettre ça dans une classe scss? En aurait-on par hasard qui font déjà qqc de semblable?

- Remove nested horizontal scroll by dropping _flex-container-row class from
  the period (kept on the parent list only), using inline flex styles instead.
- Constrain period width with maxWidth on the form section and selects so
  long path names no longer stretch each column.
- Allow clearing outbound/inbound path when only one choice is available
  (distinguish 'never set' vs 'user cleared').
- Hide the Generate button when no outbound path is selected, since the
  backend rejects schedule generation without one.
- Add optional style prop to InputSelect for per-usage width constraints.
@iTzxMigz iTzxMigz force-pushed the fix-schedule-period-ui branch from d3f38d4 to 96e2769 Compare April 7, 2026 13:50
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.

3 participants