Skip to content

refactor(admin): modernização da ux do portal e controles em linha - #16

Merged
ArielAio merged 1 commit into
mainfrom
refactor/admin-ux-and-styling
Mar 24, 2026
Merged

ArielAio merged 1 commit into
mainfrom
refactor/admin-ux-and-styling

Conversation

@ArielAio

Copy link
Copy Markdown
Owner
  • feat(admin): login redesenhado com estética 'Vanguard Secure Portal' (remoção de suporte legado).
  • feat(catalog): introduzido 'AdminProductModal' global para edição rápida de produtos direto da vitrine pública.
  • ui(admin): simplificadas as abas de gerenciamento de Produtos, Categorias e Atendimento.
  • fix(mobile): adicionado padding condicional no Footer (globals.css).
  • refactor(footer): link dinâmico focado no Instagram.
  • fix(ui): favicon migrado para um gerador icon.svg dinâmico com clip-path nativo circular.

[skip ci]

@ArielAio ArielAio self-assigned this Mar 24, 2026
Copilot AI review requested due to automatic review settings March 24, 2026 20:54
@vercel

vercel Bot commented Mar 24, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
li-rilko Ready Ready Preview, Comment Mar 26, 2026 2:21pm

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Atualiza a UX/visual do portal (admin) e da vitrine pública, incluindo navegação mobile com bottom tabs e um fluxo global de edição rápida de produtos (modal) acessível diretamente do catálogo/produto quando a sessão admin estiver válida.

Changes:

  • Introduz AdminProductModal global + gatilhos de edição inline (com isAdmin vindo da sessão).
  • Moderniza UI pública (home, catálogo, PDP, carrinho) e adiciona BottomTabBar no mobile.
  • Refatora fluxo do WhatsApp (picker/estado) e ajusta componentes de header/footer + CSS amplo.

Reviewed changes

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

Show a summary per file
File Description
scripts/create-svg-favicon.js Script para gerar app/icon.svg a partir de PNG (base64 + clip-path).
components/whatsapp-float-widget.js Widget WhatsApp com novo visual e estado do picker vindo do CatalogProvider.
components/whatsapp-attendant-picker.js Picker com classes vg-*, overflow lock via body.style, e lista sem shuffle.
components/site-header.js Header com marca textual, badge de carrinho e novo drawer mobile vg-*.
components/site-footer.js Footer redesenhado com link destacado para Instagram e grid simplificado.
components/providers/catalog-provider.js Adiciona isAdmin, estado global do WhatsApp picker e do editor de produto (modal).
components/providers/app-providers.js Propaga isAdmin para CatalogProvider.
components/product-detail-actions.js Atualiza ações do PDP (layout + toasts) e classes vg-*.
components/product-card.js Novo card vg-* com CTA WhatsApp e botão inline “Editar” quando isAdmin.
components/icons.js Adiciona ícones (Home/Book/User) para navegação inferior.
components/catalog-page-content.js Novo layout de catálogo (search/sort/pills) e resultados em grid “stacked”.
components/bottom-tab-bar.js Nova barra inferior mobile com badge de carrinho e link admin opcional.
components/app-shell.js Injeta BottomTabBar e AdminProductModal globalmente.
components/admin/managers/admin-service-manager.js Simplifica gerenciamento de atendimento (remove seção de canais).
components/admin/managers/admin-products-manager.js Remove editor embutido e passa a abrir AdminProductModal via openEditModal.
components/admin/managers/admin-categories-manager.js Refatora para edição focada (um departamento por vez) + deleção.
components/admin/admin-product-modal.js Novo slideover global para criação/edição de produtos + galeria upload.
components/admin/admin-login-form.js Login admin redesenhado (“portal seguro”) com revelar senha e estado “esqueceu”.
components/admin/admin-dashboard.js Dashboard admin redesenhado (cards/módulos) e topbar.
app/produto/[id]/page.js PDP redesenhada com galeria, tabs e botão inline de edição (admin).
app/page.js Home redesenhada (hero/categorias/destaques/banner WhatsApp).
app/layout.js Deriva isAdmin via cookie de sessão e injeta nos providers.
app/globals.css Grande atualização de estilos vg-*, bottom nav, drawer, admin slideover, etc.
app/carrinho/page.js Carrinho redesenhado (lista + preview da mensagem + sticky checkout).

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

Comment thread app/carrinho/page.js
return;
}

if (!link) return;

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

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

handleSelectAttendant returns early when the selected attendant has an invalid phone (!link) without any user feedback. This leaves the picker open and looks like a broken click. Consider restoring a warning toast (and/or disabling attendants with invalid phones in the picker) so the user understands what happened.

Suggested change
if (!link) return;
if (!link) {
showToast({
type: "warning",
title: "Contato indisponível",
message: "Este atendente não possui WhatsApp configurado.",
});
return;
}

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +18
const fs = require('fs');
const path = require('path');

const imgPath = path.join(process.cwd(), 'public/li-rilko-icon-page.png');
const imgData = fs.readFileSync(imgPath);
const base64 = imgData.toString('base64');

const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 192">
<defs>
<clipPath id="circleView">
<circle cx="96" cy="96" r="96" />
</clipPath>
</defs>
<image width="192" height="192" href="data:image/png;base64,${base64}" clip-path="url(#circleView)" preserveAspectRatio="xMidYMid slice" />
</svg>`;

fs.writeFileSync(path.join(process.cwd(), 'app/icon.svg'), svg);
console.log('App Icon SVG created successfully!');

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

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

This script generates app/icon.svg but it isn’t referenced by any npm script or documented, so it’s easy for the committed favicon to drift from the source PNG. Consider adding an npm script (e.g., generate:favicon) and/or documenting when it should be run (and whether app/icon.svg should be committed).

Copilot uses AI. Check for mistakes.
Comment on lines +231 to +243
return (
<>
<div className="vg-modal-backdrop" onClick={closeEditModal} />
<div className="vg-admin-slideover">
<div className="vg-slideover-header">
<div>
<h2>{isNew ? "Novo Produto" : "Editar Produto"}</h2>
<span className="vg-slideover-id">PRODUCT ID: #{productForm.id.split("-").pop().substring(0,6).toUpperCase()}</span>
</div>
<button className="vg-slideover-close" onClick={closeEditModal} aria-label="Fechar">
×
</button>
</div>

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

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

AdminProductModal renders a modal/slideover without role="dialog"/aria-modal and doesn’t handle Escape-to-close or focus management. The codebase already has an accessible modal pattern (components/admin/admin-modal.js)—consider reusing it or adding the same accessibility behaviors here so keyboard/screen-reader users can operate the editor.

Copilot uses AI. Check for mistakes.
Comment thread components/app-shell.js Outdated
Comment on lines +18 to +22
<main className="app-shell has-bottom-nav">{children}</main>
<SiteFooter />
{!isAdminRoute && <MobileCartBar />}
{!isAdminRoute && <WhatsAppFloatWidget />}
<BottomTabBar />

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

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

has-bottom-nav is applied unconditionally, but BottomTabBar is hidden on /admin routes. On mobile this still adds extra bottom padding to admin pages. Consider only adding has-bottom-nav (and rendering BottomTabBar) when !isAdminRoute so admin layouts don’t get an unnecessary 80px gap.

Suggested change
<main className="app-shell has-bottom-nav">{children}</main>
<SiteFooter />
{!isAdminRoute && <MobileCartBar />}
{!isAdminRoute && <WhatsAppFloatWidget />}
<BottomTabBar />
<main className={`app-shell${!isAdminRoute ? " has-bottom-nav" : ""}`}>
{children}
</main>
<SiteFooter />
{!isAdminRoute && <MobileCartBar />}
{!isAdminRoute && <WhatsAppFloatWidget />}
{!isAdminRoute && <BottomTabBar />}

Copilot uses AI. Check for mistakes.
Comment thread components/admin/admin-login-form.js Outdated

{state?.error ? <p className="admin-error">{state.error}</p> : null}
<button type="submit" className="vg-secure-submit" disabled={isPending}>
{isPending ? "ENTRANDO..." : "ENTRAR"} <span className="arrow">→]</span>

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

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

There’s a stray ] in the submit button arrow (→]), which looks like a typo in the UI. Remove the extra bracket (or replace with a proper icon/arrow).

Suggested change
{isPending ? "ENTRANDO..." : "ENTRAR"} <span className="arrow">→]</span>
{isPending ? "ENTRANDO..." : "ENTRAR"} <span className="arrow">→</span>

Copilot uses AI. Check for mistakes.
Comment thread components/whatsapp-float-widget.js Outdated
Comment on lines 25 to 53
@@ -36,8 +40,7 @@ export default function WhatsAppFloatWidget() {
}

if (action.mode === "picker") {
setPendingMessage(message);
setIsPickerOpen(true);
openWhatsAppPicker(message);
return;
}

@@ -49,13 +52,8 @@ export default function WhatsAppFloatWidget() {
});
}

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

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

attendantFlow and handleClick are now unused (the UI calls openWhatsAppPicker directly). This leaves dead code and an unused import (resolveAttendantFlow). Either wire the UI back to handleClick or remove the unused flow/handler to avoid confusion.

Copilot uses AI. Check for mistakes.
Comment thread app/produto/[id]/page.js Outdated
Comment on lines +101 to +102
<span className="vg-price-main">{formatCurrency(priceCash)}</span>
<span className="vg-price-alt">ou {formatCurrency(priceInstallment)} à vista</span>

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

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

The price label is inconsistent: priceInstallment is shown with the text “à vista”. This will display the installment price but label it as cash price. Swap the label/value so priceCash is the “à vista” amount and priceInstallment is the “a prazo” amount.

Suggested change
<span className="vg-price-main">{formatCurrency(priceCash)}</span>
<span className="vg-price-alt">ou {formatCurrency(priceInstallment)} à vista</span>
<span className="vg-price-main">{formatCurrency(priceCash)} à vista</span>
<span className="vg-price-alt">ou {formatCurrency(priceInstallment)} a prazo</span>

Copilot uses AI. Check for mistakes.
Comment thread components/admin/admin-login-form.js Outdated
import { useActionState } from "react";
import { useActionState, useState } from "react";
import { adminLoginAction } from "@/app/admin/actions";
import { IconUser, IconHome } from "@/components/icons";

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

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

IconHome is imported but never used. Please remove unused imports to keep the module tidy.

Suggested change
import { IconUser, IconHome } from "@/components/icons";
import { IconUser } from "@/components/icons";

Copilot uses AI. Check for mistakes.
Comment thread components/admin/admin-product-modal.js Outdated
Comment on lines +3 to +7
import { useEffect, useMemo, useRef, useState } from "react";
import { useCatalog } from "@/components/providers/catalog-provider";
import { useToast } from "@/components/providers/toast-provider";
import { formatCurrencyInput, formatCurrencyInputForEdit, parseCurrencyInputToNumber } from "@/lib/admin-input-formatters";
import { IconPhoto, IconClose } from "@/components/icons";

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

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

Several imports are unused (useRef, IconPhoto, IconClose). Removing them reduces bundle size slightly and avoids confusion during future edits.

Suggested change
import { useEffect, useMemo, useRef, useState } from "react";
import { useCatalog } from "@/components/providers/catalog-provider";
import { useToast } from "@/components/providers/toast-provider";
import { formatCurrencyInput, formatCurrencyInputForEdit, parseCurrencyInputToNumber } from "@/lib/admin-input-formatters";
import { IconPhoto, IconClose } from "@/components/icons";
import { useEffect, useMemo, useState } from "react";
import { useCatalog } from "@/components/providers/catalog-provider";
import { useToast } from "@/components/providers/toast-provider";
import { formatCurrencyInput, formatCurrencyInputForEdit, parseCurrencyInputToNumber } from "@/lib/admin-input-formatters";

Copilot uses AI. Check for mistakes.
Comment on lines +36 to +51
async function handleToggleVisibility(product) {
if (isProcessing) return;
setIsProcessing(true);
const result = await toggleProductVisibility(product.id, product.isVisible !== false);
setIsProcessing(false);

async function handleRemoveImage(image, index) {
const result = await deleteProductImage(productForm.id, image.id);
if (!result.ok) {
showToast({
type: "warning",
title: "Erro ao excluir imagem",
message: result.error || "Não foi possível excluir a imagem.",
});
return;
showToast({ type: "warning", title: "Erro", message: result.error });
}

setProductImages((prev) => prev.filter((_, currentIndex) => currentIndex !== index).map(normalizeImageItem));
}

function moveImageToPrimary(index) {
setProductImages((prev) => {
if (index <= 0 || index >= prev.length) {
return prev;
}

const next = [...prev];
const [selected] = next.splice(index, 1);
next.unshift(selected);
return next.map(normalizeImageItem);
});
}

async function handleSaveProduct(event) {
event.preventDefault();
const payload = buildProductPayload();
const validationError = validatePayload(payload);

if (validationError) {
showToast({
type: "warning",
title: "Dados inválidos",
message: validationError,
});
return;
}

setIsSubmitting(true);

try {
if (editingProductId) {
const result = await updateProduct(editingProductId, payload);
if (!result.ok) {
showToast({
type: "warning",
title: "Erro ao salvar",
message: result.error || "Não foi possível atualizar o produto.",
});
return;
}

showToast({
type: "success",
title: "Produto atualizado",
message: "As informações do produto foram salvas.",
});
return;
}

const result = await addProduct(payload);
if (!result.ok) {
showToast({
type: "warning",
title: "Erro ao criar produto",
message: result.error || "Não foi possível criar o produto.",
});
return;
}
async function handleToggleAvailability(product) {
if (isProcessing) return;
setIsProcessing(true);
const result = await toggleProductAvailability(product.id, product.isAvailable !== false);
setIsProcessing(false);

Copilot AI Mar 24, 2026

Copy link

Choose a reason for hiding this comment

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

toggleProductVisibility only takes (productId) (it reads current state from productMap), but this call passes a second argument that is ignored. Same for toggleProductAvailability. Remove the extra parameter (or update the provider signature) to avoid misleading future changes.

Copilot uses AI. Check for mistakes.
- feat(admin): login redesenhado com estética 'Vanguard Secure Portal'.
- feat(catalog): introduzido 'AdminProductModal' global para edição rápida de produtos.
- ui(admin): simplificadas as abas de gerenciamento de Produtos, Categorias e Atendimento.
- fix(mobile): padding condicional no Footer e BottomTabBar condicionada a rotas não-admin.
- fix(mobile): admin topbar responsivo com flex-wrap e breakpoint mobile.
- refactor(footer): link dinâmico focado no Instagram (@lirilkoimportscentro).
- fix(ui): favicon migrado para icon.svg com clip-path circular nativo.
- fix(a11y): role=dialog, aria-modal e Escape-to-close no AdminProductModal.
- fix(ui): corrigido label de preço (à vista / a prazo) na página de produto.
- chore: removidas importações e código morto.
- chore: adicionado script npm generate:favicon.
@ArielAio
ArielAio force-pushed the refactor/admin-ux-and-styling branch from 6bb9a2c to 6a2d604 Compare March 24, 2026 21:32
@ArielAio
ArielAio merged commit f88d314 into main Mar 24, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
Preview — 6a2d6041 Deployed Mar 24, 2026 by vercel[bot]
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