Skip to content

🎨 Palette: Refactor Unit multiselect with max_selections and improve empty state UX - #56

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

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

Conversation

@Gunnarguy

@Gunnarguy Gunnarguy commented Jul 4, 2026

Copy link
Copy Markdown
Owner
  • 💡 What: Refactored the st.multiselect for "Units" in the Team Lab section to use the native max_selections=4 parameter instead of post-interaction validation and truncation. Also added a nice material icon to the empty state info message.
  • 🎯 Why: Preventing users from selecting more than 4 items proactively is better UX than letting them select 5, truncating it to 4, and showing a warning message. The empty state icon makes the UI more welcoming and less sterile.

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

Summary by Sourcery

Refine the Team Lab units multiselect UX by enforcing a hard limit of four selections and improving the empty-state presentation.

New Features:

  • Limit Team Lab unit selection to a maximum of four units via the multiselect control.
  • Enhance the Team Lab empty state with a material icon to make informational messaging more visually engaging.

Documentation:

  • Extend the Jules palette documentation with guidance on using multiselect max_selections and native UI constraints for better UX.

…empty state UX

Co-authored-by: Gunnarguy <110250624+Gunnarguy@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 4, 2026 08:03
@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.

@sourcery-ai

sourcery-ai Bot commented Jul 4, 2026

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

Reviewer's Guide

Refactors the Team Lab units multiselect to use Streamlit's native max_selections constraint and improves the empty-state informational message with a material icon, while documenting the UX rationale in the palette notes.

Sequence diagram for the updated Team Lab units multiselect with max_selections

sequenceDiagram
    actor User
    participant StreamlitApp
    participant render_team_lab

    User->>StreamlitApp: interact with Team Lab UI
    StreamlitApp->>render_team_lab: render_team_lab(data)
    render_team_lab->>StreamlitApp: st.multiselect("Units", max_selections=4)

    alt [no units selected]
        render_team_lab->>StreamlitApp: st.info("Select up to 4 units to inspect SP economy and defensive coverage.", icon=:material/science:)
        StreamlitApp-->>User: empty state with material icon
    else [1 to 4 units selected]
        render_team_lab->>render_team_lab: analyze selected_variant_ids
        StreamlitApp-->>User: show Team Lab analysis
    end
Loading

File-Level Changes

Change Details Files
Use Streamlit's native max_selections on the Team Lab units multiselect instead of manual post-selection truncation and warnings.
  • Update the multiselect help text to describe analyzing up to 4 units without mentioning truncation behavior.
  • Add max_selections=4 to the units multiselect to proactively prevent selecting more than four items.
  • Remove the conditional logic that warns and truncates selections when more than four units are chosen.
  • Keep the existing empty-state check but rely on the multiselect constraint to maintain valid selections.
src/grandchase_meta_analyzer/explorer_app.py
Enhance the Team Lab empty-state info banner with a material icon and document the UX pattern in palette notes.
  • Augment the empty-state st.info call with a Material Symbols icon shortcode specific to science analysis.
  • Retain the explanatory empty-state message text while adding visual differentiation.
  • Add a new palette entry describing the learning around st.multiselect max_selections and the decision to favor native UI constraints over post-interaction validation.
src/grandchase_meta_analyzer/explorer_app.py
.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:

  • Consider extracting the 4 limit into a named constant shared between max_selections and the help/empty-state text so they stay in sync if the limit needs to change later.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider extracting the `4` limit into a named constant shared between `max_selections` and the help/empty-state text so they stay in sync if the limit needs to change later.

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 Streamlit “Team Lab” unit-selection UX by enforcing a hard cap of 4 selected units directly in the st.multiselect widget and by making the empty-state banner more visually distinctive via a Material icon.

Changes:

  • Switched Team Lab “Units” multiselect to use Streamlit’s native max_selections=4 instead of truncating selections after the fact.
  • Updated the Team Lab empty state info banner to include a Material icon.
  • Added palette documentation describing why to prefer native UI constraints for st.multiselect.

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 Enforces max 4 unit selections via max_selections and enhances empty-state st.info presentation.
.Jules/palette.md Documents the multiselect max_selections UX guideline for future UI work.

Comment on lines +3299 to 3301
help="Select up to 4 units to analyze.",
max_selections=4,
)
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