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
10 changes: 5 additions & 5 deletions src/components/admin/products/bulk-import/StepPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function StepPreview({
<Label htmlFor="mode-upsert" className="cursor-pointer text-sm">
<span className="font-medium">Upsert</span>
<span className="ml-1 text-muted-foreground">
— insere novos, atualiza existentes (por SKU)
insere novos, atualiza existentes (por SKU)
</span>
</Label>
</div>
Expand All @@ -89,7 +89,7 @@ export function StepPreview({
<Label htmlFor="mode-insert" className="cursor-pointer text-sm">
<span className="font-medium">Inserir</span>
<span className="ml-1 text-muted-foreground">
— apenas novos ({newCount}), pula existentes
apenas novos ({newCount}), pula existentes
</span>
</Label>
</div>
Expand Down Expand Up @@ -125,17 +125,17 @@ export function StepPreview({
(rawData[r.row - 1]?.[
Object.entries(mapping).find(([, v]) => v === 'sku')?.[0] || ''
] as string) ||
'—'}
''}
</TableCell>
<TableCell className="max-w-[180px] truncate text-sm">
{r.data?.name ||
(rawData[r.row - 1]?.[
Object.entries(mapping).find(([, v]) => v === 'name')?.[0] || ''
] as string) ||
'—'}
''}
</TableCell>
<TableCell className="text-sm tabular-nums">
{r.data?.sale_price ? `R$ ${Number(r.data.sale_price).toFixed(2)}` : '—'}
{r.data?.sale_price ? `R$ ${Number(r.data.sale_price).toFixed(2)}` : ''}
</TableCell>
<TableCell>
{r.existsInDb ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function PrintAreaForm({ initial, onSave, onCancel, isSaving }: Props) {
onSave(form);
};

const areaNamePreview = [form.location_name, form.technique_name].filter(Boolean).join(' — ');
const areaNamePreview = [form.location_name, form.technique_name].filter(Boolean).join(' ');

return (
<div className="ml-6 space-y-2.5 rounded-md border border-primary/20 bg-primary/5 p-2.5">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function VolumeValidation({
variant="outline"
className="gap-1 border-destructive/50 bg-destructive/10 px-1.5 py-0 text-[10px] text-destructive"
>
<XCircle className="h-3 w-3" /> NÃO CABE
<XCircle className="h-3 w-3" /> NÃO CABE
</Badge>
)}
</div>
Expand All @@ -114,9 +114,9 @@ export function VolumeValidation({

<div className="flex items-center gap-3 text-[10px] text-muted-foreground">
<span>
Caixa interna: {boxW?.toFixed(0)}×{boxL?.toFixed(0)}×{boxH?.toFixed(0)} mm
Caixa interna: {boxW?.toFixed(0)}×{boxL?.toFixed(0)}×{boxH?.toFixed(0)} mm
</span>
{totalWeight > 0 && <span>• Peso total: {(totalWeight / 1000).toFixed(2)} kg</span>}
{totalWeight > 0 && <span> Peso total: {(totalWeight / 1000).toFixed(2)} kg</span>}
</div>

{componentVolumes.length > 0 && (
Expand All @@ -128,12 +128,12 @@ export function VolumeValidation({
return (
<div key={c.id} className="flex items-center justify-between text-[10px]">
<span className="flex-1 truncate text-muted-foreground">
{c.component_name || 'Sem nome'} {(c.quantity ?? 1) > 1 ? `×${c.quantity}` : ''}
{c.component_name || 'Sem nome'} {(c.quantity ?? 1) > 1 ? `×${c.quantity}` : ''}
</span>
{c.hasDimensions ? (
<div className="flex shrink-0 items-center gap-2">
<span className="font-mono text-muted-foreground">
{c.width_mm}×{c.length_mm}×{c.height_mm} mm
{c.width_mm}×{c.length_mm}×{c.height_mm} mm
</span>
{itemFits ? (
<CheckCircle2 className="h-3 w-3 text-success" />
Expand All @@ -153,7 +153,7 @@ export function VolumeValidation({
{missingDimensions.length > 0 && (
<div className="flex items-center gap-1.5 pt-0.5 text-[10px] text-warning">
<AlertCircle className="h-3 w-3 shrink-0" />
{missingDimensions.length} componente(s) sem dimensões — o cálculo pode ser impreciso.
{missingDimensions.length} componente(s) sem dimensões o cálculo pode ser impreciso.
</div>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/admin/products/kit-components/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export async function deletePrintArea(id: string): Promise<void> {
if (!data?.success) throw new Error(data?.error || 'Erro ao excluir área');
}

// ── Kit Component Media (external DB) ──
// ── Kit Component Media (external DB) ──

export interface ComponentMedia {
id: string;
Expand Down
6 changes: 3 additions & 3 deletions src/components/admin/suppliers-manager/SupplierTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ export function SupplierTable({
{supplier.email && <p>{supplier.email}</p>}
{supplier.phone && <p className="text-muted-foreground">{supplier.phone}</p>}
{!supplier.email && !supplier.phone && (
<p className="text-muted-foreground">—</p>
<p className="text-muted-foreground"></p>
)}
</div>
</TableCell>
<TableCell className="text-right">
{supplier.default_markup_percent !== null ? (
<span className="font-mono text-sm">{supplier.default_markup_percent}%</span>
) : (
'—'
''
)}
</TableCell>
<TableCell className="text-center">
Expand All @@ -129,7 +129,7 @@ export function SupplierTable({
</div>
</TableCell>
<TableCell className="text-right">
<span className="font-mono text-sm">{supplier.priority ?? '—'}</span>
<span className="font-mono text-sm">{supplier.priority ?? ''}</span>
</TableCell>
<TableCell>
<div className="flex gap-1 opacity-0 transition-opacity group-hover:opacity-100">
Expand Down
4 changes: 2 additions & 2 deletions src/components/filters/filter-panel/useFilterPanelState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,10 @@ export function useFilterPanelState(
const sectionSummaries = useMemo(() => {
const summaries: Record<string, string> = {};
if (filters.priceRange[0] > 0 || filters.priceRange[1] < 9999) {
summaries.preco = `R$${filters.priceRange[0]}–${filters.priceRange[1] >= 9999 ? '∞' : filters.priceRange[1]}`;
summaries.preco = `R$${filters.priceRange[0]}${filters.priceRange[1] >= 9999 ? '' : filters.priceRange[1]}`;
}
if (filters.minStock > 0) {
summaries.estoque = `≥${filters.minStock} un.`;
summaries.estoque = `${filters.minStock} un.`;
}
if (filters.sortBy !== 'name') {
const opt = SORT_OPTIONS.find((o) => o.value === filters.sortBy);
Expand Down
2 changes: 1 addition & 1 deletion src/components/pricing/QuantityPriceCalculator.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* QuantityPriceCalculator — Main orchestrator.
* QuantityPriceCalculator Main orchestrator.
* Sub-components extracted to calculator/ folder.
*/
import { useState, useCallback } from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* TechniqueMultiSelector — Grid of available techniques to toggle.
* TechniqueMultiSelector Grid of available techniques to toggle.
*/
import { useQuery } from '@tanstack/react-query';
import { invokeExternalRpc } from '@/lib/external-rpc';
Expand Down
2 changes: 1 addition & 1 deletion src/components/pricing/simulator/EngravingList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function EngravingList({
{engraving.sizeOption && (
<Badge variant="secondary" className="text-xs">
<Ruler className="mr-1 h-3 w-3" />
{engraving.sizeOption.replace('x', ' × ')} cm
{engraving.sizeOption.replace('x', ' × ')} cm
</Badge>
)}
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/pricing/simulator/MultiEngravingResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export function MultiEngravingResult({
</div>
<div className="flex justify-between pl-6 text-sm">
<span className="text-muted-foreground">
{formatNumber(quantity)} × {formatCurrency(product.price)}
{formatNumber(quantity)} × {formatCurrency(product.price)}
</span>
<span>{formatCurrency(productTotal)}</span>
</div>
Expand Down Expand Up @@ -294,7 +294,7 @@ export function MultiEngravingResult({
<div className="space-y-0.5 text-xs text-muted-foreground">
<div className="flex justify-between">
<span>
{formatNumber(quantity)} × {formatCurrency(calc.priceData.unit_price)}{' '}
{formatNumber(quantity)} × {formatCurrency(calc.priceData.unit_price)}{' '}
(Faixa {calc.priceData.tier_used})
</span>
<span>{formatCurrency(calc.priceData.subtotal_pecas)}</span>
Expand Down
4 changes: 2 additions & 2 deletions src/components/pricing/simulator/ProductSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function ProductSearch({ onSelect, selectedProduct }: ProductSearchProps)
<p className="font-medium">{selectedProduct.name}</p>
<div className="flex items-center gap-2 text-sm text-muted-foreground">
<span>SKU: {selectedProduct.sku}</span>
<span>•</span>
<span></span>
<span className="font-medium text-primary">
{formatCurrency(selectedProduct.price)}
</span>
Expand Down Expand Up @@ -132,7 +132,7 @@ export function ProductSearch({ onSelect, selectedProduct }: ProductSearchProps)
<div className="min-w-0 flex-1">
<p className="truncate font-medium">{product.name}</p>
<p className="text-xs text-muted-foreground">
{product.sku} • {formatCurrency(product.price)}
{product.sku} {formatCurrency(product.price)}
</p>
</div>
</button>
Expand Down
6 changes: 3 additions & 3 deletions src/components/pricing/simulator/QuantityAndResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export function QuantityAndResult({
{/* Produto */}
<div className="flex justify-between text-sm">
<span className="text-muted-foreground">
Produtos ({formatNumber(quantity)} × {formatCurrency(product.price)})
Produtos ({formatNumber(quantity)} × {formatCurrency(product.price)})
</span>
<span>{formatCurrency(productTotal)}</span>
</div>
Expand All @@ -203,7 +203,7 @@ export function QuantityAndResult({

<div className="flex justify-between pl-4 text-sm">
<span className="text-muted-foreground">
{formatNumber(quantity)} × {formatCurrency(priceData.unit_price)}
{formatNumber(quantity)} × {formatCurrency(priceData.unit_price)}
<span className="ml-1 text-xs">(Faixa {priceData.tier_used})</span>
</span>
<span>{formatCurrency(priceData.subtotal_pecas)}</span>
Expand Down Expand Up @@ -283,7 +283,7 @@ export function QuantityAndResult({
{/* Info box sobre a lógica v5.1 */}
{priceData && (
<div className="rounded-lg bg-muted/50 p-3 text-xs text-muted-foreground">
<p className="mb-1 font-medium">📊 Sistema de Preços v5.1</p>
<p className="mb-1 font-medium">📊 Sistema de Preços v5.1</p>
<p>
O setup é aplicado como <strong>faturamento mínimo</strong>, não é somado ao total.
Se o subtotal das peças for menor que o mínimo, o total será igual ao faturamento
Expand Down
6 changes: 3 additions & 3 deletions src/components/pricing/simulator/TechniqueSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export function TechniqueSelector({
<p className="font-medium">{loc.name}</p>
<p className="text-xs text-muted-foreground">
{maxWidth && maxHeight ? `${maxWidth}x${maxHeight}mm` : 'Área variável'}
{' • '}
{' '}
{loc.techniques.length}{' '}
{loc.techniques.length === 1 ? 'técnica' : 'técnicas'}
</p>
Expand Down Expand Up @@ -260,8 +260,8 @@ export function TechniqueSelector({
<p className="font-medium">{tech.areaName || tech.techniqueCode}</p>
<p className="text-xs text-muted-foreground">
{tech.techniqueCode && `Código: ${tech.techniqueCode}`}
{tech.maxColors && ` • Até ${tech.maxColors} cores`}
{tech.areaCm2 && ` • ${tech.areaCm2}cm²`}
{tech.maxColors && ` Até ${tech.maxColors} cores`}
{tech.areaCm2 && ` ${tech.areaCm2}cm²`}
</p>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/hooks/voice/logVoiceCommand.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* logVoiceCommand — Logs a voice command to the database for analytics.
* Fire-and-forget — does not throw or block the UI.
* logVoiceCommand Logs a voice command to the database for analytics.
* Fire-and-forget does not throw or block the UI.
*/
import { supabase } from '@/integrations/supabase/client';
import type { VoiceAgentAction } from './types';
Expand All @@ -9,7 +9,7 @@ export function logVoiceCommand(
action: VoiceAgentAction,
meta: { transcript: string; durationMs?: number; success?: boolean },
) {
// Fire and forget — don't await, don't block
// Fire and forget don't await, don't block
(async () => {
try {
const {
Expand All @@ -27,7 +27,7 @@ export function logVoiceCommand(
success: meta.success ?? true,
});
} catch {
// Silent — analytics should never break UX
// Silent analytics should never break UX
}
})();
}
2 changes: 1 addition & 1 deletion src/hooks/voice/processTranscript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { VoiceAgentAction } from './types';

/**
* processVoiceTranscript — Sends transcript to AI and returns structured action.
* processVoiceTranscript Sends transcript to AI and returns structured action.
* Uses fetch with AbortController for proper timeout support (15s).
*/
export async function processVoiceTranscript(transcript: string): Promise<VoiceAgentAction> {
Expand Down
10 changes: 5 additions & 5 deletions src/lib/kit-builder/price-calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import type { KitItem, KitBox, KitPersonalization } from './types';

// ============================================
// CÁLCULOS DE PREÇO
// CÁLCULOS DE PREÇO
// ============================================

/**
Expand Down Expand Up @@ -107,7 +107,7 @@ export function calculateSavings(
}

// ============================================
// FORMATAÇÃO
// FORMATAÇÃO
// ============================================

// Import + re-export from centralized format module
Expand All @@ -123,7 +123,7 @@ export function formatUnitPrice(total: number, quantity: number): string {
}

// ============================================
// BREAKDOWN DO PREÇO
// BREAKDOWN DO PREÇO
// ============================================

export interface PriceBreakdownItem {
Expand Down Expand Up @@ -157,7 +157,7 @@ export function generatePriceBreakdown(
// Personalização da caixa
if (personalization.box.enabled && personalization.box.estimatedPrice) {
breakdown.push({
label: `↳ Gravação: ${personalization.box.techniqueName || 'Personalização'}`,
label: ` Gravação: ${personalization.box.techniqueName || 'Personalização'}`,
quantity: kitQuantity,
unitPrice: personalization.box.estimatedPrice,
totalPrice: personalization.box.estimatedPrice * kitQuantity,
Expand All @@ -180,7 +180,7 @@ export function generatePriceBreakdown(
const itemPersonalization = personalization.items[item.id];
if (itemPersonalization?.enabled && itemPersonalization.estimatedPrice) {
breakdown.push({
label: `↳ Gravação: ${itemPersonalization.techniqueName || 'Personalização'}`,
label: ` Gravação: ${itemPersonalization.techniqueName || 'Personalização'}`,
quantity: totalQty,
unitPrice: itemPersonalization.estimatedPrice,
totalPrice: itemPersonalization.estimatedPrice * totalQty,
Expand Down
10 changes: 5 additions & 5 deletions src/lib/kit-builder/volume-calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export function calculateVolumeUsagePercent(itemsVolume: number, boxVolume: numb
}

// ============================================
// VALIDAÇÕES
// VALIDAÇÕES
// ============================================

/**
Expand Down Expand Up @@ -116,7 +116,7 @@ export function isAtCapacity(usagePercent: number): boolean {
}

// ============================================
// FORMATAÇÃO
// FORMATAÇÃO
// ============================================

/**
Expand Down Expand Up @@ -157,12 +157,12 @@ export function getVolumeStatusLabel(percent: number): string {
}

// ============================================
// PARSING DE DIMENSÕES
// PARSING DE DIMENSÕES
// ============================================

/**
* Tenta extrair dimensões de uma string de dimensões
* Formatos suportados: "10x20x5", "10 x 20 x 5", "10×20×5"
* Formatos suportados: "10x20x5", "10 x 20 x 5", "10×20×5"
*/
export function parseDimensionsString(
dimensionsStr: string | null | undefined,
Expand All @@ -174,7 +174,7 @@ export function parseDimensionsString(
.toLowerCase()
.replace(/\s+/g, '')
.replace(/\u00d7/g, 'x')
.replace(/×/g, 'x')
.replace(/×/g, 'x')
.replace(/cm/g, '');

// Tenta match com padrão NxNxN
Expand Down
2 changes: 1 addition & 1 deletion src/lib/personalization/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type {
} from '@/types/tecnica-unificada';

// ============================================
// RAW DB → PORTUGUESE DOMAIN TYPES (para hooks)
// RAW DB PORTUGUESE DOMAIN TYPES (para hooks)
// ============================================

/**
Expand Down
Loading
Loading