diff --git a/web/src/components/Dashboard/DashboardDiscover/EventDetails.tsx b/web/src/components/Dashboard/DashboardDiscover/EventDetails.tsx index 4ccd732..05cee9a 100644 --- a/web/src/components/Dashboard/DashboardDiscover/EventDetails.tsx +++ b/web/src/components/Dashboard/DashboardDiscover/EventDetails.tsx @@ -1,5 +1,6 @@ import { Dispatch, SetStateAction } from "react"; import { IoArrowBackCircle } from "react-icons/io5"; +import React, { useState } from 'react'; type Event = { event_title: string; @@ -29,6 +30,26 @@ export default function EventDetails({event, setEventDetails}: EventProps) { const mapEmbed = "https://maps.google.com/maps?q="+event.coordinates.longitude+","+event.coordinates.latitude+"&hl=en&z=18&&output=embed" const options: Intl.DateTimeFormatOptions = { weekday: 'long', month: 'long', day: 'numeric', year: 'numeric'}; + + const [buttonText, setButtonText] = useState('Register for Event'); + const [isPopupVisible, setIsPopupVisible] = useState(false); // State for popup visibility + + const handleClick = () => { + if (buttonText === 'Register for Event') { + setButtonText('You are registered!'); + } else { + setIsPopupVisible(true); // Show the popup if already registered + } + }; + + const handleConfirmUnregister = () => { + setButtonText('Register for Event'); // Change button text back to 'Register for Event' + setIsPopupVisible(false); // Close the popup + }; + + const handleCancelUnregister = () => { + setIsPopupVisible(false); // Close the popup without changing the button text + }; return (
{/* event-container */}
setEventDetails(null)}>
@@ -38,7 +59,7 @@ export default function EventDetails({event, setEventDetails}: EventProps) {

{event.event_title}

- +
@@ -47,6 +68,28 @@ export default function EventDetails({event, setEventDetails}: EventProps) { ))}
+ {/* Popup for confirmation */} + {isPopupVisible && ( +
+
+

Are you sure you want to unregister?

+
+ + +
+
+
+ )}