diff --git a/src/app/components/UserDetailModal.tsx b/src/app/components/UserDetailModal.tsx index 9843453..8270c62 100644 --- a/src/app/components/UserDetailModal.tsx +++ b/src/app/components/UserDetailModal.tsx @@ -49,8 +49,8 @@ export default function UserDetailModal({ isOpen, onClose, userId, onUserUpdated // Contract preview state (lazy-loaded, per contract type) const [activePreviewTab, setActivePreviewTab] = useState<'contract' | 'gdpr'>('contract') const [previewState, setPreviewState] = useState({ - contract: { loading: false, html: null as string | null, error: null as string | null }, - gdpr: { loading: false, html: null as string | null, error: null as string | null }, + contract: { loading: false, html: null as string | null, error: null as string | null, warning: null as string | null }, + gdpr: { loading: false, html: null as string | null, error: null as string | null, warning: null as string | null }, }) useEffect(() => { @@ -63,8 +63,8 @@ export default function UserDetailModal({ isOpen, onClose, userId, onUserUpdated if (!isOpen) return setActivePreviewTab('contract') setPreviewState({ - contract: { loading: false, html: null, error: null }, - gdpr: { loading: false, html: null, error: null } + contract: { loading: false, html: null, error: null, warning: null }, + gdpr: { loading: false, html: null, error: null, warning: null } }) }, [isOpen, userId]) @@ -153,19 +153,19 @@ export default function UserDetailModal({ isOpen, onClose, userId, onUserUpdated if (!userId || !token || !userDetails) return setPreviewState((prev) => ({ ...prev, - [contractType]: { ...prev[contractType], loading: true, error: null } + [contractType]: { ...prev[contractType], loading: true, error: null, warning: null } })) try { - const html = await AdminAPI.getContractPreviewHtml(token, String(userId), userDetails.user.user_type, contractType) + const result = await AdminAPI.getContractPreviewHtml(token, String(userId), userDetails.user.user_type, contractType) setPreviewState((prev) => ({ ...prev, - [contractType]: { loading: false, html, error: null } + [contractType]: { loading: false, html: result.html, error: null, warning: result.warning || null } })) } catch (e: any) { console.error('UserDetailModal.loadContractPreview error:', e) setPreviewState((prev) => ({ ...prev, - [contractType]: { loading: false, html: null, error: e?.message || 'Failed to load contract preview' } + [contractType]: { loading: false, html: null, error: e?.message || 'Failed to load contract preview', warning: e?.warning || null } })) } } @@ -459,6 +459,11 @@ export default function UserDetailModal({ isOpen, onClose, userId, onUserUpdated