@@ -100,6 +100,7 @@ export const CreateGroupModal: React.FC<CreateGroupModalProps> = ({
100100 groupMembers : useDummyGroupInfo ? groupMembers : [ ] ,
101101 groupAdmins : useDummyGroupInfo ? groupAdmins : [ ] ,
102102 } ) ;
103+ const [ isImageUploaded , setIsImageUploaded ] = useState < boolean > ( false ) ;
103104
104105 useEffect ( ( ) => {
105106 setGroupInputDetails ( {
@@ -120,6 +121,8 @@ export const CreateGroupModal: React.FC<CreateGroupModalProps> = ({
120121 onClose = { onClose }
121122 groupInputDetails = { groupInputDetails }
122123 setGroupInputDetails = { setGroupInputDetails }
124+ isImageUploaded = { isImageUploaded }
125+ setIsImageUploaded = { setIsImageUploaded }
123126 />
124127 ) ;
125128 case CREATE_GROUP_STEP_KEYS . GROUP_TYPE :
@@ -166,6 +169,8 @@ export const CreateGroupModal: React.FC<CreateGroupModalProps> = ({
166169 onClose = { onClose }
167170 groupInputDetails = { groupInputDetails }
168171 setGroupInputDetails = { setGroupInputDetails }
172+ isImageUploaded = { isImageUploaded }
173+ setIsImageUploaded = { setIsImageUploaded }
169174 />
170175 ) ;
171176 }
@@ -188,6 +193,8 @@ export interface ModalHeaderProps {
188193 groupEncryptionType ?: string ;
189194 setGroupEncryptionType ?: React . Dispatch < React . SetStateAction < string > > ;
190195 handleAddWallets ?: ( ) => void ;
196+ isImageUploaded ?: boolean ;
197+ setIsImageUploaded ?: React . Dispatch < React . SetStateAction < boolean > > ;
191198}
192199
193200interface GroupDetailState {
@@ -206,15 +213,15 @@ const CreateGroupDetail = ({
206213 onClose,
207214 groupInputDetails,
208215 setGroupInputDetails,
216+ isImageUploaded,
217+ setIsImageUploaded,
209218} : ModalHeaderProps & GroupDetailState ) => {
210- const groupInfoToast = useToast ( ) ;
211219 const { groupName, groupDescription, groupImage } = groupInputDetails ;
212220 const theme = useContext ( ThemeContext ) ;
213221 const [ validationErrors , setValidationErrors ] =
214222 useState < CriteriaValidationErrorType > ( { } ) ;
215223 const fileUploadInputRef = useRef < HTMLInputElement > ( null ) ;
216224 const isMobile = useMediaQuery ( device . mobileL ) ;
217- const [ isImageUploaded , setIsImageUploaded ] = useState < boolean > ( false ) ;
218225 const [ imageSrc , setImageSrc ] = useState < string | null > ( ) ;
219226
220227 const handleChange = ( e : Event ) => {
@@ -226,7 +233,8 @@ const CreateGroupDetail = ({
226233 }
227234 if (
228235 ( e . target as HTMLInputElement ) . files &&
229- ( ( e . target as HTMLInputElement ) . files as FileList ) . length
236+ ( ( e . target as HTMLInputElement ) . files as FileList ) . length &&
237+ setIsImageUploaded
230238 ) {
231239 setIsImageUploaded ( true ) ;
232240 setGroupInputDetails ( {
@@ -250,15 +258,6 @@ const CreateGroupDetail = ({
250258 }
251259 } ;
252260
253- const showError = ( errorMessage : string ) => {
254- groupInfoToast . showMessageToast ( {
255- toastTitle : 'Error' ,
256- toastMessage : errorMessage ,
257- toastType : 'ERROR' ,
258- getToastIcon : ( size ) => < MdError size = { size } color = "red" /> ,
259- } ) ;
260- } ;
261-
262261 const verifyAndHandelNext = ( ) => {
263262 const skipVerify = false ;
264263
@@ -290,7 +289,6 @@ const CreateGroupDetail = ({
290289 fileUploadInputRef . current . click ( ) ;
291290 }
292291 } ;
293-
294292 //groupImage and desccription is optional
295293 return (
296294 < Section
0 commit comments