@@ -17,8 +17,6 @@ function SelectCredentials({ showPopup, setShowPopup, setSelectionMap, conforman
17
17
const [ currentSelectionMap , setCurrentSelectionMap ] = useState ( { } ) ;
18
18
const [ requestedFields , setRequestedFields ] = useState ( [ ] ) ;
19
19
const [ showRequestedFields , setShowRequestedFields ] = useState ( false ) ;
20
- const [ renderContent , setRenderContent ] = useState ( showRequestedFields ) ;
21
- const [ applyTransition , setApplyTransition ] = useState ( false ) ;
22
20
const [ credentialDisplay , setCredentialDisplay ] = useState ( { } ) ;
23
21
24
22
useEffect ( ( ) => {
@@ -46,17 +44,6 @@ function SelectCredentials({ showPopup, setShowPopup, setSelectionMap, conforman
46
44
getData ( ) ;
47
45
} , [ api , currentIndex ] ) ;
48
46
49
- useEffect ( ( ) => {
50
- if ( showRequestedFields ) {
51
- setRenderContent ( true ) ;
52
- } else if ( applyTransition ) {
53
- setTimeout ( ( ) => setRenderContent ( false ) , 500 ) ;
54
- } else {
55
- setRenderContent ( false ) ;
56
- }
57
- } , [ showRequestedFields , applyTransition ] ) ;
58
-
59
-
60
47
const goToNextSelection = ( ) => {
61
48
setCurrentIndex ( ( i ) => i + 1 ) ;
62
49
}
@@ -67,12 +54,9 @@ function SelectCredentials({ showPopup, setShowPopup, setSelectionMap, conforman
67
54
currentMap [ descriptorId ] = credentialIdentifier ;
68
55
return currentMap ;
69
56
} ) ;
70
- setApplyTransition ( false ) ;
71
- setShowRequestedFields ( false ) ;
72
57
goToNextSelection ( ) ;
73
58
} ;
74
59
75
-
76
60
const handleCancel = ( ) => {
77
61
setShowPopup ( false ) ;
78
62
navigate ( '/' ) ; // Navigate to home page or any other route
@@ -82,6 +66,10 @@ function SelectCredentials({ showPopup, setShowPopup, setSelectionMap, conforman
82
66
return null ;
83
67
} ;
84
68
69
+ const toggleRequestedFields = ( ) => {
70
+ setShowRequestedFields ( ! showRequestedFields ) ;
71
+ } ;
72
+
85
73
const toggleCredentialDisplay = ( identifier ) => {
86
74
setCredentialDisplay ( prev => ( {
87
75
...prev ,
@@ -102,36 +90,29 @@ function SelectCredentials({ showPopup, setShowPopup, setSelectionMap, conforman
102
90
{ t ( 'selectCredentialPopup.description' ) }
103
91
</ p >
104
92
{ requestedFields && (
105
-
106
-
107
- < div className = "lg:p-0 p-2 mt-4 w-full" >
93
+ < div className = "lg:p-0 p-2 my-4 w-full" >
108
94
< div className = "mb-2 flex items-center" >
109
95
< button
110
- onClick = { ( ) => { setApplyTransition ( true ) ; setShowRequestedFields ( ! showRequestedFields ) } }
111
- className = "px-2 py-2 text-white cursor-pointer flex items-center bg-custom-blue hover:bg-custom-blue-hover font-medium rounded-lg text-sm px-4 py-2 text-center dark:bg-custom-blue-hover dark:hover:bg-custom-blue-hover"
96
+ onClick = { toggleRequestedFields }
97
+ className = "px-2 py-2 text-white cursor-pointer flex items-center bg-custom-blue hover:bg-custom-blue-hover font-medium rounded-lg text-xs px-4 py-2 text-center dark:bg-custom-blue-hover dark:hover:bg-custom-blue-hover"
112
98
>
113
99
{ showRequestedFields ? `${ t ( 'selectCredentialPopup.requestedFieldsHide' ) } ` : `${ t ( 'selectCredentialPopup.requestedFieldsShow' ) } ` }
114
100
</ button >
115
101
</ div >
116
102
117
- < hr className = "border-t border-gray-300 py-1" />
118
-
119
- < div
120
- className = { `overflow-hidden transition-height ${ showRequestedFields ? 'max-h-96' : 'max-h-0' } ` }
121
- style = { { transition : 'max-height 0.5s ease-in-out' } }
122
-
123
- >
124
- { renderContent && (
125
- < >
126
- < p className = 'mb-2 text-sm italic text-gray-700' > { t ( 'selectCredentialPopup.requestedFieldsinfo' ) } { verifierDomainName } </ p >
127
- < textarea
128
- readOnly
129
- value = { requestedFields . join ( '\n' ) }
130
- className = "w-full border rounded p-2 rounded-xl"
131
- rows = { Math . min ( 3 , Math . max ( 1 , requestedFields . length ) ) }
132
- > </ textarea >
133
- </ >
134
- ) }
103
+ < hr className = "border-t border-gray-300" />
104
+
105
+ < div className = { `transition-all ease-in-out duration-1000 p-2 overflow-hidden rounded-xl shadow-xl ${ showRequestedFields ? 'max-h-[500px] opacity-100' : 'max-h-0 opacity-0 m-0 p-0' } ` } >
106
+ < >
107
+ < p className = 'mb-2 text-sm italic text-gray-700' > { t ( 'selectCredentialPopup.requestedFieldsinfo' ) } { verifierDomainName } </ p >
108
+ < textarea
109
+ readOnly
110
+ value = { requestedFields . join ( '\n' ) }
111
+ className = "p-2 border rounded-lg text-sm"
112
+ style = { { width : '-webkit-fill-available' } }
113
+ rows = { Math . min ( 3 , Math . max ( 1 , requestedFields . length ) ) }
114
+ > </ textarea >
115
+ </ >
135
116
</ div >
136
117
</ div >
137
118
) }
@@ -150,7 +131,7 @@ function SelectCredentials({ showPopup, setShowPopup, setSelectionMap, conforman
150
131
{ credentialDisplay [ image . credentialIdentifier ] ? 'Hide Details' : 'Show Details' }
151
132
</ button >
152
133
< div
153
- className = { `transition-all ease-in-out duration-500 overflow-hidden shadow-lg rounded-lg ${ credentialDisplay [ image . credentialIdentifier ] ? 'max-h-[500px] opacity-100' : 'max-h-0 opacity-0' } ` }
134
+ className = { `transition-all ease-in-out duration-1000 overflow-hidden shadow-lg rounded-lg ${ credentialDisplay [ image . credentialIdentifier ] ? 'max-h-[500px] opacity-100' : 'max-h-0 opacity-0' } ` }
154
135
>
155
136
< CredentialInfo credential = { image . credential } mainClassName = { "text-xs w-full" } />
156
137
</ div >
0 commit comments