Skip to content

Commit 697fb44

Browse files
committed
#3873 working frontend
1 parent 4cc9863 commit 697fb44

5 files changed

Lines changed: 126 additions & 56 deletions

File tree

src/backend/src/prisma/schema.prisma

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,12 +1027,12 @@ enum DayOfWeek {
10271027
}
10281028

10291029
model Schedule_Slot {
1030-
scheduleSlotId String @id @default(uuid())
1031-
startTime DateTime
1032-
endTime DateTime
1033-
allDay Boolean @default(false)
1034-
eventId String
1035-
event Event @relation(fields: [eventId], references: [eventId])
1030+
scheduleSlotId String @id @default(uuid())
1031+
startTime DateTime
1032+
endTime DateTime
1033+
allDay Boolean @default(false)
1034+
eventId String
1035+
event Event @relation(fields: [eventId], references: [eventId])
10361036
10371037
@@index([endTime])
10381038
@@index([startTime])
@@ -1088,7 +1088,7 @@ model Event {
10881088
shops Shop[]
10891089
machinery Machinery[]
10901090
workPackages Work_Package[]
1091-
documents Document[]
1091+
documents Document[]
10921092
status Event_Status
10931093
initialDateScheduled DateTime?
10941094
questionDocumentLink String?
@@ -1322,6 +1322,8 @@ model Organization {
13221322
partReviewSampleImageId String?
13231323
partReviewGuideLink String?
13241324
sponsorshipNotificationsSlackChannelId String?
1325+
finishlineDescription String @default("")
1326+
finishlineLogo String @default("")
13251327
13261328
// Relation references
13271329
wbsElements WBS_Element[]

src/backend/src/prisma/seed.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ const performSeed: () => Promise<void> = async () => {
128128
applyInterestImageId: '1_iak6ord4JP9TcR1sOYopyEs6EjTKQpw',
129129
exploreAsGuestImageId: '1wRes7V_bMm9W7_3JCIDXYkMUiy6B3wRI',
130130
applicationLink:
131-
'https://docs.google.com/forms/d/e/1FAIpQLSeCvG7GqmZm_gmSZiahbVTW9ZFpEWG0YfGQbkSB_whhHzxXpA/closedform'
131+
'https://docs.google.com/forms/d/e/1FAIpQLSeCvG7GqmZm_gmSZiahbVTW9ZFpEWG0YfGQbkSB_whhHzxXpA/closedform',
132+
finishlineDescription:
133+
'Finishline is a Project Management Dashboard developed by the Software Team at Northeastern Electric Racing.',
134+
finishlineLogo: '1auQO3GYydZOo1-vCn0D2iyCfaxaVFssx'
132135
}
133136
});
134137

src/frontend/src/pages/HomePage/IntroGuestHomePage.tsx

Lines changed: 107 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
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';
74
import { useEffect } from 'react';
85
import { useHomePageContext } from '../../app/HomePageContext';
96
import { useCurrentOrganization } from '../../hooks/organizations.hooks';
107
import LoadingIndicator from '../../components/LoadingIndicator';
118
import ErrorPage from '../ErrorPage';
129
import { 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

1416
const 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

src/frontend/src/pages/HomePage/components/FeaturedProjects.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { wbsPipe } from 'shared';
1010
import LoadingIndicator from '../../../components/LoadingIndicator';
1111
import ScrollablePageBlock from './ScrollablePageBlock';
1212
import EmptyPageBlockDisplay from './EmptyPageBlockDisplay';
13-
import { Box } from '@mui/material';
13+
import { Box, useMediaQuery, useTheme } from '@mui/material';
1414
import { Error } from '@mui/icons-material';
1515

1616
const NoFeaturedProjectsDisplay: React.FC = () => {
@@ -35,13 +35,15 @@ const NoFeaturedProjectsDisplay: React.FC = () => {
3535
};
3636

3737
const FeaturedProjects: React.FC = () => {
38+
const theme = useTheme();
39+
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
3840
const { data: featuredProjects, isLoading, isError, error } = useFeaturedProjects();
3941

4042
if (isLoading || !featuredProjects) return <LoadingIndicator />;
4143
if (isError) return <ErrorPage error={error} message={error.message} />;
4244

4345
const fullDisplay = (
44-
<ScrollablePageBlock title={`Featured Projects`} horizontal>
46+
<ScrollablePageBlock title={`What We're Working On`} horizontal={!isMobile}>
4547
{featuredProjects.length === 0 ? (
4648
<NoFeaturedProjectsDisplay />
4749
) : (

src/shared/src/types/user-types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ export interface Organization {
7272
slackWorkspaceId?: string;
7373
partReviewGuideLink?: string;
7474
sponsorshipNotificationsSlackChannelId?: string;
75+
finishlineDescription: string;
76+
finishlineLogo: string;
7577
}
7678

7779
/**

0 commit comments

Comments
 (0)