@@ -36,6 +36,7 @@ import { isVideoRoom } from "../../utils/video-rooms";
3636import { UIFeature } from "../../settings/UIFeature" ;
3737import { type InteractionName } from "../../PosthogTrackers" ;
3838import { ElementCallMemberEventType } from "../../call-types" ;
39+ import { LocalRoom , LocalRoomState } from "../../models/LocalRoom" ;
3940
4041export enum PlatformCallType {
4142 ElementCall ,
@@ -83,7 +84,7 @@ const enum State {
8384 * @returns the call button attributes for the given room
8485 */
8586export const useRoomCall = (
86- room : Room ,
87+ room : Room | LocalRoom ,
8788) : {
8889 voiceCallDisabledReason : string | null ;
8990 voiceCallClick ( evt : React . MouseEvent | undefined , selectedType : PlatformCallType ) : void ;
@@ -274,11 +275,16 @@ export const useRoomCall = (
274275 } ) ;
275276 } , [ isViewingCall , room . roomId ] ) ;
276277
278+ const roomDoesNotExist = room instanceof LocalRoom && room . state !== LocalRoomState . CREATED ;
279+
277280 // We hide the voice call button if it'd have the same effect as the video call button
278281 let hideVoiceCallButton = isManagedHybridWidgetEnabled ( room ) || ! callOptions . includes ( PlatformCallType . LegacyCall ) ;
279282 let hideVideoCallButton = false ;
280- // We hide both buttons if they require widgets but widgets are disabled, or if the Voip feature is disabled.
281- if ( ( memberCount > 2 && ! widgetsFeatureEnabled ) || ! voipFeatureEnabled ) {
283+ // We hide both buttons if:
284+ // - they require widgets but widgets are disabled
285+ // - if the Voip feature is disabled.
286+ // - The room is not created yet (rendering "send first message view")
287+ if ( ( memberCount > 2 && ! widgetsFeatureEnabled ) || ! voipFeatureEnabled || roomDoesNotExist ) {
282288 hideVoiceCallButton = true ;
283289 hideVideoCallButton = true ;
284290 }
0 commit comments