@@ -7,26 +7,33 @@ import { useCurrentUser } from '../../hooks/users.hooks';
77import { useEffect } from 'react' ;
88import { useHomePageContext } from '../../app/HomePageContext' ;
99import { useCurrentOrganization } from '../../hooks/organizations.hooks' ;
10+ import LoadingIndicator from '../../components/LoadingIndicator' ;
1011import ErrorPage from '../ErrorPage' ;
12+ import { useGetImageUrl } from '../../hooks/onboarding.hook' ;
1113
1214const IntroGuestHomePage = ( ) => {
1315 const user = useCurrentUser ( ) ;
1416 const history = useHistory ( ) ;
15- const { isError : organizationIsError , error : organizationError } = useCurrentOrganization ( ) ;
17+ const {
18+ data : organization ,
19+ isLoading : organizationIsLoading ,
20+ isError : organizationIsError ,
21+ error : organizationError
22+ } = useCurrentOrganization ( ) ;
1623 const { setCurrentHomePage } = useHomePageContext ( ) ;
1724
18- // const {
19- // data: applyInterestImageUrl,
20- // isLoading: applyImageLoading,
21- // isError: applyImageIsError,
22- // error: applyImageError
23- // } = useGetImageUrl(organization?.applyInterestImageId ?? null);
24- // const {
25- // data: exploreGuestImageUrl,
26- // isLoading: exploreImageLoading,
27- // isError: exploreImageIsError,
28- // error: exploreImageError
29- // } = 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 ) ;
3037
3138 useEffect ( ( ) => {
3239 setCurrentHomePage ( 'guest' ) ;
@@ -35,11 +42,11 @@ const IntroGuestHomePage = () => {
3542 if ( organizationIsError ) {
3643 return < ErrorPage message = { organizationError . message } /> ;
3744 }
38- // if (applyImageIsError) return <ErrorPage message={applyImageError.message} />;
39- // if (exploreImageIsError) return <ErrorPage message={exploreImageError.message} />;
45+ if ( applyImageIsError ) return < ErrorPage message = { applyImageError . message } /> ;
46+ if ( exploreImageIsError ) return < ErrorPage message = { exploreImageError . message } /> ;
4047
41- // if (!organization || organizationIsLoading || applyImageLoading || exploreImageLoading) return <LoadingIndicator />;
42- // if (!applyInterestImageUrl || !exploreGuestImageUrl) return <LoadingIndicator />;
48+ if ( ! organization || organizationIsLoading || applyImageLoading || exploreImageLoading ) return < LoadingIndicator /> ;
49+ if ( ! applyInterestImageUrl || ! exploreGuestImageUrl ) return < LoadingIndicator /> ;
4350
4451 return (
4552 < PageLayout title = "Home" hidePageTitle >
@@ -59,13 +66,13 @@ const IntroGuestHomePage = () => {
5966 < Box sx = { { display : 'flex' , gap : 5 } } >
6067 < ImageWithButton
6168 title = "Interested in applying"
62- imageSrc = { '' }
69+ imageSrc = { applyInterestImageUrl }
6370 buttonText = "Learn More"
6471 onClick = { ( ) => history . push ( routes . HOME_PNM ) }
6572 />
6673 < ImageWithButton
6774 title = "Explore Our Work as a Guest"
68- imageSrc = { '' }
75+ imageSrc = { exploreGuestImageUrl }
6976 buttonText = "FinishLine"
7077 onClick = { ( ) => history . push ( routes . HOME_MEMBER ) }
7178 />
0 commit comments