Enhancement: standardize editor panel #2462
Merged
+6,834
−6,482
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors the
EditorPanelcomponent in the chart package to use the sharedEditorPanelbase component from@cdc/core, and cleans up chart-specific logic. It also improves code readability and consistency in the UI, particularly in tooltip and markup formatting.Component refactor and architecture:
EditorPanelimplementation inpackages/chart/src/components/EditorPanel/EditorPanel.tsxwith the sharedEditorPanel(BaseEditorPanel) from@cdc/core/components/EditorPanel/EditorPanel, removing the dependency on theLayoutandErrorBoundarycomponents and updating the render logic accordingly. [1] [2]convertStateToConfig) into a custom function and passes it to the base panel as needed, ensuring chart requirements (like handlingnewVizfield) are preserved.Code cleanup and state management:
displayPanel) and the associatedonBackClickhandler, simplifying the component’s state management. [1] [2]convertStateToConfigand relateduseEffect, centralizing the config transformation logic.UI and markup consistency:
<p>tags and multi-line attributes in JSX. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]These changes streamline the component, promote code reuse, and improve maintainability and user interface consistency.