Skip to content

Commit 851b785

Browse files
committed
event-card
1 parent 6ee0167 commit 851b785

File tree

5 files changed

+193
-26
lines changed

5 files changed

+193
-26
lines changed

frontend/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
<script type="module" src="https://cdn.jsdelivr.net/npm/ldrs/dist/auto/jelly.js"></script>
109109

110110
<link rel="icon" type="image/svg+xml" href="./favicon/favicon.ico" />
111+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,[email protected],100..700,0..1,-50..200&icon_names=close" />
111112
<link rel="apple-touch-icon" sizes="180x180" href="./favicon/apple-touch-icon.png">
112113
<link rel="icon" type="image/png" sizes="32x32" href="./favicon/favicon-32x32.png">
113114
<link rel="icon" type="image/png" sizes="16x16" href="./favicon/favicon-16x16.png">

frontend/package-lock.json

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"react": "18.3.1",
3434
"react-dom": "18.3.1",
3535
"react-fast-marquee": "^1.6.5",
36+
"react-responsive-modal": "^6.4.2",
3637
"react-router-dom": "6.23.0",
3738
"react-simple-maps": "^3.0.0",
3839
"tailwind-merge": "^2.5.2",

frontend/src/components/Home/UpcomingEvents.jsx

Lines changed: 85 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1+
import React from "react";
12
import { Button } from "@nextui-org/button";
23
import { Chip } from "@nextui-org/chip";
34
import { useRef, useEffect, useState } from "react";
5+
import { Modal } from 'react-responsive-modal';
6+
import 'react-responsive-modal/styles.css';
47
import { Link } from "react-router-dom";
8+
import { modal } from "@nextui-org/theme";
59

610
function formatDate(isoDate) {
711
const date = new Date(isoDate);
812
if (isNaN(date.getTime())) return isoDate
913
const options = { year: 'numeric', month: 'long', day: 'numeric' };
1014
return date.toLocaleDateString(undefined, options);
1115
}
12-
function EventCard({ title, date, type = "Workshop", description, isVisible, registrationLink }) {
16+
function EventCard({ title, date, details, moreInfo, registrationLink, imgUrl, type = "Workshop", description, isVisible }) {
1317
const cardRef = useRef(null);
1418
const [visible, setVisible] = useState(isVisible);
19+
const [open, setOpen] = React.useState(false);
20+
const myRef = React.useRef(null);
1521

1622
const eventDate = new Date(date);
1723
const currentDate = new Date();
@@ -30,10 +36,39 @@ function EventCard({ title, date, type = "Workshop", description, isVisible, reg
3036
};
3137
}, []);
3238

39+
const closeIcon = (
40+
<span class="material-symbols-outlined">
41+
close
42+
</span>
43+
);
44+
45+
3346
return (
47+
<>
48+
<div ref={myRef} />
49+
50+
51+
<Modal
52+
open={open}
53+
onClose={() => setOpen(false)}
54+
center
55+
container={myRef.current}
56+
closeIcon={closeIcon}
57+
>
58+
<div className="event-card-info">
59+
<div className="event-img-container">
60+
<img src={imgUrl}></img>
61+
</div>
62+
<h1 className="text-3xl ">{title}</h1>
63+
<p><span className="text-2xl">Event Description : </span><br /><span className="text-1xl">{moreInfo}</span></p>
64+
<p><span className="text-2xl">Event Details : </span><br /><span className="text-1xl">{details[0]}<br />{details[1]}<br />{details[2]}<br /></span></p>
65+
</div>
66+
</Modal>
67+
3468
<div
3569
ref={cardRef}
3670
className={`flex flex-col bg-[#00ff7b] bg-opacity-10 p-5 gap-2 hover:translate-y-[-10px] transition-all outline-1 hover:outline outline-[#00ff7b] sm:max-w-[20vw] sm:min-w-[20vw] max-w-[90vw] min-w-[90vw] overflow-hidden ${visible ? 'opacity-100' : 'opacity-0'}`}
71+
onClick={() => setOpen(true)}
3772
>
3873
<div className="flex flex-col pb-2 gap-2">
3974
<div className="flex justify-between pb-2 gap-2 flex-wrap">
@@ -48,17 +83,21 @@ function EventCard({ title, date, type = "Workshop", description, isVisible, reg
4883
<Button color="danger" variant="flat" radius="none" className="mt-auto" disabled>Event has ended</Button>
4984
) : (
5085
!!registrationLink &&
51-
<a href={registrationLink}>
86+
<a href={registrationLink} className="mt-auto">
5287
<Button color="success" variant="flat" radius="none" className="mt-auto">Register</Button>
5388
</a>
5489
)}
5590
</div>
91+
</>
5692
);
5793
}
5894

5995

6096
export default function UpcomingEvents() {
6197
const events = [
98+
99+
100+
62101
{
63102
title: "Web Security Basics",
64103
date: "2025-01-24T00:00:00Z",
@@ -89,24 +128,6 @@ export default function UpcomingEvents() {
89128
description: "An introductory workshop to mobile app development using native Kotlin for Android apps.",
90129
type: "Workshop"
91130
},
92-
{
93-
title: "Pre-Tesseract Pixel Art Workshop",
94-
date: "Soon",
95-
description: "A creative art workshop before Tesseract events.",
96-
type: "Workshop"
97-
},
98-
{
99-
title: "Tesseract: CodeWars",
100-
date: "Soon",
101-
description: "A competitive coding challenge for all levels, where participants can showcase their skills and win exciting prizes.",
102-
type: "Competition"
103-
},
104-
{
105-
title: "Tesseract: CTF & Treasure Hunt",
106-
date: "Soon",
107-
description: "Capture The Flag and Treasure Hunt events, testing your problem-solving skills and knowledge.",
108-
type: "Competition"
109-
},
110131
{
111132
title: "General AI Workshop",
112133
date: "2025-01-25T00:00:00Z",
@@ -137,32 +158,70 @@ export default function UpcomingEvents() {
137158
description: "Join us for a deep dive into AWS services, focusing on cloud computing essentials.",
138159
type: "Workshop"
139160
},
161+
162+
163+
{
164+
title: "Guardians of the Elements",
165+
date: "19th Oct",
166+
status: "current",
167+
description: "Navigate through real-world locations, solve unique elemental challenges, and unlock hidden clues. This interactive adventure blends technology and nature, as you journey to prove your worth as true Guardians of the Elements!",
168+
moreInfo: "Embark on Guardians of the Elements, a thrilling geolocation-based treasure hunt where you and your team will explore the power of Earth, Fire, Water, Air, and Ether through a custom-built app. Navigate through real-world locations, solve unique elemental challenges, and unlock hidden clues. This interactive adventure blends technology and nature, testing your endurance, intellect, and adaptability as you journey to prove your worth as true Guardians of the Elements!",
169+
details: ["1. Event Timings: 19th October 2024, Saturday 10:00 AM to 12:00 PM", "2. Event Venue: To be conducted throughout the whole campus with various locations for clues", "3. Event Price: Rs. 120 per team"],
170+
imgUrl: "https://i.imgur.com/IX9LTKS.png",
171+
registrationLink: "https://docs.google.com/forms/d/e/1FAIpQLSdN3cQDTvbAwTtJ8OUNFUA9N_ARb64YdIkzW1I-cQy-B0bKgA/viewform",
172+
type: "Treasure hunt"
173+
},
174+
{
175+
title: "Capture The Flag",
176+
date: "19th Oct",
177+
status: "current",
178+
description: "Whether you're cracking cryptography, mastering reverse engineering, or outsmarting digital defenses, this competition has it all.",
179+
moreInfo: "Capture The Flag (CTF), the ultimate thrill ride in cybersecurity, brought to you by our coding club! Ready to put your hacker hat on and dive into a world of puzzles, codes, and challenges? Whether you’re cracking cryptography, mastering reverse engineering, or outsmarting digital defenses, this competition has it all. Our custom-built CTF platform is your playground, where you’ll face off against the best, push your skills to the limit, and compete for the glory of being crowned the top cyber sleuth. Let the games begin!",
180+
details: ["1. Event Timings: 19th October 2024, Saturday 02:00 PM to 05:00 PM", "2. Event Venue: BLT/ Computer Lab", "3. Event Price: Rs. 50 per team"],
181+
imgUrl: "https://i.imgur.com/Dpj6yRA.png",
182+
registrationLink: "https://docs.google.com/forms/d/e/1FAIpQLScSS2SHdhDXWUw2TscHjEwNF8gPJqwRnMP3fC5bArodtTTvnQ/viewform",
183+
type: "Competition"
184+
},
185+
{
186+
title: "Code Tatva",
187+
date: "20th Oct",
188+
status: "current",
189+
description: "Feel the adrenaline of solving challenges? Join Encode's Code Tatva to compete in challenges that tests your foundational coding skills and reasoning.",
190+
moreInfo : "Code Tatva is a Competitive Programming challenge where participants in a team take part to solve CP questions in a contest. where the five elements—Earth, Fire, Water, Air, and Ether—guide your coding journey. Compete in challenges that test your foundational skills with Earth-based problems, speed and efficiency with Fire-themed tasks, adaptability with Water puzzles, logical flow with Air challenges, and creative thinking with Ether problems. Showcase your coding prowess and unlock the secrets of each element as you strive to become the ultimate coding Guardian!",
191+
details: ["1. Event Timings: 20th October 2024, Sunday 09:00 AM to 01:00 PM", "2. Event Venue: C007/C008/Computer Lab", "3. Event Price: Rs. 70 per team"],
192+
imgUrl: "https://i.imgur.com/DuTMdrW.png",
193+
registrationLink: "https://forms.gle/oFm41wRoAam1iRgv6",
194+
type: "Competition"
195+
}
140196
];
141197

142198

143199
return (
200+
144201
<section className="min-h-screen h-fit justify-center w-full flex flex-col items-center gap-6">
145202
<div className="flex flex-col items-center gap-2">
146-
<span className="font-semibold text-5xl text-center">Upcoming Events</span>
147-
<span className="font-normal text-md text-foreground-500">This year's events of Encode!</span>
203+
<span className="font-semibold text-5xl text-center">TesseractX</span>
204+
<span className="font-normal text-md text-foreground-500">TesseractX events of Encode!</span>
148205
</div>
149206

150207
<div className="flex flex-wrap gap-5 justify-center w-[100vw]">
151208
{events
152-
.filter(event => event.date !== "Soon").sort((a, b) => new Date(a.date) - new Date(b.date))
153-
.concat(events.filter(event => event.date === "Soon")).map((event, index) => (
209+
.filter(event => event.status == "current").map((event, index) => (
154210
<EventCard
155211
key={index}
156212
title={event.title}
157213
date={event.date}
158214
description={event.description}
159215
type={event.type}
216+
moreInfo={event.moreInfo}
217+
details={event.details}
160218
isVisible={false}
219+
imgUrl={event.imgUrl}
220+
registrationLink={event.registrationLink}
161221
/>
162222
))}
163223
</div>
164-
165-
<Button color="success" radius="none" size="lg" className="mt-2 font-semibold text-lg">View All Events</Button>
166224
</section>
225+
167226
);
168227
}

frontend/src/styles/globals.css

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,57 @@ body {
172172
height: 40px;
173173
margin-inline: 0;
174174
}
175+
176+
.react-responsive-modal-root{
177+
z-index: 19;;
178+
}
179+
180+
181+
182+
183+
/* temporary css for event more Info part */
184+
/* ============ */
185+
/* ============ */
186+
187+
188+
.event-card-info{
189+
padding: 1vw;
190+
}
191+
192+
.event-img-container{
193+
display: flex;
194+
flex-direction: column;
195+
align-items: center;
196+
}
197+
198+
.event-img-container img{
199+
width: 20vw;
200+
}
201+
202+
@media (max-width: 500px){
203+
.event-img-container img{
204+
width: 40vw;
205+
}
206+
}
207+
208+
.event-card-info h1, .event-card-info div, .event-card-info p{
209+
padding: 15px;
210+
}
211+
212+
.event-card-info span:last-child{
213+
opacity: 0.7;
214+
}
215+
216+
217+
.react-responsive-modal-modal{
218+
background: black;
219+
}
220+
221+
222+
.material-symbols-outlined {
223+
font-variation-settings:
224+
'FILL' 0,
225+
'wght' 400,
226+
'GRAD' 0,
227+
'opsz' 24
228+
}

0 commit comments

Comments
 (0)