Skip to content

Commit

Permalink
able to change colors on tutorial card
Browse files Browse the repository at this point in the history
  • Loading branch information
Jasmine Tran committed Sep 14, 2023
1 parent 29fc5e2 commit 958bacc
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion client/src/components/timetable/ExpandedEventView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Save,
} from '@mui/icons-material';
import {
Button,
Dialog,
Grid,
IconButton,
Expand All @@ -21,7 +22,7 @@ import {
TextField,
Typography,
} from '@mui/material';
import { styled } from '@mui/system';
import { Box, styled } from '@mui/system';
import { TimePicker } from '@mui/x-date-pickers';
import React, { useContext, useState } from 'react';

Expand All @@ -31,6 +32,7 @@ import { CourseContext } from '../../context/CourseContext';
import { EventTime } from '../../interfaces/Periods';
import { ExpandedEventViewProps } from '../../interfaces/PropTypes';
import {
StyledButtonContainer,
StyledDialogContent,
StyledDialogTitle,
StyledListItem,
Expand Down Expand Up @@ -225,6 +227,12 @@ const ExpandedEventView: React.FC<ExpandedEventViewProps> = ({
delete updatedEventData[id];
setCreatedEvents(updatedEventData);
};

const handleSaveNewTutorialColor = () => {
handleUpdateEvent(eventPeriod.event.id);
handleCloseDialog();
}

return (
<Dialog open={popupOpen} maxWidth="sm" onClose={handleCloseDialog}>
{isEditing ? (
Expand Down Expand Up @@ -413,6 +421,26 @@ const ExpandedEventView: React.FC<ExpandedEventViewProps> = ({
</StyledListItem>
)}
</StyledDialogContent>
{eventPeriod.subtype === 'Tutoring' && (
<Box display="flex" justifyContent="center" alignItems="center" paddingBottom={1}>
<ColorPicker
color={newColor}
setColor={setNewColor}
colorPickerAnchorEl={colorPickerAnchorEl}
handleOpenColorPicker={handleOpenColorPicker}
handleCloseColorPicker={handleCloseColorPicker}
/>
<div>
<Button
variant="outlined"
size="small"
onClick={handleSaveNewTutorialColor}
>
Save
</Button>
</div>
</Box>
)}
</>
)}
</Dialog>
Expand Down

0 comments on commit 958bacc

Please sign in to comment.