Skip to content

Commit

Permalink
Edit event detail page to make it compile?
Browse files Browse the repository at this point in the history
  • Loading branch information
JiashuHarryHuang committed Nov 11, 2023
1 parent 8fc48fd commit f4c7527
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions components/Event/Event.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QueriedVolunteerEventData } from 'bookem-shared/src/types/database';
import { QueriedVolunteerEventDTO } from 'bookem-shared/src/types/database';
import React, { useState } from 'react';
import Header from '@/components/Event/Header';
import BookIcon from '@/components/Event/BookIcon';
Expand All @@ -21,7 +21,7 @@ import { BOOKEM_THEME } from '@/utils/constants';
* Event Detail
* @param event Data about the event
*/
const Event = ({ event }: { event: QueriedVolunteerEventData }) => {
const Event = ({ event }: { event: QueriedVolunteerEventDTO }) => {
/**
* True: display About
* False: display Contact
Expand Down
10 changes: 5 additions & 5 deletions components/Event/EventName.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QueriedVolunteerEventData } from 'bookem-shared/src/types/database';
import { QueriedVolunteerEventDTO } from 'bookem-shared/src/types/database';
import React, { useEffect } from 'react';
import {
EventNameBox,
Expand All @@ -15,7 +15,7 @@ import Image from 'next/image';
* Calculate the length of the event volunteers
* If event.volunteers is undefined, return 0
*/
export const getEventLength = (event: QueriedVolunteerEventData) => {
export const getEventLength = (event: QueriedVolunteerEventDTO) => {
if (event.volunteers && event.volunteers.length)
return event.volunteers.length;
else return 0;
Expand All @@ -33,7 +33,7 @@ const EventName = ({
}: {
signedUp: boolean;
setSignedUp: (signedUp: boolean) => void;
event: QueriedVolunteerEventData;
event: QueriedVolunteerEventDTO;
signUpEvent: () => void;
}) => {
const { data: session } = useSession();
Expand All @@ -54,7 +54,7 @@ const EventName = ({
<Media greaterThanOrEqual="sm">
<NameAndSpot>
<b>{event.name}</b>
{event.tags.length > 0 && <p>({event.program.tagName})</p>}
{event.tags.length > 0 && <p>({event.program?.name})</p>}
<br />
{getEventLength(event)}/{event.maxSpot} spots filled
</NameAndSpot>
Expand All @@ -66,7 +66,7 @@ const EventName = ({
{/* Mobile */}
<Media lessThan="sm">
<NameAndSpot>
<b>{event.name}</b> <span>({event.program?.tagName}) </span>
<b>{event.name}</b> <span>({event.program?.name}) </span>
<br />
<StatusBox>
<Image src="/event/dot.svg" alt="" width={10} height={10} />
Expand Down
4 changes: 2 additions & 2 deletions components/Event/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SignupButton } from '@/styles/components/Event/event.styles';
import { QueriedVolunteerEventData } from 'bookem-shared/src/types/database';
import { QueriedVolunteerEventDTO } from 'bookem-shared/src/types/database';
import { useSession } from 'next-auth/react';
import React, { useEffect } from 'react';
import { getEventLength } from '@/components/Event/EventName';
Expand All @@ -20,7 +20,7 @@ const Footer = ({
}: {
signedUp: boolean;
setSignedUp: (signedUp: boolean) => void;
event: QueriedVolunteerEventData;
event: QueriedVolunteerEventDTO;
signUpEvent: () => void;
}) => {
// Get user id in session
Expand Down
4 changes: 2 additions & 2 deletions pages/event/[pid].tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Event from '@/components/Event/Event';
import { fetchData } from '@/utils/utils';
import { QueriedVolunteerEventData } from 'bookem-shared/src/types/database';
import { QueriedVolunteerEventDTO } from 'bookem-shared/src/types/database';
import { useRouter } from 'next/router';
import { useEffect, useState } from 'react';

Expand All @@ -12,7 +12,7 @@ const EventDetail = () => {
const router = useRouter();
const { pid } = router.query;

const [event, setEvent] = useState<QueriedVolunteerEventData>();
const [event, setEvent] = useState<QueriedVolunteerEventDTO>();
const [error, setError] = useState<Error>();

// use simple fetch to fetch when component is mounted
Expand Down

0 comments on commit f4c7527

Please sign in to comment.