From fcdf4d0f87027ba862ea83352d0f0d4a8d80b09e Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 23 Sep 2023 17:18:37 -0700 Subject: [PATCH] added meetup modal --- app/CalendarPage.jsx | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/app/CalendarPage.jsx b/app/CalendarPage.jsx index e973e99..b5a50fc 100644 --- a/app/CalendarPage.jsx +++ b/app/CalendarPage.jsx @@ -3,6 +3,7 @@ import styled from '@emotion/styled' import { Box, Container, Grid, Paper, Typography, Badge } from '@mui/material'; import { grey } from '@mui/material/colors'; import { DateCalendar, PickersDay } from '@mui/x-date-pickers'; +import MeetupDetails from '@components/MeetupDetails'; const SuiteAndBTCGraphic = ( @@ -76,6 +77,9 @@ const CustomDiv = styled.div` `; const isFirstWednesday = (day) => { + // console.log(day); + // console.log(day instanceof Date); + // console.log(JSON.stringify(day)); let date = new Date(day); return date.getDay() === 3 && date.getDate() <= 7; } @@ -90,7 +94,7 @@ const MeetupDay = (props) => { key={props.day.toString()} variant='dot' color='secondary' - invisible={isSelected ? false : true} + invisible={!isSelected} overlap='circular' > @@ -99,22 +103,33 @@ const MeetupDay = (props) => { } + /* The goal of the calendar is to be able to click on dates and have a popup that shows our meetup details. -1. Perhaps the modal is actually seperate and is just passed the dates from a click event? -*** 2. We also want to have the only badge be on the first wednesday of each month - - onMonthChange has been added. Need to get this info to the day components to render badge - - Since there will be a default month, use that and onMonthChange to set badges +*** 1. Perhaps the modal is actually seperate and is just passed the dates from a click event? 3. Also need to change colors */ const CalendarPage = () => { + const [openMeetupDetails, setOpenMeetupDetails] = useState(false); + + const closeMeetupDetails = () => { + setOpenMeetupDetails(false); + } + + const checkToOpenDetails = (value, selectionState) => { + console.log("Test"); + console.log(value); + console.log(isFirstWednesday(value)); + isFirstWednesday(value) ? setOpenMeetupDetails(true) : null; + } return ( + @@ -126,6 +141,7 @@ const CalendarPage = () => { slots={{ day: MeetupDay }} + onChange={checkToOpenDetails} />