Skip to content

Feat/ux better details pr1#141

Merged
henri318 merged 5 commits into
mainfrom
feat/ux-better-details_pr1
Jul 12, 2026
Merged

Feat/ux better details pr1#141
henri318 merged 5 commits into
mainfrom
feat/ux-better-details_pr1

Conversation

@henri318

@henri318 henri318 commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Nuevas funcionalidades

    • El carrito muestra los detalles guardados de cada personalización, incluidas imágenes, colores, tallas y posiciones de diseño.
    • Se puede editar una personalización directamente desde el carrito.
    • El listado inicial de productos muestra hasta 12 artículos.
  • Mejoras visuales

    • Se renueva el diseño del carrito, con tarjetas, miniaturas, controles de cantidad y acciones más claros y adaptados a móviles.
  • Correcciones

    • Los precios se formatean correctamente según el idioma español.
    • El estado de carga de los botones aparece traducido como “Cargando...”.
    • Se mejora la gestión y presentación de errores durante la subida de archivos.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@henri318, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 41 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e556275d-a49e-4ebd-8155-20b19df2182b

📥 Commits

Reviewing files that changed from the base of the PR and between 7654918 and 7ea13ac.

📒 Files selected for processing (3)
  • modules/cart/presentation/components/cart-view.tsx
  • tests/e2e/products/products.spec.ts
  • tests/unit/components/cart/add-to-cart-button.test.tsx
📝 Walkthrough

Walkthrough

La página del carrito resuelve snapshots de personalización y los muestra con enlaces de edición. También se actualizan estilos responsivos, formato monetario español, textos localizados, límites de uploads, semántica de la página inicial y pruebas asociadas.

Changes

Carrito y presentación

Layer / File(s) Summary
Resolución y renderizado de personalizaciones
app/[locale]/cart/page.tsx, modules/cart/presentation/components/*, tests/unit/app/cart/*, tests/unit/components/cart/*
Los ítems autenticados resuelven snapshots mediante sus IDs y CartView muestra sus datos, miniaturas y enlaces de edición.
Estilos responsivos del carrito
modules/cart/presentation/components/cart-view.module.css
La vista adopta tarjetas, controles, miniaturas superpuestas y ajustes específicos para móvil.
Sección semántica y paginación de inicio
app/[locale]/page.tsx, shared/ui/index.ts, tests/unit/app/[locale]/page.test.tsx
La página usa un <section> directo, elimina la reexportación de MiddleSection y cambia el tamaño de página a 12.
Contratos de errores y límites de uploads
modules/uploads/application/*, tests/unit/modules/uploads/application/*
Se exportan límites y tipos MIME, y se añade el mapeo tipado entre errores de upload y claves i18n.
Formato monetario y estados localizados
shared/kernel/domain/value-objects/money.ts, shared/ui/button.tsx, tests/unit/shared/*, tests/unit/modules/presentation/*, tests/unit/app/*
Los importes usan formato monetario español con fallback y los estados de carga usan textos del diccionario.
Validaciones de producto y canvas
tests/unit/app/[locale]/products/*
Se prueba el redibujado del canvas tras cargar una nueva imagen y se añade un escenario comentado de edición desde el carrito.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CartPage
  participant CustomizationLookup
  participant CartView
  CartPage->>CustomizationLookup: findByIds(customizationIdList)
  CustomizationLookup-->>CartPage: snapshots de personalización
  CartPage->>CartView: items enriquecidos y labels
  CartView-->>CartPage: enlace de edición con parámetros
Loading

Possibly related PRs

Suggested labels: type:feature

🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive El título es demasiado genérico y no describe con claridad el cambio principal del PR. Usa un título más específico que resuma la mejora principal, por ejemplo el enriquecimiento de detalles del carrito y la vista home.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ux-better-details_pr1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
modules/cart/presentation/components/cart-view.module.css (1)

43-328: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Restablece el cumplimiento de Stylelint.

Los selectores camelCase modificados incumplen selector-class-pattern, y la media query incumple media-feature-range-notation. Renombra los selectores junto con sus consumidores CSS Module, o configura una excepción específica para CSS Modules si camelCase es la convención intencional.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modules/cart/presentation/components/cart-view.module.css` around lines 43 -
328, Restablece el cumplimiento de Stylelint en los selectores del módulo CSS:
renombra las clases camelCase de cart-view.module.css a kebab-case y actualiza
todos sus consumidores CSS Module correspondientes, o añade una excepción
específica para CSS Modules si la convención camelCase debe mantenerse. Corrige
también la media query responsive para usar la notación de rango exigida por
media-feature-range-notation.

Source: Linters/SAST tools

🧹 Nitpick comments (3)
tests/unit/app/[locale]/products/[id]/page.test.tsx (1)

210-255: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Considera reemplazar el bloque comentado por un TODO o un issue.

45 líneas de código de prueba comentado son código muerto que no se ejecuta y puede quedar desactualizado fácilmente. Ya que la característica está planificada para PR-3, sería más sostenible registrarla como un issue o dejar un comentario breve // TODO(PR-3): … en lugar de commitar el bloque completo.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/app/`[locale]/products/[id]/page.test.tsx around lines 210 - 255,
Remove the commented-out test block for cart customization editing and replace
it with a concise TODO referencing PR-3 and the intended behavior, or track the
work in an issue instead. Keep the existing executable tests unchanged.
modules/uploads/application/upload-error-map.ts (1)

8-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Haz que el mapa dependa de UPLOAD_ERROR_CODES.

Los literales duplicados y Record<string, string> permiten que las claves del mapa y los códigos se desincronicen sin error de tipos. Define primero los códigos y usa claves calculadas con satisfies para mantener el contrato tipado.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@modules/uploads/application/upload-error-map.ts` around lines 8 - 16, Define
primero UPLOAD_ERROR_CODES, then update UPLOAD_ERROR_MAP to use computed keys
from those constants and validate it with satisfies, replacing the broad
Record<string, string> annotation so key and value contracts remain
synchronized.
tests/unit/modules/uploads/application/upload-error-map.test.ts (1)

34-52: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Comprueba la whitelist completa, no solo sus miembros.

toContain detecta MIME faltantes, pero las pruebas seguirían pasando si se añade accidentalmente un tipo no permitido. Compara el array completo con toEqual([...]) para proteger el contrato de validación.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/modules/uploads/application/upload-error-map.test.ts` around lines
34 - 52, Actualiza las pruebas de ALLOWED_MIME_TYPES para comparar el array
completo mediante toEqual([...]) en lugar de comprobaciones individuales con
toContain. Incluye exactamente los MIME permitidos actuales: image/jpeg,
image/png, image/webp, video/mp4 y video/webm, preservando el contrato completo
de la whitelist.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/unit/app/`[locale]/cart/cart-view-customization.test.tsx:
- Around line 87-89: Update the customization link flow to pass the cart line
identifier item.id into buildCustomizationHref and serialize it as the
customizationCartItemId query parameter, ensuring the generated edit href
identifies the correct cart item.

In `@tests/unit/app/`[locale]/products/[id]/mockup-canvas-control.test.tsx:
- Around line 113-114: Actualiza la prueba alrededor de
`fireEvent.load(replacementImage)` para limpiar el mock `context.clearRect`
después del montaje inicial y antes de disparar el evento `load`. Mantén la
aserción posterior verificando que `clearRect` fue llamado, aislando así el
redibujado provocado por el manejador `onLoad`.

In `@tests/unit/components/cart/add-to-cart-button.test.tsx`:
- Around line 151-195: Actualiza la lógica de AddToCartButton para que, cuando
exista una línea invitada del mismo producto con una personalización distinta,
permita añadir la nueva línea sin mostrar alreadyInCartDifferent. Conserva el
uso de addItem con la nueva customizationText y ajusta la prueba solo si el
comportamiento esperado del producto sigue siendo mostrar el aviso.

---

Outside diff comments:
In `@modules/cart/presentation/components/cart-view.module.css`:
- Around line 43-328: Restablece el cumplimiento de Stylelint en los selectores
del módulo CSS: renombra las clases camelCase de cart-view.module.css a
kebab-case y actualiza todos sus consumidores CSS Module correspondientes, o
añade una excepción específica para CSS Modules si la convención camelCase debe
mantenerse. Corrige también la media query responsive para usar la notación de
rango exigida por media-feature-range-notation.

---

Nitpick comments:
In `@modules/uploads/application/upload-error-map.ts`:
- Around line 8-16: Define primero UPLOAD_ERROR_CODES, then update
UPLOAD_ERROR_MAP to use computed keys from those constants and validate it with
satisfies, replacing the broad Record<string, string> annotation so key and
value contracts remain synchronized.

In `@tests/unit/app/`[locale]/products/[id]/page.test.tsx:
- Around line 210-255: Remove the commented-out test block for cart
customization editing and replace it with a concise TODO referencing PR-3 and
the intended behavior, or track the work in an issue instead. Keep the existing
executable tests unchanged.

In `@tests/unit/modules/uploads/application/upload-error-map.test.ts`:
- Around line 34-52: Actualiza las pruebas de ALLOWED_MIME_TYPES para comparar
el array completo mediante toEqual([...]) en lugar de comprobaciones
individuales con toContain. Incluye exactamente los MIME permitidos actuales:
image/jpeg, image/png, image/webp, video/mp4 y video/webm, preservando el
contrato completo de la whitelist.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 531e726d-7d42-4198-9921-e8fd9cf9e468

📥 Commits

Reviewing files that changed from the base of the PR and between 15c980a and 7654918.

⛔ Files ignored due to path filters (1)
  • public/img/decorations/formas-15.svg is excluded by !**/*.svg
📒 Files selected for processing (23)
  • app/[locale]/cart/page.tsx
  • app/[locale]/page.tsx
  • modules/cart/presentation/components/cart-view.module.css
  • modules/uploads/application/create-upload-use-case.ts
  • modules/uploads/application/upload-error-map.ts
  • shared/kernel/domain/value-objects/money.ts
  • shared/ui/button.tsx
  • shared/ui/index.ts
  • shared/ui/middle-section.module.css
  • shared/ui/middle-section.tsx
  • tests/unit/app/[locale]/admin/sellers/[sellerId]/seller-detail-form.test.tsx
  • tests/unit/app/[locale]/cart/cart-view-customization.test.tsx
  • tests/unit/app/[locale]/page.test.tsx
  • tests/unit/app/[locale]/products/[id]/mockup-canvas-control.test.tsx
  • tests/unit/app/[locale]/products/[id]/page.test.tsx
  • tests/unit/app/cart/cart-view-guest.test.tsx
  • tests/unit/app/cart/cart-view-snapshots.test.tsx
  • tests/unit/app/cart/cart-view.test.tsx
  • tests/unit/components/cart/add-to-cart-button.test.tsx
  • tests/unit/modules/presentation/components/button.test.tsx
  • tests/unit/modules/presentation/components/login-modal.test.tsx
  • tests/unit/modules/uploads/application/upload-error-map.test.ts
  • tests/unit/shared/kernel/money.test.ts
💤 Files with no reviewable changes (3)
  • shared/ui/index.ts
  • shared/ui/middle-section.tsx
  • shared/ui/middle-section.module.css

Comment on lines +87 to +89
expect(link.getAttribute('href')).toContain(
'customizationCartItemId=item-1',
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Incluye el identificador de la línea del carrito en el enlace de edición.

La nueva aserción falla porque el href omite customizationCartItemId. Propaga item.id a buildCustomizationHref y serializa ese parámetro; sin él, el PDP no puede identificar qué línea debe actualizar.

🧰 Tools
🪛 GitHub Actions: CI / 2_unit.txt

[error] 87-89: Test failed: link href missing expected query param. Expected href to contain 'customizationCartItemId=item-1' but received '/es/products/prod-1?customizationText=Hello&customizationColor=Blue&customizationSize=M&customizationImageUrl=%2Fcustomization.png'.

🪛 GitHub Actions: CI / unit

[error] 87-87: CartView customization links test failed. Expected link href to contain 'customizationCartItemId=item-1', but received '/es/products/prod-1?customizationText=Hello&customizationColor=Blue&customizationSize=M&customizationImageUrl=%2Fcustomization.png'.

🪛 GitHub Check: unit

[failure] 87-87: [unit-react] tests/unit/app/[locale]/cart/cart-view-customization.test.tsx > CartView customization links > links back to the PDP with customization query parameters
AssertionError: expected '/es/products/prod-1?customizationText…' to contain 'customizationCartItemId=item-1'

Expected: "customizationCartItemId=item-1"
Received: "/es/products/prod-1?customizationText=Hello&customizationColor=Blue&customizationSize=M&customizationImageUrl=%2Fcustomization.png"

❯ tests/unit/app/[locale]/cart/cart-view-customization.test.tsx:87:39

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/app/`[locale]/cart/cart-view-customization.test.tsx around lines
87 - 89, Update the customization link flow to pass the cart line identifier
item.id into buildCustomizationHref and serialize it as the
customizationCartItemId query parameter, ensuring the generated edit href
identifies the correct cart item.

Source: Linters/SAST tools

Comment on lines +113 to +114
fireEvent.load(replacementImage);
expect(context.clearRect).toHaveBeenCalled();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

La aserción no aísla el redibujado tras el evento load.

context.clearRect ya se invoca durante el montaje inicial (vía configureCanvasdrawCanvas en el useEffect), por lo que expect(context.clearRect).toHaveBeenCalled() pasaría incluso si el manejador onLoad no funcionara. Para verificar realmente que el redibujado ocurre a causa del evento load, limpia el mock antes de dispararlo:

🧪 Propuesta de corrección
     expect(replacementImage.getAttribute('src')).toBe('/replacement.png');
+    context.clearRect.mockClear();
     fireEvent.load(replacementImage);
     expect(context.clearRect).toHaveBeenCalled();
📝 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
fireEvent.load(replacementImage);
expect(context.clearRect).toHaveBeenCalled();
expect(replacementImage.getAttribute('src')).toBe('/replacement.png');
context.clearRect.mockClear();
fireEvent.load(replacementImage);
expect(context.clearRect).toHaveBeenCalled();
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/app/`[locale]/products/[id]/mockup-canvas-control.test.tsx around
lines 113 - 114, Actualiza la prueba alrededor de
`fireEvent.load(replacementImage)` para limpiar el mock `context.clearRect`
después del montaje inicial y antes de disparar el evento `load`. Mantén la
aserción posterior verificando que `clearRect` fue llamado, aislando así el
redibujado provocado por el manejador `onLoad`.

Comment on lines +151 to +195
it('adds a distinct personalized line without showing a conflicting-customization warning', async () => {
mockUseGuestCart.mockReturnValue({
items: [
{
id: 'guest-item-1',
productId: 'prod-1',
sellerId: 'seller-1',
quantity: 1,
unitPriceSnapshot: 29.99,
customizationText: 'First design',
},
],
itemCount: 1,
addItem: mockAddItem,
updateQuantity: vi.fn(),
removeItem: vi.fn(),
updateItemQuantity: vi.fn(),
removeItemById: vi.fn(),
updateCustomization: vi.fn(),
updateItemCustomization: vi.fn(),
clearCart: vi.fn(),
hydrated: true,
});

render(
<AddToCartButton
{...defaultProps}
customization={{ text: 'Second design' }}
labels={{
...defaultProps.labels,
alreadyInCartDifferent: 'Already customized differently',
}}
/>,
);

expect(
screen.queryByText('Already customized differently'),
).not.toBeInTheDocument();

fireEvent.click(screen.getByRole('button', { name: /add to cart/i }));

expect(mockAddItem).toHaveBeenCalledWith(
expect.objectContaining({ customizationText: 'Second design' }),
);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Alinea el flujo invitado con la nueva expectativa de personalizaciones distintas.

Esta prueba falla porque una línea existente del mismo producto activa alreadyInCartDifferent y muestra el aviso. Ajusta la lógica para permitir la nueva línea personalizada sin ese aviso, o revisa la expectativa si ese aviso sigue siendo el comportamiento requerido.

🧰 Tools
🪛 GitHub Actions: CI / 2_unit.txt

[error] 188-188: Test failed: expected element NOT to be in the document. Found Already customized differently instead. (expect(...).not.toBeInTheDocument())

🪛 GitHub Actions: CI / unit

[error] 188-188: AddToCartButton test failed (guest user). Expected element not to be in the document, but found Already customized differently.

🪛 GitHub Check: unit

[failure] 188-188: [unit-react] tests/unit/components/cart/add-to-cart-button.test.tsx > AddToCartButton > guest user (unauthenticated) > adds a distinct personalized line without showing a conflicting-customization warning
Error: expect(element).not.toBeInTheDocument()

expected document not to contain element, found <span
class="_alreadyInCartLabel_d81c52"

Already customized differently
instead
❯ tests/unit/components/cart/add-to-cart-button.test.tsx:188:13

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/components/cart/add-to-cart-button.test.tsx` around lines 151 -
195, Actualiza la lógica de AddToCartButton para que, cuando exista una línea
invitada del mismo producto con una personalización distinta, permita añadir la
nueva línea sin mostrar alreadyInCartDifferent. Conserva el uso de addItem con
la nueva customizationText y ajusta la prueba solo si el comportamiento esperado
del producto sigue siendo mostrar el aviso.

Source: Linters/SAST tools

@henri318
henri318 merged commit 5198a1a into main Jul 12, 2026
5 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jul 18, 2026
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.

1 participant