1+ import React , { useEffect } from 'react' ;
2+ import { useParams , useRouter } from 'next/navigation' ;
13import { graphql } from '@/gql' ;
24import {
35 ApiOrganizationOrganizationTypesEnum ,
46 OrganizationInputPartial ,
57} from '@/gql/generated/graphql' ;
68import { useOrganizationTypes } from '@/hooks/useOrganizationTypes' ;
7- import { GraphQL } from '@/lib/api' ;
89import { useMutation } from '@tanstack/react-query' ;
9- import { useParams , useRouter } from 'next/navigation' ;
1010import { Button , DropZone , Select , Text , TextField , toast } from 'opub-ui' ;
11- import React , { useEffect } from 'react' ;
11+
1212import { useDashboardStore } from '@/config/store' ;
13+ import { GraphQL } from '@/lib/api' ;
1314
1415const organizationUpdateMutation : any = graphql ( `
1516 mutation updateOrganization($input: OrganizationInputPartial!) {
@@ -23,6 +24,10 @@ const organizationUpdateMutation: any = graphql(`
2324 path
2425 url
2526 }
27+ linkedinProfile
28+ githubProfile
29+ twitterProfile
30+ location
2631 homepage
2732 organizationTypes
2833 contactEmail
@@ -50,6 +55,10 @@ const OrgProfile = () => {
5055 description : entityDetails ?. organizations [ 0 ] . description ,
5156 logo : entityDetails ?. organizations [ 0 ] . logo ,
5257 id : entityDetails ?. organizations [ 0 ] . id ,
58+ linkedinProfile : entityDetails ?. organizations [ 0 ] . linkedinProfile ,
59+ githubProfile : entityDetails ?. organizations [ 0 ] . githubProfile ,
60+ twitterProfile : entityDetails ?. organizations [ 0 ] . twitterProfile ,
61+ location : entityDetails ?. organizations [ 0 ] . location ,
5362 } ) ;
5463 }
5564 } , [ entityDetails ?. organizations ] ) ;
@@ -62,6 +71,10 @@ const OrgProfile = () => {
6271 description : '' ,
6372 logo : null as File | null ,
6473 id : '' ,
74+ linkedinProfile : '' ,
75+ githubProfile : '' ,
76+ twitterProfile : '' ,
77+ location : '' ,
6578 } ;
6679
6780 const [ formData , setFormData ] = React . useState ( initialFormData ) ;
@@ -80,11 +93,18 @@ const OrgProfile = () => {
8093 description : res ?. updateOrganization ?. description ,
8194 logo : res ?. updateOrganization ?. logo ,
8295 id : res ?. updateOrganization ?. id ,
96+ linkedinProfile : res ?. updateOrganization ?. linkedinProfile ,
97+ githubProfile : res ?. updateOrganization ?. githubProfile ,
98+ twitterProfile : res ?. updateOrganization ?. twitterProfile ,
99+ location : res ?. updateOrganization ?. location ,
83100 } ) ;
84101 setEntityDetails ( {
85102 organizations : [ formData ] ,
86103 } ) ;
87- if ( res ?. updateOrganization ?. slug && res . updateOrganization . slug !== params . entitySlug ) {
104+ if (
105+ res ?. updateOrganization ?. slug &&
106+ res . updateOrganization . slug !== params . entitySlug
107+ ) {
88108 const newPath = `/dashboard/${ params . entityType } /${ res . updateOrganization . slug } /profile` ;
89109 router . replace ( newPath ) ;
90110 }
@@ -104,6 +124,10 @@ const OrgProfile = () => {
104124 homepage : formData . homepage ,
105125 description : formData . description ,
106126 id : formData . id ,
127+ linkedinProfile : formData . linkedinProfile ,
128+ githubProfile : formData . githubProfile ,
129+ twitterProfile : formData . twitterProfile ,
130+ location : formData . location ,
107131 } ;
108132
109133 // Only add logo if it has changed
@@ -112,11 +136,8 @@ const OrgProfile = () => {
112136 }
113137
114138 mutate ( { input : inputData } ) ;
115-
116-
117139 } ;
118140
119-
120141 return (
121142 < div >
122143 < div >
@@ -163,11 +184,53 @@ const OrgProfile = () => {
163184 < TextField
164185 label = "Homepage"
165186 name = "homepage"
187+ type = "url"
166188 value = { formData . homepage }
167189 onChange = { ( e ) => setFormData ( { ...formData , homepage : e } ) }
168190 />
169191 </ div >
170192 </ div >
193+ < div className = "flex flex-wrap gap-6 lg:flex-nowrap" >
194+ < div className = "w-full" >
195+ < TextField
196+ label = "Linkedin Profile"
197+ type = "url"
198+ name = "linkedinProfile"
199+ value = { formData . linkedinProfile }
200+ onChange = { ( e ) => setFormData ( { ...formData , linkedinProfile : e } ) }
201+ />
202+ </ div >
203+
204+ < div className = "w-full" >
205+ < TextField
206+ label = "Github Profile"
207+ type = "url"
208+ name = "githubProfile"
209+ value = { formData . githubProfile }
210+ onChange = { ( e ) => setFormData ( { ...formData , githubProfile : e } ) }
211+ />
212+ </ div >
213+ </ div >
214+ < div className = "flex flex-wrap gap-6 lg:flex-nowrap" >
215+ < div className = "w-full" >
216+ < TextField
217+ label = "Twitter Profile"
218+ name = "twitterProfile"
219+ type = "url"
220+ value = { formData . twitterProfile }
221+ onChange = { ( e ) => setFormData ( { ...formData , twitterProfile : e } ) }
222+ />
223+ </ div >
224+
225+ < div className = "w-full" >
226+ < TextField
227+ label = "Location"
228+ name = "location"
229+ value = { formData . location }
230+ onChange = { ( e ) => setFormData ( { ...formData , location : e } ) }
231+ />
232+ </ div >
233+ </ div >
171234 < div className = "flex flex-wrap gap-6 lg:flex-nowrap" >
172235 < div className = "w-full" >
173236 < TextField
@@ -202,4 +265,4 @@ const OrgProfile = () => {
202265 ) ;
203266} ;
204267
205- export default OrgProfile ;
268+ export default OrgProfile ;
0 commit comments