@@ -5,9 +5,10 @@ import { useContext, useEffect, useState } from 'react';
5
5
import styled , { useTheme } from 'styled-components' ;
6
6
7
7
// Internal Compoonents
8
- import { ButtonV2 , ImageV2 , ItemHV2 , ItemVV2 , SpanV2 } from 'components/reusables/SharedStylingV2' ;
8
+ import { ButtonV2 , ImageV2 , ItemHV2 , ItemVV2 , Skeleton , SkeletonLine , SpanV2 } from 'components/reusables/SharedStylingV2' ;
9
9
import { AppContext } from 'contexts/AppContext' ;
10
10
import { useAccount , useDeviceWidthCheck } from 'hooks' ;
11
+ import { retrieveUserPGPKeyFromStorage } from 'helpers/connectWalletHelper' ;
11
12
12
13
// Internal Configs
13
14
import { device , size } from 'config/Globals' ;
@@ -74,6 +75,19 @@ const UnlockProfile = ({ InnerComponentProps, onClose }: UnlockProfileModalProps
74
75
75
76
const isMobile = useDeviceWidthCheck ( parseInt ( size . tablet ) ) ;
76
77
78
+ const [ isLoading , setIsLoading ] = useState ( false ) ;
79
+
80
+ useEffect ( ( ) => {
81
+ if ( wallet ?. accounts ?. length > 0 ) {
82
+ const decryptedPGPKeys = retrieveUserPGPKeyFromStorage ( account ) ;
83
+ console . log ( "decryptedPGPKeys" , decryptedPGPKeys ) ;
84
+ if ( decryptedPGPKeys ) {
85
+ setIsLoading ( true ) ;
86
+ }
87
+ }
88
+
89
+ } , [ account ] )
90
+
77
91
return (
78
92
< Container type = { type } >
79
93
< SubContainer type = { type } >
@@ -92,22 +106,45 @@ const UnlockProfile = ({ InnerComponentProps, onClose }: UnlockProfileModalProps
92
106
/>
93
107
94
108
< ItemVV2 alignItems = { type === UNLOCK_PROFILE_TYPE . MODAL || isMobile ? 'center' : 'baseline' } >
95
- < SpanV2
96
- fontSize = "24px"
97
- fontWeight = "500"
98
- lineHeight = "28.8px"
99
- color = { theme . default . color }
100
- >
101
- { activeStatus . title }
102
- </ SpanV2 >
103
- < SpanV2
104
- fontSize = { type === UNLOCK_PROFILE_TYPE . MODAL || isMobile ? '16px' : '18px' }
105
- fontWeight = "400"
106
- lineHeight = "22.4px"
107
- color = { theme . default . secondaryColor }
108
- >
109
- { activeStatus . body }
110
- </ SpanV2 >
109
+
110
+ { ! isLoading ? (
111
+ < >
112
+ < SpanV2
113
+ fontSize = "24px"
114
+ fontWeight = "500"
115
+ lineHeight = "28.8px"
116
+ color = { theme . default . color }
117
+ >
118
+ { activeStatus . title }
119
+ </ SpanV2 >
120
+ < SpanV2
121
+ fontSize = { type === UNLOCK_PROFILE_TYPE . MODAL || isMobile ? '16px' : '18px' }
122
+ fontWeight = "400"
123
+ lineHeight = "22.4px"
124
+ color = { theme . default . secondaryColor }
125
+ >
126
+ { activeStatus . body }
127
+ </ SpanV2 >
128
+ </ >
129
+ ) : (
130
+ < SkeletonWrapper >
131
+ < SkeletonLine
132
+ height = "24px"
133
+ width = '100%'
134
+ margin = "0 0 8px 0"
135
+ borderRadius = '4px'
136
+ > </ SkeletonLine >
137
+
138
+ < SkeletonLine
139
+ height = "16px"
140
+ width = '100%'
141
+ margin = "0 0 8px 0"
142
+ borderRadius = '4px'
143
+ > </ SkeletonLine >
144
+
145
+ </ SkeletonWrapper >
146
+ ) }
147
+
111
148
</ ItemVV2 >
112
149
</ ItemHV2 >
113
150
@@ -150,23 +187,43 @@ const UnlockProfile = ({ InnerComponentProps, onClose }: UnlockProfileModalProps
150
187
alignItems = "baseline"
151
188
flexDirection = { type === UNLOCK_PROFILE_TYPE . MODAL || isMobile ? 'column' : 'row' }
152
189
>
153
- < DefaultButton
154
- activeStatus = { activeStatus . status }
155
- status = { PROFILESTATE . CONNECT_WALLET }
156
- disabled = { activeStatus . status !== PROFILESTATE . CONNECT_WALLET && true }
157
- onClick = { ( ) => connectWallet ( ) }
158
- >
159
- Connect Wallet
160
- </ DefaultButton >
161
-
162
- < DefaultButton
163
- activeStatus = { activeStatus . status }
164
- status = { PROFILESTATE . UNLOCK_PROFILE }
165
- disabled = { activeStatus . status === PROFILESTATE . CONNECT_WALLET && true }
166
- onClick = { handleChatprofileUnlock }
167
- >
168
- Unlock Profile
169
- </ DefaultButton >
190
+
191
+ { ! isLoading ? (
192
+ < >
193
+ < DefaultButton
194
+ activeStatus = { activeStatus . status }
195
+ status = { PROFILESTATE . CONNECT_WALLET }
196
+ disabled = { activeStatus . status !== PROFILESTATE . CONNECT_WALLET && true }
197
+ onClick = { ( ) => connectWallet ( ) }
198
+ >
199
+ Connect Wallet
200
+ </ DefaultButton >
201
+
202
+ < DefaultButton
203
+ activeStatus = { activeStatus . status }
204
+ status = { PROFILESTATE . UNLOCK_PROFILE }
205
+ disabled = { activeStatus . status === PROFILESTATE . CONNECT_WALLET && true }
206
+ onClick = { handleChatprofileUnlock }
207
+ >
208
+ Unlock Profile
209
+ </ DefaultButton >
210
+ </ >
211
+ ) : (
212
+ < SkeletonContainer
213
+ width = "100%"
214
+ flexDirection = { type === UNLOCK_PROFILE_TYPE . MODAL || isMobile ? 'column' : 'row' }
215
+ >
216
+ < SkeletonLine
217
+ height = "40px"
218
+ width = "150px"
219
+ > </ SkeletonLine >
220
+ < SkeletonLine
221
+ height = "40px"
222
+ width = "150px"
223
+ > </ SkeletonLine >
224
+ </ SkeletonContainer >
225
+
226
+ ) }
170
227
</ ItemHV2 >
171
228
</ ItemVV2 >
172
229
</ SubContainer >
@@ -209,21 +266,21 @@ const RenderToolTip = ({ children, type }) => {
209
266
placementProps = {
210
267
type === UNLOCK_PROFILE_TYPE . MODAL
211
268
? {
212
- background : 'black' ,
213
- width : '220px' ,
214
- padding : '8px 12px' ,
215
- top : '10px' ,
216
- left : '60px' ,
217
- borderRadius : '4px 12px 12px 12px' ,
218
- }
269
+ background : 'black' ,
270
+ width : '220px' ,
271
+ padding : '8px 12px' ,
272
+ top : '10px' ,
273
+ left : '60px' ,
274
+ borderRadius : '4px 12px 12px 12px' ,
275
+ }
219
276
: {
220
- background : 'black' ,
221
- width : '120px' ,
222
- padding : '8px 12px' ,
223
- bottom : '0px' ,
224
- right : '-30px' ,
225
- borderRadius : '12px 12px 12px 4px' ,
226
- }
277
+ background : 'black' ,
278
+ width : '120px' ,
279
+ padding : '8px 12px' ,
280
+ bottom : '0px' ,
281
+ right : '-30px' ,
282
+ borderRadius : '12px 12px 12px 4px' ,
283
+ }
227
284
}
228
285
tooltipContent = {
229
286
< SpanV2
@@ -318,4 +375,16 @@ const DefaultButton = styled(ButtonV2)`
318
375
cursor: ${ ( props ) => ( props . activeStatus !== props . status ? 'not-allowed' : 'pointer' ) } ;
319
376
` ;
320
377
378
+ const SkeletonWrapper = styled . div `
379
+ overflow: hidden;
380
+ min-width:220px;
381
+ ` ;
382
+
383
+ const SkeletonContainer = styled ( Skeleton ) `
384
+ max-width: -webkit-fill-available;
385
+ border-radius: 5px;
386
+ gap: 16px;
387
+ display: flex;
388
+ ` ;
389
+
321
390
export default UnlockProfile ;
0 commit comments