You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
2.0 KiB
TypeScript
68 lines
2.0 KiB
TypeScript
import React from 'react';
|
|
|
|
import { useDispatch, useSelector } from 'react-redux';
|
|
import {
|
|
isMessageDetailView,
|
|
isMessageSelectionMode,
|
|
} from '../../../state/selectors/conversations';
|
|
|
|
import { closeMessageDetailsView, openRightPanel } from '../../../state/ducks/conversations';
|
|
|
|
import { useSelectedConversationKey } from '../../../state/selectors/selectedConversation';
|
|
import { Flex } from '../../basic/Flex';
|
|
import { AvatarHeader, BackButton, CallButton } from './ConversationHeaderItems';
|
|
import { SelectionOverlay } from './ConversationHeaderSelectionOverlay';
|
|
import { ConversationHeaderTitle } from './ConversationHeaderTitle';
|
|
|
|
export const ConversationHeaderWithDetails = () => {
|
|
const isSelectionMode = useSelector(isMessageSelectionMode);
|
|
const isMessageDetailOpened = useSelector(isMessageDetailView);
|
|
const selectedConvoKey = useSelectedConversationKey();
|
|
const dispatch = useDispatch();
|
|
|
|
if (!selectedConvoKey) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<div className="module-conversation-header">
|
|
<Flex
|
|
container={true}
|
|
justifyContent={isMessageDetailOpened ? 'space-between' : 'flex-end'}
|
|
alignItems="center"
|
|
width="100%"
|
|
flexGrow={1}
|
|
>
|
|
<BackButton
|
|
onGoBack={() => {
|
|
dispatch(closeMessageDetailsView());
|
|
}}
|
|
showBackButton={isMessageDetailOpened}
|
|
/>
|
|
<ConversationHeaderTitle />
|
|
|
|
{!isSelectionMode && (
|
|
<Flex
|
|
container={true}
|
|
flexDirection="row"
|
|
alignItems="center"
|
|
flexGrow={0}
|
|
flexShrink={0}
|
|
>
|
|
<CallButton />
|
|
<AvatarHeader
|
|
onAvatarClick={() => {
|
|
dispatch(openRightPanel());
|
|
}}
|
|
pubkey={selectedConvoKey}
|
|
showBackButton={isMessageDetailOpened}
|
|
/>
|
|
</Flex>
|
|
)}
|
|
</Flex>
|
|
|
|
{isSelectionMode && <SelectionOverlay />}
|
|
</div>
|
|
);
|
|
};
|