fix(pecas): destacar marca da peça em vermelho/laranja para revisões sem sobrepor tag comp
This commit is contained in:
@@ -15,7 +15,6 @@ import {
|
||||
Loader2,
|
||||
ExternalLink,
|
||||
Minus,
|
||||
AlertTriangle,
|
||||
FileText
|
||||
} from 'lucide-react';
|
||||
import { Peca } from '@/hooks/usePecas';
|
||||
@@ -47,6 +46,7 @@ export function TableRow({
|
||||
const { componentes, loading } = useComponentesPeca(isExpanded ? peca.id : '');
|
||||
|
||||
const hasSubComponents = peca.tem_componentes;
|
||||
const hasRevisao = Boolean(peca.tem_revisao || (peca.qtd_revisoes && peca.qtd_revisoes > 0));
|
||||
|
||||
const toggleExpand = (e: React.MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
@@ -92,23 +92,26 @@ export function TableRow({
|
||||
{peca.etapa_fase}
|
||||
</TableCell>
|
||||
|
||||
<TableCell className="w-14 px-2 text-foreground text-xs font-bold font-mono">
|
||||
<TableCell className="w-14 px-2 text-xs font-bold font-mono">
|
||||
<div className="flex items-center gap-1.5">
|
||||
<span>{peca.marca}</span>
|
||||
{Boolean(peca.tem_revisao || (peca.qtd_revisoes && peca.qtd_revisoes > 0)) && (
|
||||
<button
|
||||
type="button"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
onOpenRevisao?.();
|
||||
}}
|
||||
className="cursor-pointer inline-flex items-center gap-0.5 text-[10px] bg-amber-500/15 text-amber-700 dark:text-amber-400 hover:bg-amber-500/25 border border-amber-500/40 px-1.5 py-0.5 rounded-full font-bold transition-all shadow-sm animate-pulse"
|
||||
title={`Peça possui ${peca.qtd_revisoes || 1} revisão(ões) registrada(s) (${peca.revisao_atual || 'Rev'}). Clique para consultar.`}
|
||||
>
|
||||
<AlertTriangle className="h-2.5 w-2.5 text-amber-600 dark:text-amber-400" />
|
||||
<span>{peca.revisao_atual || '!'}</span>
|
||||
</button>
|
||||
)}
|
||||
<span
|
||||
onClick={hasRevisao && onOpenRevisao ? (e) => {
|
||||
e.stopPropagation();
|
||||
onOpenRevisao();
|
||||
} : undefined}
|
||||
className={`${
|
||||
hasRevisao
|
||||
? 'text-red-600 dark:text-orange-400 font-extrabold cursor-pointer hover:underline'
|
||||
: 'text-foreground'
|
||||
}`}
|
||||
title={
|
||||
hasRevisao
|
||||
? `Peça em revisão (${peca.revisao_atual || 'Rev'}). Clique para consultar.`
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{peca.marca}
|
||||
</span>
|
||||
{hasSubComponents && (
|
||||
<span
|
||||
onClick={toggleExpand}
|
||||
|
||||
Reference in New Issue
Block a user