From f008abe473e20c992d6d6856c42c87f4491bc0af Mon Sep 17 00:00:00 2001 From: CodeServer Date: Thu, 31 Mar 2022 01:45:08 +0100 Subject: [PATCH] bug fix for Schedule Meetings and Call Group --- src/components/home/CallFavouritesDialog.tsx | 125 ++++++----- src/components/home/ScheduleMeetingDialog.tsx | 197 ++++++++++-------- 2 files changed, 180 insertions(+), 142 deletions(-) diff --git a/src/components/home/CallFavouritesDialog.tsx b/src/components/home/CallFavouritesDialog.tsx index 484035a..e074548 100644 --- a/src/components/home/CallFavouritesDialog.tsx +++ b/src/components/home/CallFavouritesDialog.tsx @@ -4,6 +4,7 @@ import { Dialog, DialogActions, DialogContent, + DialogContentText, DialogTitle, FormControlLabel, FormGroup, @@ -33,6 +34,7 @@ const CallFavouritesDialog: React.FC = ({ const [group, setGroup] = useState("Favorites"); const [inputText, setInputText] = useState(""); const [checkedUuids, setCheckedUuids] = useState([]); + const [urlDialog, seturlDialog] = useState({ open: false, url: "" }); const handleCheck = (uuid: string, checked: boolean) => { if (checked) { @@ -58,8 +60,11 @@ const CallFavouritesDialog: React.FC = ({ 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,63 +75,77 @@ const CallFavouritesDialog: React.FC = ({ ); const meeting: DetailedMeeting = response?.data; console.log("create meeting response: " + meeting.startTime + ":" + meeting.duration); + seturlDialog({ open: true, url: meeting.joinUrl }); handleClose(); }; return ( - - Select who to call: - - - - - { - setInputText(e.target.value); - }} - /> - - {groupMembers - .filter((member) => - member.name.toLowerCase().includes(inputText.toLowerCase()) - ) - .map((member) => ( - { - handleCheck(member.uuid, e.target.checked); - }} - control={ - - } - /> - ))} - - + <> + + Select who to call: + + + + + { + setInputText(e.target.value); + }} + /> + + {groupMembers + .filter((member) => + member.name.toLowerCase().includes(inputText.toLowerCase()) + ) + .map((member) => ( + { + handleCheck(member.uuid, e.target.checked); + }} + control={ + + } + /> + ))} + + - - - - + + + + + { + seturlDialog({ open: false, url: "" }); + }} + > + Join + + {urlDialog.url} + + + ); }; diff --git a/src/components/home/ScheduleMeetingDialog.tsx b/src/components/home/ScheduleMeetingDialog.tsx index 3dbec0f..2570aa5 100644 --- a/src/components/home/ScheduleMeetingDialog.tsx +++ b/src/components/home/ScheduleMeetingDialog.tsx @@ -4,6 +4,7 @@ import { Dialog, DialogActions, DialogContent, + DialogContentText, DialogTitle, FormControlLabel, FormGroup, @@ -28,7 +29,7 @@ import { handleClose: () => void; } - const CallFavouritesDialog: React.FC = ({ + const CallScheduledMeetingDialog: React.FC = ({ open, handleClose, }: Props) => { @@ -39,6 +40,7 @@ import { const [group, setGroup] = useState("Favorites"); const [inputText, setInputText] = useState(""); const [checkedUuids, setCheckedUuids] = useState([]); + 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,98 +86,112 @@ import { ); const meeting: DetailedMeeting = response?.data; console.log("create meeting response: " + meeting.startTime + ":" + meeting.duration); + seturlDialog({ open: true, url: meeting.joinUrl }); handleClose(); }; return ( - - Schedule A Meeting - - - } + <> + + Schedule A Meeting + + + } + /> + + { + setMeetingDuration(parseInt(event.target.value)); + }} /> - - { - setMeetingDuration(parseInt(event.target.value)); - }} - /> - - - { - setMeetingTopic(event.target.value); - }} - /> - - - - - - { - setInputText(e.target.value); - }} - /> - - {groupMembers - .filter((member) => - member.name.toLowerCase().includes(inputText.toLowerCase()) - ) - .map((member) => ( - { - handleCheck(member.uuid, e.target.checked); - }} - control={ - - } - /> - ))} - - - - - - - + + + { + setMeetingTopic(event.target.value); + }} + /> + + + + + + { + setInputText(e.target.value); + }} + /> + + {groupMembers + .filter((member) => + member.name.toLowerCase().includes(inputText.toLowerCase()) + ) + .map((member) => ( + { + handleCheck(member.uuid, e.target.checked); + }} + control={ + + } + /> + ))} + + + + + + + + { + seturlDialog({ open: false, url: "" }); + }} + > + Join + + {urlDialog.url} + + + ); }; - export default CallFavouritesDialog; \ No newline at end of file + export default CallScheduledMeetingDialog; \ No newline at end of file