-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
General UI improvements #2 #17576
General UI improvements #2 #17576
Conversation
WalkthroughThe pull request introduces a series of styling and layout modifications across various Twig templates in the Sylius AdminBundle. The changes primarily focus on adjusting CSS classes, margins, and visual representations of form elements, dropdown items, and table components. These modifications aim to refine the user interface by altering column layouts, spacing, and styling of different sections in the admin panel, without fundamentally changing the underlying functionality of the templates. Changes
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (11)
🚧 Files skipped from review as they are similar to previous changes (11)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 (3)
src/Sylius/Bundle/AdminBundle/templates/product_variant/form/sections/general.html.twig (1)
27-33
: Consider enhancing the properties sectionWhile the layout is functional, consider these accessibility and UX improvements:
- Add
aria-labelledby
to group the properties fields with their heading- Consider using a fieldset with legend for better semantic structure
- <div class="mb-4"> - <h4 class="ui dividing header">{{ 'sylius.ui.properties'|trans }}</h4> + <fieldset class="mb-4"> + <legend class="h4 ui dividing header" id="properties-heading">{{ 'sylius.ui.properties'|trans }}</legend> + <div role="group" aria-labelledby="properties-heading"> {{ form_row(form.height) }} {{ form_row(form.width) }} {{ form_row(form.depth) }} {{ form_row(form.weight) }} + </div> - </div> + </fieldset>src/Sylius/Bundle/AdminBundle/templates/product/form/sections/taxonomy/product_taxons.html.twig (1)
5-5
: Consider maintaining visual containmentThe removal of the "card" class might affect the visual containment of the taxon tree component. Consider using an alternative class or border to maintain clear visual boundaries for this interactive element.
- <div {{ stimulus_controller('product-taxon-tree', {treeData: this.tree, autoOpen: hookableMetadata.configuration.auto_open}) }}> + <div class="border rounded p-3" {{ stimulus_controller('product-taxon-tree', {treeData: this.tree, autoOpen: hookableMetadata.configuration.auto_open}) }}>src/Sylius/Bundle/AdminBundle/templates/product_option/form/sections/values/value/translations.html.twig (1)
1-3
: Consider responsive layout behaviorThe change from
col-12
tocol-3
means 4 translations per row, which might cause layout issues on smaller screens. Consider using responsive column classes (e.g.,col-12 col-md-6 col-lg-3
) to ensure proper stacking on mobile devices.-<div class="col-3" {{ sylius_test_html_attribute('option-value-locale', translation_form_key) }}> +<div class="col-12 col-md-6 col-lg-3" {{ sylius_test_html_attribute('option-value-locale', translation_form_key) }}>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
src/Sylius/Bundle/AdminBundle/Resources/assets/styles/_sidebar.scss
(1 hunks)src/Sylius/Bundle/AdminBundle/templates/product/form/sections/taxonomy/product_taxons.html.twig
(1 hunks)src/Sylius/Bundle/AdminBundle/templates/product_attribute/form/configuration.html.twig
(1 hunks)src/Sylius/Bundle/AdminBundle/templates/product_attribute/form/general.html.twig
(1 hunks)src/Sylius/Bundle/AdminBundle/templates/product_attribute/form/translations.html.twig
(1 hunks)src/Sylius/Bundle/AdminBundle/templates/product_option/form/sections/values/value.html.twig
(1 hunks)src/Sylius/Bundle/AdminBundle/templates/product_option/form/sections/values/value/translations.html.twig
(1 hunks)src/Sylius/Bundle/AdminBundle/templates/product_variant/form/content/update/header/actions/price_history.html.twig
(1 hunks)src/Sylius/Bundle/AdminBundle/templates/product_variant/form/sections/general.html.twig
(1 hunks)src/Sylius/Bundle/AdminBundle/templates/shared/crud/common/sidebar/menu/menu.html.twig
(1 hunks)src/Sylius/Bundle/AdminBundle/templates/shared/helper/table.html.twig
(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- src/Sylius/Bundle/AdminBundle/templates/product_option/form/sections/values/value.html.twig
- src/Sylius/Bundle/AdminBundle/templates/product_attribute/form/translations.html.twig
- src/Sylius/Bundle/AdminBundle/templates/product_attribute/form/general.html.twig
🔇 Additional comments (8)
src/Sylius/Bundle/AdminBundle/templates/product_variant/form/content/update/header/actions/price_history.html.twig (1)
Line range hint 1-33
: Verify template usage and styling consistency
Let's ensure this template is used consistently and the styling matches other similar dropdowns in the admin panel.
✅ Verification successful
Based on the results, I can now generate the final response:
Template follows consistent patterns and styling
The verification shows that:
- The dropdown pattern with
dropdown-item-icon
class is consistently used across multiple templates in the admin bundle - The price history feature appears in related templates with consistent structure
- The
tabler:eye
icon is consistently used with the same class styling (icon dropdown-item-icon
) in similar dropdown contexts
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for similar dropdown patterns and icon usage in other templates
# Check for other templates using similar dropdown patterns
echo "Checking for similar dropdown patterns..."
rg -l 'dropdown-item-icon' 'src/Sylius/Bundle/AdminBundle/templates'
# Check for other price history related templates
echo "Checking for other price history templates..."
fd -e twig -e html.twig . 'src/Sylius/Bundle/AdminBundle/templates' -x grep -l 'price_history'
# Check for consistent icon usage
echo "Checking for consistent icon usage pattern..."
rg "ux_icon\('tabler:eye'" 'src/Sylius/Bundle/AdminBundle/templates'
Length of output: 4268
src/Sylius/Bundle/AdminBundle/templates/product_attribute/form/configuration.html.twig (1)
5-5
: Improved responsive layout
Good simplification of the grid system. Using g-col-12
without the -xl
breakpoint ensures consistent full-width layout across all screen sizes, which is appropriate for configuration forms.
src/Sylius/Bundle/AdminBundle/templates/product_variant/form/sections/general.html.twig (1)
11-14
: Improved vertical spacing
Good adjustment of margins from mb-3
to mb-4
. The increased spacing between form sections improves readability and creates better visual separation between logically grouped fields.
Also applies to: 15-19, 20-26
src/Sylius/Bundle/AdminBundle/templates/product/form/sections/taxonomy/product_taxons.html.twig (1)
Line range hint 8-27
: Well-structured filter controls and tree layout
Good improvements:
- Increased bottom padding (
pb-5
) provides adequate space for the tree structure - Clear visual hierarchy with filter controls
- Proper use of utility classes for alignment and spacing
- Semantic use of buttons and input groups
src/Sylius/Bundle/AdminBundle/templates/product_option/form/sections/values/value/translations.html.twig (1)
4-16
: LGTM! Well-structured label rendering
The label rendering logic is well-organized with proper spacing and alignment using Bootstrap 5 utilities. The conditional handling of global vs locale-specific labels is clear and maintainable.
src/Sylius/Bundle/AdminBundle/Resources/assets/styles/_sidebar.scss (1)
34-37
: LGTM! Consider verifying color contrast ratios.
The color changes for dropdown items improve visual hierarchy:
- Normal state using
$gray-500
provides better visibility than transparent - Active state using
$primary
creates clear distinction
✅ Verification successful
Let me analyze the background color against which these text colors will be used to properly verify the contrast ratios.
Let me check the parent container's background color as the immediate element has a transparent background.
Color contrast appears sufficient for accessibility
The color choices are appropriate for the sidebar context:
- Text color
$gray-500
(#adb5bd) against the dark navbar background (using CSS variable with 0.8 opacity white) provides good contrast for normal state - Active state using
$primary
(#22B99A) against the same background provides even stronger contrast
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if color variables are defined with sufficient contrast ratios
rg -A 1 '(\$gray-500|\$primary):' .
Length of output: 756
Script:
#!/bin/bash
# Check the background color of the sidebar menu items
rg -B 2 -A 2 'background|bg-' src/Sylius/Bundle/AdminBundle/Resources/assets/styles/_sidebar.scss
Length of output: 387
Script:
#!/bin/bash
# Check the entire sidebar styling for background colors
cat src/Sylius/Bundle/AdminBundle/Resources/assets/styles/_sidebar.scss
Length of output: 2163
src/Sylius/Bundle/AdminBundle/templates/shared/crud/common/sidebar/menu/menu.html.twig (1)
92-94
: LGTM! Good separation of concerns.
The simplified dropdown item markup is an improvement:
- Moves styling logic to CSS where it belongs
- Maintains functionality for external links and target attributes
- Clean integration with the new SCSS active state styling
src/Sylius/Bundle/AdminBundle/templates/shared/helper/table.html.twig (1)
34-34
: Verify the impact of removing the code tag wrapper
The removal of the <code>
tag wrapper might affect:
- Visual distinction of code values in the table
- Semantic meaning of the content
- Screen reader behavior
Please ensure that:
- Code values remain visually distinct from regular text
- The semantic meaning is preserved through alternative styling
- Screen readers can properly interpret the content
Let's check if there are any CSS styles that might compensate for the removed <code>
tag:
@@ -19,7 +19,7 @@ | |||
class="dropdown-item{% if url is not defined %} disabled{% endif %}" | |||
href="{{ url }}" | |||
> | |||
{{ ux_icon(action.icon|default('tabler:eye')) }} | |||
{{ ux_icon(action.icon|default('tabler:eye'), {'class': 'icon dropdown-item-icon'}) }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix undefined variable and simplify icon usage
The action
variable is not defined in this template, which could cause runtime issues. Since this is specifically for viewing price history, we should use the eye icon directly without the undefined variable reference.
Apply this diff to fix the issue:
-{{ ux_icon(action.icon|default('tabler:eye'), {'class': 'icon dropdown-item-icon'}) }}
+{{ ux_icon('tabler:eye', {'class': 'icon dropdown-item-icon'}) }}
📝 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.
{{ ux_icon(action.icon|default('tabler:eye'), {'class': 'icon dropdown-item-icon'}) }} | |
{{ ux_icon('tabler:eye', {'class': 'icon dropdown-item-icon'}) }} |
<div class="input-group"> | ||
{{ form_widget(translation_form.value) }} | ||
<button | ||
type="button" | ||
class="btn btn-icon" | ||
data-bs-toggle="tooltip" | ||
data-bs-title="{{ 'sylius.ui.apply_to_all'|trans }}" | ||
data-action="live#action:prevent" | ||
data-live-action-param="applyToAll" | ||
data-live-value-key-param="{{ hookable_metadata.context.value_form_key }}" | ||
data-live-translation-key-param="{{ translation_form_key }}" | ||
{{ sylius_test_html_attribute('apply-to-all') }} | ||
> | ||
{{ ux_icon('tabler:copy-plus') }} | ||
</button> | ||
{{ form_errors(translation_form.value) }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add accessibility attributes to the action button
The "Apply to all" button needs accessibility improvements. Consider adding aria-label
for screen readers and ensuring the tooltip is keyboard accessible.
<button
type="button"
class="btn btn-icon"
+ aria-label="{{ 'sylius.ui.apply_to_all'|trans }}"
data-bs-toggle="tooltip"
data-bs-title="{{ 'sylius.ui.apply_to_all'|trans }}"
data-action="live#action:prevent"
data-live-action-param="applyToAll"
data-live-value-key-param="{{ hookable_metadata.context.value_form_key }}"
data-live-translation-key-param="{{ translation_form_key }}"
{{ sylius_test_html_attribute('apply-to-all') }}
>
📝 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.
<div class="input-group"> | |
{{ form_widget(translation_form.value) }} | |
<button | |
type="button" | |
class="btn btn-icon" | |
data-bs-toggle="tooltip" | |
data-bs-title="{{ 'sylius.ui.apply_to_all'|trans }}" | |
data-action="live#action:prevent" | |
data-live-action-param="applyToAll" | |
data-live-value-key-param="{{ hookable_metadata.context.value_form_key }}" | |
data-live-translation-key-param="{{ translation_form_key }}" | |
{{ sylius_test_html_attribute('apply-to-all') }} | |
> | |
{{ ux_icon('tabler:copy-plus') }} | |
</button> | |
{{ form_errors(translation_form.value) }} | |
<div class="input-group"> | |
{{ form_widget(translation_form.value) }} | |
<button | |
type="button" | |
class="btn btn-icon" | |
aria-label="{{ 'sylius.ui.apply_to_all'|trans }}" | |
data-bs-toggle="tooltip" | |
data-bs-title="{{ 'sylius.ui.apply_to_all'|trans }}" | |
data-action="live#action:prevent" | |
data-live-action-param="applyToAll" | |
data-live-value-key-param="{{ hookable_metadata.context.value_form_key }}" | |
data-live-translation-key-param="{{ translation_form_key }}" | |
{{ sylius_test_html_attribute('apply-to-all') }} | |
> | |
{{ ux_icon('tabler:copy-plus') }} | |
</button> | |
{{ form_errors(translation_form.value) }} |
{{ sylius_grid_render_field(grid, field, row) }} | ||
{% else %} | ||
{{ sylius_grid_render_field(grid, field, row) }} | ||
{% endif %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Remove redundant conditional block
The conditional block for the code
field now contains identical code in both branches, making it redundant.
Consider simplifying the code by removing the conditional:
- {% if field.name == 'code' %}
- {{ sylius_grid_render_field(grid, field, row) }}
- {% else %}
- {{ sylius_grid_render_field(grid, field, row) }}
- {% endif %}
+ {{ sylius_grid_render_field(grid, field, row) }}
📝 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.
{{ sylius_grid_render_field(grid, field, row) }} | |
{% else %} | |
{{ sylius_grid_render_field(grid, field, row) }} | |
{% endif %} | |
{{ sylius_grid_render_field(grid, field, row) }} |
Bunnyshell Preview Environment deletedAvailable commands:
|
4235ae9
to
38be138
Compare
Summary by CodeRabbit
New Features
Bug Fixes
Style
Documentation