Merge pull request #71 from CPSC319-Winter-term-2/home

bug fix for Schedule Meetings and Call Group
This commit is contained in:
Jincheng Lu 2022-03-30 17:45:40 -07:00 committed by GitHub
commit 0044435a11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 180 additions and 142 deletions

View File

@ -4,6 +4,7 @@ import {
Dialog,
DialogActions,
DialogContent,
DialogContentText,
DialogTitle,
FormControlLabel,
FormGroup,
@ -33,6 +34,7 @@ const CallFavouritesDialog: React.FC<Props> = ({
const [group, setGroup] = useState<string>("Favorites");
const [inputText, setInputText] = useState<string>("");
const [checkedUuids, setCheckedUuids] = useState<string[]>([]);
const [urlDialog, seturlDialog] = useState({ open: false, url: "" });
const handleCheck = (uuid: string, checked: boolean) => {
if (checked) {
@ -58,8 +60,11 @@ const CallFavouritesDialog: React.FC<Props> = ({
const auth = useAuth();
const handleCall = async(e: React.SyntheticEvent) => {
const start = new Date().toISOString();
let newStart = start.split('.')[0];
newStart += start.includes("Z") ? "Z" : "";
const newMeeting: NewMeeting ={
startTime: new Date().toISOString(),
startTime: newStart,
duration: 60,
topic: "Quick Call to Group",
registrantIds: checkedUuids
@ -70,10 +75,12 @@ const CallFavouritesDialog: React.FC<Props> = ({
);
const meeting: DetailedMeeting = response?.data;
console.log("create meeting response: " + meeting.startTime + ":" + meeting.duration);
seturlDialog({ open: true, url: meeting.joinUrl });
handleClose();
};
return (
<>
<Dialog onClose={handleClose} open={open} fullWidth maxWidth="sm">
<DialogTitle>Select who to call:</DialogTitle>
<DialogContent>
@ -127,6 +134,18 @@ const CallFavouritesDialog: React.FC<Props> = ({
</Button>
</DialogActions>
</Dialog>
<Dialog
open={urlDialog.open}
onClose={() => {
seturlDialog({ open: false, url: "" });
}}
>
<DialogTitle>Join</DialogTitle>
<DialogContent>
<DialogContentText>{urlDialog.url}</DialogContentText>
</DialogContent>
</Dialog>
</>
);
};

View File

@ -4,6 +4,7 @@ import {
Dialog,
DialogActions,
DialogContent,
DialogContentText,
DialogTitle,
FormControlLabel,
FormGroup,
@ -28,7 +29,7 @@ import {
handleClose: () => void;
}
const CallFavouritesDialog: React.FC<Props> = ({
const CallScheduledMeetingDialog: React.FC<Props> = ({
open,
handleClose,
}: Props) => {
@ -39,6 +40,7 @@ import {
const [group, setGroup] = useState<string>("Favorites");
const [inputText, setInputText] = useState<string>("");
const [checkedUuids, setCheckedUuids] = useState<string[]>([]);
const [urlDialog, seturlDialog] = useState({ open: false, url: "" });
const handleCheck = (uuid: string, checked: boolean) => {
if (checked) {
@ -69,8 +71,11 @@ import {
const auth = useAuth();
const handleCall = async(e: React.SyntheticEvent) => {
const start = meetingStartDate ? meetingStartDate.toISOString() : new Date().toISOString();
let newStart = start.split('.')[0];
newStart += start.includes("Z") ? "Z" : "";
const newMeeting: NewMeeting ={
startTime: meetingStartDate ? meetingStartDate.toISOString() : new Date().toISOString(),
startTime: newStart,
duration: meetingDuration,
topic: meetingTopic,
registrantIds: checkedUuids
@ -81,10 +86,12 @@ import {
);
const meeting: DetailedMeeting = response?.data;
console.log("create meeting response: " + meeting.startTime + ":" + meeting.duration);
seturlDialog({ open: true, url: meeting.joinUrl });
handleClose();
};
return (
<>
<Dialog onClose={handleClose} open={open} fullWidth maxWidth="sm">
<DialogTitle>Schedule A Meeting</DialogTitle>
<DialogContent dividers>
@ -172,7 +179,19 @@ import {
</Button>
</DialogActions>
</Dialog>
<Dialog
open={urlDialog.open}
onClose={() => {
seturlDialog({ open: false, url: "" });
}}
>
<DialogTitle>Join</DialogTitle>
<DialogContent>
<DialogContentText>{urlDialog.url}</DialogContentText>
</DialogContent>
</Dialog>
</>
);
};
export default CallFavouritesDialog;
export default CallScheduledMeetingDialog;