@@ -27,6 +27,7 @@ import { usePageTitle } from '../layout/layoutSlice';
2727import PageNotFound from '../layout/PageNotFound' ;
2828import NarrativeList from '../navigator/NarrativeList/NarrativeList' ;
2929import classes from './Profile.module.scss' ;
30+ import { Affiliation , ProfileData } from './profileTypes' ;
3031
3132/*
3233 * The following components are stubs due to be written in the future.
@@ -58,7 +59,12 @@ export const NarrativesView: FC<{ realname: string; yours: boolean }> = ({
5859 yours,
5960} ) => {
6061 return (
61- < div className = { classes . narratives } >
62+ < div
63+ className = { classes . narratives }
64+ role = "tabpanel"
65+ id = "narratives-tabpanel"
66+ aria-labelledby = "narratives-tab"
67+ >
6268 < ProfileNarrativesMessage realname = { realname } yours = { yours } />
6369 < NarrativeList
6470 hasMoreItems = { false }
@@ -80,34 +86,34 @@ export const ProfileInfobox: FC<{ realname: string }> = ({ realname }) => {
8086export const ProfileView : FC < {
8187 realname : string ;
8288 username : string ;
83- // eslint-disable-next-line @typescript-eslint/no-explicit-any
84- profileData : any ;
85- } > = ( { realname, username, profileData } ) => {
86- const gravatarHash = profileData . synced . gravatarHash ;
87- const avatarSrc = gravatarHash
88- ? `https://www.gravatar.com/avatar/${ gravatarHash } ?s=300&r=pg&d=identicon`
89- : '' ;
90- // Placeholder data for research interests
91- const researchInterests = [
92- 'Biology' ,
93- 'Genomics' ,
94- 'Data Management' ,
95- 'Scientific Communication' ,
96- ] ;
97- // Placeholder data for organizations
98- const organizations = [
99- 'Eiusmod sit est aute aliqua nostrud sint eu ex tempor.' ,
100- 'Sint non cupidatat reprehenderit proident deserunt esse Lorem.' ,
101- 'Tempor reprehenderit commodo voluptate fugiat aliqua.' ,
102- 'Reprehenderit dolore aute proident et.' ,
103- ] ;
89+ profileData : ProfileData ;
90+ viewMine : boolean ;
91+ } > = ( { realname, username, profileData, viewMine } ) => {
92+ const gravatarHash = profileData ?. synced ?. gravatarHash ?? '' ;
93+ const gravatarDefault = profileData ?. userdata ?. gravatarDefault ?? 'identicon' ;
94+ const avatarOption = profileData ?. userdata ?. avatarOption ?? 'gravatar' ;
95+ const avatarSrc =
96+ avatarOption === 'gravatar' && gravatarHash
97+ ? `https://www.gravatar.com/avatar/${ gravatarHash } ?s=300&r=pg&d=${ gravatarDefault } `
98+ : '' ;
99+ const researchInterests = profileData ?. userdata ?. researchInterests ?? [ ] ;
100+ const affiliations = profileData ?. userdata ?. affiliations ?? [ ] ;
101+ const jobTitle = profileData ?. userdata ?. jobTitle ?? '' ;
102+ const jobTitleDisplay =
103+ jobTitle === 'Other'
104+ ? profileData ?. userdata ?. jobTitleOther ?? ''
105+ : jobTitle ;
106+ const department = profileData ?. userdata ?. department ?? '' ;
107+ const organization = profileData ?. userdata ?. organization ?? '' ;
108+ const city = profileData ?. userdata ?. city ?? '' ;
109+ const state = profileData ?. userdata ?. state ?? '' ;
110+ const country = profileData ?. userdata ?. country ?? '' ;
111+ const locationParts = [ city , state , country ] . filter ( Boolean ) ;
112+ const location = locationParts . join ( ', ' ) ;
113+ const researchStatement = profileData ?. userdata ?. researchStatement ?? '' ;
114+
104115 return (
105- < div
106- className = { classes . profile }
107- role = "tabpanel"
108- id = "profile-tabpanel"
109- aria-labelledby = "profile-tab"
110- >
116+ < div role = "tabpanel" id = "profile-tabpanel" aria-labelledby = "profile-tab" >
111117 < Grid container spacing = { 2 } >
112118 < Grid item md = { 3 } >
113119 < Stack spacing = { 2 } >
@@ -124,28 +130,30 @@ export const ProfileView: FC<{
124130 < Stack spacing = { 2 } >
125131 < Stack spacing = { 1 } >
126132 < Typography fontWeight = "bold" > Position</ Typography >
127- < Typography > Consectetur culpa commodo </ Typography >
133+ < Typography > { jobTitleDisplay || '\u2014' } </ Typography >
128134 </ Stack >
129135 < Stack spacing = { 1 } >
130136 < Typography fontWeight = "bold" > Department</ Typography >
131- < Typography > Consectetur culpa commodo </ Typography >
137+ < Typography > { department || '\u2014' } </ Typography >
132138 </ Stack >
133139 < Stack spacing = { 1 } >
134140 < Typography fontWeight = "bold" > Organization</ Typography >
135- < Typography > Consectetur culpa commodo </ Typography >
141+ < Typography > { organization || '\u2014' } </ Typography >
136142 </ Stack >
137143 < Stack spacing = { 1 } >
138144 < Typography fontWeight = "bold" > Location</ Typography >
139- < Typography > Consectetur culpa commodo </ Typography >
145+ < Typography > { location || '\u2014' } </ Typography >
140146 </ Stack >
141147 </ Stack >
142148 </ Paper >
143- < Button
144- variant = "contained"
145- startIcon = { < FontAwesomeIcon icon = { faEdit } /> }
146- >
147- Edit Profile
148- </ Button >
149+ { viewMine && (
150+ < Button
151+ variant = "contained"
152+ startIcon = { < FontAwesomeIcon icon = { faEdit } /> }
153+ >
154+ Edit Profile
155+ </ Button >
156+ ) }
149157 </ Stack >
150158 </ Grid >
151159 < Grid item md = { 9 } >
@@ -155,30 +163,18 @@ export const ProfileView: FC<{
155163 < Typography variant = "h5" fontWeight = "bold" >
156164 Research or Personal Statement
157165 </ Typography >
158- < Typography >
159- { profileData . userdata . researchStatement }
160- </ Typography >
166+ < Typography > { researchStatement } </ Typography >
161167 </ Stack >
162168 < Stack spacing = { 1 } >
163169 < Typography variant = "h5" fontWeight = "bold" >
164170 Research Interests
165171 </ Typography >
166172 < Stack direction = "row" spacing = { 1 } flexWrap = "wrap" rowGap = { 1 } >
167- { researchInterests . map ( ( interest , i ) => (
173+ { researchInterests . map ( ( interest ) => (
168174 < Chip key = { interest } label = { interest } />
169175 ) ) }
170176 </ Stack >
171177 </ Stack >
172- < Stack spacing = { 1 } >
173- < Typography variant = "h5" fontWeight = "bold" >
174- Organizations
175- </ Typography >
176- < Stack spacing = { 1 } >
177- { organizations . map ( ( org ) => (
178- < Typography key = { org } > { org } </ Typography >
179- ) ) }
180- </ Stack >
181- </ Stack >
182178 < Stack spacing = { 1 } >
183179 < Typography variant = "h5" fontWeight = "bold" >
184180 Affiliations
@@ -192,22 +188,18 @@ export const ProfileView: FC<{
192188 </ TableRow >
193189 </ TableHead >
194190 < TableBody >
195- { /* eslint-disable @typescript-eslint/no-explicit-any */ }
196- { profileData . userdata . affiliations . map (
197- ( affiliation : any ) => (
198- < TableRow
199- key = { `${ affiliation . title } -${ affiliation . organization } ` }
200- >
201- < TableCell > { affiliation . title } </ TableCell >
202- < TableCell > { affiliation . organization } </ TableCell >
203- < TableCell >
204- { affiliation . started } -{ ' ' }
205- { affiliation . ended || 'Present' }
206- </ TableCell >
207- </ TableRow >
208- )
209- ) }
210- { /* eslint-enable @typescript-eslint/no-explicit-any */ }
191+ { affiliations . map ( ( affiliation : Affiliation ) => (
192+ < TableRow
193+ key = { `${ affiliation . title } -${ affiliation . organization } ` }
194+ >
195+ < TableCell > { affiliation . title } </ TableCell >
196+ < TableCell > { affiliation . organization } </ TableCell >
197+ < TableCell >
198+ { affiliation . started } -{ ' ' }
199+ { affiliation . ended || 'Present' }
200+ </ TableCell >
201+ </ TableRow >
202+ ) ) }
211203 </ TableBody >
212204 </ Table >
213205 </ Stack >
@@ -223,7 +215,7 @@ export interface ProfileParams {
223215 narrativesLink : string ;
224216 pageTitle : string ;
225217 profileLink : string ;
226- profileData : unknown ;
218+ profileData : ProfileData ;
227219 realname : string ;
228220 username : string ;
229221 viewMine : boolean ;
@@ -289,6 +281,7 @@ export const Profile: FC<ProfileParams> = ({
289281 realname = { realname }
290282 username = { username }
291283 profileData = { profileData }
284+ viewMine = { viewMine }
292285 />
293286 ) }
294287 </ section >
@@ -359,7 +352,7 @@ export const ProfileWrapper: FC = () => {
359352 narrativesLink = { narrativesLink }
360353 pageTitle = { pageTitle }
361354 profileLink = { profileLink }
362- profileData = { profile . profile }
355+ profileData = { profile . profile as ProfileData }
363356 realname = { realname }
364357 username = { viewUsername }
365358 viewMine = { viewMine }
0 commit comments