Skip to content

feat: enhance aggregate parameter input with multi-select presets #7168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

catalyst17
Copy link
Contributor

@catalyst17 catalyst17 commented May 27, 2025

[Dashboard] Feature: Enhance Aggregate Parameter Input with Multi-Select Functionality

Notes for the reviewer

This PR replaces the simple dropdown select with a more robust multi-select component for aggregate parameter inputs. The new implementation allows users to select multiple presets and displays them as badges.

How to test

Test the new aggregate parameter input by:

  1. Opening the insight blueprint page
  2. Selecting multiple presets from the dropdown
  3. Verifying that selected values appear as badges
  4. Testing the search functionality within the preset selector
  5. Confirming that manual input still works alongside preset selection

Summary by CodeRabbit

  • New Features
    • Enhanced aggregate parameter input with combined manual entry and multi-select for presets.
    • Added search functionality within the multi-select component for easier preset selection.
    • Updated parameter descriptions and examples for "aggregate" to clarify multi-selection usage.
  • Refactor
    • Made input options optional and improved synchronization between manual input and multi-select.
    • Adjusted tooltip positioning for better UI alignment on aggregate parameters.

PR-Codex overview

This PR enhances the ParameterSection and AggregateParameterInput components by adding conditional rendering for descriptions and examples based on the param.name. It also refines the AggregateParameterInput to use a MultiSelect for aggregation presets, improving user interaction.

Detailed summary

  • Updated the description in ParameterSection based on param.name.
  • Changed example text in ParameterSection conditionally for aggregate.
  • Modified AggregateParameterInput to use MultiSelect instead of Select.
  • Added state management for manual input and selected values in AggregateParameterInput.
  • Implemented custom search functionality for MultiSelect.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

changeset-bot bot commented May 27, 2025

⚠️ No Changeset found

Latest commit: f7331f1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented May 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 28, 2025 9:51pm
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped (Inspect) May 28, 2025 9:51pm
login ⬜️ Skipped (Inspect) May 28, 2025 9:51pm
thirdweb-www ⬜️ Skipped (Inspect) May 28, 2025 9:51pm
wallet-ui ⬜️ Skipped (Inspect) May 28, 2025 9:51pm

Copy link
Contributor

coderabbitai bot commented May 27, 2025

"""

Walkthrough

The AggregateParameterInput component was modified to replace the previous single-select dropdown UI for aggregate presets with a combined manual input field and a multi-select component. It now synchronizes a comma-separated manual input with multi-select badges, supports searching presets by label or value, and uses React hooks for state and event management. Additionally, the ParameterSection component was updated to provide custom description, example text, and tooltip positioning for the "aggregate" parameter.

Changes

File(s) Change Summary
apps/playground-web/src/app/insight/[blueprint_slug]/aggregate-parameter-input.client.tsx Replaced single-select dropdown with manual input plus multi-select; synchronized input and selection state; updated prop types to make some optional; replaced Select with MultiSelect.
apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx Added special UI handling for "aggregate" parameter: fixed description text, example text, and tooltip button positioning.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant AggregateParameterInput
  participant MultiSelect

  User->>AggregateParameterInput: Focuses or types in manual input
  AggregateParameterInput->>AggregateParameterInput: Parses input string into array
  AggregateParameterInput->>MultiSelect: Updates selected presets
  User->>MultiSelect: Selects or deselects presets
  MultiSelect->>AggregateParameterInput: Updates selected presets array
  AggregateParameterInput->>AggregateParameterInput: Updates manual input string (comma-separated)
Loading

Possibly related PRs

Suggested reviewers

  • MananTank
  • jnsdls
    """

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 03342b3 and f7331f1.

📒 Files selected for processing (2)
  • apps/playground-web/src/app/insight/[blueprint_slug]/aggregate-parameter-input.client.tsx (2 hunks)
  • apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx
  • apps/playground-web/src/app/insight/[blueprint_slug]/aggregate-parameter-input.client.tsx
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Build Packages
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Unit Tests
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the Playground Changes involving the Playground codebase. label May 27, 2025
Copy link
Contributor Author

catalyst17 commented May 27, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

codecov bot commented May 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.66%. Comparing base (a5d6e76) to head (f7331f1).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7168   +/-   ##
=======================================
  Coverage   55.66%   55.66%           
=======================================
  Files         904      904           
  Lines       58400    58400           
  Branches     4116     4116           
=======================================
  Hits        32510    32510           
  Misses      25784    25784           
  Partials      106      106           
Flag Coverage Δ
packages 55.66% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
apps/playground-web/src/app/insight/[blueprint_slug]/aggregate-parameter-input.client.tsx (3)

5-11: Remove unused imports to keep bundle lean and satisfy linters

MultiSelect, useEffect, and XIcon are never referenced in this file. Shipping unused symbols bloats the bundle and fails Biome/ES-lint with noUnusedImports.

-import { MultiSelect } from "@/components/blocks/multi-select";
-import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import { useCallback, useMemo, useRef, useState } from "react";-import { ChevronDownIcon, SearchIcon, XIcon } from "lucide-react";
+import { ChevronDownIcon, SearchIcon } from "lucide-react";
🧰 Tools
🪛 Biome (1.9.4)

[error] 5-5: This import is unused.

Unused imports might be the result of an incomplete refactoring.
Safe fix: Remove the unused import.

(lint/correctness/noUnusedImports)


[error] 6-6: This import is unused.

Unused imports might be the result of an incomplete refactoring.
Safe fix: Remove the unused import.

(lint/correctness/noUnusedImports)


[error] 11-11: This import is unused.

Unused imports might be the result of an incomplete refactoring.
Safe fix: Remove the unused import.

(lint/correctness/noUnusedImports)


190-200: Accessibility: pop-over trigger lacks an aria label

Screen-reader users will hear “button” with no description. Add aria-label (or title) so the purpose is announced:

-<Button 
+<Button
+  aria-label="Open aggregation presets"

238-248: Consider allowing badge removal for better UX

Once multiple presets are picked, the only way to remove one is manual text editing.
A small “×” on each badge that deletes the corresponding token would be more intuitive.

(If you agree, I can draft a quick implementation.)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0e4390b and a82e7b1.

📒 Files selected for processing (1)
  • apps/playground-web/src/app/insight/[blueprint_slug]/aggregate-parameter-input.client.tsx (2 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
apps/playground-web/src/app/insight/[blueprint_slug]/aggregate-parameter-input.client.tsx

[error] 5-5: This import is unused.

Unused imports might be the result of an incomplete refactoring.
Safe fix: Remove the unused import.

(lint/correctness/noUnusedImports)


[error] 6-6: This import is unused.

Unused imports might be the result of an incomplete refactoring.
Safe fix: Remove the unused import.

(lint/correctness/noUnusedImports)


[error] 11-11: This import is unused.

Unused imports might be the result of an incomplete refactoring.
Safe fix: Remove the unused import.

(lint/correctness/noUnusedImports)


[error] 202-202: These CSS classes should be sorted.

Unsafe fix: Sort the classes.

(lint/nursery/useSortedClasses)


[error] 204-204: These CSS classes should be sorted.

Unsafe fix: Sort the classes.

(lint/nursery/useSortedClasses)


[error] 209-209: These CSS classes should be sorted.

Unsafe fix: Sort the classes.

(lint/nursery/useSortedClasses)


[error] 223-223: These CSS classes should be sorted.

Unsafe fix: Sort the classes.

(lint/nursery/useSortedClasses)


[error] 228-228: These CSS classes should be sorted.

Unsafe fix: Sort the classes.

(lint/nursery/useSortedClasses)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Size
  • GitHub Check: Analyze (javascript)

Copy link
Contributor

github-actions bot commented May 27, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 61.75 KB (0%) 1.3 s (0%) 191 ms (+64.89% 🔺) 1.5 s
thirdweb (cjs) 344.4 KB (0%) 6.9 s (0%) 897 ms (-1.9% 🔽) 7.8 s
thirdweb (minimal + tree-shaking) 5.69 KB (0%) 114 ms (0%) 68 ms (+885.89% 🔺) 182 ms
thirdweb/chains (tree-shaking) 531 B (0%) 11 ms (0%) 49 ms (+1592.64% 🔺) 59 ms
thirdweb/react (minimal + tree-shaking) 19.54 KB (0%) 391 ms (0%) 108 ms (+449.5% 🔺) 499 ms

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx (2)

530-533: Consider extracting hardcoded description to a constant.

The hardcoded description text for the aggregate parameter works functionally but could impact maintainability. Consider extracting this to a configuration object or constant to improve code organization.

+const PARAMETER_OVERRIDES = {
+  aggregate: {
+    description: "Aggregation(s). You can type in multiple, separated by a comma, or select from the presets",
+    example: "count() AS count_all, countDistinct(address) AS unique_addresses"
+  }
+} as const;

// Later in the component:
-                                      {param.name === "aggregate"
-                                        ? "Aggregation(s). You can type in multiple, separated by a comma, or select from the presets"
-                                        : description}
+                                      {PARAMETER_OVERRIDES[param.name]?.description ?? description}

554-557: Consider using CSS custom properties for magic number.

The hardcoded top-[21px] value appears to be a magic number for tooltip positioning. While functional, consider using a CSS custom property or extracting this value to improve maintainability.

+const AGGREGATE_TOOLTIP_TOP_OFFSET = "top-[21px]";

                                className={cn(
                                  "-translate-y-1/2 absolute top-1/2 right-2 hidden h-auto w-auto p-1.5 text-muted-foreground opacity-50 hover:opacity-100 lg:flex",
-                                  param.name === "aggregate" && "top-[21px]",
+                                  param.name === "aggregate" && AGGREGATE_TOOLTIP_TOP_OFFSET,
                                )}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a82e7b1 and 03342b3.

📒 Files selected for processing (2)
  • apps/playground-web/src/app/insight/[blueprint_slug]/aggregate-parameter-input.client.tsx (2 hunks)
  • apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/playground-web/src/app/insight/[blueprint_slug]/aggregate-parameter-input.client.tsx
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Unit Tests
  • GitHub Check: Lint Packages
  • GitHub Check: Size
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
apps/playground-web/src/app/insight/[blueprint_slug]/blueprint-playground.client.tsx (1)

541-544: LGTM! Example text provides clear guidance.

The custom example for the aggregate parameter demonstrates typical SQL aggregation functions, which helps users understand the expected format for multiple comma-separated aggregations.

@catalyst17 catalyst17 requested a review from AmineAfia May 27, 2025 09:38
Copy link
Member

@MananTank MananTank left a comment

Choose a reason for hiding this comment

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

please see check the comments - also lets modify the UI to be more like: https://v0.dev/chat/p2LWAMXAsD6

Copy link
Contributor Author

addressed all in the next PR

Copy link
Contributor

graphite-app bot commented May 28, 2025

Merge activity

)

## [Dashboard] Feature: Enhance Aggregate Parameter Input with Multi-Select Functionality

## Notes for the reviewer
This PR replaces the simple dropdown select with a more robust multi-select component for aggregate parameter inputs. The new implementation allows users to select multiple presets and displays them as badges.

## How to test
Test the new aggregate parameter input by:
1. Opening the insight blueprint page
2. Selecting multiple presets from the dropdown
3. Verifying that selected values appear as badges
4. Testing the search functionality within the preset selector
5. Confirming that manual input still works alongside preset selection

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Enhanced aggregate parameter input with combined manual entry and multi-select for presets.
  - Added search functionality within the multi-select component for easier preset selection.
  - Updated parameter descriptions and examples for "aggregate" to clarify multi-selection usage.
- **Refactor**
  - Made input options optional and improved synchronization between manual input and multi-select.
  - Adjusted tooltip positioning for better UI alignment on aggregate parameters.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR enhances the `ParameterSection` and `AggregateParameterInput` components to provide dynamic descriptions and examples based on the parameter type. It also refines the handling of selected values and manual input for aggregations, replacing the `Select` component with a `MultiSelect`.

### Detailed summary
- Updated `description` and `exampleToShow` in `ParameterSection` based on `param.name`.
- Introduced `MultiSelect` in `AggregateParameterInput` for selecting aggregation presets.
- Added state management for manual input and selected values.
- Removed the `Select` component in favor of a more flexible input system.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
@graphite-app graphite-app bot force-pushed the feat_enhance_aggregate_parameter_input_with_multi-select_presets branch from b1d6b81 to f7331f1 Compare May 28, 2025 21:48
@vercel vercel bot temporarily deployed to Preview – wallet-ui May 28, 2025 21:48 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb-www May 28, 2025 21:48 Inactive
@vercel vercel bot temporarily deployed to Preview – login May 28, 2025 21:48 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 May 28, 2025 21:48 Inactive
@graphite-app graphite-app bot merged commit f7331f1 into main May 28, 2025
23 checks passed
@graphite-app graphite-app bot deleted the feat_enhance_aggregate_parameter_input_with_multi-select_presets branch May 28, 2025 21:52
@vercel vercel bot temporarily deployed to Production – wallet-ui May 28, 2025 21:52 Inactive
@vercel vercel bot temporarily deployed to Production – login May 28, 2025 21:52 Inactive
@vercel vercel bot temporarily deployed to Production – docs-v2 May 28, 2025 21:52 Inactive
@vercel vercel bot temporarily deployed to Production – thirdweb-www May 28, 2025 21:52 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Playground Changes involving the Playground codebase.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants