@@ -100,6 +100,7 @@ export const CreateGroupModal: React.FC<CreateGroupModalProps> = ({
100
100
groupMembers : useDummyGroupInfo ? groupMembers : [ ] ,
101
101
groupAdmins : useDummyGroupInfo ? groupAdmins : [ ] ,
102
102
} ) ;
103
+ const [ isImageUploaded , setIsImageUploaded ] = useState < boolean > ( false ) ;
103
104
104
105
useEffect ( ( ) => {
105
106
setGroupInputDetails ( {
@@ -120,6 +121,8 @@ export const CreateGroupModal: React.FC<CreateGroupModalProps> = ({
120
121
onClose = { onClose }
121
122
groupInputDetails = { groupInputDetails }
122
123
setGroupInputDetails = { setGroupInputDetails }
124
+ isImageUploaded = { isImageUploaded }
125
+ setIsImageUploaded = { setIsImageUploaded }
123
126
/>
124
127
) ;
125
128
case CREATE_GROUP_STEP_KEYS . GROUP_TYPE :
@@ -166,6 +169,8 @@ export const CreateGroupModal: React.FC<CreateGroupModalProps> = ({
166
169
onClose = { onClose }
167
170
groupInputDetails = { groupInputDetails }
168
171
setGroupInputDetails = { setGroupInputDetails }
172
+ isImageUploaded = { isImageUploaded }
173
+ setIsImageUploaded = { setIsImageUploaded }
169
174
/>
170
175
) ;
171
176
}
@@ -188,6 +193,8 @@ export interface ModalHeaderProps {
188
193
groupEncryptionType ?: string ;
189
194
setGroupEncryptionType ?: React . Dispatch < React . SetStateAction < string > > ;
190
195
handleAddWallets ?: ( ) => void ;
196
+ isImageUploaded ?: boolean ;
197
+ setIsImageUploaded ?: React . Dispatch < React . SetStateAction < boolean > > ;
191
198
}
192
199
193
200
interface GroupDetailState {
@@ -206,15 +213,15 @@ const CreateGroupDetail = ({
206
213
onClose,
207
214
groupInputDetails,
208
215
setGroupInputDetails,
216
+ isImageUploaded,
217
+ setIsImageUploaded,
209
218
} : ModalHeaderProps & GroupDetailState ) => {
210
- const groupInfoToast = useToast ( ) ;
211
219
const { groupName, groupDescription, groupImage } = groupInputDetails ;
212
220
const theme = useContext ( ThemeContext ) ;
213
221
const [ validationErrors , setValidationErrors ] =
214
222
useState < CriteriaValidationErrorType > ( { } ) ;
215
223
const fileUploadInputRef = useRef < HTMLInputElement > ( null ) ;
216
224
const isMobile = useMediaQuery ( device . mobileL ) ;
217
- const [ isImageUploaded , setIsImageUploaded ] = useState < boolean > ( false ) ;
218
225
const [ imageSrc , setImageSrc ] = useState < string | null > ( ) ;
219
226
220
227
const handleChange = ( e : Event ) => {
@@ -226,7 +233,8 @@ const CreateGroupDetail = ({
226
233
}
227
234
if (
228
235
( 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
230
238
) {
231
239
setIsImageUploaded ( true ) ;
232
240
setGroupInputDetails ( {
@@ -250,15 +258,6 @@ const CreateGroupDetail = ({
250
258
}
251
259
} ;
252
260
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
-
262
261
const verifyAndHandelNext = ( ) => {
263
262
const skipVerify = false ;
264
263
@@ -290,7 +289,6 @@ const CreateGroupDetail = ({
290
289
fileUploadInputRef . current . click ( ) ;
291
290
}
292
291
} ;
293
-
294
292
//groupImage and desccription is optional
295
293
return (
296
294
< Section
0 commit comments