diff --git a/teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/_components/FieldPlacer.tsx b/teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/_components/FieldPlacer.tsx index 87c0fed..96c8a21 100644 --- a/teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/_components/FieldPlacer.tsx +++ b/teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/_components/FieldPlacer.tsx @@ -12,6 +12,7 @@ import { type DragEndEvent, } from '@dnd-kit/core'; import { CSS } from '@dnd-kit/utilities'; +import { getFieldType, type SignatureFieldType } from '@/lib/db/schema'; import type { SignatureFieldData } from '@/lib/db/schema'; interface PageInfo { @@ -65,18 +66,27 @@ async function persistFields(docId: string, fields: SignatureFieldData[]) { } } +// Token color palette — each maps to a SignatureFieldType +const PALETTE_TOKENS: Array<{ id: SignatureFieldType; label: string; color: string }> = [ + { id: 'client-signature', label: 'Signature', color: '#2563eb' }, // blue + { id: 'initials', label: 'Initials', color: '#7c3aed' }, // purple + { id: 'checkbox', label: 'Checkbox', color: '#059669' }, // green + { id: 'date', label: 'Date', color: '#d97706' }, // amber + { id: 'text', label: 'Text', color: '#64748b' }, // slate +]; + // Draggable token in the palette -function DraggableToken({ id }: { id: string }) { +function DraggableToken({ id, label, color }: { id: string; label: string; color: string }) { const { attributes, listeners, setNodeRef, isDragging } = useDraggable({ id }); const style: React.CSSProperties = { // No transform — DragOverlay handles the ghost. Applying transform here causes snap-back animation. opacity: isDragging ? 0.4 : 1, cursor: 'grab', padding: '6px 12px', - border: '2px dashed #2563eb', + border: `2px dashed ${color}`, borderRadius: '4px', - background: 'rgba(37,99,235,0.08)', - color: '#2563eb', + background: `${color}14`, // ~8% opacity tint + color, fontSize: '13px', fontWeight: 600, userSelect: 'none', @@ -85,7 +95,7 @@ function DraggableToken({ id }: { id: string }) { return (