Skip to content

Adds dynamic dropdown for track selection - #11

Merged
Eddykasp merged 7 commits into
kieler:mainfrom
Tokessa:dynamic_dropdown
Sep 16, 2026
Merged

Eddykasp merged 7 commits into
kieler:mainfrom
Tokessa:dynamic_dropdown

Conversation

@Tokessa

@Tokessa Tokessa commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
  • Added a new FieldMultiSelectDropdown field that allows selecting multiple options using checkboxes.
  • Refactored TrackStatement from a dynamic block with a standard dropdown to a static block using the new multi-select dropdown field.

Comment thread locales/de/de_tokens.js Outdated
Comment thread locales/en/en_tokens.js Outdated

Copilot AI 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.

🟡 Changes recommended

Unresolved migration, validation, loading, and field-behavior issues block approval.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds checkbox-based multi-track selection and converts TrackStatement from a dynamic dropdown block to a static block.

Changes:

  • Adds FieldMultiSelectDropdown.
  • Updates track generation, warnings, and localization.
  • Removes the previous dynamic track block implementation.
File summaries
File Summary and review notes
locales/en/en_tokens.js Adds English track-selection tokens. Tooltip still references the removed +/- control (nit, 1 vote).
locales/de/de_tokens.js Adds German translations. Tooltip still references the removed +/- control (nit, 1 vote).
frontend/main.js Adds empty-selection warnings, but initial restores and file loads are not fully covered (moderate, 3 votes).
frontend/generator.js Generates commands from selected tracks, but empty selections can produce and submit invalid RailSL (critical, 1 vote).
frontend/fields.js Implements the checkbox field. The popup content is not cleared between openings (moderate, 1 vote), and option values are replaced by labels (moderate, 1 vote).
frontend/dynamic_blocks.js Removes the previous dynamic track block implementation.
frontend/blocks.js Defines the static TrackStatement block. Saved workspaces can lose selections without migration (critical, 3 votes); its tooltip still references the removed +/- control (nit, 2 votes).
Review details

Suppressed comments (4)

frontend/fields.js:272

  • DropDownDiv reuses this shared content container; without clearing it, each time the field is reopened another checkbox list is appended, so the popup accumulates duplicate/stale rows. Clear contentDiv before appending the new list.
    const contentDiv = Blockly.DropDownDiv.getContentDiv()

frontend/fields.js:230

  • FieldDropdown option tuples use [label, value] (as in segName), but this replaces every tuple with [label, label]. As a result getFieldValue('MULTI_FIELD') returns display labels instead of the configured ITEMn values, making the new field's API inconsistent with the Blockly field it extends and coupling the generator to this hidden behavior. Preserve the option values and map them to segment names in the generator instead.
    this.menuOptions_ = options.map(([val]) => [val, val])

locales/de/de_tokens.js:72

  • The TrackStatement no longer has a +/- field after this refactor, but this tooltip still tells users to click it. Please update the tooltip to describe selecting tracks through the checkbox dropdown; otherwise the new control is documented incorrectly.
  RAILBLOCKS_TRACK_TEXT: 'Setze das Gleis %1 auf %2',

locales/en/en_tokens.js:72

  • The TrackStatement no longer has a +/- field after this refactor, but this tooltip still tells users to click it. Please update the tooltip to describe selecting tracks through the checkbox dropdown; otherwise the new control is documented incorrectly.
  RAILBLOCKS_TRACK_TEXT: 'Set track %1 to %2',
  • Files reviewed: 7/7 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread frontend/blocks.js
Comment thread frontend/generator.js
Comment thread frontend/main.js
Comment thread frontend/blocks.js
@Eddykasp
Eddykasp merged commit bf53c96 into kieler:main Sep 16, 2026
@Tokessa
Tokessa deleted the dynamic_dropdown branch September 19, 2026 10:13
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