Skip to content

Commit

Permalink
56 bug batch 1 (#63)
Browse files Browse the repository at this point in the history
* added logo to navbar, changed website title (potentially fix low-res)

* better quality aiss svg

* clicking confirm confirms the event in the pub-sched database

* updated toast description upon catalog event success

---------

Co-authored-by: Alyssia Tan <[email protected]>
Co-authored-by: Kristen Yee <[email protected]>
  • Loading branch information
3 people authored Mar 21, 2024
1 parent 9ce3bb0 commit db42b46
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 15 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="/src/Logo.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
<title>AISS Schedule Planner</title>
</head>
<body>
<div id="root"></div>
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"react-dom": "^18.2.0",
"react-hook-form": "^7.45.4",
"react-html-email": "^3.0.0",
"react-icons": "^5.0.1",
"react-router-dom": "^6.20.0",
"react-script": "^2.0.5",
"yup": "^1.3.2"
Expand Down
Binary file added src/Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/Logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 8 additions & 8 deletions src/components/Catalog/CreateEventForm/CreateEventForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,33 +46,33 @@ const CreateEventForm = ({ eventData, setDataShouldRevalidate, closeModal }) =>

// make post request to catalog backend route
try {
let response;
let id;
// let response;
// let id;
if (eventData) {
response = await NPOBackend.put(`/catalog/${eventData.id}`, {
await NPOBackend.put(`/catalog/${eventData.id}`, {
host: host,
title: title,
eventType: eventType,
subject: subject,
description: description,
year: year,
});
id = response.data[0].id;
// id = response.data[0].id;
} else {
response = await NPOBackend.post(`/catalog`, {
await NPOBackend.post(`/catalog`, {
host: host,
title: title,
eventType: eventType,
subject: subject,
description: description,
year: year,
});
id = response.data.id;
// id = response.data.id;
}
reset();
toast({
title: 'Event submitted!',
description: `Event has been submitted. ID: ${id}`,
title: 'Event has been added',
// description: `Event has been submitted. ID: ${id}`,
status: 'success',
variant: 'subtle',
position: 'bottom',
Expand Down
30 changes: 26 additions & 4 deletions src/components/Events/DailyEvent.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
import PropTypes from 'prop-types';
import { Box, Flex, Text, Grid, Button } from '@chakra-ui/react';
import { useState } from 'react';
import { NPOBackend } from '../../utils/auth_utils.js';

const DailyEvent = ({ startTime, endTime, eventTitle, location, confirmed }) => {
const DailyEvent = ({ id, startTime, endTime, eventTitle, location, confirmed }) => {
// console.log("CONFIRMED:" + confirmed);

const [confirmEvent, setConfirmEvent] = useState(confirmed);

let border_color = '#2B93D1';
let background_color = '#F7FAFC';
if (!confirmed) {
if (!confirmEvent) {
border_color = '#F69052';
background_color = '#FEF1DC';
}

const handleConfirm = async () => {
const date = new Date();
try {
let response;
response = await NPOBackend.put(`/published-schedule/${id}`, {
confirmed: true,
confirmedOn: date,
}
);
console.log(response);
setConfirmEvent(true);
} catch (error) {
console.error('Error fetching data:', error);
}
}

return (
<Box
bg={background_color}
Expand All @@ -34,12 +55,12 @@ const DailyEvent = ({ startTime, endTime, eventTitle, location, confirmed }) =>
</Grid>
</Box>

{!confirmed ? (
{!confirmEvent ? (
<Box w="15vh" alignItems="top">
<Grid gap={2}>
<div></div>
<div></div>
<Button bg="#FBD38D" textColor="#2D3748" size="sm">
<Button bg="#FBD38D" textColor="#2D3748" size="sm" onClick={handleConfirm}>
Confirm
</Button>
</Grid>
Expand All @@ -53,6 +74,7 @@ const DailyEvent = ({ startTime, endTime, eventTitle, location, confirmed }) =>
};

DailyEvent.propTypes = {
id: PropTypes.number.isRequired,
startTime: PropTypes.string.isRequired,
endTime: PropTypes.string.isRequired,
eventTitle: PropTypes.string.isRequired,
Expand Down
1 change: 1 addition & 0 deletions src/components/Events/Events.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const Events = ( {eventData, location} ) => {
{eventData.map(item => (
<DailyEvent
key={item.id}
id={item.id}
startTime={formatDate(item.startTime)}
endTime={formatDate(item.endTime)}
eventTitle={item.title}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navbar/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const Navbar = ({ hasLoaded, isAdmin }) => {
>
<HStack>
<Flex align={'center'}>
<Image src="../../../aiss-logo.png" marginRight={'48px'}></Image>
<Image src="src/Logo.svg" marginRight={'48px'}></Image>
{makeNavTabs('Schedule', '/publishedSchedule')}
{makeNavTabs('Catalog', '/catalog')}
</Flex>
Expand Down

0 comments on commit db42b46

Please sign in to comment.