diff --git a/src/App.jsx b/src/App.jsx index 13b6f5f..b3ba82b 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -50,7 +50,7 @@ const Layout = () => { ) : ( )} - + diff --git a/src/components/Auth/AuthPage.jsx b/src/components/Auth/AuthPage.jsx index b2204cb..3a46e51 100644 --- a/src/components/Auth/AuthPage.jsx +++ b/src/components/Auth/AuthPage.jsx @@ -4,7 +4,7 @@ import PropTypes from 'prop-types'; const AuthPage = ({ children }) => { return ( - + { - const [numberOfParticipants, setNumberOfParticipants] = useState(''); - const [submittable, setSubmittable] = useState(false); + const [numberOfParticipants, setNumberOfParticipants] = useState(1); + const [submittable, setSubmittable] = useState(true); const handleInput = e => { setNumberOfParticipants(e.target.value); @@ -33,7 +33,7 @@ const CheckinModal = ({ isOpen, onClose, volunteer, onCheckInConfirm }) => { }; const handleCheckIn = async () => { - if (volunteer && typeof volunteer === 'object' && volunteer.id) { + if (volunteer && typeof volunteer === 'object' && volunteer.id && volunteer.event_data_id) { await onCheckInConfirm(volunteer, numberOfParticipants); // Pass the entire volunteer object onClose(); } else { @@ -76,7 +76,9 @@ const CheckinModal = ({ isOpen, onClose, volunteer, onCheckInConfirm }) => { > - {volunteer.number_in_party === 1 ? 'Individual' : 'Group'} + {!volunteer.number_in_party || volunteer.number_in_party == 1 + ? 'Individual' + : 'Group'} @@ -128,6 +130,7 @@ CheckinModal.propTypes = { email: PropTypes.string, image_url: PropTypes.string, number_in_party: PropTypes.number, + event_data_id: PropTypes.number, }), }; diff --git a/src/components/DummyVolunteerProfile/ProfilePageModals.jsx b/src/components/DummyVolunteerProfile/ProfilePageModals.jsx index 3c1750b..4d0e56f 100644 --- a/src/components/DummyVolunteerProfile/ProfilePageModals.jsx +++ b/src/components/DummyVolunteerProfile/ProfilePageModals.jsx @@ -92,7 +92,6 @@ const EditFirstNameModal = ({ isOpen, onClose, user }) => { // Push over by the size of the button width={'100%'} fontWeight={'800'} - fontFamily={'Avenir'} letterSpacing={'0em'} > Edit First Name @@ -123,7 +122,6 @@ const EditFirstNameModal = ({ isOpen, onClose, user }) => { fontWeight={'500'} fontSize={'16px'} marginLeft={'13px'} - fontFamily={'Avenir'} lineHeight={'15px'} letterSpacing={'0em'} justify={'left'} @@ -132,7 +130,6 @@ const EditFirstNameModal = ({ isOpen, onClose, user }) => { First Name { color={'#0075FF'} gap={'6px'} padding={'12 11.321188926696777 12 11.321188926696777'} - fontFamily={'Avenir'} fontSize={'14px'} _hover={{ bg: 'red', @@ -179,7 +175,6 @@ const EditFirstNameModal = ({ isOpen, onClose, user }) => { color={'#FFFFFF'} onClick={handleSubmit} isDisabled={isSubmittable} - fontFamily={'Avenir'} fontSize={'14px'} _hover={{ bg: 'green', @@ -267,7 +262,6 @@ const EditLastNameModal = ({ isOpen, onClose, user }) => { // Push over by the size of the button width={'100%'} fontWeight={'800'} - fontFamily={'Avenir'} letterSpacing={'0em'} > Edit Last Name @@ -298,7 +292,6 @@ const EditLastNameModal = ({ isOpen, onClose, user }) => { fontWeight={'500'} fontSize={'16px'} marginLeft={'13px'} - fontFamily={'Avenir'} lineHeight={'15px'} letterSpacing={'0em'} justify={'left'} @@ -307,7 +300,6 @@ const EditLastNameModal = ({ isOpen, onClose, user }) => { Last Name { color={'#0075FF'} gap={'6px'} padding={'12 11.321188926696777 12 11.321188926696777'} - fontFamily={'Avenir'} fontSize={'14px'} _hover={{ bg: 'red', @@ -354,7 +345,6 @@ const EditLastNameModal = ({ isOpen, onClose, user }) => { color={'#FFFFFF'} onClick={handleSubmit} isDisabled={isSubmittable} - fontFamily={'Avenir'} fontSize={'14px'} _hover={{ bg: 'green', @@ -442,7 +432,6 @@ const EditEmailModal = ({ isOpen, onClose, user }) => { // Push over by the size of the button width={'100%'} fontWeight={'800'} - fontFamily={'Avenir'} letterSpacing={'0em'} > Edit Email @@ -473,7 +462,6 @@ const EditEmailModal = ({ isOpen, onClose, user }) => { fontWeight={'500'} fontSize={'16px'} marginLeft={'13px'} - fontFamily={'Avenir'} lineHeight={'15px'} letterSpacing={'0em'} justify={'left'} @@ -482,7 +470,6 @@ const EditEmailModal = ({ isOpen, onClose, user }) => { Email { color={'#0075FF'} gap={'6px'} padding={'12 11.321188926696777 12 11.321188926696777'} - fontFamily={'Avenir'} fontSize={'14px'} _hover={{ bg: 'red', @@ -529,7 +515,6 @@ const EditEmailModal = ({ isOpen, onClose, user }) => { color={'#FFFFFF'} onClick={handleSubmit} isDisabled={isSubmittable} - fontFamily={'Avenir'} fontSize={'14px'} _hover={{ bg: 'green', @@ -617,7 +602,6 @@ const EditOrganizationModal = ({ isOpen, onClose, user }) => { // Push over by the size of the button width={'100%'} fontWeight={'800'} - fontFamily={'Avenir'} letterSpacing={'0em'} > Edit Organization @@ -648,7 +632,6 @@ const EditOrganizationModal = ({ isOpen, onClose, user }) => { fontWeight={'500'} fontSize={'16px'} marginLeft={'13px'} - fontFamily={'Avenir'} lineHeight={'15px'} letterSpacing={'0em'} justify={'left'} @@ -657,7 +640,6 @@ const EditOrganizationModal = ({ isOpen, onClose, user }) => { Organization { color={'#0075FF'} gap={'6px'} padding={'12 11.321188926696777 12 11.321188926696777'} - fontFamily={'Avenir'} fontSize={'14px'} _hover={{ bg: 'red', @@ -704,7 +685,6 @@ const EditOrganizationModal = ({ isOpen, onClose, user }) => { color={'#FFFFFF'} onClick={handleSubmit} isDisabled={isSubmittable} - fontFamily={'Avenir'} fontSize={'14px'} _hover={{ bg: 'green', @@ -792,7 +772,6 @@ const EditPhoneNumberModal = ({ isOpen, onClose, user }) => { // Push over by the size of the button width={'100%'} fontWeight={'800'} - fontFamily={'Avenir'} letterSpacing={'0em'} > Edit Phone Number @@ -823,7 +802,6 @@ const EditPhoneNumberModal = ({ isOpen, onClose, user }) => { fontWeight={'500'} fontSize={'16px'} marginLeft={'13px'} - fontFamily={'Avenir'} lineHeight={'15px'} letterSpacing={'0em'} justify={'left'} @@ -832,7 +810,6 @@ const EditPhoneNumberModal = ({ isOpen, onClose, user }) => { Phone Number { color={'#0075FF'} gap={'6px'} padding={'12 11.321188926696777 12 11.321188926696777'} - fontFamily={'Avenir'} fontSize={'14px'} _hover={{ bg: 'red', @@ -879,7 +855,6 @@ const EditPhoneNumberModal = ({ isOpen, onClose, user }) => { color={'#FFFFFF'} onClick={handleSubmit} isDisabled={isSubmittable} - fontFamily={'Avenir'} fontSize={'14px'} _hover={{ bg: 'green', @@ -967,7 +942,6 @@ const EditAboutMeModal = ({ isOpen, onClose, user }) => { // Push over by the size of the button width={'100%'} fontWeight={'800'} - fontFamily={'Avenir'} letterSpacing={'0em'} > Edit About Me Section @@ -998,7 +972,6 @@ const EditAboutMeModal = ({ isOpen, onClose, user }) => { fontWeight={'500'} fontSize={'16px'} marginLeft={'13px'} - fontFamily={'Avenir'} lineHeight={'15px'} letterSpacing={'0em'} justify={'left'} @@ -1007,7 +980,6 @@ const EditAboutMeModal = ({ isOpen, onClose, user }) => { About Me { color={'#0075FF'} gap={'6px'} padding={'12 11.321188926696777 12 11.321188926696777'} - fontFamily={'Avenir'} fontSize={'14px'} _hover={{ bg: 'red', @@ -1054,7 +1025,6 @@ const EditAboutMeModal = ({ isOpen, onClose, user }) => { color={'#FFFFFF'} onClick={handleSubmit} isDisabled={isSubmittable} - fontFamily={'Avenir'} fontSize={'14px'} _hover={{ bg: 'green', diff --git a/src/components/EventRegistration/LoadingModal.jsx b/src/components/EventRegistration/LoadingModal.jsx index 1e48221..b9c4dd1 100644 --- a/src/components/EventRegistration/LoadingModal.jsx +++ b/src/components/EventRegistration/LoadingModal.jsx @@ -8,14 +8,13 @@ const LoadingModal = ({ ...props }) => { - + {`Registering...`} {`Hang tight, and you'll registered soon!`} diff --git a/src/components/EventRegistration/RegistrationModal.jsx b/src/components/EventRegistration/RegistrationModal.jsx index c23626a..8165aae 100644 --- a/src/components/EventRegistration/RegistrationModal.jsx +++ b/src/components/EventRegistration/RegistrationModal.jsx @@ -30,13 +30,12 @@ const RegistrationModal = ({ color={'#717171'} fontSize={'20px'} align={'center'} - fontFamily={'Avenir'} fontWeight={800} mb={'-6px'} > Volunteer registration - + {title} diff --git a/src/components/EventRegistration/SignWaiverModal.jsx b/src/components/EventRegistration/SignWaiverModal.jsx index 81d3e52..cb8d6e1 100644 --- a/src/components/EventRegistration/SignWaiverModal.jsx +++ b/src/components/EventRegistration/SignWaiverModal.jsx @@ -19,21 +19,14 @@ const SignWaiverModal = ({ registrationFlowState, ...props }) => { continueText={'Register'} {...props} > - {/* color: var(--Primary-Text, #3B3B3B); -font-family: Avenir; -font-size: 18px; -font-style: normal; -font-weight: 500; -line-height: normal; */} - + Read terms and conditions {/* Terms box */} - + I agree to the terms and conditions diff --git a/src/components/EventRegistration/SuccessfulRegistrationModal.jsx b/src/components/EventRegistration/SuccessfulRegistrationModal.jsx index bf633be..0acb330 100644 --- a/src/components/EventRegistration/SuccessfulRegistrationModal.jsx +++ b/src/components/EventRegistration/SuccessfulRegistrationModal.jsx @@ -39,14 +39,13 @@ const SuccessfulRegistrationModal = ({ ...props }) => { - + {`You're all set!`} {`We're excited to see you at the event!`} diff --git a/src/components/Events/DataCard.jsx b/src/components/Events/DataCard.jsx index 7fa4e56..7bcbc8c 100644 --- a/src/components/Events/DataCard.jsx +++ b/src/components/Events/DataCard.jsx @@ -4,7 +4,7 @@ const DataCard = ({ icon, text, amount }) => { return ( {icon} - + {text} { fontSize={56} fontWeight={800} color={'rgba(0, 0, 0, 0.75)'} - fontFamily={'Avenir'} > {amount} diff --git a/src/components/Events/DeleteEventsModal.jsx b/src/components/Events/DeleteEventsModal.jsx index 1fac607..a039f78 100644 --- a/src/components/Events/DeleteEventsModal.jsx +++ b/src/components/Events/DeleteEventsModal.jsx @@ -27,7 +27,6 @@ const DeleteEventsModal = ({ isOpen, onClose, events, confirmDelete }) => { fontWeight="800" fontSize="32px" lineHeight="33.71px" - fontFamily="Avenir, sans-serif" style={{ display: 'block' }} // Ensure text alignment applies correctly > Are you sure you want to delete: {formattedEventNames} {eventLabel}? diff --git a/src/components/Events/EventCard.jsx b/src/components/Events/EventCard.jsx index 6c20a04..6ffbb03 100644 --- a/src/components/Events/EventCard.jsx +++ b/src/components/Events/EventCard.jsx @@ -125,7 +125,8 @@ const EventCard = ({ - - {name.length > 30 ? ( - - {name.substring(0, 30)}... - - ) : ( - - {name} - - )} + {name} + + { const [featuredEvents, setFeaturedEvents] = useState([]); @@ -55,7 +56,6 @@ const FeaturedDashboard = ({ lineHeight="normal" fontStyle="normal" fontSize={{ base: '18px', xl: '32px' }} - fontFamily={'Avenir'} color={'rgba(0, 0, 0, 0.75)'} > Featured Events @@ -72,7 +72,7 @@ const FeaturedDashboard = ({ w="40px" icon={} onClick={onOpen} - display={showOpenDrawerButton ? { base: 'none', xl: 'flex' } : 'none'} + display={showOpenDrawerButton && !isOpen ? { base: 'none', xl: 'flex' } : 'none'} > @@ -116,6 +116,7 @@ const FeaturedDashboard = ({ }; FeaturedDashboard.propTypes = { + isOpen: PropTypes.bool, onOpen: PropTypes.func, showOpenDrawerButton: PropTypes.bool, setCurrentEventId: PropTypes.func.isRequired, diff --git a/src/components/Events/ImpactSummary.jsx b/src/components/Events/ImpactSummary.jsx index 01b2f88..47d9bf9 100644 --- a/src/components/Events/ImpactSummary.jsx +++ b/src/components/Events/ImpactSummary.jsx @@ -100,6 +100,7 @@ const ImpactSummary = () => { backgroundColor={'#F8F8F8'} borderRadius={'lg'} py={10} + p={3} > { /> - + + { + if (result) { + let data; + + try { + data = JSON.parse(result.getText()); + console.log('Before backend call'); + console.log(data); + const volunteerDataResp = await Backend.get(`/profiles/${result}`); + // console.log("Look here"); + // console.log(volunteerData); + setVolunteerData(volunteerDataResp.data); + } catch (e) { + console.error('Failed parsing QR Code:', e); + setError(true); + } + + setData(data); + } + }} + constraints={{ facingMode: 'user' }} + ViewFinder={() => { + return
; + }} + /> + + {error && ( + + Error: No valid volunteer found + + )} + + {!error && data && ( + <> + + Volunteer: {volunteerData?.first_name} {volunteerData?.last_name} + + + + )} + + + + ); +}; + +Scanner.propTypes = { + isOpen: PropTypes.bool.isRequired, + onClose: PropTypes.func.isRequired, + handleSuccess: PropTypes.func.isRequired, + event_id: PropTypes.string.isRequired, +}; + +export default Scanner; diff --git a/src/components/VolunteerSideView.jsx b/src/components/VolunteerSideView.jsx index 87b294f..c2436a6 100644 --- a/src/components/VolunteerSideView.jsx +++ b/src/components/VolunteerSideView.jsx @@ -146,7 +146,7 @@ const VolunteerSideView = ({ eventId, onClose, setShowOpenDrawerButton }) => { gap={'0.3em'} > - {eventDataVolunteer[0]?.number_in_party > 1 ? "Group" : "Individual"} + {eventDataVolunteer[0]?.number_in_party > 1 ? 'Group' : 'Individual'} @@ -162,7 +162,7 @@ const VolunteerSideView = ({ eventId, onClose, setShowOpenDrawerButton }) => { gap={'0.3em'} > - {eventDataVolunteer[0]?.is_checked_in ? "Checked-in" : "Registered"} + {eventDataVolunteer[0]?.is_checked_in ? 'Checked-in' : 'Registered'} diff --git a/src/components/VolunteerSideViewDrawer.jsx b/src/components/VolunteerSideViewDrawer.jsx new file mode 100644 index 0000000..e183601 --- /dev/null +++ b/src/components/VolunteerSideViewDrawer.jsx @@ -0,0 +1,278 @@ +import { Flex, Button, Image, Text, HStack, Box, VStack, IconButton } from '@chakra-ui/react'; +import { + Drawer, + DrawerOverlay, + DrawerContent, + DrawerCloseButton, + DrawerBody, +} from '@chakra-ui/react'; +import PropTypes from 'prop-types'; +import { useState, useEffect } from 'react'; +import { Icon } from '@chakra-ui/react'; +import { getEventById } from '../utils/eventsUtils'; +import { EditIcon, CalendarIcon } from '@chakra-ui/icons'; +import logos_google_calendar from '../assets/logos_google-calendar.svg'; +import logos_google_maps from '../assets/logos_google-maps.svg'; +import { IoPeopleSharp } from 'react-icons/io5'; +import { IoMdLink } from 'react-icons/io'; +import { RxCaretRight } from 'react-icons/rx'; +import HappeningInChip from './HappeningInChip/HappeningInChip'; + +const VolunteerSideView = ({ eventId, isOpen, onClose, setShowOpenDrawerButton }) => { + const [eventData, setEventData] = useState([]); + const [isReadMore, setIsReadMore] = useState(false); + const [calendarSelected, setCalendarSelected] = useState(false); + const [mapSelected, setMapSelected] = useState(false); + // const [dateObj, setDateObj] = useState(new Date()); + const dateObj = new Date(Date.parse(eventData.date)); + // console.log(eventData); + + useEffect(() => { + getEventById(eventId).then(data => setEventData(data)); + // setDateObj(new Date(Date.parse(eventData.date))) + }, [eventId]); + + // console.log('e', eventData); + // console.log('d', dateObj) + + function formatDate(dateString) { + const months = [ + 'Jan', + 'Feb', + 'Mar', + 'Apr', + 'May', + 'Jun', + 'Jul', + 'Aug', + 'Sep', + 'Oct', + 'Nov', + 'Dec', + ]; + console.log('dateString', dateString); + const date = new Date(dateString); + const month = months[date.getUTCMonth()]; + const day = date.getUTCDate(); + const year = date.getUTCFullYear(); + const time = dateObj.toLocaleString('default', { timeStyle: 'short' }); + // const time = + // date.getUTCHours().toString().padStart(2, '0') + + // ':' + + // date.getUTCMinutes().toString().padStart(2, '0') + + // (hours >= 12 ? ' PM' : ' AM'); + + return `${month} ${day}, ${year} @ ${time}`; + } + return ( + + + + + + + + } + onClick={() => { + onClose(); + setShowOpenDrawerButton(true); + }} + /> + + + + + + + + + + + + + + + Your event status + + + + + + Type + + + Group + + + + Registration + + + Registered + + + + Party size + 12 people + + + + + + + {eventData.name} + + + {formatDate(eventData.date)} + + + {eventData.description} + + + + + + + Add this event to: + + + + + + + + + + + + + ); +}; + +VolunteerSideView.propTypes = { + eventId: PropTypes.string.isRequired, + isOpen: PropTypes.func.isRequired, + onClose: PropTypes.func.isRequired, + setShowOpenDrawerButton: PropTypes.func.isRequired, +}; + +export default VolunteerSideView; diff --git a/src/components/VolunteersTable.jsx b/src/components/VolunteersTable.jsx index c7ac11d..a477ea8 100644 --- a/src/components/VolunteersTable.jsx +++ b/src/components/VolunteersTable.jsx @@ -54,9 +54,9 @@ const RenderVolunteerRow = ({ volunteer }) => { <> - + - + {first_name} {last_name} diff --git a/src/pages/AdminPage.jsx b/src/pages/AdminPage.jsx index 037f331..be2149a 100644 --- a/src/pages/AdminPage.jsx +++ b/src/pages/AdminPage.jsx @@ -96,7 +96,7 @@ export default function AdminPage() { return ( - + Administrators + + + { padding={'2%'} > - + {`${user.first_name} ${user.last_name}`}
@@ -260,7 +269,15 @@ export const DummyProfilePage = () => {
- + {`${user.first_name} ${user.last_name}`}
diff --git a/src/pages/ForgotPasswordV2.jsx b/src/pages/ForgotPasswordV2.jsx index 04f0de4..0c46bee 100644 --- a/src/pages/ForgotPasswordV2.jsx +++ b/src/pages/ForgotPasswordV2.jsx @@ -75,7 +75,7 @@ const ForgotPasswordForm = () => { return (
- + Forgot Password?
@@ -93,7 +93,6 @@ const ForgotPasswordForm = () => { marginTop={30} borderRadius={8} placeholder="Email" - fontFamily={'Avenir'} boxShadow={'0 4px 2px -2px gray'} type="email" size={'lg'} diff --git a/src/pages/LoginV2.jsx b/src/pages/LoginV2.jsx index 69fd46a..83c0661 100644 --- a/src/pages/LoginV2.jsx +++ b/src/pages/LoginV2.jsx @@ -152,7 +152,6 @@ const LoginForm = () => { maxW={'20rem'} marginTop={30} borderRadius={8} - fontFamily={'Avenir'} placeholder="Email" boxShadow={'0 4px 2px -2px gray'} type="email" @@ -170,7 +169,6 @@ const LoginForm = () => { maxW={'20rem'} marginTop={30} borderRadius={8} - fontFamily={'Avenir'} placeholder="Password" type="password" boxShadow={'0 4px 2px -2px gray'} @@ -200,7 +198,6 @@ const LoginForm = () => { marginTop={2} fontWeight="bold" style={{ - fontFamily: 'Avenir', fontSize: '20px', fontWeight: '500', }} @@ -236,7 +233,6 @@ const LoginForm = () => { { style={{ background: 'none', height: '24px', - fontFamily: 'Avenir', fontSize: '18px', fontWeight: '800', textAlign: 'center', @@ -267,7 +262,6 @@ const LoginForm = () => { background: 'none', height: '24px', color: '#478CB6', - fontFamily: 'Avenir', fontSize: '18px', fontWeight: '800', textAlign: 'center', diff --git a/src/pages/QRCodePage.jsx b/src/pages/QRCodePage.jsx index a8546c0..51b3dd3 100644 --- a/src/pages/QRCodePage.jsx +++ b/src/pages/QRCodePage.jsx @@ -46,7 +46,13 @@ function QRCodePage() { /> - + {volunteerFirstName} {volunteerLastName} diff --git a/src/pages/SignupV2.jsx b/src/pages/SignupV2.jsx index 908fc0e..e06ce28 100644 --- a/src/pages/SignupV2.jsx +++ b/src/pages/SignupV2.jsx @@ -131,7 +131,6 @@ const CreateAccount = () => { width={'100%'} marginTop={30} marginRight={'70%'} - fontFamily={'Avenir'} size={'lg'} borderRadius={8} boxShadow={'0 4px 2px -2px gray'} @@ -148,7 +147,6 @@ const CreateAccount = () => { marginTop={30} size={'lg'} borderRadius={8} - fontFamily={'Avenir'} boxShadow={'0 4px 2px -2px gray'} placeholder="Last name" type="text" @@ -163,7 +161,6 @@ const CreateAccount = () => { marginTop={30} size={'lg'} borderRadius={8} - fontFamily={'Avenir'} boxShadow={'0 4px 2px -2px gray'} placeholder={'Email'} type="email" @@ -182,7 +179,6 @@ const CreateAccount = () => { marginTop={30} size={'lg'} borderRadius={8} - fontFamily={'Avenir'} boxShadow={'0 4px 2px -2px gray'} placeholder={'Password'} type="password" @@ -201,7 +197,6 @@ const CreateAccount = () => { marginTop={30} size={'lg'} borderRadius={8} - fontFamily={'Avenir'} boxShadow={'0 4px 2px -2px gray'} placeholder={'Confirm Password'} type="password" diff --git a/src/pages/VolunteerEventPage.jsx b/src/pages/VolunteerEventPage.jsx index c11463c..755320f 100644 --- a/src/pages/VolunteerEventPage.jsx +++ b/src/pages/VolunteerEventPage.jsx @@ -6,21 +6,30 @@ import { useContext, useState } from 'react'; import NavbarContext from '../utils/NavbarContext'; import VolunteerSideView from '../components/VolunteerSideView.jsx'; import { RxCaretLeft } from 'react-icons/rx'; +import { useBreakpoint, useDisclosure } from '@chakra-ui/react'; +import VolunteerSideViewDrawer from '../components/VolunteerSideViewDrawer.jsx'; // import RegistrationFlowController from '../components/EventRegistration/RegistrationFlowController.jsx'; const VolunteerEventPage = () => { - const { onNavbarDrawerOpen } = useContext(NavbarContext); - // eslint-disable-next-line - const [currentEventId, setCurrentEventId] = useState(-1); + const { isOpen: isDrawerOpen, onOpen: onDrawerOpen, onClose: onDrawerClose } = useDisclosure(); + const [isOpen, setIsOpen] = useState(false); + const onClose = () => setIsOpen(!isOpen); + const { onNavbarDrawerOpen } = useContext(NavbarContext); + const [currentEventId, setCurrentEventId] = useState(null); // Initial state is null to indicate no event selected + const breakpoint = useBreakpoint(); const [showOpenDrawerButton, setShowOpenDrawerButton] = useState(false); - const [isOpen, setIsOpen] = useState(false); - const onOpen = () => { - setIsOpen(!isOpen); + + const openEventDrawer = eventId => { + setCurrentEventId(eventId); // Set the current event ID, which triggers the side view to display setShowOpenDrawerButton(false); + onDrawerOpen(); }; - const onClose = () => setIsOpen(!isOpen); + // const handleClose = () => { + // onDrawerClose(); + // }; + console.log('test' + currentEventId); // const { // isOpen: isRegistrationFlowOpen, // onOpen: onRegistrationFlowOpen, @@ -76,7 +85,7 @@ const VolunteerEventPage = () => { flex-shrink="0" borderRadius={'xl'} flexDir={'column'} - display={showOpenDrawerButton ? { base: 'flex', xl: 'none' } : 'none'} + display={showOpenDrawerButton && !isDrawerOpen ? { base: 'flex', xl: 'none' } : 'none'} > { h="64px" w="64px" icon={} - onClick={onOpen} + onClick={() => { + onDrawerOpen(); + }} > - - - {isOpen && ( - - )} - - + {/* Drawer Component */} + {breakpoint == 'base' ? ( + + ) : ( + isOpen && ( + + ) + )} ); }; - export default VolunteerEventPage; diff --git a/src/pages/VolunteerHomePage.jsx b/src/pages/VolunteerHomePage.jsx index fd2425a..cf6d8a4 100644 --- a/src/pages/VolunteerHomePage.jsx +++ b/src/pages/VolunteerHomePage.jsx @@ -208,19 +208,20 @@ const VolunteerHomePage = () => { - - + + {eventCards} - - + +
diff --git a/src/pages/Volunteers.jsx b/src/pages/Volunteers.jsx index bd48425..4c15277 100644 --- a/src/pages/Volunteers.jsx +++ b/src/pages/Volunteers.jsx @@ -19,6 +19,7 @@ import Fuse from 'fuse.js'; import { TrophyIcon } from '../components/Icons/TrophyIcon'; import NavbarContext from '../utils/NavbarContext'; import { MdPeopleAlt } from 'react-icons/md'; +import { CSVLink } from 'react-csv'; const Volunteers = () => { const [registered, setRegistered] = useState(''); @@ -27,8 +28,19 @@ const Volunteers = () => { const [volunteers, setVolunteers] = useState([]); const [displayedVolunteers, setDisplayedVolunteers] = useState([]); const [input, setInput] = useState(''); + const [volunteerData, setVolunteerData] = useState([]); const { onNavbarDrawerOpen } = useContext(NavbarContext); + const header = [ + { key: 'name', label: 'NAME' }, + { key: 'email', label: 'EMAIL' }, + { key: 'phone_number', label: 'PHONE_NUMBER' }, + { key: 'organization', label: 'ORGANIZATION' }, + { key: 'about_me', label: 'ABOUT_ME' }, + { key: 'total_trash', label: 'TOTAL_TRASH' }, + { key: 'events_attended', label: 'EVENTS_ATTENDED' }, + ]; + const setData = async () => { try { const res = await Backend.get('/stats/registered'); @@ -69,6 +81,19 @@ const Volunteers = () => { } }, [input, volunteers]); + useEffect(() => { + const getVolunteerData = async () => { + try { + const volunteerData = await Backend.get(`/stats/export/volunteers`); + setVolunteerData(volunteerData.data); + } catch (err) { + console.log(err.message); + } + }; + + getVolunteerData(); + }, []); + return ( <> {/* Registered + Checked-In */} @@ -162,44 +187,65 @@ const Volunteers = () => { bg="#D4E4F9" padding="3" fontSize="lg" - display="flex" - justifyContent="space-between" + justify="space-between" alignItems="center" w="100%" borderRadius={'4.541px'} + maxWidth={{ base: '300px', md: '300px', lg: '300px', xl: '300px' }} > - - - + + + {topThree[0] && topThree[0].volunteer_first_name}{' '} {topThree[0] && topThree[0].volunteer_last_name}{' '} - + + {/* */} {topThree[0] && truncate(topThree[0].total_weight, 2)} lbs - + 2 - - {topThree[1] && topThree[1].volunteer_first_name}{' '} - {topThree[1] && topThree[1].volunteer_last_name}{' '} + + + {topThree[1] && topThree[1].volunteer_first_name}{' '} + {topThree[1] && topThree[1].volunteer_last_name}{' '} + {topThree[1] && truncate(topThree[1].total_weight, 2)} lbs - + 3{' '} {' '} - - {topThree[2] && topThree[2].volunteer_first_name}{' '} - {topThree[2] && topThree[2].volunteer_last_name}{' '} + + + {topThree[2] && topThree[2].volunteer_first_name}{' '} + {topThree[2] && topThree[2].volunteer_last_name}{' '} + {topThree[2] && truncate(topThree[2].total_weight, 2)} lbs @@ -215,13 +261,19 @@ const Volunteers = () => { style={{ whiteSpace: 'normal', wordWrap: 'break-word', + color: 'white', + my: "3" }} height={'fit-content'} > {' '} - + Export All Volunteer Data - +