diff --git a/app/(pages)/(event-page)/event/page.tsx b/app/(pages)/(event-page)/event/page.tsx index 34f59ca6..7cd01eb6 100644 --- a/app/(pages)/(event-page)/event/page.tsx +++ b/app/(pages)/(event-page)/event/page.tsx @@ -8,19 +8,35 @@ import RiverCow from '../../(index-page)/_components/RiverCow/RiverCow'; import BottomSection from '../../(index-page)/_components/BottomSection/BottomSection'; import Sponsors from '../../(index-page)/_components/Sponsors/Sponsors'; import Resources from '../../(index-page)/_components/Resources/Resources'; +// import Schedule from '../event/schedule/_components/Schedule'; import { resourcePackDOE } from '../../_data/resourceData'; +// import Link from 'next/link'; export default function Home() { return ( -
+
+ {/*
+ + + +
*/}
diff --git a/app/(pages)/(event-page)/event/schedule/_components/Calculations.ts b/app/(pages)/(event-page)/event/schedule/_components/Calculations.ts index 194606ba..aeb1ac0c 100644 --- a/app/(pages)/(event-page)/event/schedule/_components/Calculations.ts +++ b/app/(pages)/(event-page)/event/schedule/_components/Calculations.ts @@ -32,7 +32,7 @@ export function generate24HRClock(startTime: Date): Date[] { export function createTimeChunks(events: Event[]): TimeChunk[] { const timeChunks: TimeChunk[] = []; - console.log(events); + // console.log(events); const sortedEvents = events.sort( (a, b) => a.startTime.getTime() - b.startTime.getTime() diff --git a/app/(pages)/(event-page)/event/schedule/_components/Schedule.tsx b/app/(pages)/(event-page)/event/schedule/_components/Schedule.tsx index d0cbf416..850a22f0 100644 --- a/app/(pages)/(event-page)/event/schedule/_components/Schedule.tsx +++ b/app/(pages)/(event-page)/event/schedule/_components/Schedule.tsx @@ -7,6 +7,7 @@ import type { TimeChunk, Event } from '@/public/types/Schedule.types'; import { createTimeChunks } from './Calculations'; import Filters from './Filters'; import { getAllEvents } from '@/app/(api)/_actions/events/getEvents'; +import { useRef } from 'react'; type ScheduleDay = { dayString: string; @@ -63,6 +64,7 @@ export default function Schedule() { const [allEvents, setAllEvents] = useState([]); const [startTime, setStartTime] = useState(eventDays[0].startDay); const [selectedFilters, setSelectedFilters] = useState(FilterItems); + const timetableRef = useRef(null); //fetching events from DB and creating time chunks useEffect(() => { @@ -84,39 +86,45 @@ export default function Schedule() { return (
-
-

- Schedule -

-
- {currentDay.dayString} -
- setCurrentDay(eventDays[0])} - style={{ - color: currentDay === eventDays[0] ? 'gray' : 'black', - }} - /> - setCurrentDay(eventDays[1])} - style={{ - color: currentDay === eventDays[1] ? 'gray' : 'black', - }} - /> +
+
+

+ Schedule +

+
+ {currentDay.dayString} +
+ setCurrentDay(eventDays[0])} + style={{ + color: currentDay === eventDays[0] ? 'gray' : 'black', + }} + /> + setCurrentDay(eventDays[1])} + style={{ + color: currentDay === eventDays[1] ? 'gray' : 'black', + }} + /> +
+
+ +
-
- +
-
- -
); } diff --git a/app/(pages)/(event-page)/event/schedule/_components/TimeTable.tsx b/app/(pages)/(event-page)/event/schedule/_components/TimeTable.tsx index 3b4f7047..4a1cb120 100644 --- a/app/(pages)/(event-page)/event/schedule/_components/TimeTable.tsx +++ b/app/(pages)/(event-page)/event/schedule/_components/TimeTable.tsx @@ -1,10 +1,12 @@ import { calcEventRows, generate24HRClock } from './Calculations'; import EventContent from './_components/EventContent'; import type { TimeChunk } from '../../../../../../public/types/Schedule.types'; +import { useEffect } from 'react'; interface TimeTableProps { timeChunks: TimeChunk[]; startTime: Date; + timetableRef: React.RefObject; } const colorActivities: Record = { @@ -25,8 +27,33 @@ const highlightColor: Record = { const rowSize = '50px'; -export default function TimeTable({ timeChunks, startTime }: TimeTableProps) { +export default function TimeTable({ + timeChunks, + startTime, + timetableRef, +}: TimeTableProps) { const clockTimes = generate24HRClock(startTime); + useEffect(() => { + const now = new Date(); + + const currentTimeIndex = clockTimes.findIndex( + (time) => + time.getHours() === now.getHours() && + time.getMinutes() === now.getMinutes() + ); + + if (currentTimeIndex !== -1 && timetableRef.current) { + const currentElement = timetableRef.current.children[ + currentTimeIndex + ] as HTMLDivElement; + if (currentElement) { + currentElement.scrollIntoView({ + behavior: 'smooth', + block: 'nearest', + }); + } + } + }, [timetableRef, clockTimes]); // Include timetableRef in the dependency array return (
@@ -37,6 +64,7 @@ export default function TimeTable({ timeChunks, startTime }: TimeTableProps) { gridTemplateColumns: '1fr 15fr', gridAutoRows: rowSize, }} + ref={timetableRef} > {clockTimes.map((time, index) => { const isHour = time.getMinutes() === 0; diff --git a/app/(pages)/(event-page)/event/schedule/page.tsx b/app/(pages)/(event-page)/event/schedule/page.tsx index 4d126c6e..86439da9 100644 --- a/app/(pages)/(event-page)/event/schedule/page.tsx +++ b/app/(pages)/(event-page)/event/schedule/page.tsx @@ -2,7 +2,7 @@ import Schedule from './_components/Schedule'; export default function SchedulePage() { return ( -
+
); diff --git a/app/(pages)/(index-page)/_components/Landing/Landing.module.scss b/app/(pages)/(index-page)/_components/Landing/Landing.module.scss index bc6de3d9..99331625 100644 --- a/app/(pages)/(index-page)/_components/Landing/Landing.module.scss +++ b/app/(pages)/(index-page)/_components/Landing/Landing.module.scss @@ -41,6 +41,7 @@ $tablet-breakpoint: 1007px; .landing_container{ width: 100%; + // height: 80%; position: relative; overflow: hidden; diff --git a/app/(pages)/(index-page)/_components/Landing/Landing.tsx b/app/(pages)/(index-page)/_components/Landing/Landing.tsx index 8b278c0e..19bca92f 100644 --- a/app/(pages)/(index-page)/_components/Landing/Landing.tsx +++ b/app/(pages)/(index-page)/_components/Landing/Landing.tsx @@ -5,7 +5,7 @@ import styles from './Landing.module.scss'; export default function Landing() { return ( -
+
diff --git a/app/(pages)/(index-page)/_components/WhatIsHackdavis/WhatIsHackdavis.tsx b/app/(pages)/(index-page)/_components/WhatIsHackdavis/WhatIsHackdavis.tsx index 99c3a39d..92b2a050 100644 --- a/app/(pages)/(index-page)/_components/WhatIsHackdavis/WhatIsHackdavis.tsx +++ b/app/(pages)/(index-page)/_components/WhatIsHackdavis/WhatIsHackdavis.tsx @@ -2,6 +2,7 @@ import { useEffect, useState, useRef } from 'react'; import styles from './WhatIsHackdavis.module.scss'; import Image from 'next/image'; +import { usePathname } from 'next/navigation'; // Import useRouter // statically import images import logLeftRock from 'public/index/whatIsHackdavis/log_left-rock.png'; @@ -39,15 +40,20 @@ export default function WhatIsHackdavis() { }; }, []); + const pathname = usePathname(); + const isDOE = pathname.includes('event'); + return (
-
-

What is HackDavis?

-

- HackDavis is one of the top 50 hackathons in the world, where over 750 - creators, and leaders come together to create for social good. -

-
+ {!isDOE && ( +
+

What is HackDavis?

+

+ HackDavis is one of the top 50 hackathons in the world, where over + 750 creators, and leaders come together to create for social good. +

+
+ )}
, title: 'CREATOR JAMS', url: 'temp' }, + { + icon: , + title: 'CREATOR JAMS', + url: 'https://open.spotify.com/playlist/5Izx2G67iaShHyLeShoOaK?si=LonAnRy-TXySP51NDfbZvw&pi=u-hA1Wp2ebTNWb', + }, { icon: event map logo., @@ -40,4 +46,9 @@ export const resourcePackDOE: ResourceType[] = [ title: 'SAFETY INFO', url: 'https://www.notion.so/hackdavis/HackDavis-Safety-42561065cd254194bc26bcf48432f36a', }, + { + icon: , + title: 'SCHEDULE', + url: '/event/schedule', + }, ];