Skip to content

🎨 Palette: Improve Team Lab unit selector UX with native constraints - #75

Open
Gunnarguy wants to merge 1 commit into
mainfrom
palette/multiselect-ux-improvements-7631558248620112530
Open

Gunnarguy wants to merge 1 commit into
mainfrom
palette/multiselect-ux-improvements-7631558248620112530

Conversation

@Gunnarguy

@Gunnarguy Gunnarguy commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Replaces manual Python-side validation and warning messages in the Team Lab unit selector with Streamlit's native max_selections=4 argument. Adds a helpful placeholder text for an improved empty-state UX.

Updates .Jules/palette.md to document the learning around native component constraints.


PR created automatically by Jules for task 7631558248620112530 started by @Gunnarguy

Summary by Sourcery

Improve the Team Lab unit selector UX by enforcing selection limits via native Streamlit constraints and documenting the related design learning.

New Features:

  • Add native max selection and placeholder support to the Team Lab unit multiselect for clearer, constraint-aware input.

Enhancements:

  • Remove manual post-selection validation logic in favor of Streamlit's built-in max selection handling in the Team Lab view.

Documentation:

  • Document the practice of using native frontend component constraints instead of Python-side validation in the Palette guidelines.

Replaces manual Python-side validation and warning messages in the Team Lab unit selector with Streamlit's native `max_selections=4` argument. Adds a helpful placeholder text for an improved empty-state UX.

Updates `.Jules/palette.md` to document the learning around native component constraints.

Co-authored-by: Gunnarguy <110250624+Gunnarguy@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings July 24, 2026 08:10
@sourcery-ai

sourcery-ai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Streamlit Team Lab unit selector now relies on native multiselect constraints and improved empty-state messaging, and palette documentation is updated to capture the learning about using native component limits.

Sequence diagram for updated Team Lab unit selection with native max_selections

sequenceDiagram
    actor User
    participant render_team_lab
    participant Streamlit_multiselect

    User->>render_team_lab: open Team Lab view
    render_team_lab->>Streamlit_multiselect: st.multiselect(max_selections=4, placeholder, help)
    User->>Streamlit_multiselect: select up to 4 units
    Streamlit_multiselect-->>render_team_lab: selected_variant_ids

    alt [no units selected]
        render_team_lab->>render_team_lab: st.info("Select up to 4 units to inspect SP economy and defensive coverage.")
        render_team_lab-->>User: return
    else [units selected]
        render_team_lab-->>User: continue with Team Lab analysis
    end
Loading

File-Level Changes

Change Details Files
Use Streamlit multiselect native constraints instead of manual validation for the Team Lab unit selector and refine its UX text.
  • Replace manual Python-side length check and warning with the multiselect max_selections=4 argument so the UI prevents over-selection directly.
  • Add a placeholder message to the multiselect to indicate the 4-unit limit before any selection is made.
  • Update the help text to describe the purpose of selecting units (SP economy and defensive coverage) while still mentioning the 4-unit constraint.
  • Remove logic that truncates the selected units list to the first four entries, relying on the frontend constraint instead.
src/grandchase_meta_analyzer/explorer_app.py
Document the guideline to prefer native Streamlit component constraints over manual validation in the Palette.
  • Add a new learning entry explaining why native component constraints (e.g., max_selections) give a better UX than post-hoc Python validation and warnings.
  • Record an action item encouraging use of component features like max_selections, max_chars, and numeric bounds in Streamlit apps instead of invalid-input alerts.
.Jules/palette.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai 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.

Hey - I've left some high level feedback:

  • The empty-state st.info message, placeholder, and help text now all say essentially the same thing; consider differentiating them (e.g., guidance in help, concise hint in placeholder, and more contextual explanation in the info banner) to avoid redundant messaging.
  • In .Jules/palette.md, the new 2024-05-18 entry appears after a 2025-06-17 entry; if the headings are meant to be chronological, consider reordering them to keep the timeline clear.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The empty-state `st.info` message, placeholder, and help text now all say essentially the same thing; consider differentiating them (e.g., guidance in help, concise hint in placeholder, and more contextual explanation in the info banner) to avoid redundant messaging.
- In `.Jules/palette.md`, the new 2024-05-18 entry appears after a 2025-06-17 entry; if the headings are meant to be chronological, consider reordering them to keep the timeline clear.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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

Pull request overview

Improves the Team Lab “Units” selector UX by relying on Streamlit’s native selection constraints rather than post-selection Python validation, and captures the guideline in the Palette docs.

Changes:

  • Enforce the 4-unit selection limit via st.multiselect(max_selections=4) and add placeholder/help text for clearer guidance.
  • Remove the Python-side “truncate + warning” behavior for over-selection.
  • Document the preference for native component constraints in .Jules/palette.md.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/grandchase_meta_analyzer/explorer_app.py Uses max_selections=4 and improved empty-state guidance for the Team Lab unit selector.
.Jules/palette.md Adds a documented UX guideline advocating native widget constraints over manual validation.

Comment thread .Jules/palette.md
Comment on lines +12 to +14
## 2024-05-18 - Leverage Native Component Constraints
**Learning:** Preferring native frontend component constraints (like `max_selections` for `st.multiselect`) over manual Python-side validation and warning messages improves user experience by preventing invalid states rather than just scolding the user afterward.
**Action:** Use native component features (e.g. `max_selections`, `max_chars`, `min_value`/`max_value`) in Streamlit apps instead of showing alerts/warnings on invalid inputs.
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.

2 participants