Skip to content

Commit

Permalink
Merge pull request #96 from ecss-soton/events-fix
Browse files Browse the repository at this point in the history
added times to events and fixed next event bug
  • Loading branch information
casperUoS authored Sep 18, 2024
2 parents 636b3c3 + 0b2e479 commit 2fa268b
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/app/_blocks/NextEvent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const NextEventBlock: React.FC<
{
depth: 1,
limit: 1,
sort: 'date',
sort: '-date',
},
{ encode: false },
)
Expand Down
1 change: 1 addition & 0 deletions src/app/_components/CollectionArchive/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ export const CollectionArchive: React.FC<Props> = props => {
date={isPopUpVisible.date}
description={isPopUpVisible.description}
location={isPopUpVisible.location}
endTime={isPopUpVisible.endTime}
onEventClick={EventClick}
/>
)}
Expand Down
39 changes: 27 additions & 12 deletions src/app/_components/EventPopUp/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
display: flex;
flex-direction: column;
padding-left: 20px;
flex: 70%;
}

.name {
Expand Down Expand Up @@ -107,8 +108,7 @@
}

.bio {
flex: 70%;
padding-top: 30px;
// flex: 70%;
padding-left: 5%;
padding-right: 5%;
font-size: 20px;
Expand All @@ -120,13 +120,10 @@
text-align: center;
padding-left: 10%;
padding-right: 10%;
display: flex;
display: inline-flex;
flex-direction: column;
justify-content: center;

@include extra-small-break {
width: 100%;
}
}

.date {
Expand All @@ -136,9 +133,9 @@
letter-spacing: 0;
line-height: normal;

// @include extra-small-break {
// font-size: 18vw;
// }
@include extra-small-break {
font-size: 10vw;
}
}

.month {
Expand All @@ -149,9 +146,27 @@
line-height: normal;
width: 100%;

// @include extra-small-break {
// font-size: 7vw;
// }
@include extra-small-break {
font-size: 6vw;
}
}

.time {
color: var(--theme-elevation-400);
font-size: 20px;
font-weight: 400;
letter-spacing: 0;
line-height: normal;
width: 100%;
white-space: nowrap;

@include small-break {
white-space: wrap;
}

@include extra-small-break {
font-size: 4vw;
}
}


Expand Down
14 changes: 13 additions & 1 deletion src/app/_components/EventPopUp/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface PopUpProps {
date: string
location: string | null
description: string | null
endTime: string | null
onEventClick: (event: Event | null) => void
}

Expand All @@ -28,6 +29,7 @@ export const EventPopUp: React.FC<PopUpProps> = ({
date,
location,
description,
endTime,
onEventClick,
}) => {
const closeClick = () => {
Expand Down Expand Up @@ -57,7 +59,12 @@ export const EventPopUp: React.FC<PopUpProps> = ({
const month = parseInt(dateParts[1], 10)
const day = dateParts[2].split('T')[0]
const monthName = getMonthName(month)

const time = dateParts[2].split('T')[1].split(':').slice(0, 2).join(':')
let concEndTime: string | null = null
if (endTime) {
const endTimeParts = endTime.split('-')
concEndTime = endTimeParts[2].split('T')[1].split(':').slice(0, 2).join(':')
}
return (
<>
<div className={[classes.background, inter.className].join(' ')} onClick={closeClick} />
Expand All @@ -67,6 +74,11 @@ export const EventPopUp: React.FC<PopUpProps> = ({
<div className={classes.when}>
<div className={classes.date}>{day}</div>
<div className={classes.month}>{monthName}</div>
{endTime ? (
<span className={classes.time}>{time + ' - ' + concEndTime}</span>
) : (
<span className={classes.time}>{time}</span>
)}
</div>
<div className={classes.bits}>
<span className={classes.name}>{name}</span>
Expand Down
10 changes: 10 additions & 0 deletions src/payload/collections/Events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ const Events: CollectionConfig = {
},
},
},
{
name: 'endTime',
label: 'End Time',
type: 'date',
admin: {
date: {
pickerAppearance: 'timeOnly',
},
},
},
{
name: 'location',
label: 'Location',
Expand Down
1 change: 1 addition & 0 deletions src/payload/payload-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,7 @@ export interface Event {
id: string;
name: string;
date: string;
endTime?: string | null;
location?: string | null;
description?: string | null;
updatedAt: string;
Expand Down

0 comments on commit 2fa268b

Please sign in to comment.