-
Notifications
You must be signed in to change notification settings - Fork 96
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
fix: datapilot code block ui #1452
Conversation
WalkthroughThe pull request introduces changes to enhance the styling and functionality of the Changes
Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Reviewed everything up to 49403e9 in 22 seconds
More details
- Looked at
73
lines of code in3
files - Skipped
0
files when reviewing. - Skipped posting
7
drafted comments based on config settings.
1. webview_panels/src/uiCore/components/codeblock/index.tsx:29
- Draft comment:
Consider using theclassname
prop for the outer div to ensure consistent styling.
<div className={classname || classes.codeblock}>
- Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment suggests a change that could improve the flexibility of the component by allowing the outer div's className to be customized. This is a valid suggestion as it enhances the component's styling capabilities. The current implementation does not utilize the 'classname' prop for the outer div, which could be a missed opportunity for customization.
The suggestion might not align with the intended design of the component. The author might have a specific reason for using 'classes.codeblock' for the outer div.
The suggestion does not remove the existing class but adds flexibility by allowing an override. This does not conflict with the current design but enhances it.
The comment is valid as it suggests a meaningful improvement to the code by allowing customization of the outer div's className. It should be kept.
2. webview_panels/src/uiCore/components/codeblock/index.tsx:21
- Draft comment:
Renameclassname
toclassName
to follow camelCase convention.
className
- Reason this comment was not posted:
Marked as duplicate.
3. webview_panels/src/uiCore/components/codeblock/index.tsx:38
- Draft comment:
Renameclassname
toclassName
to follow camelCase convention.
className={className}
- Reason this comment was not posted:
Marked as duplicate.
4. webview_panels/src/modules/dataPilot/components/queryAnalysis/QueryAnalysis.tsx:56
- Draft comment:
Renameclassname
toclassName
to follow camelCase convention.
className={classes.codeblock}
- Reason this comment was not posted:
Marked as duplicate.
5. webview_panels/src/uiCore/components/codeblock/index.tsx:15
- Draft comment:
Add a return type to theCodeBlockComponent
function signature for better clarity and refactoring ease.
}: Props): JSX.Element => {
- Reason this comment was not posted:
Comment was on unchanged code.
6. webview_panels/src/uiCore/components/codeblock/index.tsx:13
- Draft comment:
Use 'className' instead of 'classname' for clarity and consistency with React conventions.
className?: string;
- Reason this comment was not posted:
Marked as duplicate.
7. webview_panels/src/modules/dataPilot/components/queryAnalysis/QueryAnalysis.tsx:56
- Draft comment:
Use 'className' instead of 'classname' for clarity and consistency with React conventions. This applies to multiple instances in the file.
<CodeBlock code={chat.query} language="sql" fileName={chat.fileName} className={classes.codeblock}/>
- Reason this comment was not posted:
Marked as duplicate.
Workflow ID: wflow_7dVK3MZV1TDyzJgx
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
@@ -10,27 +10,32 @@ interface Props { | |||
fileName?: string; | |||
showLineNumbers?: boolean; | |||
titleActions?: ReactNode; | |||
classname?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename classname
to className
to follow camelCase convention.
classname?: string; | |
className?: string; |
There was a problem hiding this 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
🧹 Outside diff range and nitpick comments (3)
webview_panels/src/uiCore/components/codeblock/index.tsx (3)
13-13
: Consider renamingclassname
toclassName
for consistency with React conventions.The addition of this property enhances the component's flexibility for styling. However, to maintain consistency with React naming conventions, it would be better to use
className
instead ofclassname
.Apply this change:
- classname?: string; + className?: string;
27-27
: LGTM. Consider using an object for theme mapping.The addition of
editorTheme
enhances visual customization based on the current theme. To improve readability and maintainability, consider using an object for theme mapping:- const editorTheme = theme === Themes.Dark ? "vsc-dark-plus" : "vs"; + const editorThemes = { + [Themes.Dark]: "vsc-dark-plus", + [Themes.Light]: "vs" + }; + const editorTheme = editorThemes[theme];This approach would make it easier to add more themes in the future if needed.
35-35
: LGTM. Remember to updateclassname
toclassName
if renamed.The addition of
editorTheme
andclassName
props to the CodeblockLib component successfully implements the intended UI improvements. These changes align well with the PR objectives.If you implement the earlier suggestion to rename
classname
toclassName
, remember to update this line as well:- className={classname} + className={className}Also applies to: 38-38
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
- webview_panels/src/modules/dataPilot/components/queryAnalysis/QueryAnalysis.tsx (2 hunks)
- webview_panels/src/modules/dataPilot/datapilot.module.scss (1 hunks)
- webview_panels/src/uiCore/components/codeblock/index.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
- webview_panels/src/modules/dataPilot/datapilot.module.scss
🧰 Additional context used
🔇 Additional comments (5)
webview_panels/src/uiCore/components/codeblock/index.tsx (2)
21-21
: LGTM, pending rename toclassName
.The addition of
classname
to the destructured props is correct and corresponds to the interface change. Remember to rename this toclassName
if you implement the previous suggestion.
Line range hint
1-45
: Summary: Changes successfully address PR objectives with minor improvements suggested.The implemented changes effectively enhance the
CodeBlockComponent
by introducing custom styling capabilities and theme-based editor customization. These modifications align well with the PR objective of fixing the code block UI by applying the correct CSS and theme.To further improve the code:
- Rename
classname
toclassName
for consistency with React conventions.- Consider using an object for theme mapping to improve readability and maintainability.
Overall, the changes successfully resolve the stated issue and improve the component's flexibility.
To verify that these changes resolve the issue as intended, you can run the following commands:
These tests will help ensure that the changes have been implemented correctly and that the component is using the new props as intended.
webview_panels/src/modules/dataPilot/components/queryAnalysis/QueryAnalysis.tsx (3)
13-13
: LGTM: Import statement for CSS moduleThe import statement for the SCSS module is correctly placed and follows best practices for importing CSS modules in React components.
Line range hint
1-114
: Overall assessment: Changes look good and align with PR objectivesThe modifications to import and apply a custom CSS class to the CodeBlock component are well-implemented and should address the UI issues mentioned in the PR objectives. The use of CSS modules is a good practice for style encapsulation.
To fully validate the changes:
- Ensure the styles in the
codeblock
class indatapilot.module.scss
correctly fix the UI issues.- Test the component as described in the PR objectives: open a dbt model, right-click to access the datapilot option, and select "change" to verify that the code block displays the correct UI.
Please confirm that you have tested the changes as described in the PR objectives and that the UI issues have been resolved.
56-56
: LGTM: Applied custom CSS class to CodeBlockThe custom CSS class from the imported module is correctly applied to the CodeBlock component. This change should address the UI issues mentioned in the PR objectives.
To ensure the CSS is correctly applied and the UI is fixed as intended, please verify the following:
- The
codeblock
class exists in thedatapilot.module.scss
file- The styles defined in this class correctly address the UI issues
You can run the following script to check the SCSS file:
If the class is found, please review its contents to ensure it addresses the UI issues described in the PR objectives.
Overview
Problem
In datapilot, codeblock UI is broken
Solution
Fix the codeblock with right css and theme
Screenshot/Demo
A picture is worth a thousand words. Please highlight the changes if applicable.
How to test
Checklist
README.md
updated and added information about my changeImportant
Fixes DataPilot code block UI by adding a
classname
prop toCodeBlockComponent
and updating styles indatapilot.module.scss
.classname
prop toCodeBlockComponent
inindex.tsx
to allow custom styling.QueryAnalysis.tsx
to passclassname
fromdatapilot.module.scss
toCodeBlock
..codeblock
class indatapilot.module.scss
to set--code-bg
totransparent
.This description was created by for 49403e9. It will automatically update as commits are pushed.
Summary by CodeRabbit
New Features
CodeBlock
component with customizable styling through a newclassname
prop.CodeBlock
component.Style
.codeblock
for improved styling options, setting the background to transparent.These updates improve the visual flexibility and customization options for users interacting with the
QueryAnalysis
component.