11import { Typography , Box } from '@mui/material' ;
22import PageLayout from '../../components/PageLayout' ;
3- // import { useHistory } from 'react-router-dom';
3+ import ImageWithButton from './components/ImageWithButton' ;
4+ import { useHistory } from 'react-router-dom' ;
5+ import { routes } from '../../utils/routes' ;
46import { useCurrentUser } from '../../hooks/users.hooks' ;
57import { useEffect } from 'react' ;
68import { useHomePageContext } from '../../app/HomePageContext' ;
7- // import { useCurrentOrganization } from '../../hooks/organizations.hooks';
8- // import LoadingIndicator from '../../components/LoadingIndicator';
9- // import ErrorPage from '../ErrorPage';
10- // import { useGetImageUrl } from '../../hooks/onboarding.hook';
11- import FeaturedProjects from './components/FeaturedProjects' ;
9+ import { useCurrentOrganization } from '../../hooks/organizations.hooks' ;
10+ import LoadingIndicator from '../../components/LoadingIndicator' ;
11+ import ErrorPage from '../ErrorPage' ;
12+ import { useGetImageUrl } from '../../hooks/onboarding.hook' ;
1213
1314const IntroGuestHomePage = ( ) => {
1415 const user = useCurrentUser ( ) ;
15- // const history = useHistory();
16- // const {
17- // data: organization,
18- // isLoading: organizationIsLoading,
19- // isError: organizationIsError,
20- // error: organizationError
21- // } = useCurrentOrganization();
16+ const history = useHistory ( ) ;
17+ const {
18+ data : organization ,
19+ isLoading : organizationIsLoading ,
20+ isError : organizationIsError ,
21+ error : organizationError
22+ } = useCurrentOrganization ( ) ;
2223 const { setCurrentHomePage } = useHomePageContext ( ) ;
2324
24- // const {
25- // data: applyInterestImageUrl,
26- // isLoading: applyImageLoading,
27- // isError: applyImageIsError,
28- // error: applyImageError
29- // } = useGetImageUrl(organization?.applyInterestImageId ?? null);
30- // const {
31- // data: exploreGuestImageUrl,
32- // isLoading: exploreImageLoading,
33- // isError: exploreImageIsError,
34- // error: exploreImageError
35- // } = useGetImageUrl(organization?.exploreAsGuestImageId ?? null);
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 ) ;
3637
3738 useEffect ( ( ) => {
3839 setCurrentHomePage ( 'guest' ) ;
3940 } , [ setCurrentHomePage ] ) ;
4041
41- // if (organizationIsError) {
42- // return <ErrorPage message={organizationError.message} />;
43- // }
44- // if (applyImageIsError) return <ErrorPage message={applyImageError.message} />;
45- // if (exploreImageIsError) return <ErrorPage message={exploreImageError.message} />;
42+ if ( organizationIsError ) {
43+ return < ErrorPage message = { organizationError . message } /> ;
44+ }
45+ if ( applyImageIsError ) return < ErrorPage message = { applyImageError . message } /> ;
46+ if ( exploreImageIsError ) return < ErrorPage message = { exploreImageError . message } /> ;
4647
47- // if (!organization || organizationIsLoading || applyImageLoading || exploreImageLoading) return <LoadingIndicator />;
48- // if (!applyInterestImageUrl || !exploreGuestImageUrl) return <LoadingIndicator />;
48+ if ( ! organization || organizationIsLoading || applyImageLoading || exploreImageLoading ) return < LoadingIndicator /> ;
49+ if ( ! applyInterestImageUrl || ! exploreGuestImageUrl ) return < LoadingIndicator /> ;
4950
5051 return (
5152 < PageLayout title = "Home" hidePageTitle >
@@ -59,105 +60,26 @@ const IntroGuestHomePage = () => {
5960 alignItems : 'center' ,
6061 flexDirection : { xs : 'column' , md : 'row' } ,
6162 mt : 4 ,
62- padding : '20px' ,
63- px : { xs : 1 , sm : 2 } ,
64- width : '100%' ,
65- boxSizing : 'border-box' ,
66- overflow : 'hidden'
63+ padding : '20px'
6764 } }
6865 >
69- < Box sx = { { width : '100%' , minWidth : 0 } } >
70- < FeaturedProjects />
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+ />
7179 </ Box >
7280 </ Box >
7381 </ PageLayout >
7482 ) ;
7583} ;
7684
7785export default IntroGuestHomePage ;
78-
79- // import { Typography, Box } from '@mui/material';
80- // import PageLayout from '../../components/PageLayout';
81- // import ImageWithButton from './components/ImageWithButton';
82- // import { useHistory } from 'react-router-dom';
83- // import { routes } from '../../utils/routes';
84- // import { useCurrentUser } from '../../hooks/users.hooks';
85- // import { useEffect } from 'react';
86- // import { useHomePageContext } from '../../app/HomePageContext';
87- // import { useCurrentOrganization } from '../../hooks/organizations.hooks';
88- // import LoadingIndicator from '../../components/LoadingIndicator';
89- // import ErrorPage from '../ErrorPage';
90- // import { useGetImageUrl } from '../../hooks/onboarding.hook';
91-
92- // const IntroGuestHomePage = () => {
93- // const user = useCurrentUser();
94- // const history = useHistory();
95- // const {
96- // data: organization,
97- // isLoading: organizationIsLoading,
98- // isError: organizationIsError,
99- // error: organizationError
100- // } = useCurrentOrganization();
101- // const { setCurrentHomePage } = useHomePageContext();
102-
103- // const {
104- // data: applyInterestImageUrl,
105- // isLoading: applyImageLoading,
106- // isError: applyImageIsError,
107- // error: applyImageError
108- // } = useGetImageUrl(organization?.applyInterestImageId ?? null);
109- // const {
110- // data: exploreGuestImageUrl,
111- // isLoading: exploreImageLoading,
112- // isError: exploreImageIsError,
113- // error: exploreImageError
114- // } = useGetImageUrl(organization?.exploreAsGuestImageId ?? null);
115-
116- // useEffect(() => {
117- // setCurrentHomePage('guest');
118- // }, [setCurrentHomePage]);
119-
120- // if (organizationIsError) {
121- // return <ErrorPage message={organizationError.message} />;
122- // }
123- // if (applyImageIsError) return <ErrorPage message={applyImageError.message} />;
124- // if (exploreImageIsError) return <ErrorPage message={exploreImageError.message} />;
125-
126- // if (!organization || organizationIsLoading || applyImageLoading || exploreImageLoading) return <LoadingIndicator />;
127- // if (!applyInterestImageUrl || !exploreGuestImageUrl) return <LoadingIndicator />;
128-
129- // return (
130- // <PageLayout title="Home" hidePageTitle>
131- // <Typography variant="h3" textAlign="center" sx={{ mt: 2, pt: 3 }}>
132- // {user ? `Welcome, ${user.firstName}!` : 'Welcome, Guest!' }
133- // </Typography>
134- // <Box
135- // sx={{
136- // display: 'flex',
137- // justifyContent: 'center',
138- // alignItems: 'center',
139- // flexDirection: { xs: 'column', md: 'row' },
140- // mt: 4,
141- // padding: '20px'
142- // }}
143- // >
144- // <Box sx={{ display: 'flex', gap: 5 }}>
145- // <ImageWithButton
146- // title="Interested in applying"
147- // imageSrc={applyInterestImageUrl}
148- // buttonText="Learn More"
149- // onClick={() => history.push(routes.HOME_PNM)}
150- // />
151- // <ImageWithButton
152- // title="Explore Our Work as a Guest"
153- // imageSrc={exploreGuestImageUrl}
154- // buttonText="FinishLine"
155- // onClick={() => history.push(routes.HOME_MEMBER)}
156- // />
157- // </Box>
158- // </Box>
159- // </PageLayout>
160- // );
161- // };
162-
163- // export default IntroGuestHomePage;
0 commit comments