@@ -7,6 +7,7 @@ import Error404 from '../Error404';
77import { IndvPageContainer } from './IndvPageContainer' ;
88import Box from '@material-ui/core/Box' ;
99import '../../styles.css' ;
10+ import { getOrganizationLinks } from '../../components/getOrganizationLinks.js' ;
1011
1112const IndvOrgPage = ( { match } ) => {
1213 const [ showHeaderResults , setShowHeaderResults ] = useState ( false ) ;
@@ -22,7 +23,7 @@ const IndvOrgPage = ({ match }) => {
2223 const [ notFound , setNotFound ] = useState ( true ) ;
2324 const [ dropdownTitle , setDropdownTitle ] = useState ( '' ) ;
2425
25- const pathName = ( match . params . name ) ?. toLowerCase ( ) ?. trim ( ) ;
26+ const pathName = match . params . name ?. toLowerCase ( ) ?. trim ( ) ;
2627
2728 // Reset variables when the path changes.
2829 useEffect ( ( ) => {
@@ -35,7 +36,7 @@ const IndvOrgPage = ({ match }) => {
3536 setGithubLink ( '' ) ;
3637 setParentOrgs ( [ ] ) ;
3738 setwebsiteUrlResults ( '' ) ;
38- if ( pathName === "" ) {
39+ if ( pathName === '' ) {
3940 setNotFound ( true ) ;
4041 setIsPathChange ( false ) ;
4142 }
@@ -54,11 +55,9 @@ const IndvOrgPage = ({ match }) => {
5455 const name = org . name ;
5556 const slug = org . slug ;
5657 const orgTag = org . org_tag ;
57- const githubId = org . github_id ;
5858 const githubName = org . github_name ;
5959 const url = org . url ;
6060 const modifiedName = name ?. replaceAll ( ' ' , '' ) . toLowerCase ( ) ;
61- let imageUrl ;
6261
6362 // The matching criteria is matching one of these names from matchingNameArr
6463 const matchingNameArr = [
@@ -88,12 +87,7 @@ const IndvOrgPage = ({ match }) => {
8887 ( link ) => link . link_type === 'GitHub'
8988 ) ?. url ;
9089
91- if ( githubId === null ) {
92- imageUrl = org . image_url ;
93- } else {
94- imageUrl = `https://avatars1.githubusercontent.com/u/${ githubId } ?s=100&v=4` ;
95- }
96-
90+ const imageUrl = getOrganizationLinks ( org ) . imageUrl ;
9791 // Create the breadcrums on the Individual Organization Page
9892 const parentOrgs = [ ] ;
9993 const crumbs = [
@@ -150,24 +144,28 @@ const IndvOrgPage = ({ match }) => {
150144 }
151145 } , [ isPathChange , pathName ] ) ;
152146
153-
154- return (
155- ( ! notFound ) ? (
156- < Box className = 'containerGray' >
157- < Header crumbs = { breadCrumbs }
158- showHeaderResults = { showHeaderResults } githubLink = { githubLink }
159- imageUrl = { imageUrl } websiteUrlResults = { websiteUrlResults } orgName = { orgName }
160- />
161- < IndvPageContainer
162- orgGithubName = { orgGithubName }
163- projectSearchTopicsArr = { projectSearchTopicsArr }
164- largeScreen = { projectSearchTopicsArr }
165- dropdownTitle = { dropdownTitle }
166- parentOrgs = { parentOrgs }
167- pathName = { pathName }
168- />
169- </ Box >
170- ) : ( < Error404 /> ) )
147+ return ! notFound ? (
148+ < Box className = 'containerGray' >
149+ < Header
150+ crumbs = { breadCrumbs }
151+ showHeaderResults = { showHeaderResults }
152+ githubLink = { githubLink }
153+ imageUrl = { imageUrl }
154+ websiteUrlResults = { websiteUrlResults }
155+ orgName = { orgName }
156+ />
157+ < IndvPageContainer
158+ orgGithubName = { orgGithubName }
159+ projectSearchTopicsArr = { projectSearchTopicsArr }
160+ largeScreen = { projectSearchTopicsArr }
161+ dropdownTitle = { dropdownTitle }
162+ parentOrgs = { parentOrgs }
163+ pathName = { pathName }
164+ />
165+ </ Box >
166+ ) : (
167+ < Error404 />
168+ ) ;
171169} ;
172170
173171export default IndvOrgPage ;
0 commit comments