Skip to content

Lovable sync 1780253995#552

Closed
adm01-debug wants to merge 15 commits into
mainfrom
lovable-sync-1780253995
Closed

Lovable sync 1780253995#552
adm01-debug wants to merge 15 commits into
mainfrom
lovable-sync-1780253995

Conversation

@adm01-debug
Copy link
Copy Markdown
Owner

@adm01-debug adm01-debug commented May 31, 2026

📋 Descrição

🎯 Tipo de mudança

  • 🚀 feat — nova funcionalidade
  • 🐛 fix — correção de bug
  • ♻️ refactor — refatoração (sem mudança de comportamento)
  • 🔧 chore — manutenção, deps, config
  • 📚 docs — documentação
  • ⚡ perf — performance
  • 🔒 security — segurança
  • 🚨 hotfix — correção urgente em produção
  • 💥 breaking change — quebra compatibilidade

🔗 Issues relacionadas

Closes #
Refs #

🌐 Sistemas afetados

  • Bitrix24 (CRM, SPAs, BizProc)
  • Supabase (DB, Edge Functions, RLS, migrations)
  • n8n (workflows)
  • Evolution API / WhatsApp
  • Bling (NFe, OAuth)
  • Cloudflare (Workers, Images, Tunnels)
  • Frontend (UI, dashboards)
  • CI / GitHub Actions
  • Outro: ____

🧪 Como testar

✅ Checklist pré-merge

Qualidade

  • Código segue style guide (ESLint passa)
  • npx tsc --noEmit passa sem erros
  • Testes passam (npm run test)
  • Adicionei testes para novas funcionalidades quando aplicável
  • CodeRabbit revisou o PR (ou justificativa para skip)

Segurança

  • Sem secrets, tokens ou credenciais hardcoded
  • Variáveis de ambiente novas documentadas
  • Sem console.log com payloads sensíveis (usar logger.*)
  • RLS revisado se houve mudança em tabelas
  • Edge functions: input validado com Zod

Documentação

  • Atualizei docs (README / CHANGELOG / docs/) se necessário
  • Memória atualizada (mem://) se a mudança afetar arquitetura/regras
  • Migrations com backup em _backup_*_YYYYMMDD se destrutivas

UI

  • Componentes usam tokens semânticos (sem cores hardcoded)
  • Screenshots / vídeo anexados (se mudança visual)

📸 Screenshots (se UI)

🔄 Plano de rollback

⚠️ Notas para o reviewer


Summary by cubic

Virtualized the Novidades grid with pagination and consistent card layout, and added end-to-end visual and accessibility coverage. This improves scroll performance, reduces layout shift, and speeds up CI visual tests.

  • New Features

    • Added VirtualizedNoveltyGrid using @tanstack/react-virtual for smoother scrolling and large lists (up to 400 items).
    • Introduced pagination (20 per page) with auto-reset on filter changes.
    • Improved NoveltyGridCard accessibility: role/aria labels, keyboard (Enter/Space) support, and stable min-heights for title/price. Aligned skeletons to match card layout. Refreshed page header with test IDs.
    • Added Playwright visual and a11y tests (@playwright/test + @axe-core/playwright) covering grid regressions across viewports, skeleton state, pagination, keyboard focus, and card variations.
  • Refactors

    • Sharded CI visual tests via --shard matrix and set workers=2; upload per-shard reports for faster, reliable runs.
    • Increased novelties fetch limit to 400 items.
    • Removed SupabaseConnectionDebug from the auth page.

Written for commit 1ed69b4. Summary will update on new commits.

Review in cubic

lovable-dev Bot and others added 15 commits May 31, 2026 18:47
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
X-Lovable-Edit-ID: edt-2861a40d-d258-4d19-aa54-31352a773f86
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
X-Lovable-Edit-ID: edt-dcfc3e5b-15a6-4368-9747-c1e2a3a946b2
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
X-Lovable-Edit-ID: edt-a613bb01-3be5-4e73-afb3-e58acf636175
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
X-Lovable-Edit-ID: edt-6fa19df9-0496-4719-b1c5-a88eab685b36
Co-authored-by: adm01-debug <231131902+adm01-debug@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 31, 2026 19:59
@vercel
Copy link
Copy Markdown

vercel Bot commented May 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
we-dream-big Ready Ready Preview, Comment May 31, 2026 7:59pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 31, 2026

Warning

Review limit reached

@adm01-debug, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 35 minutes and 39 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

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.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6f768231-2ae0-4d35-8a7e-d6cb8822299e

📥 Commits

Reviewing files that changed from the base of the PR and between e5c1c5c and 1ed69b4.

📒 Files selected for processing (10)
  • .github/workflows/visual-tests.yml
  • e2e/routes/app/novelty-card-variations.spec.ts
  • e2e/routes/app/novelty-grid-visual.spec.ts
  • playwright.config.ts
  • src/components/loading/ModernSkeletons.tsx
  • src/components/novelties/NoveltyCards.tsx
  • src/components/novelties/NoveltyProductGrid.tsx
  • src/components/novelties/VirtualizedNoveltyGrid.tsx
  • src/pages/auth/Auth.tsx
  • src/pages/products/NoveltiesPage.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lovable-sync-1780253995

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

@supabase
Copy link
Copy Markdown

supabase Bot commented May 31, 2026

This pull request has been ignored for the connected project doufsxqlfjyuvxuezpln because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ed69b4030

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +605 to +606
{totalPages > 1 && (
<div className="mt-6 flex justify-center py-4">
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Move pagination outside the fetching overlay

When there are more than 20 matching novelties, this pagination block is nested inside the isFetching && products.length > 0 overlay above it. That means the controls only render during background fetches, and when they do render the ancestor has pointer-events-none, so users cannot navigate past the first page after the new paginatedProducts slice is applied.

Useful? React with 👍 / 👎.

test.describe('Novelty Card Variations @mobile', () => {
test.beforeEach(async ({ context }) => {
// Mock the novelties API to provide specific edge cases
await context.route('**/functions/v1/novelties**', async route => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Mock the endpoint the novelties page actually calls

The new novelty tests install fixtures on routes such as this functions/v1/novelties URL (and **/api/external-db in the companion visual spec), but /novidades gets its data through useNoveltiesWithDetailsinvokeExternalDb, which queries Supabase REST for products and only falls back to external-db-bridge; no request is made to these mocked endpoints. In CI the assertions for exactly 3 or 45 mocked cards therefore run against real/fallback data instead of the fixture and will fail or time out depending on the environment.

Useful? React with 👍 / 👎.

onClick={selectionMode ? onToggleSelect : onClick}
onClick={handleClick}
role="article"
aria-label={`${product.product_name} — ${getStockStatusLabel(stockStatus)}, ${formatPrice(product.base_price ?? 0)}`}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Announce consultation prices consistently

For novelties whose base_price is null or 0, the visible card says “Preço sob consulta”, but this new aria-label still formats the fallback as R$ 0,00. Screen-reader users get a different price from the UI for the consultation-price case, so the accessible label should mirror the same conditional text used in the card body.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the /novidades experience to handle larger novelty lists more smoothly by introducing a virtualized grid + client-side pagination, while also adding Playwright visual/a11y coverage and speeding up CI visual runs.

Changes:

  • Added VirtualizedNoveltyGrid (TanStack React Virtual) and integrated it into NoveltyProductGrid with pagination (20/page) and filter-triggered page reset.
  • Improved novelty card keyboard/accessibility handling and aligned skeleton layout to reduce layout shift.
  • Added new Playwright visual/a11y specs for the novelty grid and updated Playwright/CI settings to run faster in parallel/shards.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 26 comments.

Show a summary per file
File Description
src/pages/products/NoveltiesPage.tsx Refreshed novelties page header/layout and added test IDs used by E2E.
src/pages/auth/Auth.tsx Removed SupabaseConnectionDebug from Auth page.
src/components/novelties/VirtualizedNoveltyGrid.tsx New virtualized novelty grid implementation.
src/components/novelties/NoveltyProductGrid.tsx Switched grid rendering to virtualization + added pagination logic/UI.
src/components/novelties/NoveltyCards.tsx Updated card interaction + a11y attributes/keyboard handling.
src/components/loading/ModernSkeletons.tsx Adjusted skeleton min-heights/structure for layout stability.
playwright.config.ts Increased CI workers to 2 for faster Playwright runs.
e2e/routes/app/novelty-grid-visual.spec.ts New novelty grid visual + a11y regression coverage.
e2e/routes/app/novelty-card-variations.spec.ts New novelty card variations visual test coverage.
.github/workflows/visual-tests.yml Sharded visual tests + report upload per shard for faster CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +610 to +613
<PaginationPrevious
onClick={() => setCurrentPage(p => Math.max(1, p - 1))}
className={cn(currentPage === 1 && "pointer-events-none opacity-50", "cursor-pointer")}
/>
Comment on lines +628 to +635
<PaginationLink
isActive={currentPage === page}
onClick={() => setCurrentPage(page)}
className="cursor-pointer"
>
{page}
</PaginationLink>
</PaginationItem>
Comment on lines +640 to +643
<PaginationNext
onClick={() => setCurrentPage(p => Math.min(totalPages, p + 1))}
className={cn(currentPage === totalPages && "pointer-events-none opacity-50", "cursor-pointer")}
/>
Comment on lines +3 to +6
import type { NoveltyWithDetails } from '@/hooks/products';
import type { ColumnCount } from '@/components/products/ColumnSelector';
import { useResponsiveColumns, getGridColsClass, getGridGapClass } from '../replenishments/grid-layout';
import { NoveltyGridCard } from './NoveltyCards';
Comment on lines +72 to +74
}}
className={`grid ${getGridColsClass(effectiveCols)} ${getGridGapClass(effectiveCols)} pb-8`}
>
Comment on lines +59 to +61
const grid = page.locator('div[role="list"]');
await grid.waitFor({ state: 'visible' });
await page.waitForTimeout(1000);
>
Novidades
</h1>
<p
<p className="text-sm text-muted-foreground">
Produtos recém-chegados ao catálogo nos últimos 30 dias
</p>
<div className="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
Comment on lines +46 to +48
const header = page.locator('div.flex.flex-col.gap-4').first();
const title = header.locator('[data-testid="page-title-novidades"]');
const desc = header.locator('[data-testid="novelty-description"]');
Comment on lines +80 to +83
const results = await new AxeBuilder({ page })
.include('div[role="list"]')
.analyze();

Copy link
Copy Markdown
Owner Author

Closing in favour of #553, which implements all features from this PR (and from #547, #549, #550, #551) on current main with three critical bugs fixed that were present across the Lovable-generated set:

  1. React Rules of Hooks violation in VariantStockTable — early return was placed between hook calls.
  2. Pagination trapped inside isFetching overlay in NoveltyProductGrid — pagination was invisible during normal browsing.
  3. Ellipsis logic collapsed navigable page buttons — fixed to use currentPage ± 2 boundary.

This branch also had merge conflicts with main due to the older base SHA.


Generated by Claude Code

adm01-debug pushed a commit that referenced this pull request May 31, 2026
Implements all features from Lovable PRs #547-#552 on a clean base,
fixing three critical bugs before merge:

BUGS FIXED
- Rules of Hooks violation in VariantStockTable: Lovable placed early
  return BEFORE remaining hook calls; moved isLoading guard after all
  hooks to comply with React invariant.
- Pagination rendered inside AnimatePresence overlay (isFetching branch
  only): the pagination block was trapped inside the refetch motion.div,
  making it invisible during normal browsing. Moved outside the relative
  container entirely.
- Ellipsis logic replaced navigable page buttons: Lovable used
  `page === 2 || page === totalPages - 1` which collapsed pages 2 and
  penultimate into ellipsis unconditionally. Fixed to use
  `page === currentPage ± 2` as boundary.

FEATURES
- NoveltyProductGrid: client-side pagination (20 items/page), page
  reset on filter/sort change, hides paginator when ≤1 page.
- NoveltyCards: ARIA attributes (role, aria-label, aria-selected,
  tabIndex, onKeyDown) + useCallback for handler stability.
- VariantStockTable: inline loading skeleton (isLoading prop) with
  animate-pulse rows; prop forwarded from StockDashboard.
- StockDashboard: error UI with AlertCircle + retry button surfaced
  from useVariantStock; passes isFetching → isLoading to table.
- useVariantStock: exposes `error`; adds retry×3 with exponential
  backoff (1s→2s→4s capped at 10s).
- stockFetcher: throws instead of silently breaking on Supabase error;
  detects 410/Gone and emits Portuguese user-facing message.
- ModernSkeletons: increased title min-height and added price-area
  skeleton with min-h-[3.25rem] to match card layout.
- CI: parallel Playwright shards (2×) in visual-tests.yml; workers=2
  in playwright.config.ts.
- E2E: novelty-grid-visual.spec.ts expanded to 4 viewports × 5 tests
  + 3 global tests; novelty-card-variations.spec.ts (new); stock
  regression spec in tests/e2e/.

SKIPPED (already applied in Phase 1/2)
- rest-native.ts additions (variant_supplier_sources, supplier_branches,
  categories) were committed in the Phase 1 kill-switch and Phase 2
  ghost-aliases sessions.

https://claude.ai/code/session_015DVTnofjTd3PtzU2kGvYtV
adm01-debug added a commit that referenced this pull request May 31, 2026
…s Lovable PRs #547-#552 (#553)

* feat(novelties+stock): resolve 5 Lovable PRs with critical bug fixes

Implements all features from Lovable PRs #547-#552 on a clean base,
fixing three critical bugs before merge:

BUGS FIXED
- Rules of Hooks violation in VariantStockTable: Lovable placed early
  return BEFORE remaining hook calls; moved isLoading guard after all
  hooks to comply with React invariant.
- Pagination rendered inside AnimatePresence overlay (isFetching branch
  only): the pagination block was trapped inside the refetch motion.div,
  making it invisible during normal browsing. Moved outside the relative
  container entirely.
- Ellipsis logic replaced navigable page buttons: Lovable used
  `page === 2 || page === totalPages - 1` which collapsed pages 2 and
  penultimate into ellipsis unconditionally. Fixed to use
  `page === currentPage ± 2` as boundary.

FEATURES
- NoveltyProductGrid: client-side pagination (20 items/page), page
  reset on filter/sort change, hides paginator when ≤1 page.
- NoveltyCards: ARIA attributes (role, aria-label, aria-selected,
  tabIndex, onKeyDown) + useCallback for handler stability.
- VariantStockTable: inline loading skeleton (isLoading prop) with
  animate-pulse rows; prop forwarded from StockDashboard.
- StockDashboard: error UI with AlertCircle + retry button surfaced
  from useVariantStock; passes isFetching → isLoading to table.
- useVariantStock: exposes `error`; adds retry×3 with exponential
  backoff (1s→2s→4s capped at 10s).
- stockFetcher: throws instead of silently breaking on Supabase error;
  detects 410/Gone and emits Portuguese user-facing message.
- ModernSkeletons: increased title min-height and added price-area
  skeleton with min-h-[3.25rem] to match card layout.
- CI: parallel Playwright shards (2×) in visual-tests.yml; workers=2
  in playwright.config.ts.
- E2E: novelty-grid-visual.spec.ts expanded to 4 viewports × 5 tests
  + 3 global tests; novelty-card-variations.spec.ts (new); stock
  regression spec in tests/e2e/.

SKIPPED (already applied in Phase 1/2)
- rest-native.ts additions (variant_supplier_sources, supplier_branches,
  categories) were committed in the Phase 1 kill-switch and Phase 2
  ghost-aliases sessions.

https://claude.ai/code/session_015DVTnofjTd3PtzU2kGvYtV

* fix(lint): prefix unused functions to satisfy ESLint baseline gate

PriceFreshnessBadge.tsx: formatExactDateTime → _formatExactDateTime
rpc-native.ts: NOT_IN_DB → _NOT_IN_DB (superseded by inline stubs)

https://claude.ai/code/session_015DVTnofjTd3PtzU2kGvYtV

* fix(lint): remove unused formatExactDateTime helper from PriceFreshnessBadge

Function was never called; removing avoids both unused-vars and naming-convention violations.

https://claude.ai/code/session_015DVTnofjTd3PtzU2kGvYtV

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants