@@ -26,15 +26,16 @@ import ContactListTableMobile from './ContactListTableMobile';
2626 * @param {Function } Props.addContact - from Contacts page
2727 * @returns {React.JSX.Element } The ContactListTable Component
2828 */
29- const ContactListTable = ( { contacts, deleteContact, handleDeleteContact, addContact } ) => {
29+ const ContactListTable = ( { contacts = [ ] , deleteContact, handleDeleteContact, addContact } ) => {
3030 const [ showMessageModal , setShowMessageModal ] = useState ( false ) ;
3131 const [ messageToField , setMessageToField ] = useState ( '' ) ;
32- const theme = useTheme ( ) ;
33- const isSmallScreen = useMediaQuery ( theme . breakpoints . down ( 'sm' ) ) ;
34-
3532 const [ showAddContactModal , setShowAddContactModal ] = useState ( false ) ;
36- const [ contactToEdit , setContactToEdit ] = useState ( { } ) ;
33+ const [ contactToEdit , setContactToEdit ] = useState ( null ) ;
3734 const [ isEditing , setIsEditing ] = useState ( false ) ;
35+ const contactWebIds = contacts . map ( ( { webId } ) => webId ) ;
36+ const theme = useTheme ( ) ;
37+ const isSmallScreen = useMediaQuery ( theme . breakpoints . down ( 'sm' ) ) ;
38+ const isSmallScreenHeight = useMediaQuery ( '(max-height: 600px)' ) ;
3839
3940 const handleSendMessage = ( contactId ) => {
4041 setShowMessageModal ( ! showMessageModal ) ;
@@ -47,17 +48,15 @@ const ContactListTable = ({ contacts, deleteContact, handleDeleteContact, addCon
4748 setIsEditing ( true ) ;
4849 } ;
4950
50- const contactWebIds = contacts . map ( ( { webId } ) => webId ) ;
51-
5251 return (
5352 < Box
5453 sx = { {
5554 margin : '20px 0' ,
5655 width : '95vw' ,
57- height : '500px'
56+ minHeight : '500px'
5857 } }
5958 >
60- { isSmallScreen ? (
59+ { isSmallScreen || isSmallScreenHeight ? (
6160 < ContactListTableMobile
6261 data-testid = "ContactListTableMobile"
6362 contacts = { contacts }
@@ -89,6 +88,7 @@ const ContactListTable = ({ contacts, deleteContact, handleDeleteContact, addCon
8988 handleDeleteContact = { handleDeleteContact }
9089 contactWebIds = { contactWebIds }
9190 contacts = { contacts }
91+ setContactToEdit = { setContactToEdit }
9292 />
9393 </ Box >
9494 ) ;
0 commit comments