diff --git a/packages/react-chat/src/components/Modals/EditModal.tsx b/packages/react-chat/src/components/Modals/EditModal.tsx index df89226a..6d3a8a5b 100644 --- a/packages/react-chat/src/components/Modals/EditModal.tsx +++ b/packages/react-chat/src/components/Modals/EditModal.tsx @@ -22,6 +22,8 @@ export const EditModalName = "editModal"; export const EditModal = () => { const { activeChannel, changeGroupChatName } = useMessengerContext(); + const { setModal } = useModal(EditModalName); + const [groupName, setGroupName] = useState(""); const [image, setImage] = useState(""); @@ -31,12 +33,16 @@ export const EditModal = () => { } }; - const { setModal } = useModal(EditModalName); - const handleUpload = () => { if (activeChannel) { - activeChannel.icon = image; - changeGroupChatName(groupName, activeChannel.id); + if (image) { + activeChannel.icon = image; // Need function to send image to waku + setImage(""); + } + if (groupName) { + changeGroupChatName(groupName, activeChannel.id); + setGroupName(""); + } setModal(false); } }; @@ -64,10 +70,11 @@ export const EditModal = () => { - + {!activeChannel?.icon && !image && activeChannel?.name?.slice(0, 1)?.toUpperCase()} + {image && }