1- import React from ' react' ;
1+ import React from " react" ;
22import {
33 HStack ,
44 Modal ,
@@ -10,33 +10,33 @@ import {
1010 ModalOverlay ,
1111 ModalProps ,
1212 VStack ,
13- } from ' @chakra-ui/react' ;
14- import { Button , InputController , PhosphorIcon , Text } from ' io-bricks-ui' ;
15- import { useForm } from ' react-hook-form' ;
16- import { useTranslation } from ' react-i18next' ;
17- import { useGrantKYC } from ' ../../../../hooks/mutations/useKYC' ;
18- import { GrantKycRequest } from ' @hashgraph/asset-tokenization-sdk' ;
19- import { useParams } from ' react-router-dom' ;
20- import { FileArchive } from ' @phosphor-icons/react' ;
21- import { useRef , useState } from ' react' ;
22- import { isValidHederaId , required } from ' ../../../../utils/rules' ;
13+ } from " @chakra-ui/react" ;
14+ import { Button , InputController , PhosphorIcon , Text } from " io-bricks-ui" ;
15+ import { useForm } from " react-hook-form" ;
16+ import { useTranslation } from " react-i18next" ;
17+ import { useGrantKYC } from " ../../../../hooks/mutations/useKYC" ;
18+ import { GrantKycRequest } from " @hashgraph/asset-tokenization-sdk" ;
19+ import { useParams } from " react-router-dom" ;
20+ import { FileArchive } from " @phosphor-icons/react" ;
21+ import { useRef , useState } from " react" ;
22+ import { isValidHederaId , required } from " ../../../../utils/rules" ;
2323
2424interface FormValues {
2525 accountId : string ;
2626 vcFile : string ;
2727}
2828
29- interface KYCModalProps extends Omit < ModalProps , ' children' > { }
29+ interface KYCModalProps extends Omit < ModalProps , " children" > { }
3030
3131export const KYCModal = ( { isOpen, onClose } : KYCModalProps ) => {
3232 const fileInputRef = useRef < HTMLInputElement | null > ( null ) ;
33- const [ fileName , setFileName ] = useState ( '' ) ;
33+ const [ fileName , setFileName ] = useState ( "" ) ;
3434 const [ isLoading , setIsLoading ] = useState ( false ) ;
3535
36- const { id : securityId = '' } = useParams ( ) ;
36+ const { id : securityId = "" } = useParams ( ) ;
3737
38- const { t : tCreate } = useTranslation ( ' security' , {
39- keyPrefix : ' details.kyc.create' ,
38+ const { t : tCreate } = useTranslation ( " security" , {
39+ keyPrefix : " details.kyc.create" ,
4040 } ) ;
4141
4242 const {
@@ -47,7 +47,7 @@ export const KYCModal = ({ isOpen, onClose }: KYCModalProps) => {
4747 reset,
4848 watch,
4949 } = useForm < FormValues > ( {
50- mode : ' onChange' ,
50+ mode : " onChange" ,
5151 } ) ;
5252
5353 const { mutate } = useGrantKYC ( ) ;
@@ -59,10 +59,10 @@ export const KYCModal = ({ isOpen, onClose }: KYCModalProps) => {
5959 const reader = new FileReader ( ) ;
6060 reader . readAsDataURL ( file ) ;
6161 reader . onload = ( ) => {
62- if ( typeof reader . result === ' string' ) {
63- const base64Data = reader . result . split ( ',' ) [ 1 ] ;
62+ if ( typeof reader . result === " string" ) {
63+ const base64Data = reader . result . split ( "," ) [ 1 ] ;
6464 if ( base64Data ) {
65- setValue ( ' vcFile' , base64Data , { shouldValidate : true } ) ;
65+ setValue ( " vcFile" , base64Data , { shouldValidate : true } ) ;
6666 }
6767 }
6868 } ;
@@ -88,62 +88,57 @@ export const KYCModal = ({ isOpen, onClose }: KYCModalProps) => {
8888 } ) ;
8989 } ;
9090
91- const isDisable = ! isValid || ! watch ( ' vcFile' ) ;
91+ const isDisable = ! isValid || ! watch ( " vcFile" ) ;
9292
9393 return (
9494 < Modal
9595 isCentered
9696 isOpen = { isOpen }
9797 onClose = { ( ) => {
98- setFileName ( '' ) ;
98+ setFileName ( "" ) ;
9999 reset ( ) ;
100100 onClose ( ) ;
101101 } }
102102 >
103103 < ModalOverlay />
104- < ModalContent bgColor = { ' white' } >
105- < ModalHeader > { tCreate ( ' title' ) } </ ModalHeader >
104+ < ModalContent bgColor = { " white" } >
105+ < ModalHeader > { tCreate ( " title" ) } </ ModalHeader >
106106 < ModalCloseButton />
107107 < ModalBody >
108108 < VStack gap = { 4 } >
109109 < InputController
110110 control = { control }
111111 id = "accountId"
112- label = { tCreate ( ' form.account.label' ) }
113- placeholder = { tCreate ( ' form.account.placeholder' ) }
112+ label = { tCreate ( " form.account.label" ) }
113+ placeholder = { tCreate ( " form.account.placeholder" ) }
114114 isRequired = { true }
115115 rules = { {
116116 required,
117117 validate : { isValidHederaId : isValidHederaId } ,
118118 } }
119119 />
120- < HStack w = { ' full' } >
120+ < HStack w = { " full" } >
121121 < input
122122 ref = { fileInputRef }
123123 type = "file"
124124 name = "vcFile"
125125 id = "vcFile"
126- style = { { display : ' none' } }
126+ style = { { display : " none" } }
127127 onChange = { onFileChange }
128128 />
129129 < Button
130130 onClick = { ( ) => fileInputRef . current ?. click ( ) }
131131 leftIcon = { < PhosphorIcon as = { FileArchive } /> }
132- variant = { ' secondary' }
132+ variant = { " secondary" }
133133 >
134- { tCreate ( ' form.vc.placeholder' ) }
134+ { tCreate ( " form.vc.placeholder" ) }
135135 </ Button >
136- < Text > { fileName } </ Text >
136+ < Text maxW = { 270 } > { fileName } </ Text >
137137 </ HStack >
138138 </ VStack >
139139 </ ModalBody >
140140 < ModalFooter >
141- < Button
142- isDisabled = { isDisable }
143- isLoading = { isLoading }
144- type = "submit"
145- onClick = { handleSubmit ( onSubmit ) }
146- >
141+ < Button isDisabled = { isDisable } isLoading = { isLoading } type = "submit" onClick = { handleSubmit ( onSubmit ) } >
147142 Create
148143 </ Button >
149144 </ ModalFooter >
0 commit comments