diff --git a/ts/components/conversation/ConversationHeader.stories.tsx b/ts/components/conversation/ConversationHeader.stories.tsx index a6a7d02ca53..aecdb4e0cbd 100644 --- a/ts/components/conversation/ConversationHeader.stories.tsx +++ b/ts/components/conversation/ConversationHeader.stories.tsx @@ -8,7 +8,10 @@ import { action } from '@storybook/addon-actions'; import { setup as setupI18n } from '../../../js/modules/i18n'; import enMessages from '../../../_locales/en/messages.json'; -import { ConversationHeader } from './ConversationHeader'; +import { + ConversationHeader, + OutgoingCallButtonStyle, +} from './ConversationHeader'; import { gifUrl } from '../../storybook/Fixtures'; const book = storiesOf('Components/Conversation/ConversationHeader', module); @@ -25,7 +28,7 @@ type ConversationHeaderStory = { const commonProps = { showBackButton: false, - showCallButtons: true, + outgoingCallButtonStyle: OutgoingCallButtonStyle.Both, markedUnread: false, i18n, @@ -186,6 +189,7 @@ const stories: Array = [ type: 'group', expireTimer: 10, acceptedMessageRequest: true, + outgoingCallButtonStyle: OutgoingCallButtonStyle.JustVideo, }, }, { @@ -201,6 +205,7 @@ const stories: Array = [ left: true, expireTimer: 10, acceptedMessageRequest: true, + outgoingCallButtonStyle: OutgoingCallButtonStyle.JustVideo, }, }, ], @@ -220,6 +225,7 @@ const stories: Array = [ type: 'direct', isMe: true, acceptedMessageRequest: true, + outgoingCallButtonStyle: OutgoingCallButtonStyle.None, }, }, ], @@ -239,6 +245,7 @@ const stories: Array = [ type: 'direct', isMe: false, acceptedMessageRequest: false, + outgoingCallButtonStyle: OutgoingCallButtonStyle.None, }, }, ], diff --git a/ts/components/conversation/ConversationHeader.tsx b/ts/components/conversation/ConversationHeader.tsx index 75771ec07c4..1fa841b6cd6 100644 --- a/ts/components/conversation/ConversationHeader.tsx +++ b/ts/components/conversation/ConversationHeader.tsx @@ -23,6 +23,13 @@ import { TimerOption, } from '../../util/ExpirationTimerOptions'; import { isMuted } from '../../util/isMuted'; +import { missingCaseError } from '../../util/missingCaseError'; + +export enum OutgoingCallButtonStyle { + None, + JustVideo, + Both, +} export interface PropsDataType { id: string; @@ -49,7 +56,7 @@ export interface PropsDataType { muteExpiresAt?: number; showBackButton?: boolean; - showCallButtons?: boolean; + outgoingCallButtonStyle: OutgoingCallButtonStyle; } export interface PropsActionsType { @@ -264,42 +271,51 @@ export class ConversationHeader extends React.Component { i18n, onOutgoingAudioCallInConversation, onOutgoingVideoCallInConversation, - showCallButtons, + outgoingCallButtonStyle, showBackButton, } = this.props; - if (!showCallButtons) { - return null; - } - - return ( - <> -