Skip to content

Commit

Permalink
Add events page
Browse files Browse the repository at this point in the history
  • Loading branch information
sidlak-c137 committed Sep 5, 2023
1 parent 1ea7a15 commit e0e7690
Show file tree
Hide file tree
Showing 7 changed files with 223 additions and 36 deletions.
72 changes: 72 additions & 0 deletions frontend-v2/components/EventPanel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import {
Image,
Box,
Skeleton,
Flex,
Text,
VStack,
} from "@chakra-ui/react";

interface IEventPanel {
name: string;
date: Date;
location: string;
description: string;
image: string;
loading: boolean;
}

export default function EventPanel(props: IEventPanel) {
const {name, date, location, description, image, loading} = props;

return (
<Flex
id='meeting-info'
height='450px'
direction='row'
width='80vw'
maxW='1500px'
bgGradient='linear(to-t, brand.mid_purple, brand.hot_pink)'
borderRadius='30px'
alignItems='center'
marginBottom='50px'
>
<Box width='30vw' maxW='500px'>
<Skeleton isLoaded={!loading}>
<Image
src={image}
alt={name}
height='350px'
width='350px'
marginLeft='50px'
borderRadius='15px'
objectFit='cover'
/>
</Skeleton>
</Box>
<VStack width='50vw' maxWidth='1000px'>
<Skeleton isLoaded={!loading} width='100%'>
<Box justifyContent='flex-start' width='100%'>
<Text fontSize='4xl' fontWeight='bold' color='white'>
{name}
</Text>
</Box>
</Skeleton>
<Skeleton isLoaded={!loading} width='100%'>
<Box justifyContent='flex-start' width='100%'>
<Text fontSize='xl' fontWeight='bold' color='white'>
{date.toLocaleDateString()}{location}
</Text>
</Box>
</Skeleton>
<Skeleton isLoaded={!loading} width='100%' height='200px' marginTop='30px'>
<Box justifyContent='flex-start' width='100%'>
<Text fontSize='xl' color='white'>
{description}
</Text>
</Box>
</Skeleton>
</VStack>
</Flex>
);
}
2 changes: 1 addition & 1 deletion frontend-v2/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function Header(props: { showSidebar: () => void }) {
size='lg'
icon={
<FontAwesomeIcon
height='40px'
height='30px'
color='white'
icon={faBars}
/>
Expand Down
7 changes: 5 additions & 2 deletions frontend-v2/components/Room.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { useMediaQuery } from "@chakra-ui/react";

export default function Room() {
const [isLargerThan1200] = useMediaQuery("(min-width: 1200px)");
return (
<iframe
title="OUG141"
id="home-vr"
allowFullScreen
width='740px'
height='370px'
width='100%'
height='100%'
src="https://www.washington.edu/classroom/vrview/index.html?image=https://features.classrooms.uw.edu/room-images/panoramas/MEB_238_panorama.jpg&"
/>
);
Expand Down
88 changes: 88 additions & 0 deletions frontend-v2/pages/events.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { Inter } from "@next/font/google";
import {
Center,
VStack,
Text,
} from "@chakra-ui/react";
// @ts-ignore
import { getAllEvents } from "@/utils/api";
import { lazy, useEffect, useState } from "react";
import { IEventInfo } from "utils/parsers";
import EventPanel from "components/EventPanel";

const Room = lazy(() => import("components/Room"));
const inter = Inter({ subsets: ["latin"] });

function Title() {
return (
<Center>
<Text
as='h2'
color='white'
fontSize='6xl'
fontWeight='semibold'
>
Events
</Text>
</Center>
);
}


interface IDisplayProps {
events: IEventInfo[];
loading: boolean;
}

function DisplayEvents(props: IDisplayProps) {
const { events, loading } = props;

return (
<VStack>
{events.map((event: IEventInfo) =>
<EventPanel
key={event.name}
name={event.name}
date={event.date}
location={event.location}
description={event.description}
image={event.image ?? "/HCPLogo.webp"}
loading={loading}
/>
)}
</VStack>
);
}

export default function Events() {
// Scroll to top of page
useEffect(() => {
window.scrollTo(0, 0);
}, []);

const [events, setEvents] = useState<IEventInfo[]>([
{
date: new Date("3/21/2023"),
name: "Default Event",
location: "Default Location",
description: "Long".repeat(100),
image: "",
},
]);
const [loading, setLoading] = useState<boolean>(true);

useEffect(() => {
const getData = (data: IEventInfo[]) => {
setEvents(data);
setLoading(false);
}
getAllEvents(getData, true);
}, []);

return (
<VStack spacing='40px'>
<Title />
<DisplayEvents events={events} loading={loading}/>
</VStack>
);
}
74 changes: 42 additions & 32 deletions frontend-v2/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
Box,
Text,
IconButton,
Wrap,
WrapItem,
} from "@chakra-ui/react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faArrowDown } from "@fortawesome/free-solid-svg-icons";
Expand Down Expand Up @@ -156,9 +158,11 @@ function FeaturedEvents() {
<Text
as='h2'
color='white'
fontSize='6xl'
fontSize={[ "4xl", "4xl", "6xl" ]}
fontWeight='semibold'
marginTop='8'
align='center'
width='70%'
>
Featured Events
</Text>
Expand All @@ -182,13 +186,16 @@ function MeetingInfo() {
bgGradient='linear(to-t, brand.mid_purple, brand.hot_pink)'
borderRadius='30px'
alignItems='center'
paddingBottom='10px'
>
<Text
as='h2'
color='white'
fontSize='6xl'
fontSize={[ "4xl", "4xl", "6xl" ]}
fontWeight='semibold'
marginTop='8'
align='center'
width='70%'
>
General Meetings
</Text>
Expand All @@ -198,20 +205,20 @@ function MeetingInfo() {
marginBottom='50px'
fontSize='2xl'
color='brand.light_brown'
textAlign="center"
align='center'
>
Join us every Thursday from 6:00pm to 7:30pm PST at MEB
(Mechanical Engineering Building) 248!
</Text>
<Box borderRadius='15px' overflow='hidden'>
<Box borderRadius='15px' overflow='hidden' width='70%' height='370px'>
<Room />
</Box>
<Text
width='70%'
marginTop='5px'
fontSize='md'
color='brand.light_brown'
textAlign="center"
align='center'
>
Mechanical Engineering Building Room 248 @ University of
Washington
Expand All @@ -235,48 +242,51 @@ function Values() {
return (
<VStack
id='club-values'
height='600px'
minHeight='400px'
height='fit-content'
direction='column'
width='80vw'
alignItems='center'
marginBottom='150px'
>
<Text
as='h2'
color='white'
fontSize='6xl'
fontSize={[ "4xl", "4xl", "6xl" ]}
fontWeight='semibold'
marginTop='8'
align='center'
>
Club Values
</Text>
<Flex direction='row' width='100%' justifyContent='center'>
<Wrap spacing='20' justify='center' paddingTop='80px'>
{slogans.map((slogan) => (
<VStack
direction='column'
width='200px'
marginX='40px'
alignItems='center'
paddingTop='80px'
key={slogan.name}
>
<Image
width={125}
height={125}
style={{ width: 'auto', height: '125px' }}
src={slogan.icon}
alt={slogan.name}
/>
<Text
marginTop='25px'
fontSize='2xl'
color='white'
textAlign="center"
<WrapItem>
<VStack
direction='column'
width='200px'
alignItems='center'
key={slogan.name}
>
{slogan.name}
</Text>
</VStack>
<Image
width={125}
height={125}
style={{ width: 'auto', height: '125px' }}
src={slogan.icon}
alt={slogan.name}
/>
<Text
marginTop='25px'
fontSize='2xl'
color='white'
align='center'
>
{slogan.name}
</Text>
</VStack>
</WrapItem>
))}
</Flex>
</Wrap>
</VStack>
);
}
Expand Down
14 changes: 14 additions & 0 deletions frontend-v2/pages/projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,20 @@ function DisplayProjects(props: IDisplayProps) {
} else {
filteredProjects = filterProjects();
}
if (filteredProjects.length === 0) {
return (
<VStack paddingBottom={100}>
<Text
as='h6'
color='white'
fontSize='2xl'
fontWeight='semibold'
>
No projects found :(
</Text>
</VStack>
);
}
return (
<SimpleGrid columns={[1, 1, 2, 2, 3]} spacing='40px'>
{filteredProjects.map((project: IProjectInfo) =>
Expand Down
2 changes: 1 addition & 1 deletion frontend-v2/utils/parsers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface IProjectInfo {
}

// rome-ignore lint/suspicious/noExplicitAny: The backend does not have types
export const parseProjects = (data: any[]) => {
export const parseProjects = (data: any[]) => {
const ret = data.map(obj => {
const res: IProjectInfo = {
name: obj.Name,
Expand Down

0 comments on commit e0e7690

Please sign in to comment.