Skip to content

[Admin] Improve product grid layout and main taxon display#17618

Merged
GSadee merged 1 commit intoSylius:2.0from
kulczy:SYL-4235/products-index-improvements
Jan 16, 2025
Merged

[Admin] Improve product grid layout and main taxon display#17618
GSadee merged 1 commit intoSylius:2.0from
kulczy:SYL-4235/products-index-improvements

Conversation

@kulczy
Copy link
Copy Markdown
Contributor

@kulczy kulczy commented Jan 10, 2025

Change in category path display. The proposed change is to display the full path only on hover, as the path can be very long and disrupt the table.

Before

Zrzut ekranu 2025-01-10 o 12 44 42

After

Zrzut ekranu 2025-01-10 o 12 33 07

Summary by CodeRabbit

  • UI/UX Improvements
    • Adjusted product grid column widths for better layout
    • Enhanced main taxon display with truncated view and tooltip
    • Refined error message styling for undefined taxon names

@kulczy kulczy requested review from a team as code owners January 10, 2025 11:48
@probot-autolabeler probot-autolabeler bot added the Admin AdminBundle related issues and PRs. label Jan 10, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 10, 2025

Walkthrough

The pull request introduces modifications to the Sylius Admin Bundle's product grid configuration and main taxon template. The changes focus on adjusting column widths in the product grid and improving the display of the main taxon's name, including a new tooltip mechanism for long category names. These updates reflect a reallocation of column widths and a refined error message style, contributing to the overall visual presentation in the admin product listing.

Changes

File Change Summary
src/Sylius/Bundle/AdminBundle/Resources/config/grids/product.yml - Modified name field width from w-75 to w-33
- Added image field with th_class: "w-1"
- Removed code field styling configuration
src/Sylius/Bundle/AdminBundle/templates/product/grid/field/main_taxon.html.twig - Implemented split logic for long category names
- Added tooltip for full category name
- Changed error message styling from danger to muted

Sequence Diagram

sequenceDiagram
    participant UI as Admin Grid
    participant Data as Product Data
    participant Template as Main Taxon Template
    
    UI->>Data: Retrieve Product Details
    Data-->>Template: Send Product Information
    Template->>Template: Split Category Name
    alt Long Category Name
        Template->>UI: Render Truncated Name with Tooltip
    else Short/Normal Name
        Template->>UI: Render Full Name
    end
Loading

Possibly related PRs

Suggested labels

UX

Suggested reviewers

  • Wojdylak
  • GSadee

Poem

🐰 In the grid of products, a change takes flight,
Columns shift and tooltips shine bright.
From wide to narrow, with rabbit's delight,
A UI transformation, clean and tight.
Hop, hop, hooray for design's new might! 🌟


📜 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 59e19bb and 813b78f.

📒 Files selected for processing (2)
  • src/Sylius/Bundle/AdminBundle/Resources/config/grids/product.yml (1 hunks)
  • src/Sylius/Bundle/AdminBundle/templates/product/grid/field/main_taxon.html.twig (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/Sylius/Bundle/AdminBundle/templates/product/grid/field/main_taxon.html.twig
  • src/Sylius/Bundle/AdminBundle/Resources/config/grids/product.yml
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Static checks / PHP 8.3, Symfony ^7.1
  • GitHub Check: Static checks / PHP 8.2, Symfony ^6.4

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.

@kulczy kulczy force-pushed the SYL-4235/products-index-improvements branch from 9f62ac2 to 59e19bb Compare January 10, 2025 11:50
Copy link
Copy Markdown

@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)
src/Sylius/Bundle/AdminBundle/templates/product/grid/field/main_taxon.html.twig (1)

9-9: Consider using a more distinct style for the error state.

While changing from danger to muted style makes the UI less aggressive, it might make it harder for users to identify problematic entries. Consider using a middle-ground approach.

-    <span class="text-muted">{{ ux_icon('tabler:exclamation-circle') }} {{ 'sylius.ui.no_main_taxon'|trans }}</span>
+    <span class="text-warning">{{ ux_icon('tabler:exclamation-circle') }} {{ 'sylius.ui.no_main_taxon'|trans }}</span>
src/Sylius/Bundle/AdminBundle/Resources/config/grids/product.yml (1)

20-21: Consider adding responsive classes for the image column.

The w-1 class might make the image too small on larger screens. Consider using Bootstrap's responsive width classes.

                        vars:
-                            th_class: "w-1"
+                            th_class: "w-1 w-sm-2 w-md-3"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9e7f1bf and 9f62ac2.

📒 Files selected for processing (2)
  • src/Sylius/Bundle/AdminBundle/Resources/config/grids/product.yml (1 hunks)
  • src/Sylius/Bundle/AdminBundle/templates/product/grid/field/main_taxon.html.twig (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Static checks / PHP 8.3, Symfony ^7.1
  • GitHub Check: Static checks / PHP 8.2, Symfony ^6.4
🔇 Additional comments (2)
src/Sylius/Bundle/AdminBundle/templates/product/grid/field/main_taxon.html.twig (1)

2-7: LGTM! Clean implementation of category path truncation with tooltip.

The solution elegantly handles long category paths by:

  1. Showing only the last segment
  2. Indicating truncation with ".. /"
  3. Providing full path on hover using Bootstrap's tooltip
src/Sylius/Bundle/AdminBundle/Resources/config/grids/product.yml (1)

20-21: Verify grid layout with various content lengths.

The column width adjustments (image: w-1, name: w-33) combined with the removal of code column width might need validation with:

  1. Products with very long names
  2. Products with long category paths (even with the new tooltip)
  3. Various screen sizes

Let's verify the impact:

Also applies to: 29-29

✅ Verification successful

Width classes follow established grid patterns

The column width adjustments (w-1 for image, w-33 for name) align with Sylius's standard grid layout patterns, as evidenced by similar usage across multiple entity grids. These classes are part of a well-tested responsive system used throughout the application.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for product grid templates and related CSS to understand layout constraints
rg -t html -t css "sylius_admin_product|product-grid" --glob '!node_modules'

# Look for any existing responsive layout tests
rg -t php "responsive|mobile|screen" --glob '*Test.php' --glob '!vendor'

Length of output: 369


Script:

#!/bin/bash
# Search for grid templates and layout patterns
rg -t html "grid|table" src/Sylius/Bundle/AdminBundle/Resources/views
rg -t yaml "grid:" src/Sylius/Bundle/AdminBundle/Resources/config

# Look for CSS framework configuration or utility classes
fd -e css . src/Sylius/Bundle/AdminBundle/Resources
fd -e scss . src/Sylius/Bundle/AdminBundle/Resources

# Search for UI/Behat testing infrastructure
fd -e feature . tests/Behat
rg -t php "WebTestCase|KernelBrowser" tests

Length of output: 10960


Script:

#!/bin/bash
# Check datatable styles implementation
cat src/Sylius/Bundle/AdminBundle/Resources/assets/styles/_datatable.scss

# Look for grid templates in UiBundle as it might contain base templates
fd -e html.twig . src/Sylius/Bundle/UiBundle/Resources/views

# Search for width class usage patterns
rg "w-[0-9]+" --type-add 'template:*.{twig,scss,css,yml,yaml}' -t template

Length of output: 12873

CoderMaggie
CoderMaggie previously approved these changes Jan 10, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 10, 2025

Bunnyshell Preview Environment deleted

Available commands:

  • /bns:deploy to redeploy the environment

diimpp
diimpp previously requested changes Jan 10, 2025
@@ -1,7 +1,10 @@
{% if data.fullname is defined %}
{{ data.fullname }}
{% set categories = data.fullname|split('/') %}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If taxon name contains / character, then split won't work as expected.

image


image

bartek-sek
bartek-sek previously approved these changes Jan 13, 2025
@kulczy kulczy dismissed stale reviews from bartek-sek and CoderMaggie via 813b78f January 13, 2025 15:09
@kulczy kulczy force-pushed the SYL-4235/products-index-improvements branch from 59e19bb to 813b78f Compare January 13, 2025 15:09
@GSadee GSadee dismissed diimpp’s stale review January 16, 2025 11:53

Suggestions have been resolved

@GSadee GSadee merged commit e80c0bd into Sylius:2.0 Jan 16, 2025
@coderabbitai coderabbitai bot mentioned this pull request Jan 24, 2025
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.

5 participants