Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…rontend into 201-refactor-sidebar-1
  • Loading branch information
eachen1010 committed May 13, 2024
2 parents a5559e7 + f5947e9 commit c7a3508
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 59 deletions.
30 changes: 25 additions & 5 deletions src/components/Auth/AuthPage.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { Box, SimpleGrid, Image, Heading } from '@chakra-ui/react';
import { Box, Image, Flex, Heading } from '@chakra-ui/react';
import S2T_Logo from '../../Assets/S2T_Logo.png';
import PropTypes from 'prop-types';

const AuthPage = ({ children }) => {
return (
<SimpleGrid columns={2} spacing={0} minH={'100vh'}>
<Flex minH={'100vh'} justifyContent={{ base: 'center', md: 'normal' }} alignItems="center">
<Box
backgroundColor="#2D558A"
position="relative"
display={'flex'}
// display={'flex'}
flexDir={'column'}
justifyContent={'center'}
alignItems={'center'}
width="50%"
minH={'100vh'}
display={{ base: 'none', md: 'flex' }}
>
<Image
borderRadius="full"
Expand Down Expand Up @@ -52,10 +55,27 @@ const AuthPage = ({ children }) => {
</Heading>
</Box>
</Box>
<Box display={'flex'} h="100%" justifyContent={'center'} alignContent={'center'} mx={4}>
<Box
width={{ base: '70%', md: '50%' }}
display={'flex'}
h="100%"
justifyContent={'center'}
alignContent={'center'}
mx={4}
my={{ base: 7, md: 0 }}
flexDir={'column'}
>
<Image
src={S2T_Logo}
alt="Logo"
H={'7rem'}
w={'7rem'}
m={'auto'}
display={{ base: 'flex', md: 'none' }}
/>
{children}
</Box>
</SimpleGrid>
</Flex>
);
};

Expand Down
4 changes: 2 additions & 2 deletions src/components/Checkin/VolunteerEventsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const RenderVolunteerRow = ({ volunteer, changeIsCheckedIn, isCheckinPage, isVie
</Flex>
</Td>
<Td>
<Flex alignItems={'start'} justifyContent={'start'} >
<Flex alignItems={'start'} justifyContent={'start'}>
<Text fontSize="md">{number_in_party}</Text>
</Flex>
</Td>
Expand All @@ -120,7 +120,7 @@ const RenderVolunteerRow = ({ volunteer, changeIsCheckedIn, isCheckinPage, isVie
isOpen={isOpen}
onClose={onClose}
id={event_data_id}
profileImage={image_url}
image_url={image_url}
firstName={first_name}
lastName={last_name}
volunteerId={volunteer_id}
Expand Down
10 changes: 6 additions & 4 deletions src/components/Events/VolunteerImpactSummary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ const VolunteerImpactSummary = ({ showLargestItemCollected }) => {
const [currentIndex, setCurrentIndex] = useState(0);
const totalItems = 3;

const { user, updateUser } = useContext(UserContext);
const { user } = useContext(UserContext);

useEffect(() => {
updateUser();
getData();
}, []);
if (user) {
getData();
}

}, [user]);

const getData = async () => {
try {
Expand Down
35 changes: 1 addition & 34 deletions src/components/Navbar/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
VolunteersIconBlue,
VolunteersIconGrey,
SupportIconGrey,
SettingsIconGrey,
LogOutIcon,
QRCodeIconGrey,
QRCodeIconBlue,
Expand Down Expand Up @@ -87,7 +86,6 @@ const Navbar = () => {

// For the support and settings button at the bottom above the user
const supportPath = '/playground';
const settingsPath = '/playground';

// For logout in case it changes from /logoutv2
const logoutPath = '/loginv2';
Expand Down Expand Up @@ -218,7 +216,7 @@ const Navbar = () => {
paddingLeft="10px"
marginLeft="14px"
marginRight="14px"
marginBottom="-13px"
marginBottom="2px"
borderRadius="4px"
cursor="pointer" // Add this to change cursor to pointer
onClick={e => {
Expand All @@ -239,37 +237,6 @@ const Navbar = () => {
</Text>
</Box>

{/* Settings button */}
<Box
height="49px"
display="flex"
flexDirection="row"
alignItems="center"
gap="10px"
paddingLeft="10px"
marginLeft="14px"
marginRight="14px"
marginBottom="2px"
borderRadius="4px"
cursor="pointer"
onClick={e => {
e.preventDefault();
navigate(settingsPath);
}}
>
<SettingsIconGrey />
<Text
style={{
fontSize: '16px',
fontWeight: '500',
lineHeight: '25px',
textAlign: 'center',
}}
>
Settings
</Text>
</Box>

{/* User card at bottom */}
<Box
style={{
Expand Down
1 change: 1 addition & 0 deletions src/components/RegisterGuestModal/RegisterGuestModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const RegisterGuestModal = ({ isOpen, onClose, eventId }) => {
};
const res = await Backend.post('/profiles/guest', volunteer);
onClose();
window.location.reload();
return res.data;
} catch (error) {
console.error('Error registering new volunteer:', error.message);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Scanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const Scanner = ({ event_id, isOpen, onClose, handleSuccess }: ScannerProps) =>
<ModalContent padding={5}>
<ModalCloseButton backgroundColor={'#EFEFEF'} borderRadius={'100px'} />

<Button onClick={() => checkinVolunteer(227)}>Success</Button>
{/* <Button onClick={() => checkinVolunteer(227)}>Success</Button> */}

<QrReader
scanDelay={1000}
Expand Down
2 changes: 1 addition & 1 deletion src/components/VolunteerSideViewDrawer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const VolunteerSideViewDrawer = ({ eventId, isOpen, onClose, setShowOpenDrawerBu

useEffect(() => {
getEventById(eventId).then(data => setEventData(data));
getEventDataVolunteerId(user.id, eventId).then(data => setEventDataVolunteer(data));
getEventDataVolunteerId(user?.id, eventId).then(data => setEventDataVolunteer(data));
// setDateObj(new Date(Date.parse(eventData.date)))
}, [eventId]);

Expand Down
2 changes: 1 addition & 1 deletion src/pages/HomePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const Home = () => {
<Flex justifyContent={'center'} flexDir={'column'} w={'95%'}>
<Box justifyContent="space-between">
<Flex flexDir={'column'} backgroundColor={'#F8F8F8'} p={8} borderRadius={'lg'} gap={8}>
<Heading w={'full'}>Upcoming Events</Heading>
<Heading w={'full'}>All Events</Heading>
<Box display="flex" flex-direction="row" justifyContent="space-between">
<HStack>
<InputGroup w="50%">
Expand Down
4 changes: 2 additions & 2 deletions src/pages/LoginV2.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ const LoginForm = () => {
<Box style={{ width: '100%' }} height={'fit-content'} mt={'auto'} mb="auto">
<form onSubmit={handleSubmit(handleLogin)}>
<Center>
<Heading marginTop={10}>Log In</Heading>
<Heading marginTop={{ base: 5, md: 10 }}>Log In</Heading>
</Center>
<FormControl isInvalid={errors.email} w={'100%'} d="block">
{/* <FormLabel>Email address</FormLabel> */}
<Center>
<Input
maxW={'20rem'}
marginTop={30}
marginTop={{ base: 7, md: 30 }}
borderRadius={8}
placeholder="Email"
boxShadow={'0 4px 2px -2px gray'}
Expand Down
15 changes: 8 additions & 7 deletions src/pages/VolunteerHomePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ const VolunteerHomePage = () => {

const { onNavbarDrawerOpen } = useContext(NavbarContext);

const { user, updateUser } = useContext(UserContext);
const { user } = useContext(UserContext);

const getEvents = async () => {
try {
let userId = user?.id;

const eventsData = await Backend.get(`data/registered/${userId}`);
console.log
console.log(user)
const eventsData = await Backend.get(`data/registered/${user.id}`);
console.log(eventsData);
setEvents(eventsData.data);
const options = { keys: ['name', 'date', 'location'], includeScore: true };
Expand All @@ -70,9 +70,10 @@ const VolunteerHomePage = () => {
));

useEffect(() => {
updateUser();
getEvents();
}, []);
if (user) {
getEvents();
}
}, [user]);

useEffect(() => {
if (!fuse) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Volunteers.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ const Volunteers = () => {
filename="./data.csv"
headers={header}
>
Export All Volunteer Data
Export All
</CSVLink>
</Button>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/firebaseAuthUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ export const createUserInFirebase = async (email, password, redirect, navigate)
export const logInWithEmailAndPassWord = async (email, password, redirect, navigate) => {
try {
await signInWithEmailAndPassword(auth, email, password);
navigate(redirect);
} catch (error) {
console.log(`${error.code}: ${error.message}`);
throw error;
}
navigate(redirect);
};

/**
Expand Down

0 comments on commit c7a3508

Please sign in to comment.