From 55f91fbfb5e952a56261a0e33f1c8b7bcda6d398 Mon Sep 17 00:00:00 2001 From: mbalsdon Date: Fri, 11 Mar 2022 21:43:40 -0800 Subject: [PATCH] finish nonfunctional call favourites button dialog component --- src/components/home/CallFavouritesDialog.tsx | 44 ++++++++++++++++++++ src/components/home/Home.tsx | 16 ++++++- src/components/home/ShortCuts.tsx | 29 ++++++++++++- 3 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 src/components/home/CallFavouritesDialog.tsx diff --git a/src/components/home/CallFavouritesDialog.tsx b/src/components/home/CallFavouritesDialog.tsx new file mode 100644 index 0000000..61c97ee --- /dev/null +++ b/src/components/home/CallFavouritesDialog.tsx @@ -0,0 +1,44 @@ +import { Button, Checkbox, Dialog, DialogActions, DialogContent, DialogTitle, FormControlLabel, FormGroup, Typography } from "@mui/material"; +import { SidebarUserObj } from "../sidebar/SidebarUser"; + +interface Props { + open: boolean; + selectedValue: SidebarUserObj; + onClose: (value: SidebarUserObj) => void; + users: SidebarUserObj[]; +} + +const CallFavouritesDialog: React.FC = ({ open, selectedValue, onClose, users }: Props) => { + const handleClose = () => { + onClose(selectedValue); + }; + + return ( + + Select who to call: + + } label="Select everyone" /> + + + + {users.map((user) => ( + } label={user.name} /> + ))} + + + + + + + + ); +}; + +export default CallFavouritesDialog; \ No newline at end of file diff --git a/src/components/home/Home.tsx b/src/components/home/Home.tsx index c50a231..43829b6 100644 --- a/src/components/home/Home.tsx +++ b/src/components/home/Home.tsx @@ -2,8 +2,22 @@ import MeetingsPanel from "./MeetingsPanel"; import ShortCuts from "./ShortCuts"; import Container from "@mui/material/Container"; import Grid from "@mui/material/Grid"; +import { MeetingStatus, SidebarUserObj } from "../sidebar/SidebarUser"; +import { useState } from "react"; const Home: React.FC = () => { + + /* Temporary data - this is the same as what's in ProtectedRoute.tsx so it should not + be duplicated like this in the future (Route components were being weird when I tried + to pass it down from App.tsx) */ + const [mockUsers] = useState([ + { id: 0, name: "Jincheng L.", meetingStatus: MeetingStatus.ONLINE }, + { id: 1, name: "Matt B.", meetingStatus: MeetingStatus.IN_MEETING }, + { id: 2, name: "Taehee C.", meetingStatus: MeetingStatus.OFFLINE }, + { id: 3, name: "Bob A.", meetingStatus: MeetingStatus.AWAY } + ]); + + return ( @@ -11,7 +25,7 @@ const Home: React.FC = () => { - + diff --git a/src/components/home/ShortCuts.tsx b/src/components/home/ShortCuts.tsx index 61afba9..eae6245 100644 --- a/src/components/home/ShortCuts.tsx +++ b/src/components/home/ShortCuts.tsx @@ -4,8 +4,27 @@ import PhoneEnabledIcon from "@mui/icons-material/PhoneEnabled"; import CircleIcon from "@mui/icons-material/Circle"; import Button from "@mui/material/Button"; import Grid from "@mui/material/Grid"; +import { SidebarUserObj } from "../sidebar/SidebarUser"; +import CallFavouritesDialog from "./CallFavouritesDialog"; +import { useState } from "react"; + +interface Props { + users: SidebarUserObj[]; +} + +const ShortCuts: React.FC = ({ users }: Props) => { + const [open, setOpen] = useState(false); + const [selectedValue, setSelectedValue] = useState(users[0]); + + const handleClickOpen = () => { + setOpen(true); + }; + + const handleClose = (value: SidebarUserObj) => { + setOpen(false); + setSelectedValue(value); + }; -const ShortCuts: React.FC = () => { return (
@@ -24,10 +43,16 @@ const ShortCuts: React.FC = () => { - + +