Skip to content

Commit

Permalink
added chatprofile with video support in dapp (#1359)
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausMikhaelson authored Jan 5, 2024
1 parent 856e973 commit 5cb17a5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 63 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@mui/material": "^5.5.0",
"@pushprotocol/restapi": "1.4.45",
"@pushprotocol/socket": "0.5.3",
"@pushprotocol/uiweb": "1.1.23",
"@pushprotocol/uiweb": "1.2.0",
"@reduxjs/toolkit": "^1.7.1",
"@testing-library/dom": "^9.0.1",
"@testing-library/jest-dom": "^4.2.4",
Expand Down
81 changes: 19 additions & 62 deletions src/components/chat/w2wChat/chatBox/ChatBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import ScrollToBottom from 'react-scroll-to-bottom';
import { useClickAway } from 'react-use';
import styled, { useTheme } from 'styled-components';
import { produce } from 'immer';
import { ChatViewList, MessageInput } from '@pushprotocol/uiweb';
import { ChatProfile, ChatViewList, MessageInput } from '@pushprotocol/uiweb';
// Internal Components
import { ReactComponent as Info } from 'assets/chat/group-chat/info.svg';
import { ReactComponent as InfoDark } from 'assets/chat/group-chat/infodark.svg';
Expand Down Expand Up @@ -248,48 +248,9 @@ const ChatBox = ({ showGroupInfoModal }): JSX.Element => {
background={theme.default.bg}
padding="6px"
fontWeight="500"
zIndex="1"
>
<ItemHV2
height="48px"
flex="initial"
>
<TabletBackButton
margin="0px 5px 0px 0px"
color={theme.default.secondaryColor}
background="transparent"
hover="transparent"
hoverBackground="transparent"
onClick={() => {
setChat(null);
}}
>
<MdOutlineArrowBackIos size={24} />
</TabletBackButton>

<ImageV2
height="48px"
width="48px"
alt="Profile Picture"
src={imageSource}
borderRadius="100%"
overflow="hidden"
objectFit="cover"
/>
</ItemHV2>

<SpanV2
flex="1"
margin="5px 10px"
fontWeight="400"
textAlign="start"
>
{getDisplayName()}
</SpanV2>

{/* Video call button */}
{!isGroup && (
<Tooltip
{(!!currentChat || !!Object.keys(currentChat || {}).length) && (
<ChatProfile component={<Tooltip
tooltipContent="Video call"
placementProps={{
bottom: '1.4rem',
Expand All @@ -306,25 +267,7 @@ const ChatBox = ({ showGroupInfoModal }): JSX.Element => {
src={videoCallIcon}
/>
</VideoCallButton>
</Tooltip>
)}

{currentChat.groupInformation && (
<MoreOptions onClick={() => setShowGroupInfo(!showGroupInfo)}>
<ItemHV2 padding="0px 11px 0px 0px">{theme.scheme == 'light' ? <More /> : <MoreDark />}</ItemHV2>
{showGroupInfo && (
<GroupInfo
onClick={() => {
showGroupInfoModal();
setShowGroupInfo(false);
}}
ref={groupInfoRef}
>
<ItemVV2 maxWidth="32px">{theme.scheme == 'light' ? <Info /> : <InfoDark />}</ItemVV2>
<SpanV2 color={theme.default.secondaryColor}>Group Info</SpanV2>
</GroupInfo>
)}
</MoreOptions>
</Tooltip>} style="Info" chatId={(currentChat?.did?.includes(":") ? currentChat?.did.split(":")[1] : currentChat?.did) || currentChat?.groupInformation?.chatId} />
)}
</ItemHV2>

Expand Down Expand Up @@ -392,6 +335,21 @@ const MessageContainer = styled(ItemVV2)`
// margin: 0;
width: 95%;
height: 80%;
@media (max-height: 750px) {
height: 75%;
}
@media (max-height: 650px) {
height: 70%;
}
@media (max-height: 550px) {
height: 63%;
}
@media (max-height: 450px) {
height: 55%;
}
@media (max-height: 400px) {
height: 45%;
}
// max-height: 20%;
overflow-x: hidden;
// overflow-y: scroll;
Expand Down Expand Up @@ -626,7 +584,6 @@ const VideoCallButton = styled(ButtonV2)`
max-width: 1.75rem;
min-width: 1.75rem;
background: none;
margin-right: 2rem;
`;

export default ChatBox;

0 comments on commit 5cb17a5

Please sign in to comment.