Remove dead Add-Contact modal from ContactsPage
After the grid/contacts unification (v0.1.0:52) the Contacts page's "Add New Contact" modal was made unreachable (new people are added from the grid). This removes the now-dead showForm/formData/formError state, handleAddContact, and the modal JSX. Other components' forms are untouched; html parses clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -3421,9 +3421,6 @@
|
||||
const [sort, setSort] = useState('last_name');
|
||||
const [order, setOrder] = useState('asc');
|
||||
const [selectedContact, setSelectedContact] = useState(null);
|
||||
const [showForm, setShowForm] = useState(false);
|
||||
const [formData, setFormData] = useState({ contact_type: 'prospect', status: 'active', source: '', linkedin_url: '', city: '', state: '', country: '', location_query: '' });
|
||||
const [formError, setFormError] = useState('');
|
||||
const [deleting, setDeleting] = useState(null);
|
||||
const [confirmDelete, setConfirmDelete] = useState(null);
|
||||
|
||||
@@ -3452,29 +3449,6 @@
|
||||
fetchContacts();
|
||||
}, [token, tab, search, sort, order, contactsOffset]);
|
||||
|
||||
const handleAddContact = async (e) => {
|
||||
e.preventDefault();
|
||||
setFormError('');
|
||||
|
||||
try {
|
||||
await api('/api/contacts', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(formData)
|
||||
}, token);
|
||||
|
||||
setShowForm(false);
|
||||
setFormData({ contact_type: 'prospect', status: 'active', source: '', linkedin_url: '', city: '', state: '', country: '', location_query: '' });
|
||||
|
||||
// Refresh list
|
||||
const result = await api(`/api/contacts?search=${encodeURIComponent(search)}&type=${tabFilter}&sort=${sort}&order=${order}&limit=${CONTACTS_PAGE_SIZE}&offset=${contactsOffset}`, {}, token);
|
||||
setContacts(result.data || []);
|
||||
setContactsTotal(Number(result.total) || 0);
|
||||
onShowToast('Contact created successfully', 'success');
|
||||
} catch (err) {
|
||||
setFormError(err.message);
|
||||
}
|
||||
};
|
||||
|
||||
const handleDeleteContact = async (id) => {
|
||||
setDeleting(id);
|
||||
try {
|
||||
@@ -3605,148 +3579,6 @@
|
||||
)}
|
||||
</div>
|
||||
|
||||
{showForm && (
|
||||
<div className="modal-overlay">
|
||||
<div className="modal">
|
||||
<div className="modal-header">Add New Contact</div>
|
||||
{formError && <div className="toast error" style={{ position: 'static', marginBottom: '16px' }}>{formError}</div>}
|
||||
<form onSubmit={handleAddContact}>
|
||||
<div className="form-group">
|
||||
<label className="form-label">First Name *</label>
|
||||
<input
|
||||
type="text"
|
||||
className="text-input"
|
||||
value={formData.first_name || ''}
|
||||
onChange={(e) => setFormData({ ...formData, first_name: e.target.value })}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label className="form-label">Last Name *</label>
|
||||
<input
|
||||
type="text"
|
||||
className="text-input"
|
||||
value={formData.last_name || ''}
|
||||
onChange={(e) => setFormData({ ...formData, last_name: e.target.value })}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label className="form-label">Email</label>
|
||||
<input
|
||||
type="email"
|
||||
className="text-input"
|
||||
value={formData.email || ''}
|
||||
onChange={(e) => setFormData({ ...formData, email: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label className="form-label">Phone</label>
|
||||
<input
|
||||
type="tel"
|
||||
className="text-input"
|
||||
value={formData.phone || ''}
|
||||
onChange={(e) => setFormData({ ...formData, phone: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label className="form-label">Title</label>
|
||||
<input
|
||||
type="text"
|
||||
className="text-input"
|
||||
value={formData.title || ''}
|
||||
onChange={(e) => setFormData({ ...formData, title: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label className="form-label">Organization</label>
|
||||
<input
|
||||
type="text"
|
||||
className="text-input"
|
||||
value={formData.organization || ''}
|
||||
onChange={(e) => setFormData({ ...formData, organization: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label className="form-label">Lead Source</label>
|
||||
<input
|
||||
type="text"
|
||||
className="text-input"
|
||||
value={formData.source || ''}
|
||||
onChange={(e) => setFormData({ ...formData, source: e.target.value })}
|
||||
placeholder="Intro source, conference, referral, etc."
|
||||
/>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label className="form-label">LinkedIn URL</label>
|
||||
<input
|
||||
type="url"
|
||||
className="text-input"
|
||||
value={formData.linkedin_url || ''}
|
||||
onChange={(e) => setFormData({ ...formData, linkedin_url: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label className="form-label">City</label>
|
||||
<input
|
||||
type="text"
|
||||
className="text-input"
|
||||
value={formData.city || ''}
|
||||
onChange={(e) => setFormData({ ...formData, city: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label className="form-label">State</label>
|
||||
<input
|
||||
type="text"
|
||||
className="text-input"
|
||||
value={formData.state || ''}
|
||||
onChange={(e) => setFormData({ ...formData, state: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label className="form-label">Country</label>
|
||||
<input
|
||||
type="text"
|
||||
className="text-input"
|
||||
value={formData.country || ''}
|
||||
onChange={(e) => setFormData({ ...formData, country: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label className="form-label">Contact Type</label>
|
||||
<select
|
||||
className="select-input"
|
||||
value={formData.contact_type}
|
||||
onChange={(e) => setFormData({ ...formData, contact_type: e.target.value })}
|
||||
>
|
||||
<option value="investor">Investor</option>
|
||||
<option value="prospect">Prospect</option>
|
||||
<option value="advisor">Advisor</option>
|
||||
<option value="other">Other</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className="form-group">
|
||||
<label className="form-label">Status</label>
|
||||
<select
|
||||
className="select-input"
|
||||
value={formData.status || ''}
|
||||
onChange={(e) => setFormData({ ...formData, status: e.target.value })}
|
||||
>
|
||||
<option value="active">Active</option>
|
||||
<option value="inactive">Inactive</option>
|
||||
<option value="prospect">Prospect</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className="form-actions">
|
||||
<button type="button" className="button-secondary" onClick={() => setShowForm(false)}>Cancel</button>
|
||||
<button type="submit">Add Contact</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{selectedContact && (
|
||||
<ContactDetailPanel
|
||||
contact={selectedContact}
|
||||
|
||||
Reference in New Issue
Block a user