Skip to content

Commit

Permalink
68 bugfix season select dropdown and student view cleanup (#77)
Browse files Browse the repository at this point in the history
* Fixed bug on Windows, requires macOS testing

* hide dropdown from student view

* Hide edit, delete events and confirm tentative event buttons from student view.

---------

Co-authored-by: Ethan Ho <[email protected]>
  • Loading branch information
Philip-Jian and h0ethan04 authored Apr 16, 2024
1 parent fe6b403 commit 6ba6138
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.Windows-PSOption {
color: black;
}
6 changes: 5 additions & 1 deletion src/components/Events/DailyEvent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ import PropTypes from 'prop-types';
import { Box, Flex, Text, Grid, Button, Spacer } from '@chakra-ui/react';
import { useState } from 'react';
import { NPOBackend } from '../../utils/auth_utils.js';
import AUTH_ROLES from '../../utils/auth_config.js';
import { useAuthContext } from '../../common/AuthContext.jsx';
const { USER_ROLE } = AUTH_ROLES.AUTH_ROLES;

const DailyEvent = ({ id, startTime, endTime, eventTitle, confirmed, description }) => {
const [confirmEvent, setConfirmEvent] = useState(confirmed);
const {currentUser} = useAuthContext();

let border_color = '#2B93D1';
let background_color = '#F7FAFC';
Expand Down Expand Up @@ -55,7 +59,7 @@ const DailyEvent = ({ id, startTime, endTime, eventTitle, confirmed, description
<Grid gap={2}>
<div></div>
<div></div>
<Button bg="#FBD38D" textColor="#2D3748" size="sm" onClick={handleConfirm}>
<Button bg="#FBD38D" textColor="#2D3748" size="sm" onClick={handleConfirm} visibility={currentUser.type == USER_ROLE ? 'hidden' : 'visible'}>
Confirm
</Button>
</Grid>
Expand Down
8 changes: 6 additions & 2 deletions src/components/Events/EventInfo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ import { DeleteIcon } from '@chakra-ui/icons';
import { LuPen } from 'react-icons/lu';
import PlannerModal from '../Planner/PlannerModal';
import { NPOBackend } from '../../utils/auth_utils';
import AUTH_ROLES from '../../utils/auth_config.js';
import { useAuthContext } from '../../common/AuthContext.jsx';
const { USER_ROLE } = AUTH_ROLES.AUTH_ROLES;

const EventInfo = ({ dayId, eventDate, day, startTime, endTime, location, notes, setShouldDataRevalidate }) => {
const { isOpen: isOpenPlanner, onOpen: onOpenPlanner, onClose: onClosePlanner } = useDisclosure();
const { isOpen: isOpenDelete, onOpen: onOpenDelete, onClose: onCloseDelete } = useDisclosure();
const toast = useToast();
const {currentUser} = useAuthContext();

const handlePlannerClose = () => {
setShouldDataRevalidate(true);
Expand Down Expand Up @@ -49,10 +53,10 @@ const EventInfo = ({ dayId, eventDate, day, startTime, endTime, location, notes,
<Text whiteSpace="pre-wrap" mb="2rem">{notes ? notes : 'No notes.'}</Text>

<HStack mt="auto">
<IconButton bg="white" onClick={onOpenPlanner}>
<IconButton bg="white" onClick={onOpenPlanner} visibility={currentUser.type == USER_ROLE ? 'hidden' : 'visible'}>
<LuPen color='#A0AEC0'/>
</IconButton>
<IconButton bg="white" onClick={onOpenDelete}>
<IconButton bg="white" onClick={onOpenDelete} visibility={currentUser.type == USER_ROLE ? 'hidden' : 'visible'}>
<DeleteIcon color='#A0AEC0'/>
</IconButton>
</HStack>
Expand Down
5 changes: 4 additions & 1 deletion src/pages/PublishedSchedule/PublishedSchedule.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,13 @@ const PublishedSchedule = () => {
textColor="transparent"
onChange={(e) => setSelectedSeason(e.target.value)}
width="23%"
visibility={currentUser.type == USER_ROLE ? 'hidden' : 'visible'}
>
{ currentUser.type === ADMIN_ROLE &&
allSeasons.map(item => (
<option key={item} value={item}>{item}</option>
<option key={item} value={item} className={navigator.userAgent.includes('Windows') ? 'Windows-PSOption' : 'Unix-PSOption'}>
{item}
</option>
))
}
</Select>
Expand Down

0 comments on commit 6ba6138

Please sign in to comment.