Overview
The Contacts feature allows users to maintain a personal directory of contacts with wallet addresses, email, phone, and notes. Contacts can be marked as favorites for quick access and filtering. File Reference:frontend/app/contacts/page.tsx:25
Key Features
Contact Directory
Displays all saved contacts with:- Contact Cards - Individual cards for each contact
- Favorite Filtering - Show only favorited contacts
- Quick Actions - Edit, favorite/unfavorite, delete
- Empty State - Helpful message when no contacts exist
frontend/app/contacts/page.tsx:107-127
Contact Information
Each contact can store:- Name - Contact’s full name
- Wallet Address - Blockchain wallet address (Berachain format)
- Email - Email address
- Phone - Phone number
- Notes - Free-form notes field
- Favorite Status - Boolean flag for quick filtering
frontend/types/contact.ts
Adding Contacts
Add Contact Flow
- Click “Add Contact” button
AddContactModalopens- Enter contact information:
- Name (required)
- Wallet address (optional)
- Email (optional)
- Phone (optional)
- Notes (optional)
- Click “Save”
- Contact is created and appears in directory
frontend/app/contacts/page.tsx:53-56, 89
Add Contact Modal
The modal includes:- Form Fields - Input for all contact properties
- Validation - Required field checks (name)
- Error Display - Shows
addContactErrorfrom context - Save Button - Calls
handleAddContact(contact) - Cancel Button - Closes modal without saving
components/contacts/add-contact-modal.tsx
Code Reference: frontend/app/contacts/page.tsx:89
Managing Contacts
Contact Card
Each contact is displayed in aContactCard component showing:
- Avatar - Fallback with initials
- Name - Primary identifier
- Contact Info - Wallet, email, phone (if provided)
- Notes Preview - Truncated notes field
- Favorite Icon - Star/outline star for toggle
- Actions Menu - Edit and delete options
frontend/app/contacts/page.tsx:116-124
Editing Contacts
Edit functionality viaContactCard:
- Click edit action in contact card
- Update contact fields
- Call
updateContact(contact)from context - Contact updates in directory
frontend/app/contacts/page.tsx:58-61, 120
Favoriting Contacts
Toggle Favorite:is_favorite boolean and saves.
Code Reference: frontend/app/contacts/page.tsx:58-61
Favorite Icon - Star icon fills when favorited, outline when not.
Deleting Contacts
- Click delete action in contact card
DeleteContactModalopens with confirmation- User confirms deletion
handleDeleteContact(id)is called- Contact is removed from directory
frontend/app/contacts/page.tsx:63-70, 82-88
Filtering
Favorites Filter
Checkbox Filter:frontend/app/contacts/page.tsx:94-106
Filter Logic
WhenonlyFavorites is true:
is_favorite: true are skipped.
Code Reference: frontend/app/contacts/page.tsx:113-114
State Management
Context Provider
TheContactsProvider manages:
frontend/app/contacts/page.tsx:31-38
App Context
UsesAppProvider for:
frontend/app/contacts/page.tsx:40-44
Local State
frontend/app/contacts/page.tsx:27-30
Authentication
Auth Guard
frontend/app/contacts/page.tsx:45-49
Loading State
frontend/app/contacts/page.tsx:72-78
UI Components
Page Layout
- Header - “Contacts” title and description
- Filter Checkbox - Favorites filter control
- Contact List - Grid/list of contact cards
- Add Button - Primary action button
- Count Display - Shows filtered contact count
frontend/app/contacts/page.tsx:80-139
Modals
- AddContactModal - Create new contact
- DeleteContactModal - Confirm deletion
- EditContactModal - Edit existing contact (inline in ContactCard)
frontend/app/contacts/page.tsx:82-89
ContactCard Component
Props:frontend/app/contacts/page.tsx:116-123
Error Handling
Error Display
Errors are shown in modals:frontend/app/contacts/page.tsx:89
Error Clearing
frontend/app/contacts/page.tsx:53-56
Contact Count
Displays filtered count at bottom:frontend/app/contacts/page.tsx:136-138
API Integration
While not directly visible in the page component, theContactsProvider likely handles:
Contact Type
frontend/types/contact.ts
Best Practices
Data Management
- Validate Wallet Addresses - Ensure proper Berachain address format
- Email Validation - Check email format before saving
- Duplicate Prevention - Warn if contact with same wallet/email exists
- Data Persistence - Ensure changes are saved to backend
User Experience
- Clear Empty State - Show helpful message when no contacts
- Favorite Quick Access - Make favoriting intuitive and visible
- Bulk Actions - Consider adding bulk edit/delete for power users
- Search - Add search functionality for large contact lists
- Import/Export - Allow CSV import/export for backup
Performance
- Pagination - Implement for >100 contacts
- Virtual Scrolling - For very large lists
- Debounced Search - If search is added
- Optimistic Updates - Update UI before backend confirms
Wallet Integration
Wallet Address Field
The wallet address field can:- Store Berachain wallet addresses
- Link to wallet balance/transaction views
- Enable quick transfers to contact
- Verify address ownership (future enhancement)
Quick Send Integration
Potential integration with wallet sending:Accessibility
Keyboard Navigation
- Tab through contact cards
- Enter to open actions menu
- Arrow keys to navigate within menu
- Escape to close modals
Screen Reader Support
- Label all form fields
- Announce contact count changes
- Describe favorite status
- Provide context for actions
Focus Management
- Return focus to trigger after modal close
- Focus first field when modal opens
- Trap focus within modal
Troubleshooting
Common Issues
Contacts Not Loading- Check
contactsStatusin context - Verify authentication status
- Check network requests in dev tools
- Confirm backend endpoint is reachable
- Verify
updateContact()completes - Check for error messages
- Confirm optimistic update vs backend response
- Check network tab for failed requests
- Verify
is_favoriteproperty on contacts - Check filter logic in map function
- Ensure state updates trigger re-render
Debugging Tips
Future Enhancements
Planned Features
- Contact Groups - Organize contacts into categories
- Tags - Multi-tag support for flexible filtering
- Contact Sharing - Share contacts with other users
- QR Code - Generate QR code for contact info
- vCard Export - Export as standard vCard format
- Contact Verification - Verify wallet ownership
- Activity History - Track interactions with contact
- Notes Timeline - Date-stamped notes entries
Integration Opportunities
- Transaction History - Link to past transactions with contact
- Workflow Collaboration - Add contacts as workflow participants
- Messaging - Direct messaging to contacts
- Calendar Integration - Schedule meetings with contacts
- Profile Linking - Link to contact’s public profile