Skip to content

Commit db761de

Browse files
author
Ryan Hodge
committed
Fix events page
1 parent 6287527 commit db761de

File tree

7 files changed

+30
-20
lines changed

7 files changed

+30
-20
lines changed

.github/workflows/deploy.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ name: Deploy Next.js site to Pages
1212
# # Allows you to run this workflow manually from the Actions tab
1313
# workflow_dispatch:
1414

15-
# on: [push]
15+
on: [push]
1616

1717
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1818
permissions:
@@ -28,7 +28,7 @@ concurrency:
2828

2929
defaults:
3030
run:
31-
working-directory: ./templerobotics.github.io
31+
working-directory: ./
3232

3333
jobs:
3434
# Build job
@@ -68,7 +68,7 @@ jobs:
6868
- name: Restore cache
6969
uses: actions/cache@v4
7070
with:
71-
path: ./templerobotics.github.io/.next/cache
71+
path: ./.next/cache
7272
# Generate a new cache whenever packages or source files change.
7373
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
7474
# If source files changed but packages didn't, rebuild from a prior cache.
@@ -84,7 +84,7 @@ jobs:
8484
- name: Upload artifact
8585
uses: actions/upload-pages-artifact@v3
8686
with:
87-
path: ./templerobotics.github.io/out
87+
path: ./out
8888

8989
# Deployment job
9090
deploy:

.github/workflows/node.js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
name: Node.js CI
55

6-
on: [push]
6+
# on: [push]
77

88
jobs:
99
build:

components/events/EventsSection.tsx

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,39 @@
1+
'use client'
12
import { EventProps, events } from './EventsData'
23
import styles from './EventsSection.module.css'
34

4-
import React from 'react'
5+
import React, { useEffect, useState } from 'react'
6+
7+
const dayOfWeek = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
58

69
const EventsSection = (): React.ReactElement => {
7-
const removePastEvents = (): EventProps[] => {
10+
const [futureEvents, setFutureEvents] = useState<EventProps[]>([])
11+
12+
useEffect(() => {
813
const currentDate = new Date();
914
currentDate.setHours(23, 59, 0, 0)
1015
const updatedEventsWithDates = events.map(event => {
11-
if (event.endDate && event.endDate.getTime() > currentDate.getTime()) {
16+
const newEvent: EventProps = JSON.parse(JSON.stringify(event))
17+
newEvent.date = new Date(newEvent.date)
18+
if (newEvent.endDate) {
19+
newEvent.endDate = new Date(newEvent.endDate)
20+
}
21+
if (newEvent.endDate && newEvent.endDate.getTime() > currentDate.getTime()) {
1222
// Set date to be the next event occurrence if weekly
13-
const dayOffset = (7 + event.date.getDay() - currentDate.getDay()) % 7
23+
const dayOffset = (7 + newEvent.date.getDay() - currentDate.getDay()) % 7
1424
const nextOccurrence = new Date(currentDate.getTime() + dayOffset * 24 * 60 * 60 * 1000)
15-
nextOccurrence.setHours(event.date.getHours(), event.date.getMinutes())
16-
event.date = nextOccurrence
25+
nextOccurrence.setHours(newEvent.date.getHours(), newEvent.date.getMinutes())
26+
newEvent.date = nextOccurrence
1727
}
18-
return event
28+
return newEvent
1929
});
2030
const filteredEvents = updatedEventsWithDates.filter(event => event.date.getTime() > currentDate.getTime())
21-
return filteredEvents
22-
}
31+
setFutureEvents(filteredEvents)
32+
}, [])
2333

2434
return (
2535
<div className={`flex-vertical ${styles.container}`}>
26-
{removePastEvents().map((event, i) => <EventRow key={i} event={event}/>)}
36+
{futureEvents.map((event, i) => <EventRow key={i} event={event}/>)}
2737
</div>
2838
)
2939
}
@@ -33,7 +43,7 @@ const EventRow = ({ event }: { event: EventProps }): React.ReactElement => {
3343
<div className={styles.eventRow}>
3444
<div className={`flex-vertical ${styles.eventRowLeft}`}>
3545
<div className={`sub-section-header-text`}>{event.date.getMonth() + 1}/{event.date.getDate()}</div>
36-
{event.endDate && <div>Weekly on Monday&apos;s</div>}
46+
{event.endDate && <div>Weekly on {dayOfWeek[event.date.getDay()]}&apos;s</div>}
3747
</div>
3848
<div className={styles.eventRowRight}>
3949
<div className={`flex-horizontal sub-section-header-text`}>{event.title}</div>

components/navigation/DropDownMenu.module.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333
}
3434

3535
.menuItem:last-child {
36-
border-bottom-left-radius: 8;
37-
border-bottom-right-radius: 8;
36+
border-bottom-left-radius: 8px;
37+
border-bottom-right-radius: 8px;
3838
}

components/rocksat/RocksatData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import img5 from '@assets/images/rocksat-photo-gallery/rocksat-2015.jpg'
99
import img6 from '@assets/images/rocksat-photo-gallery/rocksat-2014-3.jpg'
1010
import img7 from '@assets/images/rocksat-photo-gallery/rocksat-2014-2.jpg'
1111
import img8 from '@assets/images/rocksat-photo-gallery/rocksat-2014-1.jpg'
12-
import img9 from '@assets/images/rocksat-photo-gallery/rocksat-2011.jpg'
12+
import img9 from '@assets/images/rocksat-photo-gallery/rocksat-2011.bmp'
1313

1414
export const rocksatPhotoGallery: PhotoComponentProps[] = [
1515
{ image: img1, title: '2020', content: 'This group developed a payload to collect air samples via atmospheric port at varying altitudes to evaluate ozone and CFC levels' },

styles/theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const theme = createTheme({
2828
color: 'var(--foreground)',
2929
backgroundColor: 'transparent',
3030
borderColor: 'var(--foreground)',
31-
borderRadius: 8,
31+
borderRadius: '8px',
3232
transition: 'color 500ms, background-color 500ms',
3333
'&:hover': {
3434
color: 'var(--primary)',

0 commit comments

Comments
 (0)