11import { Dispatch , FC , SetStateAction , useState } from 'react'
22
3- import { UserProfile , downloadProfileAsync } from '~/libs/core'
3+ import { downloadProfileAsync , UserProfile } from '~/libs/core'
44import { Button , ContentLayout , IconSolid , PageTitle } from '~/libs/ui'
55
66// import { MemberTCActivityInfo } from '../tc-activity'
@@ -31,20 +31,28 @@ const ProfilePageLayout: FC<ProfilePageLayoutProps> = (props: ProfilePageLayoutP
3131 if ( ! authProfile ) {
3232 return false
3333 }
34+
3435 // Check if user is viewing their own profile
3536 if ( authProfile . handle === profile . handle ) {
3637 return true
3738 }
39+
3840 // Check if user has admin roles
3941 const adminRoles = [ 'administrator' , 'admin' ]
4042 if ( authProfile . roles ?. some ( role => adminRoles . includes ( role . toLowerCase ( ) ) ) ) {
4143 return true
4244 }
45+
4346 // Check if user has PM or Talent Manager roles
4447 const allowedRoles = [ 'Project Manager' , 'Talent Manager' ]
45- if ( authProfile . roles ?. some ( role => allowedRoles . some ( allowed => role . toLowerCase ( ) === allowed . toLowerCase ( ) ) ) ) {
48+ if ( authProfile
49+ . roles ?. some (
50+ role => allowedRoles . some ( allowed => role . toLowerCase ( ) === allowed . toLowerCase ( ) ) ,
51+ )
52+ ) {
4653 return true
4754 }
55+
4856 return false
4957 }
5058
@@ -57,6 +65,7 @@ const ProfilePageLayout: FC<ProfilePageLayoutProps> = (props: ProfilePageLayoutP
5765 if ( isDownloading ) {
5866 return
5967 }
68+
6069 setIsDownloading ( true )
6170 try {
6271 await downloadProfileAsync ( props . profile . handle )
@@ -80,7 +89,7 @@ const ProfilePageLayout: FC<ProfilePageLayoutProps> = (props: ProfilePageLayoutP
8089 < Button
8190 label = 'Download Profile'
8291 icon = { IconSolid . DownloadIcon }
83- iconToRight = { true }
92+ iconToRight
8493 onClick = { handleDownloadProfile }
8594 disabled = { isDownloading }
8695 className = { styles . downloadButton }
@@ -112,70 +121,70 @@ const ProfilePageLayout: FC<ProfilePageLayoutProps> = (props: ProfilePageLayoutP
112121 < div className = { styles . profileHeaderBottom } />
113122 </ div >
114123
115- < ContentLayout
116- outerClass = { styles . profileOuter }
117- innerClass = { styles . profileInner }
118- >
119- < div className = { styles . profileInfoWrap } >
120- < div className = { styles . profileInfoLeft } >
121- < AboutMe
122- profile = { props . profile }
123- authProfile = { props . authProfile }
124- refreshProfile = { props . refreshProfile }
125- />
126-
127- < MemberLanguages profile = { props . profile } authProfile = { props . authProfile } />
128-
129- < MemberLocalInfo
130- profile = { props . profile }
131- authProfile = { props . authProfile }
132- refreshProfile = { props . refreshProfile }
133- />
134-
135- { props . profile . userId === props . authProfile ?. userId && (
136- < MemberLinks profile = { props . profile } authProfile = { props . authProfile } />
137- ) }
138- </ div >
139- < div className = { styles . profileInfoRight } >
140- { props . authProfile ?. handle === props . profile . handle && (
141- < ProfileCompleteness profile = { props . profile } authProfile = { props . authProfile } />
142- ) }
143- < div className = { styles . sectionWrap } >
144- < div className = { styles . skillsWrap } >
145- < MemberSkillsInfo
146- profile = { props . profile }
147- authProfile = { props . authProfile }
148- refreshProfile = { props . refreshProfile }
149- />
150- </ div >
124+ < ContentLayout
125+ outerClass = { styles . profileOuter }
126+ innerClass = { styles . profileInner }
127+ >
128+ < div className = { styles . profileInfoWrap } >
129+ < div className = { styles . profileInfoLeft } >
130+ < AboutMe
131+ profile = { props . profile }
132+ authProfile = { props . authProfile }
133+ refreshProfile = { props . refreshProfile }
134+ />
135+
136+ < MemberLanguages profile = { props . profile } authProfile = { props . authProfile } />
137+
138+ < MemberLocalInfo
139+ profile = { props . profile }
140+ authProfile = { props . authProfile }
141+ refreshProfile = { props . refreshProfile }
142+ />
143+
144+ { props . profile . userId === props . authProfile ?. userId && (
145+ < MemberLinks profile = { props . profile } authProfile = { props . authProfile } />
146+ ) }
151147 </ div >
148+ < div className = { styles . profileInfoRight } >
149+ { props . authProfile ?. handle === props . profile . handle && (
150+ < ProfileCompleteness profile = { props . profile } authProfile = { props . authProfile } />
151+ ) }
152+ < div className = { styles . sectionWrap } >
153+ < div className = { styles . skillsWrap } >
154+ < MemberSkillsInfo
155+ profile = { props . profile }
156+ authProfile = { props . authProfile }
157+ refreshProfile = { props . refreshProfile }
158+ />
159+ </ div >
160+ </ div >
152161
153- < MemberTCAchievements profile = { props . profile } />
154-
155- < div className = { styles . expirenceWrap } >
156- < div >
162+ < MemberTCAchievements profile = { props . profile } />
163+
164+ < div className = { styles . expirenceWrap } >
165+ < div >
166+ < div className = { styles . sectionWrap } >
167+ < WorkExpirence
168+ profile = { props . profile }
169+ authProfile = { props . authProfile }
170+ refreshProfile = { props . refreshProfile }
171+ />
172+ </ div >
173+ </ div >
157174 < div className = { styles . sectionWrap } >
158- < WorkExpirence
175+ < EducationAndCertifications
159176 profile = { props . profile }
160177 authProfile = { props . authProfile }
161178 refreshProfile = { props . refreshProfile }
162179 />
163180 </ div >
164181 </ div >
165- < div className = { styles . sectionWrap } >
166- < EducationAndCertifications
167- profile = { props . profile }
168- authProfile = { props . authProfile }
169- refreshProfile = { props . refreshProfile }
170- />
171- </ div >
172182 </ div >
173183 </ div >
174- </ div >
175184
176- </ ContentLayout >
185+ </ ContentLayout >
177186
178- < OnboardingCompleted authProfile = { props . authProfile } />
187+ < OnboardingCompleted authProfile = { props . authProfile } />
179188
180189 </ div >
181190 )
0 commit comments