blob: d2040d7f1bf00d03a3f6743b397a8b5d5c170a0c [file] [log] [blame]
simonf9d78f22022-11-25 15:47:15 -05001/*
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 */
18import { Divider, Stack, Typography } from '@mui/material';
19import { useContext } from 'react';
20
21import { CallContext } from '../contexts/CallProvider';
22import { ConversationContext } from '../contexts/ConversationProvider';
23import ChatInterface from '../pages/ChatInterface';
24import { CloseButton } from './Button';
25
26export default () => {
27 return (
28 <Stack
29 width="33%"
30 height="100%"
31 sx={{
32 backgroundColor: 'white',
33 }}
34 >
35 <CallChatDrawerHeader />
36 <Divider
37 sx={{
38 borderTop: '1px solid #E5E5E5',
39 }}
40 />
41 <ChatInterface />
42 </Stack>
43 );
44};
45
46const CallChatDrawerHeader = () => {
47 const { setIsChatShown } = useContext(CallContext);
48 const { conversation } = useContext(ConversationContext);
49
50 // TODO: Improve this to support multiple members
51 const contact = conversation.getFirstMember().contact;
52
53 return (
54 <Stack direction="row" padding={2} spacing={2} alignItems="center">
55 <CloseButton
56 onClick={() => {
57 setIsChatShown(false);
58 }}
59 />
60 <Stack direction="column">
61 <Typography variant="h3" textOverflow="ellipsis">
62 {contact.getDisplayName()}
63 </Typography>
64 </Stack>
65 </Stack>
66 );
67};