Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

--z-admin-modal: 140;
--z-whatsapp-modal: 2200;
--z-toast: 3000;
--z-toast: 11000;
}

* {
Expand Down Expand Up @@ -5261,16 +5261,17 @@ body.modal-open {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 85vw;
max-width: 320px;
background: var(--surface);
z-index: 1001;
transform: translateX(-100%);
transform: translateX(100%);
transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
display: flex;
flex-direction: column;
box-shadow: 20px 0 40px rgba(0,0,0,0.1);
box-shadow: -20px 0 40px rgba(0,0,0,0.1);
overflow-y: auto;
}

.vg-mobile-drawer.is-open {
Expand Down Expand Up @@ -5327,8 +5328,6 @@ body.modal-open {

.vg-drawer-categories {
padding: 1.5rem;
overflow-y: auto;
flex: 1;
}

.vg-drawer-subtitle {
Expand Down
66 changes: 56 additions & 10 deletions components/admin/admin-product-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,19 @@ export default function AdminProductModal() {
function handlePriceFieldBlur(field) {
setProductForm((prev) => {
const rawValue = String(prev[field] ?? "").trim();
if (!rawValue) return { ...prev, [field]: "" };
return { ...prev, [field]: formatCurrencyInput(prev[field]) };
const nextValue = rawValue ? formatCurrencyInput(rawValue) : "";

const otherField = field === "priceCash" ? "priceInstallment" : "priceCash";
const otherValue = String(prev[otherField] ?? "").trim();

const nextForm = { ...prev, [field]: nextValue };

// Se preencheu um e o outro tá vazio, espelha pra facilitar
if (nextValue && !otherValue) {
nextForm[otherField] = nextValue;
}

return nextForm;
});
}

Expand All @@ -168,6 +179,7 @@ export default function AdminProductModal() {

function validatePayload(payload) {
if (!payload.name || !payload.categoryId || !payload.subcategoryId) return "Nome, categoria e subcategoria são obrigatórios.";
if (payload.priceCash <= 0 || payload.priceInstallment <= 0) return "Preços à vista e a prazo devem ser maiores que zero.";
if (!Array.isArray(payload.imageItems) || payload.imageItems.length === 0) return "Adicione ao menos uma imagem na galeria.";
return "";
}
Expand Down Expand Up @@ -270,7 +282,18 @@ export default function AdminProductModal() {
</select>
</div>
<div className="vg-slideover-field">
<label>PREÇO (R$)</label>
<label>SUBCATEGORIA</label>
<select value={productForm.subcategoryId} onChange={(e) => handleProductField("subcategoryId", e.target.value)} required>
{availableSubcategories.map((sub) => (
<option key={sub.id} value={sub.id}>{sub.name}</option>
))}
</select>
</div>
</div>

<div className="vg-slideover-row">
<div className="vg-slideover-field">
<label>PREÇO À VISTA (R$)</label>
<input
type="text"
inputMode="decimal"
Expand All @@ -281,19 +304,42 @@ export default function AdminProductModal() {
required
/>
</div>
<div className="vg-slideover-field">
<label>PREÇO A PRAZO (R$)</label>
<input
type="text"
inputMode="decimal"
value={productForm.priceInstallment}
onChange={(e) => handlePriceFieldChange("priceInstallment", e.target.value)}
onFocus={() => handlePriceFieldFocus("priceInstallment")}
onBlur={() => handlePriceFieldBlur("priceInstallment")}
required
/>
</div>
</div>

<div className="vg-slideover-field">
<label>SUBCATEGORIA</label>
<select value={productForm.subcategoryId} onChange={(e) => handleProductField("subcategoryId", e.target.value)} required>
{availableSubcategories.map((sub) => (
<option key={sub.id} value={sub.id}>{sub.name}</option>
))}
</select>
<label>BADGE / ETIQUETA (EX: MAIS VENDIDO)</label>
<input
type="text"
value={productForm.badge}
onChange={(e) => handleProductField("badge", e.target.value)}
placeholder="Ex: Novo, Oferta, Destaque..."
/>
</div>

<div className="vg-slideover-field">
<label>DESTAQUES DO PRODUTO (UM POR LINHA)</label>
<textarea
rows={3}
value={productForm.highlightsText}
onChange={(e) => handleProductField("highlightsText", e.target.value)}
placeholder="Ex: Couro Legítimo&#10;Acabamento Premium&#10;Garantia de 1 ano"

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

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

In JSX, the placeholder string won’t decode HTML entities like &#10;, so users will likely see the literal text &#10; instead of line breaks. Use a JS string with real newlines (e.g. "...\n..." via {}) if you want a multi-line placeholder.

Suggested change
placeholder="Ex: Couro Legítimo&#10;Acabamento Premium&#10;Garantia de 1 ano"
placeholder={"Ex: Couro Legítimo\nAcabamento Premium\nGarantia de 1 ano"}

Copilot uses AI. Check for mistakes.
/>
</div>

<div className="vg-slideover-field">
<label>DESCRIÇÃO</label>
<label>DESCRIÇÃO COMPLETA</label>
<textarea
rows={4}
value={productForm.shortDescription}
Expand Down
20 changes: 15 additions & 5 deletions components/catalog-page-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import { useCatalog } from "@/components/providers/catalog-provider";
import TransitionLink from "@/components/transition-link";

const SORT_OPTIONS = [
{ value: "relevancia", label: "Relevância" },
{ value: "menor-preco-vista", label: "Menor preço" },
{ value: "maior-preco-vista", label: "Maior preço" },
{ value: "relevancia", label: "Destaques" },
{ value: "menor-preco", label: "Menor Preço" },
{ value: "maior-preco", label: "Maior Preço" },
{ value: "nome-az", label: "Nome: A-Z" },
{ value: "nome-za", label: "Nome: Z-A" },
];

function normalizeSort(value) {
Expand Down Expand Up @@ -68,14 +70,22 @@ export default function CatalogPageContent({ initialCategory = "Todos", initialS
);
});

if (sortBy === "menor-preco-vista") {
if (sortBy === "menor-preco") {
products = [...products].sort((a, b) => Number(a.priceCash ?? a.price ?? 0) - Number(b.priceCash ?? b.price ?? 0));
}

if (sortBy === "maior-preco-vista") {
if (sortBy === "maior-preco") {
products = [...products].sort((a, b) => Number(b.priceCash ?? b.price ?? 0) - Number(a.priceCash ?? a.price ?? 0));
}

if (sortBy === "nome-az") {
products = [...products].sort((a, b) => a.name.localeCompare(b.name));
}

if (sortBy === "nome-za") {
products = [...products].sort((a, b) => b.name.localeCompare(a.name));
}

return products;
}, [publicProducts, searchTerm, selectedCategory, selectedSub, sortBy]);

Expand Down
2 changes: 1 addition & 1 deletion components/site-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export default function SiteHeader() {
>
<div className="vg-drawer-header">
<TransitionLink href="/" className="vg-drawer-brand">
Li Rilko
<img src="/logo-li-rilko-header.png" alt="Li Rilko Imports" style={{ height: '32px', width: 'auto' }} />
</TransitionLink>
<button type="button" className="vg-drawer-close" aria-label="Fechar menu" onClick={() => setIsMenuOpen(false)}>
<IconClose className="icon" />
Expand Down
6 changes: 6 additions & 0 deletions components/whatsapp-float-widget.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use client";

import { useState } from "react";
import { usePathname } from "next/navigation";
import { IconWhatsApp } from "@/components/icons";
import WhatsAppAttendantPicker from "@/components/whatsapp-attendant-picker";
import { useCatalog } from "@/components/providers/catalog-provider";
Expand All @@ -19,9 +20,14 @@ export default function WhatsAppFloatWidget() {
openWhatsAppPicker,
closeWhatsAppPicker
} = useCatalog();
const pathname = usePathname();
const { count } = useCart();
const { showToast } = useToast();

if (pathname?.startsWith("/carrinho")) {
return null;
}

function handleSelectAttendant(attendant) {
const link = buildAttendantWhatsAppLink(whatsappPendingMessage, attendant);

Expand Down
Loading