generated from ctc-uci/npo-frontend-vite-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #158 from ctc-uci/152-modify-impactsummary-in-past…
…events Modify ImpactSummary in PastEvents
- Loading branch information
Showing
18 changed files
with
6,215 additions
and
8,622 deletions.
There are no files selected for viewing
2,039 changes: 1,038 additions & 1,001 deletions
2,039
src/components/DummyVolunteerProfile/ProfilePageModals.jsx
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import { Box, Button, Flex, VStack } from '@chakra-ui/react'; | ||
import { useEffect, useState } from 'react'; | ||
import { AiOutlineExport } from 'react-icons/ai'; | ||
import { FaTrashCan } from 'react-icons/fa6'; | ||
import { IoDocumentText } from 'react-icons/io5'; | ||
import { MdPeopleAlt } from 'react-icons/md'; | ||
import Backend from '../../utils/utils'; | ||
import DataCard from './DataCard'; | ||
|
||
const PastEventsImpactSummary = () => { | ||
const [registered, setRegistered] = useState(0); | ||
const [checkedIn, setCheckedIn] = useState(0); | ||
const [total, setTotal] = useState(0); | ||
|
||
useEffect(() => { | ||
getData(); | ||
}, []); | ||
|
||
const getData = async () => { | ||
try { | ||
let response = await Backend.get('/stats/registered/past'); | ||
console.log(response.data); | ||
setRegistered(parseFloat(response.data)); | ||
response = await Backend.get('/stats/checkedIn/past'); | ||
setCheckedIn(parseFloat(response.data)); | ||
response = await Backend.get('/stats/total/past'); | ||
setTotal(parseFloat(response.data)); | ||
} catch (err) { | ||
console.log(`Error getting events: `, err.message); | ||
} | ||
}; | ||
|
||
return ( | ||
<Box | ||
mb="5" | ||
display="flex" | ||
flexDirection="row" | ||
gap="8" | ||
justifyContent="center" | ||
alignItems={'center'} | ||
backgroundColor={'#F8F8F8'} | ||
borderRadius={'lg'} | ||
py={10} | ||
> | ||
<DataCard | ||
amount={registered} | ||
text={'Total Registered Volunteers'} | ||
icon={ | ||
<Flex background={'#96DB53'} p={2.5} borderRadius={'lg'}> | ||
<IoDocumentText color="white" size={20}></IoDocumentText> | ||
</Flex> | ||
} | ||
/> | ||
<DataCard | ||
amount={checkedIn} | ||
text={'Total Checked-In Volunteers'} | ||
icon={ | ||
<Flex background={'#915EFF'} p={2.5} borderRadius={'lg'}> | ||
<MdPeopleAlt color="white" size={20}></MdPeopleAlt> | ||
</Flex> | ||
} | ||
/> | ||
<DataCard | ||
amount={total} | ||
text={'Total Trash Weight'} | ||
icon={ | ||
<Flex background={'#FF792E'} p={2.5} borderRadius={'lg'}> | ||
<FaTrashCan color="white" size={20} /> | ||
</Flex> | ||
} | ||
/> | ||
<VStack gap={120}> | ||
<Box></Box> | ||
<Button colorScheme={'messenger'} leftIcon={<AiOutlineExport></AiOutlineExport>} size="md"> | ||
Export Data | ||
</Button> | ||
</VStack> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default PastEventsImpactSummary; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,103 @@ | ||
/* eslint-disable react/prop-types */ | ||
import { | ||
Text, | ||
Flex, | ||
Image, | ||
Table, | ||
Thead, | ||
Tbody, | ||
Tr, | ||
Th, | ||
Td, | ||
TableContainer, | ||
Button, | ||
} from '@chakra-ui/react'; | ||
import { NavLink } from "react-router-dom"; | ||
|
||
const RenderEventRow = ({ event }) => { | ||
const { id, name, location, date, image_url } = event; | ||
Text, | ||
Flex, | ||
Image, | ||
Table, | ||
Thead, | ||
Tbody, | ||
Tr, | ||
Th, | ||
Td, | ||
TableContainer, | ||
Button, | ||
} from '@chakra-ui/react'; | ||
import { NavLink } from 'react-router-dom'; | ||
|
||
return ( | ||
<> | ||
<Tr key={id} bg="#FFFFFF" fontWeight={'medium'}> | ||
<Td> | ||
<Flex> | ||
<Image src={image_url} boxSize="4rem" borderRadius="full" /> | ||
<Flex direction="column" ml={3} mt={4} g={1} overflow="hidden"> | ||
<Text color={'#2D3748'} whiteSpace="nowrap" overflow="hidden" textOverflow="ellipsis"> | ||
{name} | ||
</Text> | ||
</Flex> | ||
</Flex> | ||
</Td> | ||
<Td> | ||
<Flex> | ||
<Text fontWeight="550" mt={2}> | ||
{location} | ||
</Text> | ||
</Flex> | ||
</Td> | ||
<Flex mt={9}> | ||
<Text fontWeight="550"> | ||
{`${date.substring(5, 7)}/${date.substring(8, 10)}/${date.substring(0, 4)}`} | ||
const RenderEventRow = ({ event }) => { | ||
const { id, name, location, date, image_url } = event; | ||
|
||
return ( | ||
<> | ||
<Tr key={id} bg="#FFFFFF" fontWeight={'medium'}> | ||
<Td> | ||
<Flex> | ||
<Image src={image_url} boxSize="4rem" borderRadius="full" /> | ||
<Flex direction="column" ml={3} mt={4} g={1} overflow="hidden"> | ||
<Text color={'#2D3748'} whiteSpace="nowrap" overflow="hidden" textOverflow="ellipsis"> | ||
{name} | ||
</Text> | ||
</Flex> | ||
<Td> | ||
<NavLink | ||
to={`/past-events/${event.id}`} | ||
> | ||
<Button | ||
color="#0075FF" | ||
variant="outline" | ||
borderWidth="2px" | ||
borderColor="#0075FF" | ||
onClick={() => console.log("sends to new page")} | ||
> | ||
View Event | ||
</Button> | ||
</NavLink> | ||
</Td> | ||
</Tr> | ||
</> | ||
); | ||
}; | ||
|
||
const EventsTable = ({ events }) => { | ||
return ( | ||
<TableContainer border={'2px solid #E2E8F0'} borderRadius={'15px'}> | ||
<Table mb={5} colorScheme="gray"> | ||
<Thead bg="#F7FAFC"> | ||
<Tr fontWeight={'medium'}> | ||
<Th w="25%"> | ||
<Flex gap={2}> | ||
<Text color="#2D3748" fontWeight="650"> | ||
Event Name | ||
</Text> | ||
</Flex> | ||
</Th> | ||
<Th w="25%"> | ||
<Flex gap={2}> | ||
<Text color="#2D3748" fontWeight="650"> | ||
Location | ||
</Text> | ||
</Flex> | ||
</Th> | ||
<Th w="25%"> | ||
<Flex gap={2}> | ||
<Text color="#2D3748" fontWeight="650"> | ||
Date | ||
</Text> | ||
</Flex> | ||
</Th> | ||
<Th w="100%"> | ||
</Th> | ||
</Tr> | ||
</Thead> | ||
<Tbody> | ||
{events.map(event => ( | ||
<RenderEventRow key={event.id} event={event} /> | ||
))} | ||
</Tbody> | ||
</Table> | ||
</TableContainer> | ||
); | ||
}; | ||
|
||
export default EventsTable; | ||
|
||
</Flex> | ||
</Td> | ||
<Td> | ||
<Flex> | ||
<Text fontWeight="550" mt={2}> | ||
{location} | ||
</Text> | ||
</Flex> | ||
</Td> | ||
<Flex mt={9}> | ||
<Text fontWeight="550"> | ||
{`${date.substring(5, 7)}/${date.substring(8, 10)}/${date.substring(0, 4)}`} | ||
</Text> | ||
</Flex> | ||
<Td> | ||
<NavLink to={`/past-events/${event.id}`}> | ||
<Button | ||
color="#0075FF" | ||
variant="outline" | ||
borderWidth="2px" | ||
borderColor="#0075FF" | ||
onClick={() => console.log('sends to new page')} | ||
> | ||
View Event | ||
</Button> | ||
</NavLink> | ||
</Td> | ||
</Tr> | ||
</> | ||
); | ||
}; | ||
|
||
const EventsTable = ({ events }) => { | ||
return ( | ||
<TableContainer border={'2px solid #E2E8F0'} borderRadius={'15px'}> | ||
<Table mb={5} colorScheme="gray"> | ||
<Thead bg="#F7FAFC"> | ||
<Tr fontWeight={'medium'}> | ||
<Th w="25%"> | ||
<Flex gap={2}> | ||
<Text color="#2D3748" fontWeight="650"> | ||
Event Name | ||
</Text> | ||
</Flex> | ||
</Th> | ||
<Th w="25%"> | ||
<Flex gap={2}> | ||
<Text color="#2D3748" fontWeight="650"> | ||
Location | ||
</Text> | ||
</Flex> | ||
</Th> | ||
<Th w="25%"> | ||
<Flex gap={2}> | ||
<Text color="#2D3748" fontWeight="650"> | ||
Date | ||
</Text> | ||
</Flex> | ||
</Th> | ||
<Th w="100%"></Th> | ||
</Tr> | ||
</Thead> | ||
<Tbody> | ||
{events.map(event => ( | ||
<RenderEventRow key={event.id} event={event} /> | ||
))} | ||
</Tbody> | ||
</Table> | ||
</TableContainer> | ||
); | ||
}; | ||
|
||
export default EventsTable; |
Oops, something went wrong.