Skip to content

Thulasizwe/en/panel#3133

Merged
James-Baloyi merged 15 commits intoshesha-io:mainfrom
czwe-01:thulasizwe/en/panel
Apr 17, 2025
Merged

Thulasizwe/en/panel#3133
James-Baloyi merged 15 commits intoshesha-io:mainfrom
czwe-01:thulasizwe/en/panel

Conversation

@czwe-01
Copy link
Copy Markdown
Collaborator

@czwe-01 czwe-01 commented Apr 7, 2025

Summary by CodeRabbit

  • New Features

    • Introduced an optional accent styling option for collapsible panels, enabling customizable border effects that adapt the visual presentation based on panel type.
    • Updated panel design settings to enhance customization options across different device configurations.
  • Style

    • Enhanced icon presentation within image components by refining border radius and display properties.
    • Streamlined border styling for a more uniform and polished look.
    • Improved gap property handling in the container component for consistent pixel formatting.
  • Bug Fixes

    • Removed the maximum length constraint for password input settings, simplifying the configuration options.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 7, 2025

Walkthrough

This pull request introduces a new optional boolean property, accentStyle, into several components and style functions. The property is added to the panel components and interfaces, affecting how border styles are applied and managed. Additionally, conditional logic in the style definitions has been updated to incorporate this flag, and related settings have been adjusted. Minor structural modifications, such as simplifying default header style creation and updating type definitions, are also included. Other unrelated changes include styling updates for stored file icons, removal of a maxLength setting in password combo, and consistent pixel formatting for container gap properties. Overall, the changes focus on enhancing styling flexibility while updating type definitions and UI configurations.

Changes

Files (Group) Change Summary
shesha-reactjs/src/components/panel/index.tsx
shesha-reactjs/src/components/panel/styles/styles.ts
Added new optional accentStyle?: boolean property to panel props and introduced accentStyle parameter in the useStyles function. Updated border styles logic based on accentStyle and panelHeadType.
shesha-reactjs/src/designer-components/collapsiblePanel/collapsiblePanelComponent.tsx
shesha-reactjs/src/designer-components/collapsiblePanel/interfaces.ts
shesha-reactjs/src/designer-components/collapsiblePanel/settingsForm.ts
shesha-reactjs/src/designer-components/collapsiblePanel/utils.ts
Incorporated handling of accentStyle in the collapsible panel designer component, updated interfaces to include the property with type changes, modified settings form logic (renamed IDs, updated properties, visibility conditions including accentStyle), and simplified default header style logic by removing ghost and streamlining border styles.
shesha-reactjs/src/components/storedFilesRendererBase/styles/styles.ts Added a new CSS rule targeting .ant-image .anticon to apply border-radius (defaulting to 8px) and enforce display as block with !important.
shesha-reactjs/src/designer-components/passwordCombo/index.tsx Added a blank line before the <PasswordCombo> JSX element; no logic or structural changes.
shesha-reactjs/src/designer-components/passwordCombo/settingsForm.ts Removed the maxLength number input field from the password combo validation settings.
shesha-reactjs/src/designer-components/container/containerComponent.tsx Updated gap property handling to use addPx utility ensuring pixel units, and changed default gap in migrator from numeric 8 to string '8px'.

Suggested reviewers

  • James-Baloyi

Poem

I'm a bunny coding with glee,
Adding accent styles for all to see.
Borders dance with a vibrant hue,
Components styled shiny and new.
Hop along, let changes show through!
🐇✨
Coding joy from my warren to you!


📜 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 644f851 and e087805.

📒 Files selected for processing (2)
  • shesha-reactjs/src/designer-components/passwordCombo/index.tsx (1 hunks)
  • shesha-reactjs/src/designer-components/passwordCombo/settingsForm.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • shesha-reactjs/src/designer-components/passwordCombo/index.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • shesha-reactjs/src/designer-components/passwordCombo/settingsForm.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-attempt

🪧 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 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.

@czwe-01 czwe-01 requested a review from James-Baloyi April 7, 2025 15:25
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: 1

🧹 Nitpick comments (1)
shesha-reactjs/src/designer-components/collapsiblePanel/interfaces.ts (1)

33-35: Consider maintaining strong typing instead of using 'any'

Changing the types from IStyleType to any reduces type safety. While this provides more flexibility, it may lead to runtime errors that could have been caught at compile time.

Consider maintaining strong typing if possible:

-  desktop?: any;
-  mobile?: any;
-  tablet?: any;
+  desktop?: IStyleType & {accentStyle?: boolean, headerStyles?: any};
+  mobile?: IStyleType & {accentStyle?: boolean, headerStyles?: any};
+  tablet?: IStyleType & {accentStyle?: boolean, headerStyles?: any};
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1f4a79c and b071de8.

📒 Files selected for processing (8)
  • shesha-reactjs/src/components/panel/index.tsx (2 hunks)
  • shesha-reactjs/src/components/panel/styles/styles.ts (6 hunks)
  • shesha-reactjs/src/components/storedFilesRendererBase/styles/styles.ts (1 hunks)
  • shesha-reactjs/src/designer-components/collapsiblePanel/collapsiblePanelComponent.tsx (2 hunks)
  • shesha-reactjs/src/designer-components/collapsiblePanel/interfaces.ts (2 hunks)
  • shesha-reactjs/src/designer-components/collapsiblePanel/settingsForm.ts (6 hunks)
  • shesha-reactjs/src/designer-components/collapsiblePanel/utils.ts (1 hunks)
  • shesha-reactjs/src/designer-components/passwordCombo/index.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-attempt
🔇 Additional comments (19)
shesha-reactjs/src/components/storedFilesRendererBase/styles/styles.ts (1)

97-97: LGTM: Minor whitespace addition

This change only adds a blank line, which has no functional impact on the code.

shesha-reactjs/src/designer-components/passwordCombo/index.tsx (1)

101-125: Simplified component structure by removing unnecessary Fragment

Good improvement - removing the redundant React Fragment wrapper simplifies the component structure without changing functionality.

shesha-reactjs/src/designer-components/collapsiblePanel/utils.ts (1)

31-49: Simplified border styling approach

The border styling logic has been significantly streamlined:

  • Removed the conditional logic based on ghost
  • Changed borderType from 'custom' to 'all'
  • Simplified the border configuration to use a single definition

This change aligns with the new accentStyle property being introduced across components, creating a more consistent styling approach.

shesha-reactjs/src/components/panel/index.tsx (3)

33-33: LGTM: Added new styling property

The addition of the optional accentStyle boolean property to the interface enhances styling flexibility for the CollapsiblePanel component.


64-66: LGTM: Properly updated component parameters

Correctly updated the component parameter destructuring to include the new accentStyle property.


70-70: LGTM: Properly passing new property to styles hook

The accentStyle property is correctly passed to the useStyles hook, ensuring it impacts the component styling as intended.

shesha-reactjs/src/components/panel/styles/styles.ts (5)

10-11: Good addition of the accentStyle parameter to the useStyles function

The addition of the accentStyle parameter allows for conditional styling of panels, matching the PR objectives for enhanced styling flexibility.


75-75: Removed default values for border properties

The default values for headerBorderTopWidth, headerBorderLeftWidth, and headerBorderLeftColor have been removed, which allows direct control of these properties based on the accentStyle parameter.

Also applies to: 84-84, 86-86


163-167: Well-implemented conditional styling based on accentStyle

The implementation correctly applies different border styles based on the accentStyle flag and panelHeadType. For 'default' or 'parent' types, it applies a 3px top border with primary color, while maintaining flexibility for other cases.


200-202: Consistent accent styling for ghost mode

The accent styling is consistently applied to ghost mode panels, ensuring visual coherence across different panel types.


252-253: Consistent accent styling for simple design mode

The accent styling is consistently applied to panels in simple design mode, maintaining the visual language established in other panel variants.

shesha-reactjs/src/designer-components/collapsiblePanel/interfaces.ts (1)

18-18: Good addition of accentStyle property to the interface

The addition of the optional accentStyle property to the ICollapsiblePanelComponentProps interface aligns with the PR objectives.

shesha-reactjs/src/designer-components/collapsiblePanel/settingsForm.ts (4)

115-117: Improved structure of the collapsedByDefault setting

The restructuring of the settings input row improves the organization and readability of the code by adding proper property name and label alignment.

Also applies to: 119-120


135-145: Update hideWhenEmpty description

The description of the hideWhenEmpty property is clear and accurate, explaining the functionality to hide the panel when all components are hidden.


185-236: Well-structured settings rows for appearance options

The restructuring of the settings input rows for ghost and simple design options is well-organized and follows the project's pattern for setting inputs.


794-799: Comprehensive visibility logic for border style settings

The hidden property logic for the border style collapsible panel has been updated to include checking for accentStyle, ensuring proper visibility control based on all relevant settings.

shesha-reactjs/src/designer-components/collapsiblePanel/collapsiblePanelComponent.tsx (3)

170-170: Properly passing accentStyle to the CollapsiblePanel

The accentStyle is correctly passed from the model to the CollapsiblePanel component, ensuring the styling is applied as configured.


232-234: Good initialization of accentStyle in the migrator

The migrator correctly initializes accentStyle based on the previous model's value or the presence of headerStyles, ensuring backward compatibility.


236-239: Consistent application of accentStyle across device configurations

The accentStyle property is consistently passed to all device configurations (desktop, tablet, mobile), ensuring uniform styling across different devices.

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: 0

🧹 Nitpick comments (1)
shesha-reactjs/src/designer-components/collapsiblePanel/collapsiblePanelComponent.tsx (1)

231-237: Consider documenting the derivation logic for accentStyle

The accentStyle property is derived based on whether overflow is undefined, but this relationship isn't self-explanatory. A code comment explaining this design decision would improve maintainability.

  const accentStyle = prev?.overflow === undefined;
+ // accentStyle defaults to true when overflow is undefined to maintain backward compatibility 
+ // with existing panels while enabling the new border styling behavior
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b071de8 and d24509d.

📒 Files selected for processing (3)
  • shesha-reactjs/src/designer-components/collapsiblePanel/collapsiblePanelComponent.tsx (2 hunks)
  • shesha-reactjs/src/designer-components/collapsiblePanel/utils.ts (1 hunks)
  • shesha-reactjs/src/designer-components/passwordCombo/settingsForm.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • shesha-reactjs/src/designer-components/collapsiblePanel/utils.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-attempt
🔇 Additional comments (3)
shesha-reactjs/src/designer-components/collapsiblePanel/collapsiblePanelComponent.tsx (2)

170-170: Good addition of the accentStyle property to CollapsiblePanel

The accentStyle property is now properly passed from the model to the CollapsiblePanel component, enhancing styling flexibility.


241-241: Good use of the spread operator for immutability

Using the spread operator to create a new object for defaultHeaderStyle ensures immutability, which is a best practice in React to prevent unintended side effects.

shesha-reactjs/src/designer-components/passwordCombo/settingsForm.ts (1)

149-149:

Details

✅ Verification successful

Verify if maxLength removal is intentional

The maxLength input field has been removed from the password component settings. This change appears unrelated to the accentStyle additions in other files and might impact validation behavior.


🏁 Script executed:

#!/bin/bash
# Check if maxLength is used elsewhere in the codebase
echo "Searching for maxLength usage in password validation..."
rg "maxLength.*password" --type ts --type tsx

Length of output: 196


Action: Confirm the Intentional Removal of maxLength

It appears our first search encountered an issue with file type recognition for *.tsx files. To be certain the removal of the maxLength input field is intentional and not inadvertently affecting password validation, please run the updated search below across both TypeScript and TSX files:

If this search returns no relevant results, it would indicate that the maxLength property is not in use elsewhere and its removal is likely safe. Otherwise, if any usage is discovered (especially in password-related components), we may need to revisit the change.


🏁 Script executed:

#!/bin/bash
echo "Searching for 'maxLength' usage in .ts and .tsx files..."
rg -g '*.ts' -g '*.tsx' "maxLength"

Length of output: 313


🏁 Script executed:

#!/bin/bash
echo "Searching for 'maxLength' usage in .ts and .tsx files using find and grep..."
find . -type f \( -iname "*.ts" -o -iname "*.tsx" \) -exec grep -H "maxLength" {} \;

Length of output: 258


MaxLength Removal Verified as Intentional

After verifying across all .ts and .tsx files using multiple searches, no references to "maxLength" were found in the codebase. This indicates that the removal of the "maxLength" input field in shesha-reactjs/src/designer-components/passwordCombo/settingsForm.ts is intentional and does not impact validation behavior.

  • Verified with a focused search using find and grep across TS/TSX files with no results.
  • No evidence of any dependency on "maxLength" in any password validation logic was found.

czwe-01 and others added 2 commits April 9, 2025 16:23
…gsForm.ts

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@czwe-01 czwe-01 requested a review from AlexStepantsov April 10, 2025 07:57
@czwe-01 czwe-01 removed the request for review from AlexStepantsov April 17, 2025 06:55
@James-Baloyi James-Baloyi merged commit 271c0cc into shesha-io:main Apr 17, 2025
2 of 4 checks passed
@coderabbitai coderabbitai bot mentioned this pull request May 21, 2025
@coderabbitai coderabbitai bot mentioned this pull request Sep 26, 2025
@coderabbitai coderabbitai bot mentioned this pull request Oct 7, 2025
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