Hide call buttons when on call
This commit is contained in:
parent
a7854c6083
commit
decc93532b
18 changed files with 622 additions and 366 deletions
68
ts/state/smart/ConversationHeader.tsx
Normal file
68
ts/state/smart/ConversationHeader.tsx
Normal file
|
@ -0,0 +1,68 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { pick } from 'lodash';
|
||||
import { ConversationHeader } from '../../components/conversation/ConversationHeader';
|
||||
import { getConversationSelector } from '../selectors/conversations';
|
||||
import { StateType } from '../reducer';
|
||||
import { isCallActive } from '../ducks/calling';
|
||||
import { getIntl } from '../selectors/user';
|
||||
|
||||
export interface OwnProps {
|
||||
id: string;
|
||||
|
||||
onDeleteMessages: () => void;
|
||||
onGoBack: () => void;
|
||||
onOutgoingAudioCallInConversation: () => void;
|
||||
onOutgoingVideoCallInConversation: () => void;
|
||||
onResetSession: () => void;
|
||||
onSearchInConversation: () => void;
|
||||
onSetDisappearingMessages: (seconds: number) => void;
|
||||
onSetMuteNotifications: (seconds: number) => void;
|
||||
onSetPin: (value: boolean) => void;
|
||||
onShowAllMedia: () => void;
|
||||
onShowGroupMembers: () => void;
|
||||
|
||||
onArchive: () => void;
|
||||
onMarkUnread: () => void;
|
||||
onMoveToInbox: () => void;
|
||||
onShowSafetyNumber: () => void;
|
||||
}
|
||||
|
||||
const mapStateToProps = (state: StateType, ownProps: OwnProps) => {
|
||||
const conversation = getConversationSelector(state)(ownProps.id);
|
||||
if (!conversation) {
|
||||
throw new Error('Could not find conversation');
|
||||
}
|
||||
|
||||
return {
|
||||
...pick(conversation, [
|
||||
'acceptedMessageRequest',
|
||||
'avatarPath',
|
||||
'canChangeTimer',
|
||||
'color',
|
||||
'expireTimer',
|
||||
'isArchived',
|
||||
'isMe',
|
||||
'isMissingMandatoryProfileSharing',
|
||||
'isPinned',
|
||||
'isVerified',
|
||||
'left',
|
||||
'markedUnread',
|
||||
'muteExpiresAt',
|
||||
'name',
|
||||
'phoneNumber',
|
||||
'profileName',
|
||||
'title',
|
||||
'type',
|
||||
]),
|
||||
i18n: getIntl(state),
|
||||
showBackButton: state.conversations.selectedConversationPanelDepth > 0,
|
||||
showCallButtons:
|
||||
conversation.type === 'direct' &&
|
||||
!conversation.isMe &&
|
||||
!isCallActive(state.calling),
|
||||
};
|
||||
};
|
||||
|
||||
const smart = connect(mapStateToProps, {});
|
||||
|
||||
export const SmartConversationHeader = smart(ConversationHeader);
|
Loading…
Add table
Add a link
Reference in a new issue