From 1e005e1f10899de9492d1ba8004eee5f1ab12427 Mon Sep 17 00:00:00 2001 From: talksik Date: Mon, 30 May 2022 09:40:03 -0500 Subject: [PATCH] separating out the footer controls finally and feels nicer overall --- .../desktop/src/components/FooterControls.tsx | 200 ++++++++++++++++++ packages/desktop/src/components/Terminal.tsx | 181 +--------------- 2 files changed, 202 insertions(+), 179 deletions(-) diff --git a/packages/desktop/src/components/FooterControls.tsx b/packages/desktop/src/components/FooterControls.tsx index e69de29..71cb28b 100644 --- a/packages/desktop/src/components/FooterControls.tsx +++ b/packages/desktop/src/components/FooterControls.tsx @@ -0,0 +1,200 @@ +import { + Box, + Stack, + IconButton, + Avatar, + Tooltip, + Switch, + Button, + AvatarGroup, + Fab, + ListItemIcon, + Typography, + Menu, + MenuItem, +} from '@mui/material'; +import { blueGrey } from '@mui/material/colors'; + +import React from 'react'; +import { FiHeadphones, FiSun, FiLogOut } from 'react-icons/fi'; +import ConversationLabel from '../subcomponents/ConversationLabel'; +import useTerminal from './Terminal'; +import useAuth from '../providers/AuthProvider'; + +export default function FooterControls() { + const { selectedConversation } = useTerminal(); + const { user, logout } = useAuth(); + + const [anchorEl, setAnchorEl] = React.useState(null); + const open = Boolean(anchorEl); + const handleClickProfileMenu = (event: React.MouseEvent) => { + setAnchorEl(event.currentTarget); + }; + const handleCloseProfileMenu = () => { + setAnchorEl(null); + }; + + return ( + + + + + + + + + + + + + + + + + + + + + {selectedConversation && ( + + + + + + + + + + + + {selectedConversation.userCache?.map((conversationUser, index) => ( + + ))} + + + + )} + + {/* todo: add a third mode which is when toggle broadcasting */} + {selectedConversation ? ( + + + + + + ) : ( + + + + + + )} + + + + + + + + Logout + + + + ); +} diff --git a/packages/desktop/src/components/Terminal.tsx b/packages/desktop/src/components/Terminal.tsx index fb1dce7..a7a1242 100644 --- a/packages/desktop/src/components/Terminal.tsx +++ b/packages/desktop/src/components/Terminal.tsx @@ -53,6 +53,7 @@ import { ConversationList } from './ConversationList'; import NewConversationDialog from './NewConversationDialog'; import { createGroupConversation } from '../firebase/firestore'; import ConversationLabel from '../subcomponents/ConversationLabel'; +import FooterControls from './FooterControls'; type ConversationMap = { [conversationId: string]: Conversation; }; @@ -505,15 +506,6 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) { [setSelectedConversationId], ); - const [anchorEl, setAnchorEl] = React.useState(null); - const open = Boolean(anchorEl); - const handleClick = (event: React.MouseEvent) => { - setAnchorEl(event.currentTarget); - }; - const handleClose = () => { - setAnchorEl(null); - }; - const [createConversationMode, setCreateConversationMode] = useState(false); const handleStartConversation = useCallback( @@ -617,176 +609,7 @@ export function TerminalProvider({ children }: { children?: React.ReactNode }) { - {/* footer controls */} - - - - - - - - - - - - - - - - - - - - - {selectedConversation && ( - - - - - - - - - - - - {selectedConversation.userCache?.map((conversationUser, index) => ( - - ))} - - - - )} - - {/* todo: add a third mode which is when toggle broadcasting */} - {selectedConversation ? ( - - - - - - ) : ( - - - - - - )} - - - - - - - - Logout - - - + {children}