Skip to content

Tshepo/f/drawer#3139

Closed
Tshepo1103-lab wants to merge 9 commits intoshesha-io:mainfrom
Tshepo1103-lab:tshepo/f/drawer
Closed

Tshepo/f/drawer#3139
Tshepo1103-lab wants to merge 9 commits intoshesha-io:mainfrom
Tshepo1103-lab:tshepo/f/drawer

Conversation

@Tshepo1103-lab
Copy link
Copy Markdown
Contributor

@Tshepo1103-lab Tshepo1103-lab commented Apr 10, 2025

Summary by CodeRabbit

  • New Features
    • Introduced configurable drawer height and custom styles for improved flexibility.
    • Enhanced header and footer background style settings with clearer options and tooltips for easier customization.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 10, 2025

Walkthrough

The changes add an optional height property to the IShaDrawer interface in the drawer component. In the ShaDrawer component, the handling of width and height props and styles is modified by commenting out direct width and height assignments and adding debug logging for style properties. The settings form updates numerous control IDs and property names for consistency, replaces dropdown options with predefined arrays including tooltips, and removes redundant readOnly checks without altering logic. The drawer component’s style computations now use allStyles?.jsStyle from the model directly instead of a locally computed style. Additionally, a new optional customStyle property is added to the drawer props interface.

Changes

Files Change Summary
shesha-reactjs/.../drawer.tsx Added optional `height?: string
shesha-reactjs/.../settingsForm.ts Corrected typo in tooltip ID; renamed multiple control IDs and parentIds for header/footer background styles to consistent descriptive names; changed width/height property references from 'width'/'height' to 'dimensions.width'/'dimensions.height' with default values adjusted; removed redundant readOnly properties; replaced dropdown options with predefined arrays and added tooltips.
shesha-reactjs/.../index.tsx Removed local jsStyle computation; replaced usage of jsStyle with allStyles?.jsStyle from the model in border styles, background fetching, and style merging; destructured but did not use width and height from model.
shesha-reactjs/.../models.ts Added optional customStyle?: CSSProperties property to IDrawerProps interface to allow passing custom inline CSS styles to the drawer component.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant C as ShaDrawer
    participant D as Drawer Component

    U->>C: Render drawer with placement and optional height
    C->>C: Log style width and height
    alt Width and height props commented out
        C->>D: Render Drawer without direct width/height props
    else (previous behavior)
        C->>D: Pass width and height props
    end
Loading

Possibly related PRs

  • Tshepo/f/drawer #3128: Modifies the IShaDrawer interface by adding a background property and adjusts the ShaDrawer component, indicating a similar enhancement effort in the drawer component's interface and functionality.

Suggested reviewers

  • James-Baloyi
  • AlexStepantsov

Poem

I'm a little rabbit, hopping with delight,
Code changes bloom like carrots, crisp and bright.
New heights arise where placements decide,
Settings refined on a joyful slide.
In lines of logic, our fixes sing,
Here's to progress — let our praises ring!
🐇🌟

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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.

Copy link
Copy Markdown
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: 3

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ebb1c9c and 3189558.

📒 Files selected for processing (3)
  • shesha-reactjs/src/designer-components/drawer/drawer.tsx (2 hunks)
  • shesha-reactjs/src/designer-components/drawer/index.tsx (3 hunks)
  • shesha-reactjs/src/designer-components/drawer/settingsForm.ts (54 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • shesha-reactjs/src/designer-components/drawer/index.tsx
  • shesha-reactjs/src/designer-components/drawer/settingsForm.ts
🧰 Additional context used
🪛 GitHub Check: build-attempt
shesha-reactjs/src/designer-components/drawer/drawer.tsx

[failure] 143-143:
Unexpected console statement. Only these console methods are allowed: warn, dir, timeLog, assert, clear, count, countReset, group, groupEnd, table, dirxml, error, groupCollapsed, Console, profile, profileEnd, timeStamp, context


[failure] 144-144:
Unexpected console statement. Only these console methods are allowed: warn, dir, timeLog, assert, clear, count, countReset, group, groupEnd, table, dirxml, error, groupCollapsed, Console, profile, profileEnd, timeStamp, context


[failure] 145-145:
Unexpected console statement. Only these console methods are allowed: warn, dir, timeLog, assert, clear, count, countReset, group, groupEnd, table, dirxml, error, groupCollapsed, Console, profile, profileEnd, timeStamp, context

🪛 GitHub Actions: shesha-reactjs-build
shesha-reactjs/src/designer-components/drawer/drawer.tsx

[error] 143-143: Unexpected console statement. Only these console methods are allowed: warn, dir, timeLog, assert, clear, count, countReset, group, groupEnd, table, dirxml, error, groupCollapsed, Console, profile, profileEnd, timeStamp, context (no-console)

🔇 Additional comments (1)
shesha-reactjs/src/designer-components/drawer/drawer.tsx (1)

29-29: Good addition of height property.

Adding the height property to the IShaDrawer interface provides more flexibility for controlling the drawer dimensions. This matches the existing width property pattern and enhances the component's configurability.

Comment on lines +159 to +162
// wrapper: {
// width: style?.width,
// height: style?.height,
// },
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Remove commented-out styles wrapper.

Commented-out code creates confusion and clutters the codebase. Based on the AI summary, it appears you're refactoring how styles are managed. Either implement the new approach directly or remove the commented section entirely.

-// wrapper: {
-//   width: style?.width,
-//   height: style?.height,
-// },

If the dimensions are now being handled through a different mechanism (like the customStyle property mentioned in the AI summary), please ensure that's properly implemented and documented.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// wrapper: {
// width: style?.width,
// height: style?.height,
// },

Comment on lines +143 to +145
console.log('width', style?.width);
console.log('height', style?.height);
console.log('style', props);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove console.log statements causing build failures.

These console.log statements are causing pipeline failures. According to the static analysis tool, only specific console methods are allowed: warn, dir, timeLog, assert, clear, count, countReset, group, groupEnd, table, dirxml, error, groupCollapsed, Console, profile, profileEnd, timeStamp, context.

Replace with either:

-console.log('width', style?.width);
-console.log('height', style?.height);
-console.log('style', props);
+console.warn('width', style?.width);
+console.warn('height', style?.height);
+console.warn('style', props);

Or remove them entirely if they were only for debugging purposes.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
console.log('width', style?.width);
console.log('height', style?.height);
console.log('style', props);
console.warn('width', style?.width);
console.warn('height', style?.height);
console.warn('style', props);
🧰 Tools
🪛 GitHub Check: build-attempt

[failure] 143-143:
Unexpected console statement. Only these console methods are allowed: warn, dir, timeLog, assert, clear, count, countReset, group, groupEnd, table, dirxml, error, groupCollapsed, Console, profile, profileEnd, timeStamp, context


[failure] 144-144:
Unexpected console statement. Only these console methods are allowed: warn, dir, timeLog, assert, clear, count, countReset, group, groupEnd, table, dirxml, error, groupCollapsed, Console, profile, profileEnd, timeStamp, context


[failure] 145-145:
Unexpected console statement. Only these console methods are allowed: warn, dir, timeLog, assert, clear, count, countReset, group, groupEnd, table, dirxml, error, groupCollapsed, Console, profile, profileEnd, timeStamp, context

🪛 GitHub Actions: shesha-reactjs-build

[error] 143-143: Unexpected console statement. Only these console methods are allowed: warn, dir, timeLog, assert, clear, count, countReset, group, groupEnd, table, dirxml, error, groupCollapsed, Console, profile, profileEnd, timeStamp, context (no-console)

Comment on lines +151 to +152
// width='100%'
// height='100%'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Remove commented-out code.

Commented-out code should be removed rather than committed. If these properties are meant to be replaced with a different approach for handling dimensions, consider implementing the new approach directly.

-// width='100%'
-// height='100%'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// width='100%'
// height='100%'

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