Skip to content

🎨 Palette: Improve Team Lab unit selection UX - #71

Open
Gunnarguy wants to merge 1 commit into
mainfrom
palette/ux-multiselect-max-selections-7753378864867968234
Open

Gunnarguy wants to merge 1 commit into
mainfrom
palette/ux-multiselect-max-selections-7753378864867968234

Conversation

@Gunnarguy

@Gunnarguy Gunnarguy commented Jul 20, 2026

Copy link
Copy Markdown
Owner

💡 What: Added max_selections=4 to the Team Lab unit multiselect and removed the manual truncation/warning banner logic. Updated the help text to be clearer.
🎯 Why: Prevents the user from selecting an invalid state (more than 4 units) proactively rather than allowing the invalid state and showing a retroactive warning banner. This makes the interface smoother and more intuitive.
📸 Before/After:
Before: Users could select infinite units, triggering a yellow warning banner and silently dropping the 5th+ unit from calculations.
After: The multiselect visually greys out options and prevents clicking after 4 units are selected, completely removing the need for a warning banner.
♿ Accessibility: Reduces cognitive load by proactively preventing errors instead of requiring users to read and recover from warning states.


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

Summary by Sourcery

Enforce the 4-unit limit directly in the Team Lab multiselect and document the UX pattern change in the Palette notes.

Bug Fixes:

  • Prevent users from temporarily selecting more than 4 units in Team Lab by enforcing the limit at the multiselect component level.

Enhancements:

  • Clarify the Team Lab unit selection help text to better describe the analysis performed.
  • Remove the warning banner and manual truncation logic now that the multiselect enforces the 4-unit selection limit.

Documentation:

  • Add Palette documentation on using Streamlit's max_selections for bounded multiselects instead of retroactive warnings.

💡 What: Added `max_selections=4` to the Team Lab unit multiselect and removed the manual truncation/warning banner logic. Updated the help text to be clearer.
🎯 Why: Prevents the user from selecting an invalid state (more than 4 units) proactively rather than allowing the invalid state and showing a retroactive warning banner. This makes the interface smoother and more intuitive.
📸 Before/After:
Before: Users could select infinite units, triggering a yellow warning banner and silently dropping the 5th+ unit from calculations.
After: The multiselect visually greys out options and prevents clicking after 4 units are selected, completely removing the need for a warning banner.
♿ Accessibility: Reduces cognitive load by proactively preventing errors instead of requiring users to read and recover from warning states.

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 20, 2026 08:10
@sourcery-ai

sourcery-ai Bot commented Jul 20, 2026

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

Reviewer's Guide

This PR updates the Team Lab Streamlit multiselect to enforce a native 4-unit selection limit via max_selections, simplifies the selection handling logic by removing manual truncation and warning UI, and documents the UX pattern change in the Palette guide.

Sequence diagram for Team Lab unit selection before max_selections

sequenceDiagram
    actor User
    participant Streamlit
    participant render_team_lab

    User->>Streamlit: st.multiselect
    Streamlit->>render_team_lab: render_team_lab(data)
    render_team_lab->>render_team_lab: len(selected_variant_ids) > 4
    render_team_lab->>Streamlit: st.warning
    render_team_lab->>render_team_lab: selected_variant_ids = selected_variant_ids[:4]
    render_team_lab->>Streamlit: st.info (empty state when no selections)
Loading

Sequence diagram for Team Lab unit selection after max_selections

sequenceDiagram
    actor User
    participant Streamlit
    participant render_team_lab

    User->>Streamlit: st.multiselect max_selections=4
    Streamlit->>User: Prevent selecting more than 4 units
    Streamlit->>render_team_lab: render_team_lab(data)
    render_team_lab->>Streamlit: st.info (empty state when no selections)
    note over User,Streamlit: Warning banner and manual truncation removed
Loading

File-Level Changes

Change Details Files
Use Streamlit's native multiselect selection limit instead of manual truncation and warnings for Team Lab unit selection.
  • Update the Team Lab multiselect help text to describe the combined SP economy and defensive coverage analysis for up to 4 units.
  • Add max_selections=4 to the Team Lab multiselect configuration to enforce the 4-unit limit at the UI level.
  • Remove post-selection logic that showed a warning and truncated the selection list to the first 4 units.
src/grandchase_meta_analyzer/explorer_app.py
Document the design learning and guidance around using max_selections for bounded Streamlit multiselects.
  • Add a new Palette entry describing why native max_selections is preferred over warning-based truncation when there is a hard conceptual limit.
  • Capture the specific Team Lab 4-unit use case as an example of this UX pattern.
.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 reviewed your changes and they look great!


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

This PR improves the Team Lab unit-selection UX in the Streamlit explorer by enforcing the 4-unit constraint directly at the UI component level, avoiding temporary invalid states and removing now-redundant warning/truncation logic.

Changes:

  • Enforce a hard 4-unit selection limit using st.multiselect(max_selections=4) in Team Lab.
  • Remove the manual “warn + truncate to first 4” post-validation behavior and update the help text accordingly.
  • Document the UX pattern (“prefer native bounded multiselects over retroactive warnings”) in Palette notes.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/grandchase_meta_analyzer/explorer_app.py Uses Streamlit’s native max_selections=4 for Team Lab unit selection and removes manual warning/truncation logic.
.Jules/palette.md Adds a Palette note documenting the preferred UX pattern for bounded multiselect 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