Skip to content

migration of display and wrap#3468

Merged
James-Baloyi merged 4 commits intoshesha-io:mainfrom
czwe-01:thulasizwe/en/container-container
Jun 27, 2025
Merged

migration of display and wrap#3468
James-Baloyi merged 4 commits intoshesha-io:mainfrom
czwe-01:thulasizwe/en/container-container

Conversation

@czwe-01
Copy link
Copy Markdown
Collaborator

@czwe-01 czwe-01 commented Jun 27, 2025

#3354

Summary by CodeRabbit

  • Style
    • Improved layout consistency for specific components by updating display, flex wrap, and alignment styles. Users may notice better alignment and arrangement in certain table control elements.
    • Adjusted default container width to auto, enhancing layout flexibility in button group components.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jun 27, 2025

Walkthrough

The defaultStyles function in the container data module was updated to conditionally set the display, flexWrap, and alignItems style properties based on the value of the className property in the input. These overrides apply specifically to certain class names. Additionally, the default container width in the button group utils was changed from '100%' to 'auto'.

Changes

File(s) Change Summary
shesha-reactjs/src/designer-components/container/data.ts Updated defaultStyles to override display, flexWrap, and alignItems for specific class names.
shesha-reactjs/src/designer-components/button/buttonGroup/utils.tsx Changed default container width from '100%' to 'auto' in defaultContainerStyles.

Possibly related PRs

Suggested reviewers

  • James-Baloyi

Poem

A tweak for styles, a flex display,
When tables appear, nowrap’s the way.
Align to the center, for classes just right,
Code hops along, in CSS delight.
🐇✨


📜 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 8e78a68 and b993426.

📒 Files selected for processing (1)
  • shesha-reactjs/src/designer-components/button/buttonGroup/utils.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: teboho
PR: shesha-io/shesha-framework#3461
File: shesha-reactjs/src/designer-components/charts/settingsFormIndividual.ts:1280-1280
Timestamp: 2025-06-26T19:59:22.839Z
Learning: In shesha-reactjs chart settings forms, the styling panels (border, shadow, background) should not include buttonType-based hidden conditions since charts are not button components. The border configuration should follow the standard component pattern without button-specific restrictions.
Learnt from: teboho
PR: shesha-io/shesha-framework#3397
File: shesha-reactjs/src/designer-components/charts/bar.tsx:49-52
Timestamp: 2025-06-12T16:55:57.638Z
Learning: For the chart components’ migrators (e.g., BarChartComponent in shesha-reactjs/src/designer-components/charts/bar.tsx), the version 5 step intentionally spreads `{ ...prev, ...defaultConfigFiller }` so that values from `defaultConfigFiller` override any existing properties in `prev`. This reset to new defaults is by design and should not be flagged as an issue.
shesha-reactjs/src/designer-components/button/buttonGroup/utils.tsx (4)
Learnt from: teboho
PR: shesha-io/shesha-framework#3397
File: shesha-reactjs/src/designer-components/charts/bar.tsx:49-52
Timestamp: 2025-06-12T16:55:57.638Z
Learning: For the chart components’ migrators (e.g., BarChartComponent in shesha-reactjs/src/designer-components/charts/bar.tsx), the version 5 step intentionally spreads `{ ...prev, ...defaultConfigFiller }` so that values from `defaultConfigFiller` override any existing properties in `prev`. This reset to new defaults is by design and should not be flagged as an issue.
Learnt from: teboho
PR: shesha-io/shesha-framework#3461
File: shesha-reactjs/src/designer-components/charts/settingsFormIndividual.ts:1280-1280
Timestamp: 2025-06-26T19:59:22.839Z
Learning: In shesha-reactjs chart settings forms, the styling panels (border, shadow, background) should not include buttonType-based hidden conditions since charts are not button components. The border configuration should follow the standard component pattern without button-specific restrictions.
Learnt from: teboho
PR: shesha-io/shesha-framework#3312
File: shesha-reactjs/src/hooks/formComponentHooks.ts:183-192
Timestamp: 2025-05-28T07:55:21.036Z
Learning: In shesha-reactjs formComponentHooks.ts, the background style initialization deliberately sets valid values from properties panel immediately to provide better UX, rather than waiting for the useDeepCompareEffect to run. This intentional pattern prevents a flash of no background and shows the background image immediately when the component renders.
Learnt from: teboho
PR: shesha-io/shesha-framework#3374
File: shesha-reactjs/src/generic-pages/settings/dynamic-theme/textsExample.tsx:13-15
Timestamp: 2025-06-10T11:52:51.462Z
Learning: In the Shesha framework's dynamic theme system, the "Global text" Typography element in textsExample.tsx is intentionally left without explicit styling to demonstrate automatic global text color application through the ConfigProvider's colorText token, while the "Default text" element uses explicit theme color styling to show the difference between global and default text color approaches.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-attempt
🔇 Additional comments (1)
shesha-reactjs/src/designer-components/button/buttonGroup/utils.tsx (1)

72-72: ```bash
#!/bin/bash

More exhaustive search using find + grep across .ts and .tsx files

Gather all .ts and .tsx files

mapfile -t FILES < <(find . -type f ( -name ".ts" -o -name ".tsx" ))

if [ ${#FILES[@]} -eq 0 ]; then
echo "No .ts/.tsx files found in the repository."
exit 0
fi

echo "=== ButtonGroup usage ==="
grep -R -n -C 3 "ButtonGroup" "${FILES[@]}" || echo "No matches for ButtonGroup"

echo
echo "=== defaultContainerStyles usage ==="
grep -R -n -C 3 "defaultContainerStyles" "${FILES[@]}" || echo "No matches for defaultContainerStyles"

echo
echo "=== width: '100%' occurrences ==="
grep -R -n -E "width\s*:\s*['"]100%['"]" "${FILES[@]}" || echo "No hardcoded '100%' widths found"


</details>

</blockquote></details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACJmeCIqcXwsfAAzSFokbi80eUx6AHcqbmjIArRkBwE43Bp6OTDYD2xESkYALwKSMAAGAEZ0DHpUeCUMcVT4KIrIDEcBNoBmABYANgAOFCxcJr8SbnxEdXwXDRhd2xRkL3gMAGsogiuHDxOwirvZ+aXFgFZls4AOXw6FomSSGDQviUiAYFHg3Ah/D4Slw2i8yBU+DwjQ8DFgmFIyGYaCUW1xkDiCWo8GSPAo+AY0mQXX89PwElGdDO7k8Pj2QRCjEwkAW6AYTMQrXo1EgsFq3EQHAA9MqiOpYNgBBomMxlYgmga0GBafrDQSwKkqGwCic7sruN4vMqVhsNEZ9MZwFAyPQ0jgCMQyMo6gpWOwuLx+MJROIpDJ5Ewl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cVAUFMiwXVrsFeoRvKZz4LhEOxU5RoCkIMAMLAaT8wKOvWA6UaC7XSGgEWTo160A3g0Sh8tzBKxVjrI+DDNaiA6jSWR/ovaGz9MbLUNx+bsEtova2kBbYEIdhSZ2kJcBuxIiosyBtQxvBNlo824RMFnAAPIYBQhSW4NAKCQl8P4cxPjN7b1eJxGGlCb4rjvhQB+odBF+w/BBYk0FYK0Hzvua2nZuw+iGNlMBRZgylnoOWCMfg0A1mvPWeQDQkwtjUG2DMmSsxhhqAAfVGIgFpZUphdFoC03CzhQiegME09YJAADs6w0AbDQIsPo/wxn9HWAAJh6AIdYqxliLCWYsVYfRUi/AEGMxYABOMZ+zaDLB6MsDshgmkCGOcclYSyNkMF+Kc9Yiwei0FWL8VIqQehLIYH0NZyxlhrJ6CQVYfyBB/3WD0G5WTmnqDabQDpXSSA9Jab6G5QA=== -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---

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.

<details>
<summary>❤️ Share</summary>

- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)
- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)
- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)
- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

</details>

<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=shesha-io/shesha-framework&utm_content=3468):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Explain this complex logic.`
  - `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 explain this code block.`
  -	`@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 explain its main purpose.`
  - `@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.`

### Support

Need help? Create a ticket on our [support page](https://www.coderabbit.ai/contact-us/support) for assistance with any issues or questions.

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](https://docs.coderabbit.ai/finishing-touches/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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

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 (2)
shesha-reactjs/src/designer-components/container/data.ts (2)

203-203: Consider extracting the className logic for better maintainability.

The conditional logic correctly sets display: 'flex' for index table controls, but the hardcoded class names and repeated conditional checks could be extracted into a more maintainable pattern.

Consider refactoring to reduce repetition:

+const isIndexTableControl = prev?.className === 'sha-index-table-control' || prev?.className === 'index-table-controls-right';
+const isRightControl = prev?.className === 'index-table-controls-right';

-display: prev?.className === 'sha-index-table-control' || prev?.className === 'index-table-controls-right' ? 'flex' : prev?.display ?? "block",
+display: isIndexTableControl ? 'flex' : prev?.display ?? "block",

205-205: Logic is correct but reinforces the need for refactoring.

Setting flexWrap: 'nowrap' for index table controls is appropriate as these components typically need to keep items in a single line. This change works well with the display: 'flex' override.

This line uses the same conditional logic as line 203, which further supports extracting the className checks into variables for better maintainability.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between e904d9e and 8e78a68.

📒 Files selected for processing (1)
  • shesha-reactjs/src/designer-components/container/data.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: teboho
PR: shesha-io/shesha-framework#3397
File: shesha-reactjs/src/designer-components/charts/bar.tsx:49-52
Timestamp: 2025-06-12T16:55:57.638Z
Learning: For the chart components’ migrators (e.g., BarChartComponent in shesha-reactjs/src/designer-components/charts/bar.tsx), the version 5 step intentionally spreads `{ ...prev, ...defaultConfigFiller }` so that values from `defaultConfigFiller` override any existing properties in `prev`. This reset to new defaults is by design and should not be flagged as an issue.
Learnt from: teboho
PR: shesha-io/shesha-framework#3312
File: shesha-reactjs/src/hooks/formComponentHooks.ts:183-192
Timestamp: 2025-05-28T07:55:21.036Z
Learning: In shesha-reactjs formComponentHooks.ts, the background style initialization deliberately sets valid values from properties panel immediately to provide better UX, rather than waiting for the useDeepCompareEffect to run. This intentional pattern prevents a flash of no background and shows the background image immediately when the component renders.
shesha-reactjs/src/designer-components/container/data.ts (7)
Learnt from: teboho
PR: shesha-io/shesha-framework#3397
File: shesha-reactjs/src/designer-components/charts/bar.tsx:49-52
Timestamp: 2025-06-12T16:55:57.638Z
Learning: For the chart components’ migrators (e.g., BarChartComponent in shesha-reactjs/src/designer-components/charts/bar.tsx), the version 5 step intentionally spreads `{ ...prev, ...defaultConfigFiller }` so that values from `defaultConfigFiller` override any existing properties in `prev`. This reset to new defaults is by design and should not be flagged as an issue.
Learnt from: teboho
PR: shesha-io/shesha-framework#3312
File: shesha-reactjs/src/hooks/formComponentHooks.ts:183-192
Timestamp: 2025-05-28T07:55:21.036Z
Learning: In shesha-reactjs formComponentHooks.ts, the background style initialization deliberately sets valid values from properties panel immediately to provide better UX, rather than waiting for the useDeepCompareEffect to run. This intentional pattern prevents a flash of no background and shows the background image immediately when the component renders.
Learnt from: teboho
PR: shesha-io/shesha-framework#3461
File: shesha-reactjs/src/designer-components/charts/settingsFormIndividual.ts:1280-1280
Timestamp: 2025-06-26T19:59:22.839Z
Learning: In shesha-reactjs chart settings forms, the styling panels (border, shadow, background) should not include buttonType-based hidden conditions since charts are not button components. The border configuration should follow the standard component pattern without button-specific restrictions.
Learnt from: teboho
PR: shesha-io/shesha-framework#3374
File: shesha-reactjs/src/generic-pages/settings/dynamic-theme/textsExample.tsx:13-15
Timestamp: 2025-06-10T11:52:51.462Z
Learning: In the Shesha framework's dynamic theme system, the "Global text" Typography element in textsExample.tsx is intentionally left without explicit styling to demonstrate automatic global text color application through the ConfigProvider's colorText token, while the "Default text" element uses explicit theme color styling to show the difference between global and default text color approaches.
Learnt from: teboho
PR: shesha-io/shesha-framework#3461
File: shesha-reactjs/src/designer-components/charts/settingsFormIndividual.ts:171-192
Timestamp: 2025-06-26T20:01:48.814Z
Learning: In shesha-reactjs chart settings forms, duplicate input configurations may be intentionally included as part of UI/UX experiments and should be flagged for review during UI/UX review phases rather than immediately removed as errors.
Learnt from: teboho
PR: shesha-io/shesha-framework#3461
File: shesha-reactjs/src/designer-components/charts/chartControl.tsx:51-51
Timestamp: 2025-06-26T20:00:58.493Z
Learning: In shesha-reactjs chart components (ChartControl), filters are intentionally passed as props rather than obtained from context. This allows the query builder and other external components to dynamically update filters. The pattern is: most chart configuration comes from useChartDataStateContext(), but filters are passed as props from the chart factories (bar.tsx, line.tsx, pie.tsx, polarArea.tsx) for dynamic updates.
Learnt from: teboho
PR: shesha-io/shesha-framework#3362
File: shesha-reactjs/src/designer-components/charts/settingsFormIndividual.ts:429-448
Timestamp: 2025-06-06T10:41:31.642Z
Learning: In shesha-reactjs chart settings, conditional visibility for controls is intentionally designed to show different combinations based on chart type: pie/polarArea charts show showTitle+showLegend together, while other chart types show showTitle separately. This pattern of "one shows when others doesn't show" is by design.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build-attempt
🔇 Additional comments (1)
shesha-reactjs/src/designer-components/container/data.ts (1)

208-208: Good specificity for the alignItems override.

The conditional logic appropriately targets only 'index-table-controls-right' for center alignment, which makes sense as right-aligned controls typically need vertical centering for proper visual alignment.

The more specific targeting (only right controls vs. both control types) demonstrates thoughtful consideration of when centering is appropriate.

@czwe-01 czwe-01 requested a review from James-Baloyi June 27, 2025 13:52
@James-Baloyi James-Baloyi merged commit 62e79d0 into shesha-io:main Jun 27, 2025
2 checks passed
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