refactor(core): extract ToolbarActions and fix filter dropdown#4128
refactor(core): extract ToolbarActions and fix filter dropdown#4128MarkusNeusinger merged 2 commits intomainfrom
Conversation
- Extract CatalogLink, GridSizeToggle, ToolbarActions from FilterBar.tsx - Eliminate code duplication between desktop and mobile toolbar views - Fix filter dropdown to show all values when category selected without query - Update parse_plot_path to use current directory structure - Update related tests for new path format Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors the frontend FilterBar component and updates the backend plot path parsing to align with the current directory structure. The main changes include extracting reusable toolbar components and fixing a UX issue in the filter dropdown.
Changes:
- Refactored
ToolbarActionscomponents from FilterBar.tsx to eliminate code duplication between desktop and mobile views - Fixed filter dropdown to display all available values when a category is selected without typing a query
- Updated
parse_plot_pathfunction and tests to use the current directory structure:plots/{spec-id}/implementations/{library}.py
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| app/src/components/ToolbarActions.tsx | New component extracting CatalogLink and GridSizeToggle to eliminate duplication |
| app/src/components/FilterBar.tsx | Refactored to use ToolbarActions component and fixed dropdown to show all values when category selected without query |
| automation/scripts/workflow_utils.py | Updated parse_plot_path to match new directory structure (plots/{spec-id}/implementations/{library}.py) |
| automation/scripts/README.md | Updated comment documenting new parse_plot_path format |
| tests/unit/automation/scripts/test_workflow_utils.py | Updated tests for new parse_plot_path format and added test for all libraries |
| tests/unit/automation/scripts/test_workflow_cli.py | Updated CLI tests for new parse_plot_path format and added test to verify old format is invalid |
| match = re.match(r"plots/([^/]+)/implementations/([^/]+)\.py$", file_path) | ||
| if match: | ||
| return { | ||
| "library": match.group(1), | ||
| "plot_type": match.group(2), | ||
| "spec_id": match.group(3), | ||
| "variant": match.group(4), | ||
| "spec_id": match.group(1), | ||
| "library": match.group(2), | ||
| } |
There was a problem hiding this comment.
The parse_plot_path function should validate that the extracted library name is a valid library. Without validation, invalid library names like "plots/scatter-basic/implementations/invalid-lib.py" would be accepted. Consider adding library validation by checking if the library value is in VALID_LIBRARIES before returning the result.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Address Copilot review feedback: reject paths with invalid library names. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
CatalogLink,GridSizeToggle,ToolbarActionscomponents from FilterBar.tsx to eliminate code duplicationparse_plot_pathto use current directory structure (plots/{spec-id}/implementations/{library}.py)Test plan
🤖 Generated with Claude Code