Skip to content
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

[AdminUser][Customer] Improve Twig hook structure by adding left and right sections #17585

Merged
merged 2 commits into from
Dec 19, 2024

Conversation

Wojdylak
Copy link
Member

@Wojdylak Wojdylak commented Dec 19, 2024

Q A
Branch? 2.0
Bug fix? no/yes
New feature? no
BC breaks? no
Deprecations? no
Related tickets n/a
License MIT

Summary by CodeRabbit

  • New Features
    • Introduced new sections for admin user and customer creation/update forms, enhancing customization and organization.
    • Added an 'extra_information' section for customer forms to improve data collection.
  • Bug Fixes
    • Adjusted priorities of form sections to ensure proper rendering order.
  • Style
    • Updated HTML structure for various templates to improve layout and presentation, transitioning to a card-based design.
  • Chores
    • Cleaned up legacy code and dependencies, including the removal of outdated packages and support for older PHP/Symfony versions.
    • Raised the minimum supported PHP version to 8.2 and dropped support for Symfony 5.4.

@Wojdylak Wojdylak requested review from a team as code owners December 19, 2024 10:17
@probot-autolabeler probot-autolabeler bot added Admin AdminBundle related issues and PRs. Maintenance CI configurations, READMEs, releases, etc. labels Dec 19, 2024
Copy link

coderabbitai bot commented Dec 19, 2024

Walkthrough

The pull request introduces significant updates to the Sylius framework version 2.0.3, focusing on restructuring admin user and customer form configurations. The changes primarily involve introducing new left and right sections in Twig hooks, reorganizing form layouts, and adjusting section priorities. The modifications enhance form customization capabilities while maintaining the existing functionality. The update also includes updates to method signatures, service configurations, and template structures across multiple bundles.

Changes

File Path Change Summary
src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/admin_user/create.yaml Added new left and right sections for admin user creation form, adjusted section priorities
src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/admin_user/update.yaml Introduced new left and right sections for admin user update form, modified section priorities
src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/customer/create.yaml Added extra_information section to right-side form, disabled default general section
src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/customer/update.yaml Introduced new sections for customer update form, moved extra_information to right side
src/Sylius/Bundle/AdminBundle/templates/* Updated HTML templates to use two-column card-based layouts with sections#left and sections#right hooks

Sequence Diagram

sequenceDiagram
    participant Form as Admin Form
    participant Left as Sections#Left
    participant Right as Sections#Right
    
    Form->>Left: Render Account Section
    Form->>Left: Render Other Left Sections
    Form->>Right: Render Personal Information
    Form->>Right: Render Extra Information
Loading

Poem

🐰 Hop, hop, hooray! Forms are here to play,
Left and right, sections take their flight
Cards dancing with grace, in their new embrace
Priorities shift, templates lift
Sylius magic, oh so bright! 🎉


📜 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 ed9dc8f and 5e5d234.

📒 Files selected for processing (2)
  • src/Sylius/Bundle/AdminBundle/templates/admin_user/form/sections.html.twig (1 hunks)
  • src/Sylius/Bundle/AdminBundle/templates/customer/form/sections.html.twig (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/Sylius/Bundle/AdminBundle/templates/admin_user/form/sections.html.twig
  • src/Sylius/Bundle/AdminBundle/templates/customer/form/sections.html.twig

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

@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

🧹 Nitpick comments (2)
src/Sylius/Bundle/AdminBundle/templates/customer/form/sections.html.twig (1)

3-10: Consider simplifying the nested row structure.

The template currently has nested row divs which might be unnecessary. Consider removing the outer row since it only contains the hooks and the inner row.

-<div class="row">
    {% hook 'sections' %}
-    <div class="row">
+    <div class="row">
        <div class="col-12 col-md-6">
            {% hook 'sections#left' %}
        </div>
        <div class="col-12 col-md-6">
            {% hook 'sections#right' %}
        </div>
-    </div>
    </div>
src/Sylius/Bundle/AdminBundle/templates/admin_user/form/sections.html.twig (1)

3-10: Template structure maintains consistency with customer form.

The identical structure between admin user and customer templates is good for maintainability. However, the same nested row simplification could be applied here.

-<div class="row">
    {% hook 'sections' %}
-    <div class="row">
+    <div class="row">
        <div class="col-12 col-md-6">
            {% hook 'sections#left' %}
        </div>
        <div class="col-12 col-md-6">
            {% hook 'sections#right' %}
        </div>
-    </div>
    </div>
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d3293b3 and ed9dc8f.

📒 Files selected for processing (12)
  • UPGRADE-2.0.md (1 hunks)
  • src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/admin_user/create.yaml (1 hunks)
  • src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/admin_user/update.yaml (1 hunks)
  • src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/customer/create.yaml (1 hunks)
  • src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/customer/update.yaml (1 hunks)
  • src/Sylius/Bundle/AdminBundle/templates/admin_user/form/sections.html.twig (1 hunks)
  • src/Sylius/Bundle/AdminBundle/templates/admin_user/form/sections/account.html.twig (1 hunks)
  • src/Sylius/Bundle/AdminBundle/templates/admin_user/form/sections/personal_information.html.twig (1 hunks)
  • src/Sylius/Bundle/AdminBundle/templates/customer/form/sections.html.twig (1 hunks)
  • src/Sylius/Bundle/AdminBundle/templates/customer/form/sections/account_credentials.html.twig (1 hunks)
  • src/Sylius/Bundle/AdminBundle/templates/customer/form/sections/extra_information.html.twig (1 hunks)
  • src/Sylius/Bundle/AdminBundle/templates/customer/form/sections/general.html.twig (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • src/Sylius/Bundle/AdminBundle/templates/admin_user/form/sections/personal_information.html.twig
  • src/Sylius/Bundle/AdminBundle/templates/admin_user/form/sections/account.html.twig
  • src/Sylius/Bundle/AdminBundle/templates/customer/form/sections/general.html.twig
  • src/Sylius/Bundle/AdminBundle/templates/customer/form/sections/extra_information.html.twig
🔇 Additional comments (7)
src/Sylius/Bundle/AdminBundle/templates/customer/form/sections.html.twig (1)

4-9: LGTM! Well-structured responsive layout.

The two-column layout with responsive classes and semantic hook names (sections#left and sections#right) is well implemented. The Bootstrap grid classes ensure proper mobile-first responsiveness.

src/Sylius/Bundle/AdminBundle/templates/customer/form/sections/account_credentials.html.twig (1)

1-14: LGTM! Improved layout using card component.

The transition from column-based to card-based layout provides better visual hierarchy and semantic structure. The implementation:

  • Uses proper Bootstrap card component structure
  • Maintains the existing conditional logic
  • Provides clear visual separation of content
src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/admin_user/create.yaml (1)

20-22: LGTM: General section properly disabled

The general section is correctly disabled to allow for the new left/right section structure.

src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/admin_user/update.yaml (1)

22-31: LGTM: Consistent with create form structure

The update form configuration perfectly mirrors the create form structure, maintaining UI consistency.

src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/customer/create.yaml (1)

20-22: LGTM: General section properly disabled

The general section is correctly disabled to support the new left/right structure.

src/Sylius/Bundle/AdminBundle/Resources/config/app/twig_hooks/customer/update.yaml (1)

27-41: LGTM! The changes align with the new Twig hooks structure.

The modifications effectively reorganize the customer update form by:

  1. Disabling the general section in the main form sections
  2. Adding left and right sections to improve the form layout
  3. Properly distributing form sections between left (general, account_credentials) and right (extra_information)

This change follows the new Twig hooks pattern and improves the form structure without breaking existing functionality.

UPGRADE-2.0.md (1)

1-13: LGTM! Comprehensive upgrade documentation.

The upgrade guide thoroughly documents all necessary changes for migrating to Sylius 2.0.3, including:

  • Initial setup requirements
  • Package dependencies
  • Constructor signatures
  • Service and class changes
  • Frontend modifications
  • Twig hooks implementation

The documentation is well-structured and provides clear instructions for implementing each change.

Copy link

github-actions bot commented Dec 19, 2024

Bunnyshell Preview Environment deleted

Available commands:

  • /bns:deploy to redeploy the environment

@NoResponseMate NoResponseMate merged commit c22d093 into Sylius:2.0 Dec 19, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Admin AdminBundle related issues and PRs. Maintenance CI configurations, READMEs, releases, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants