simon | f9d78f2 | 2022-11-25 15:47:15 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2022 Savoir-faire Linux Inc. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU Affero General Public License as |
| 6 | * published by the Free Software Foundation; either version 3 of the |
| 7 | * License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU Affero General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Affero General Public |
| 15 | * License along with this program. If not, see |
| 16 | * <https://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | import { Divider, Stack, Typography } from '@mui/material'; |
simon | f9d78f2 | 2022-11-25 15:47:15 -0500 | [diff] [blame] | 19 | |
simon | 5c67796 | 2022-12-02 16:51:54 -0500 | [diff] [blame] | 20 | import { useCallContext } from '../contexts/CallProvider'; |
simon | 09fe482 | 2022-11-30 23:36:25 -0500 | [diff] [blame] | 21 | import { useConversationContext } from '../contexts/ConversationProvider'; |
simon | f9d78f2 | 2022-11-25 15:47:15 -0500 | [diff] [blame] | 22 | import ChatInterface from '../pages/ChatInterface'; |
| 23 | import { CloseButton } from './Button'; |
| 24 | |
| 25 | export default () => { |
| 26 | return ( |
| 27 | <Stack |
| 28 | width="33%" |
| 29 | height="100%" |
| 30 | sx={{ |
| 31 | backgroundColor: 'white', |
| 32 | }} |
| 33 | > |
| 34 | <CallChatDrawerHeader /> |
| 35 | <Divider |
| 36 | sx={{ |
| 37 | borderTop: '1px solid #E5E5E5', |
| 38 | }} |
| 39 | /> |
| 40 | <ChatInterface /> |
| 41 | </Stack> |
| 42 | ); |
| 43 | }; |
| 44 | |
| 45 | const CallChatDrawerHeader = () => { |
simon | 5c67796 | 2022-12-02 16:51:54 -0500 | [diff] [blame] | 46 | const { setIsChatShown } = useCallContext(); |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 47 | const { conversationDisplayName } = useConversationContext(); |
simon | f9d78f2 | 2022-11-25 15:47:15 -0500 | [diff] [blame] | 48 | |
| 49 | return ( |
| 50 | <Stack direction="row" padding={2} spacing={2} alignItems="center"> |
| 51 | <CloseButton |
| 52 | onClick={() => { |
| 53 | setIsChatShown(false); |
| 54 | }} |
| 55 | /> |
| 56 | <Stack direction="column"> |
| 57 | <Typography variant="h3" textOverflow="ellipsis"> |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 58 | {conversationDisplayName} |
simon | f9d78f2 | 2022-11-25 15:47:15 -0500 | [diff] [blame] | 59 | </Typography> |
| 60 | </Stack> |
| 61 | </Stack> |
| 62 | ); |
| 63 | }; |