contacts and meeting details pages now show joinUrl in a popup window

This commit is contained in:
Taehee Choi 2022-03-30 12:56:43 -07:00
parent 59d7df1437
commit 1ebb45b73d
2 changed files with 49 additions and 6 deletions

View File

@ -1,5 +1,14 @@
import { Box, Button, IconButton, Typography } from "@mui/material"; import {
import React from "react"; Box,
Button,
Dialog,
DialogContent,
DialogContentText,
DialogTitle,
IconButton,
Typography,
} from "@mui/material";
import React, { useState } from "react";
import PhoneIcon from "@mui/icons-material/Phone"; import PhoneIcon from "@mui/icons-material/Phone";
import AddIcon from "@mui/icons-material/Add"; import AddIcon from "@mui/icons-material/Add";
import UserLite from "../../../../api-bodies/UserLite"; import UserLite from "../../../../api-bodies/UserLite";
@ -26,6 +35,7 @@ interface Props {
const UpperBody: React.FC<Props> = ({ contactInfo }) => { const UpperBody: React.FC<Props> = ({ contactInfo }) => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const [dialog, setDialog] = useState({ open: false, url: "" });
const userStatus: UserStatus = useAppSelector((state) => const userStatus: UserStatus = useAppSelector((state) =>
selectUserStatus(state, contactInfo.uuid) selectUserStatus(state, contactInfo.uuid)
); );
@ -54,7 +64,7 @@ const UpperBody: React.FC<Props> = ({ contactInfo }) => {
`/users/${me}/meetings`, `/users/${me}/meetings`,
JSON.stringify(newMeeting) JSON.stringify(newMeeting)
); );
window.open(response.data.joinUrl, "_blank")?.focus(); setDialog({ open: true, url: response.data.joinUrl });
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
@ -141,6 +151,17 @@ const UpperBody: React.FC<Props> = ({ contactInfo }) => {
) : null} ) : null}
</Box> </Box>
</Box> </Box>
<Dialog
open={dialog.open}
onClose={() => {
setDialog({ open: false, url: "" });
}}
>
<DialogTitle>Join</DialogTitle>
<DialogContent>
<DialogContentText>{dialog.url}</DialogContentText>
</DialogContent>
</Dialog>
</Box> </Box>
); );
}; };

View File

@ -1,5 +1,15 @@
import { AppBar, Button, IconButton, Toolbar, Typography } from "@mui/material"; import {
import React from "react"; AppBar,
Button,
Dialog,
DialogContent,
DialogContentText,
DialogTitle,
IconButton,
Toolbar,
Typography,
} from "@mui/material";
import React, { useState } from "react";
import CloseIcon from "@mui/icons-material/Close"; import CloseIcon from "@mui/icons-material/Close";
import { useAppDispatch } from "../../../redux/hooks"; import { useAppDispatch } from "../../../redux/hooks";
import { close } from "../../../redux/slices/meetingDetailsOpenSlice"; import { close } from "../../../redux/slices/meetingDetailsOpenSlice";
@ -11,6 +21,7 @@ interface Props {
const Header: React.FC<Props> = ({ meeting }) => { const Header: React.FC<Props> = ({ meeting }) => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const [dialog, setDialog] = useState({ open: false, url: "" });
return ( return (
<AppBar sx={{ position: "relative" }}> <AppBar sx={{ position: "relative" }}>
@ -22,7 +33,7 @@ const Header: React.FC<Props> = ({ meeting }) => {
variant="contained" variant="contained"
color="secondary" color="secondary"
onClick={() => { onClick={() => {
window.open(meeting.joinUrl, "_blank")?.focus(); setDialog({ open: true, url: meeting.joinUrl });
}} }}
> >
Join Join
@ -37,6 +48,17 @@ const Header: React.FC<Props> = ({ meeting }) => {
<CloseIcon /> <CloseIcon />
</IconButton> </IconButton>
</Toolbar> </Toolbar>
<Dialog
open={dialog.open}
onClose={() => {
setDialog({ open: false, url: "" });
}}
>
<DialogTitle>Join</DialogTitle>
<DialogContent>
<DialogContentText>{dialog.url}</DialogContentText>
</DialogContent>
</Dialog>
</AppBar> </AppBar>
); );
}; };