Skip to content

Dev#5

Merged
hta218 merged 70 commits intomainfrom
dev
Jun 16, 2025
Merged

Dev#5
hta218 merged 70 commits intomainfrom
dev

Conversation

@dangthang1903
Copy link

@dangthang1903 dangthang1903 commented Jun 13, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced the product items section to support both carousel and grid layouts, with improved responsiveness and configurable settings for layout type, slides per view, and items per row.
  • Style

    • Updated the country selector and menu button styles for improved visual consistency.
    • Adjusted link outline option for better alignment with style variants.
    • Improved menu icon animation to indicate open/closed state.
  • Chores

    • Updated a package dependency to allow for newer compatible versions.

hta218 and others added 30 commits April 24, 2025 14:39
…/poppins, @graphql-codegen/cli, and various Radix UI components. Refactor type imports in country-selector and locale files for improved type safety and clarity.
…/poppins, @graphql-codegen/cli, Radix UI components, React, and TypeScript. Enhance various other packages for improved functionality and performance.
…improvements to Radix UI components, React, and TypeScript. Adjust various other packages for consistency and performance enhancements.
- Added a clean script to package.json for easier cleanup of build artifacts.
- Updated @tailwindcss/vite to version 4.1.7 in package.json.
- Upgraded tailwind-merge from version 2.6.0 to 3.3.0 in package.json.
- Removed @tailwindcss/postcss from postcss.config.mjs as it's no longer needed.
- Integrated tailwindcss plugin into vite.config.ts for improved Tailwind CSS support.
…g routing capabilities and allowing for manual route definitions.
…and package-lock.json, ensuring consistency across the project. Enhance CHANGELOG with new version details and updated dependencies.
…udes. Upgrade @biomejs/biome to ^2.0.0-beta.5 and @weaverse/biome to 1.2.2 in package.json. Refactor imports in various components for improved clarity and consistency.
…n package-lock.json for consistency with package.json. Update related CLI dependencies to match the new version.
hta218 and others added 23 commits June 4, 2025 16:33
…nd @weaverse/biome to 1.2.3 in package.json and package-lock.json. Remove commented-out id from GlobalStyle component in style.tsx.
…k.json, and CHANGELOG.md; remove unused $locale route file
…k.json, and CHANGELOG.md; refactor condition checks in schema.server.ts to use arrow functions for improved clarity.
Update docs, update new schema creation
…integration for product display and navigation controls
@coderabbitai
Copy link

coderabbitai bot commented Jun 13, 2025

📝 Walkthrough

"""

Walkthrough

The updates introduce visual and structural improvements across several components. The country selector and link components receive minor class and option value adjustments. The desktop menu trigger now visually rotates its SVG icon when open. The featured products section undergoes a major refactor, supporting both carousel and grid layouts with enhanced responsiveness and configurability. The package dependency for "@weaverse/hydrogen" is also updated.

Changes

File(s) Change Summary
app/components/layout/country-selector.tsx Replaced CSS class outline-none with outline-hidden on the country selector button.
app/components/layout/desktop-menu.tsx Added a CSS class to rotate SVG icon on menu open state in the Menubar.Trigger component.
app/components/link.tsx Changed "Outline" select input value from "outline-solid" to "outline" to match variant key.
app/sections/featured-products/product-items.tsx Refactored to support "carousel" and "grid" layouts using Swiper, added responsive features, updated schema and props.
package.json Updated "@weaverse/hydrogen" dependency version from "5.2.4" to "^5.3.4".

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ProductItems
    participant Swiper
    participant Grid

    User->>ProductItems: Render with props (layout, slidesPerView, itemsPerRow, gap)
    alt layout == "carousel"
        ProductItems->>Swiper: Initialize carousel with slidesPerView
        Swiper-->>ProductItems: Render carousel, handle navigation
    else layout == "grid"
        alt Desktop
            ProductItems->>Grid: Render responsive grid with itemsPerRow and gap
        else Mobile
            ProductItems->>Swiper: Initialize carousel with peek effect
            Swiper-->>ProductItems: Render carousel, handle navigation
        end
    end
Loading

Poem

A rabbit hops through code so neat,
With grids and carousels, a visual treat!
Buttons now twirl, outlines refined,
Product displays flexibly aligned.
Dependencies leap to newer ground—
In this patch, fresh features abound!
🐇✨
"""


📜 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 9157873 and dd16b57.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (1)
  • package.json (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch dev
  • Post Copyable Unit Tests in Comment

🪧 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.
    • 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 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 for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for 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 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.

@dangthang1903 dangthang1903 requested a review from hta218 June 13, 2025 10:11
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: 4

🧹 Nitpick comments (2)
app/sections/featured-products/product-items.tsx (2)

38-74: compoundVariants block is redundant

Every {layout:"grid", gap:X} already maps to the same Tailwind class produced by the gap variant itself.
Removing the whole compoundVariants array simplifies the variant declaration without changing output.


99-99: Stray double semicolon

let products = parent.data?.loaderData?.products;;
Drop the extra ; to silence linters.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 89c1158 and 0036aa9.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • app/components/layout/country-selector.tsx (1 hunks)
  • app/components/layout/desktop-menu.tsx (1 hunks)
  • app/components/layout/header.tsx (1 hunks)
  • app/components/link.tsx (1 hunks)
  • app/sections/featured-products/product-items.tsx (3 hunks)
  • package.json (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
app/components/layout/country-selector.tsx (1)
app/utils/cn.ts (1)
  • cn (4-6)
app/sections/featured-products/product-items.tsx (1)
app/components/product/product-card.tsx (1)
  • ProductCard (34-203)
🔇 Additional comments (5)
package.json (1)

45-45: Verify compatibility of @weaverse/hydrogen caret update

Bumping from a fixed 5.2.4 to ^5.3.4 allows future minor/patch updates. Ensure no breaking changes are introduced by Hydrogen 5.3.x. Run full regression tests and update lockfile accordingly.

app/components/layout/country-selector.tsx (1)

80-80: Approve class update for outline behavior

Replacing outline-none with outline-hidden aligns with updated design tokens and CSS utilities. Verify that outline-hidden is supported by Tailwind configuration.

app/components/layout/header.tsx (1)

28-28: Validate custom property class syntax

The new max-w-(--(--page-width)-width) syntax diverges from the previous max-w-(--page-width). Confirm that the Tailwind plugin recognizes this nested custom property and that the underlying CSS variable (--(--page-width)-width) exists and yields the intended page width.

app/components/layout/desktop-menu.tsx (1)

39-39: Rotate menu icon on open state

The added data-[state="open"]:[&>svg]:rotate-180 class correctly applies a 180° rotation to the trigger icon when expanded. This enhances UX feedback.

app/sections/featured-products/product-items.tsx (1)

140-147: Disabled state never fires in loop mode

Because the mobile Swiper loops, activeSlide is rarely 0; the “Prev” button will almost never be disabled.
Either:

  1. keep the button always enabled, or
  2. disable looping and rely on isBeginning.

Current UX may confuse users.

Comment on lines +10 to +11
import "swiper/css";
import "swiper/css/navigation";
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Move Swiper CSS imports to a top-level (e.g. app/entry.client.tsx)

Importing global CSS inside a component causes it to be bundled multiple times and breaks SSR streaming in some environments.
Relocate

import "swiper/css";
import "swiper/css/navigation";

to a single client-only entry point.

🤖 Prompt for AI Agents
In app/sections/featured-products/product-items.tsx at lines 10 to 11, the
Swiper CSS imports are currently inside the component file, which can cause
multiple bundling and SSR streaming issues. Remove these imports from this file
and instead add them once to a top-level client-only entry point such as
app/entry.client.tsx to ensure global CSS is loaded only once.

Comment on lines +221 to +226
className={clsx(
"featured-products-prev rounded-full bg-[#EDEAE6] p-4",
activeSlide === 0
? "opacity-50 cursor-not-allowed"
: "opacity-100"
)}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Also disable the “Next” arrow at the end of the carousel

Prev is conditionally disabled; Next stays active even at isEnd, allowing a useless click.
Track swiper.isEnd and apply the same opacity / cursor class to the next button for consistency.

🤖 Prompt for AI Agents
In app/sections/featured-products/product-items.tsx around lines 221 to 226, the
"Next" arrow button is not disabled when the carousel reaches the end, unlike
the "Prev" button which is disabled at the start. Update the "Next" button's
className to conditionally apply "opacity-50 cursor-not-allowed" when
swiper.isEnd is true, and "opacity-100" otherwise, mirroring the logic used for
the "Prev" button to prevent useless clicks.

Comment on lines +118 to +119
onSlideChange={(swiper) => setActiveSlide(swiper.activeIndex)}
navigation={{
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Use swiper.realIndex when looping

With loop: true, activeIndex includes cloned slides, so setActiveSlide(swiper.activeIndex) yields values like 1, not the logical first product.
Switch to swiper.realIndex for consistent indexing:

-onSlideChange={(swiper) => setActiveSlide(swiper.activeIndex)}
+onSlideChange={(swiper) => setActiveSlide(swiper.realIndex)}
📝 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.

Suggested change
onSlideChange={(swiper) => setActiveSlide(swiper.activeIndex)}
navigation={{
onSlideChange={(swiper) => setActiveSlide(swiper.realIndex)}
navigation={{
🤖 Prompt for AI Agents
In app/sections/featured-products/product-items.tsx around lines 118 to 119, the
onSlideChange handler uses swiper.activeIndex which includes cloned slides when
loop is true, causing incorrect slide indexing. Change the code to use
swiper.realIndex instead of swiper.activeIndex to get the logical slide index
that excludes cloned slides, ensuring consistent and accurate active slide
tracking.

@hta218 hta218 merged commit 53ce289 into main Jun 16, 2025
1 check 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.

3 participants