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

Add an optional icon and description to the page title #17579

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

kulczy
Copy link
Member

@kulczy kulczy commented Dec 16, 2024

This isn't strictly necessary for Sylius itself, but it might be useful in the Sylius Stack.

Zrzut ekranu 2024-12-16 o 16 32 19 Zrzut ekranu 2024-12-16 o 16 32 07 Zrzut ekranu 2024-12-16 o 16 31 54 Zrzut ekranu 2024-12-16 o 16 31 42

Summary by CodeRabbit

  • New Features
    • Improved header layout with enhanced flexibility for icons and subheaders.
    • Utilized Bootstrap's flex utilities for better alignment and spacing in the header section.

@kulczy kulczy requested review from a team as code owners December 16, 2024 15:35
@probot-autolabeler probot-autolabeler bot added the Admin AdminBundle related issues and PRs. label Dec 16, 2024
Copy link

coderabbitai bot commented Dec 16, 2024

Walkthrough

The pull request modifies the header template in the Sylius Admin Bundle, updating the default macro to improve header rendering flexibility. The changes introduce a more structured approach to displaying headers, icons, and subheaders using Bootstrap's flex layout utilities. The new implementation provides more dynamic rendering options for header components, allowing for conditional icon and subheader display within a more flexible container structure.

Changes

File Change Summary
src/Sylius/Bundle/AdminBundle/templates/shared/helper/header.html.twig Updated default macro to use a more flexible <div> structure with conditional icon and subheader rendering

Poem

🐰 A header's tale, now sleek and bright,
Flex and icons dancing with delight
Macros transformed with coding grace
Bootstrap's magic leaves no trace
Rabbit's design, a template's might! 🎨


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?

❤️ 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. (Beta)
  • @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: 0

🧹 Nitpick comments (1)
src/Sylius/Bundle/AdminBundle/templates/shared/helper/header.html.twig (1)

7-12: Consider adding ARIA attributes for better accessibility.

While the semantic structure is good, consider enhancing accessibility by:

  1. Adding aria-level to match the dynamic heading level
  2. Consider adding aria-describedby if the subheader provides additional context
-            <h{{ level }} class="page-title">
+            <h{{ level }} class="page-title" aria-level="{{ level }}"{% if subheader %} aria-describedby="page-subheader"{% endif %}>
                 {{ header }}
             </h{{ level }}>
             {% if subheader %}
-                <div>{{ subheader }}</div>
+                <div id="page-subheader">{{ subheader }}</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 e6490f1 and 762d1f6.

📒 Files selected for processing (1)
  • src/Sylius/Bundle/AdminBundle/templates/shared/helper/header.html.twig (1 hunks)
🔇 Additional comments (3)
src/Sylius/Bundle/AdminBundle/templates/shared/helper/header.html.twig (3)

2-2: LGTM! Well-structured container layout.

The use of Bootstrap's flex utilities with proper spacing and alignment creates a robust and flexible layout structure.


6-6: LGTM! Clean and semantic content structure.

The nested flex container with column direction provides proper spacing and organization for the header components.

Also applies to: 13-14


3-4: Verify the ux_icon Twig function implementation.

The icon implementation looks good, but let's ensure the ux_icon function is properly registered and available.

✅ Verification successful

The ux_icon function is properly configured and available

The verification shows that:

  • The ux_icon function is widely used across multiple templates in both Admin and Shop bundles
  • It's properly configured in UiBundle with default icon attributes
  • The configuration is imported correctly in the bundle's main config

The implementation is consistent with Symfony UX icons component standards, and the usage in the template is correct.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the ux_icon Twig function registration and implementation

# Search for ux_icon function registration
rg -l "ux_icon" --type php

# Search for potential icon-related Twig extensions
rg -l "TwigExtension.*icon" --type php

Length of output: 67


Script:

#!/bin/bash
# Let's broaden our search to find Twig-related files and icon implementations

# Search for any Twig files using ux_icon
rg -l "ux_icon" --type-add 'twig:*.twig' --type twig

# Search for icon-related Twig extensions or functions in PHP files with more context
rg -A 5 "function.*icon" --type php

# Search for UX-related service definitions
fd -e yaml -e yml | xargs rg -l "ux_"

# Look for potential Symfony UX component configurations
fd -e yaml -e yml | xargs rg -l "ux:|symfony/ux"

Length of output: 12300


Script:

#!/bin/bash
# Let's check the UX icons configuration and implementation

# Check the UX icons configuration
cat src/Sylius/Bundle/UiBundle/Resources/config/packages/ux_icons.yaml

# Check the UI bundle configuration for any icon-related settings
cat src/Sylius/Bundle/UiBundle/Resources/config/app/config.yml

# Look for any Twig extension or service that might register the ux_icon function
rg -l "TwigExtension|ux_icon" src/Sylius/Bundle/UiBundle/

Length of output: 551

Copy link

github-actions bot commented Dec 16, 2024

Bunnyshell Preview Environment deleted

Available commands:

  • /bns:deploy to redeploy the environment

@Wojdylak Wojdylak merged commit 259feb5 into Sylius:2.0 Dec 17, 2024
27 checks passed
loic425 added a commit to Sylius/Stack that referenced this pull request Dec 23, 2024
Based on Sylius/Sylius#17579
(improved to retrieve icon and subheader from hooks configuration)

Fixes #172

![Capture d’écran du 2024-12-23
08-48-54](https://github.com/user-attachments/assets/4116de80-2707-454e-a962-2493ee4006d8)
GSadee added a commit that referenced this pull request Jan 10, 2025
…17592)

| Q               | A
|-----------------|-----
| Branch?         | 2.0
| Bug fix?        | no
| New feature?    | yes (small improvement)
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | 
| License         | MIT

Improvement to #17579
And also related to Sylius/Stack#193

<!--
 - Bug fixes must be submitted against the 1.13 branch
 - Features and deprecations must be submitted against the 1.14 branch
- Features, removing deprecations and BC breaks must be submitted
against the 2.0 branch
 - Make sure that the correct base branch is set

To be sure you are not breaking any Backward Compatibilities, check the
documentation:

https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced header rendering with the ability to include an icon and a
subheader.
	- Support for translations for the new header elements.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants