From d2ebb2cc6703dbc3ded8c6c8bb1e1115041537e4 Mon Sep 17 00:00:00 2001
From: Chandler Copeland
Date: Sat, 21 Mar 2026 16:25:57 -0600
Subject: [PATCH] feat(12.1-02): replace TextFillForm with QuickFillPanel in
PreparePanel; delete TextFillForm.tsx
- Add textFillData, selectedFieldId, onQuickFill props to PreparePanelProps
- Remove textFillData local state and handleTextFillChange (parent now owns state)
- Remove TextFillForm import and JSX block
- Add QuickFillPanel: shows Client Name, Property Address, Client Email quick-fill buttons when selectedFieldId is non-null; idle state message when no field selected
- handlePreview and handlePrepare use textFillData from props
- Delete TextFillForm.tsx (label-keyed generic form no longer used)
---
.../[docId]/_components/PreparePanel.tsx | 65 ++++++++++----
.../[docId]/_components/TextFillForm.tsx | 88 -------------------
2 files changed, 50 insertions(+), 103 deletions(-)
delete mode 100644 teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/_components/TextFillForm.tsx
diff --git a/teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/_components/PreparePanel.tsx b/teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/_components/PreparePanel.tsx
index 2ede9f0..1e484a4 100644
--- a/teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/_components/PreparePanel.tsx
+++ b/teressa-copeland-homes/src/app/portal/(protected)/documents/[docId]/_components/PreparePanel.tsx
@@ -1,7 +1,6 @@
'use client';
import { useState, useEffect } from 'react';
import { useRouter } from 'next/navigation';
-import { TextFillForm } from './TextFillForm';
import { PreviewModal } from './PreviewModal';
interface PreparePanelProps {
@@ -14,6 +13,9 @@ interface PreparePanelProps {
clientPropertyAddress?: string | null;
previewToken: string | null;
onPreviewTokenChange: (token: string | null) => void;
+ textFillData: Record;
+ selectedFieldId: string | null;
+ onQuickFill: (fieldId: string, value: string) => void;
}
function parseEmails(raw: string | undefined): string[] {
@@ -24,16 +26,18 @@ function isValidEmail(email: string): boolean {
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
}
-export function PreparePanel({ docId, defaultEmail, clientName, currentStatus, agentDownloadUrl, signedAt, clientPropertyAddress, previewToken, onPreviewTokenChange }: PreparePanelProps) {
+export function PreparePanel({
+ docId, defaultEmail, clientName, currentStatus,
+ agentDownloadUrl, signedAt, clientPropertyAddress,
+ previewToken, onPreviewTokenChange,
+ textFillData, selectedFieldId, onQuickFill,
+}: PreparePanelProps) {
const router = useRouter();
const [recipients, setRecipients] = useState(defaultEmail ?? '');
// Sync if defaultEmail arrives after initial render (streaming / hydration timing)
useEffect(() => {
if (defaultEmail) setRecipients(defaultEmail);
}, [defaultEmail]);
- const [textFillData, setTextFillData] = useState>(
- () => (clientPropertyAddress ? { propertyAddress: clientPropertyAddress } : {} as Record)
- );
const [loading, setLoading] = useState(false);
const [result, setResult] = useState<{ ok: boolean; message: string } | null>(null);
const [previewBytes, setPreviewBytes] = useState(null);
@@ -89,11 +93,6 @@ export function PreparePanel({ docId, defaultEmail, clientName, currentStatus, a
);
}
- function handleTextFillChange(data: Record) {
- setTextFillData(data);
- onPreviewTokenChange(null);
- }
-
async function handlePreview() {
setLoading(true);
setResult(null);
@@ -184,12 +183,48 @@ export function PreparePanel({ docId, defaultEmail, clientName, currentStatus, a
+ {/* Quick-fill panel — only shown when a text field is selected */}
-
-
+
+ {selectedFieldId ? (
+
+
+ Click a suggestion to fill the selected field.
+
+ {clientName && (
+
+ )}
+ {clientPropertyAddress && (
+
+ )}
+
+
+ ) : (
+
+ Click a text field on the document to edit or quick-fill it.
+
+ )}