1- import { Typography , Box } from '@mui/material' ;
2- import PageLayout from '../../components/PageLayout' ;
3- import ImageWithButton from './components/ImageWithButton' ;
4- import { useHistory } from 'react-router-dom' ;
5- import { routes } from '../../utils/routes' ;
6- import { useCurrentUser } from '../../hooks/users.hooks' ;
1+ import { Typography , Box , Icon , Card , CardContent } from '@mui/material' ;
2+ import Link from '@mui/material/Link' ;
3+ import { Link as RouterLink } from 'react-router-dom' ;
74import { useEffect } from 'react' ;
85import { useHomePageContext } from '../../app/HomePageContext' ;
96import { useCurrentOrganization } from '../../hooks/organizations.hooks' ;
107import LoadingIndicator from '../../components/LoadingIndicator' ;
118import ErrorPage from '../ErrorPage' ;
129import { useGetImageUrl } from '../../hooks/onboarding.hook' ;
10+ import FeaturedProjects from './components/FeaturedProjects' ;
11+ import { useAllUsefulLinks } from '../../hooks/projects.hooks' ;
12+ import { Stack } from '@mui/system' ;
13+ import { routes } from '../../utils/routes' ;
14+ import { NERButton } from '../../components/NERButton' ;
1315
1416const IntroGuestHomePage = ( ) => {
15- const user = useCurrentUser ( ) ;
16- const history = useHistory ( ) ;
1717 const {
1818 data : organization ,
1919 isLoading : organizationIsLoading ,
@@ -22,63 +22,124 @@ const IntroGuestHomePage = () => {
2222 } = useCurrentOrganization ( ) ;
2323 const { setCurrentHomePage } = useHomePageContext ( ) ;
2424
25- const {
26- data : applyInterestImageUrl ,
27- isLoading : applyImageLoading ,
28- isError : applyImageIsError ,
29- error : applyImageError
30- } = useGetImageUrl ( organization ?. applyInterestImageId ?? null ) ;
31- const {
32- data : exploreGuestImageUrl ,
33- isLoading : exploreImageLoading ,
34- isError : exploreImageIsError ,
35- error : exploreImageError
36- } = useGetImageUrl ( organization ?. exploreAsGuestImageId ?? null ) ;
37-
3825 useEffect ( ( ) => {
3926 setCurrentHomePage ( 'guest' ) ;
4027 } , [ setCurrentHomePage ] ) ;
4128
29+ const {
30+ data : usefulLinks ,
31+ isLoading : usefulLinksIsLoading ,
32+ isError : usefulLinksIsError ,
33+ error : usefulLinksError
34+ } = useAllUsefulLinks ( ) ;
35+
36+ const {
37+ data : finishlineImageUrl ,
38+ isLoading : finishlineImageIsLoading ,
39+ isError : finishlineImageIsError ,
40+ error : finishlineImageError
41+ } = useGetImageUrl ( organization ?. finishlineLogo ?? null ) ;
42+
4243 if ( organizationIsError ) {
4344 return < ErrorPage message = { organizationError . message } /> ;
4445 }
45- if ( applyImageIsError ) return < ErrorPage message = { applyImageError . message } /> ;
46- if ( exploreImageIsError ) return < ErrorPage message = { exploreImageError . message } /> ;
4746
48- if ( ! organization || organizationIsLoading || applyImageLoading || exploreImageLoading ) return < LoadingIndicator /> ;
49- if ( ! applyInterestImageUrl || ! exploreGuestImageUrl ) return < LoadingIndicator /> ;
47+ if ( usefulLinksIsError ) {
48+ return < ErrorPage message = { usefulLinksError . message } /> ;
49+ }
50+
51+ if ( finishlineImageIsError ) {
52+ return < ErrorPage message = { finishlineImageError . message } /> ;
53+ }
54+
55+ if (
56+ ! finishlineImageUrl ||
57+ finishlineImageIsLoading ||
58+ ! organization ||
59+ organizationIsLoading ||
60+ ! usefulLinks ||
61+ usefulLinksIsLoading
62+ )
63+ return < LoadingIndicator /> ;
5064
5165 return (
52- < PageLayout title = "Home" hidePageTitle >
53- < Typography variant = "h3" textAlign = "center " sx = { { mt : 2 , pt : 3 } } >
54- { user ? `Welcome, ${ user . firstName } !` : 'Welcome, Guest!' }
66+ < Box sx = { { display : 'flex' , flexDirection : 'column' , alignItems : 'center' , px : 2 } } >
67+ < Typography mt = { 2 } variant = "h5 " sx = { { fontWeight : 'bold' } } >
68+ FinishLine By NER
5569 </ Typography >
5670 < Box
5771 sx = { {
72+ mt : 2 ,
5873 display : 'flex' ,
5974 justifyContent : 'center' ,
6075 alignItems : 'center' ,
61- flexDirection : { xs : 'column' , md : 'row' } ,
62- mt : 4 ,
63- padding : '20px'
76+ width : '100%' ,
77+ maxWidth : 480 ,
78+ bgcolor : 'grey.200' ,
79+ border : '1px solid' ,
80+ borderColor : 'grey.800' ,
81+ borderRadius : 1 ,
82+ overflow : 'hidden' ,
83+ boxSizing : 'border-box'
84+ } }
85+ >
86+ < Box
87+ component = "img"
88+ src = { finishlineImageUrl }
89+ alt = "FinishLine logo"
90+ sx = { {
91+ display : 'block' ,
92+ width : '100%' ,
93+ height : 'auto' ,
94+ objectFit : 'contain'
95+ } }
96+ />
97+ </ Box >
98+
99+ < Typography mt = { 2 } align = "center" sx = { { maxWidth : 560 } } >
100+ { organization . finishlineDescription }
101+ </ Typography >
102+ < Box sx = { { mt : 2 , width : '100%' , display : 'flex' , justifyContent : 'center' } } >
103+ < Stack direction = "row" flexWrap = "wrap" gap = { 2 } useFlexGap justifyContent = "center" >
104+ { usefulLinks . map ( ( link ) => (
105+ < Link
106+ key = { link . linkId }
107+ href = { link . url }
108+ target = "_blank"
109+ rel = "noopener noreferrer"
110+ underline = "hover"
111+ sx = { { display : 'inline-flex' , alignItems : 'center' , gap : 0.5 } }
112+ >
113+ < Icon sx = { { fontSize : 22 } } > { link . linkType . iconName } </ Icon >
114+ </ Link >
115+ ) ) }
116+ </ Stack >
117+ </ Box >
118+ < Card
119+ component = "section"
120+ sx = { {
121+ mt : 3 ,
122+ width : '100%' ,
123+ maxWidth : 420 ,
124+ mx : 'auto' ,
125+ textAlign : 'center' ,
126+ boxShadow : 1
64127 } }
65128 >
66- < Box sx = { { display : 'flex' , gap : 5 } } >
67- < ImageWithButton
68- title = "Interested in applying"
69- imageSrc = { applyInterestImageUrl }
70- buttonText = "Learn More"
71- onClick = { ( ) => history . push ( routes . HOME_PNM ) }
72- />
73- < ImageWithButton
74- title = "Explore Our Work as a Guest"
75- imageSrc = { exploreGuestImageUrl }
76- buttonText = "FinishLine"
77- onClick = { ( ) => history . push ( routes . HOME_MEMBER ) }
78- />
79- </ Box >
129+ < CardContent sx = { { py : 2 , '&:last-child' : { pb : 2 } } } >
130+ < Typography variant = "body1" color = "text.primary" sx = { { mb : 2 } } >
131+ Are you a student interested in joining NER?
132+ </ Typography >
133+ < NERButton component = { RouterLink } to = { routes . HOME_PNM } variant = "contained" size = "medium" >
134+ Learn more
135+ </ NERButton >
136+ </ CardContent >
137+ </ Card >
138+
139+ < Box sx = { { width : '100%' , mt : 3 } } >
140+ < FeaturedProjects />
80141 </ Box >
81- </ PageLayout >
142+ </ Box >
82143 ) ;
83144} ;
84145
0 commit comments