Skip to content

Commit

Permalink
fix: hide call layout switch when the call view is still empty.
Browse files Browse the repository at this point in the history
Signed-off-by: DorraJaouad <[email protected]>
  • Loading branch information
DorraJaouad authored and Antreesy committed May 13, 2024
1 parent 698a5a5 commit fff4ccb
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 15 deletions.
13 changes: 11 additions & 2 deletions src/components/CallView/CallView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
:local-shared-data="localSharedData" />

<template v-else>
<EmptyCallView v-if="!callParticipantModels.length && !screenSharingActive" :is-sidebar="isSidebar" />
<EmptyCallView v-if="showEmptyCallView" :is-sidebar="isSidebar" />

<div id="videos">
<div v-if="!isGrid || !callParticipantModels.length" class="video__promoted" :class="{'full-page': showFullPage}">
Expand Down Expand Up @@ -322,13 +322,17 @@ export default {
},

shouldShowPresenterOverlay() {
return this.shownRemoteScreenCallParticipantModel.attributes.videoAvailable || this.isModelWithVideo(this.shownRemoteScreenCallParticipantModel)
return this.shownRemoteScreenCallParticipantModel?.attributes.videoAvailable || this.isModelWithVideo(this.shownRemoteScreenCallParticipantModel)

},

presenterVideoBlockerEnabled() {
return this.sharedDatas[this.shownRemoteScreenPeerId]?.remoteVideoBlocker?.isVideoEnabled()
},

showEmptyCallView() {
return !this.callParticipantModels.length && !this.screenSharingActive
},
},

watch: {
Expand Down Expand Up @@ -401,6 +405,10 @@ export default {
presenterVideoBlockerEnabled(value) {
this.showPresenterOverlay = value
},

showEmptyCallView(value) {
this.$store.dispatch('isEmptyCallView', value)
},
},

created() {
Expand All @@ -422,6 +430,7 @@ export default {

beforeDestroy() {
this.debounceFetchPeers.clear?.()
this.$store.dispatch('isEmptyCallView', true)
EventBus.off('refresh-peer-list', this.debounceFetchPeers)

callParticipantCollection.off('remove', this._lowerHandWhenParticipantLeaves)
Expand Down
29 changes: 16 additions & 13 deletions src/components/TopBar/TopBarMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,20 @@
{{ t('spreed', 'Media settings') }}
</NcActionButton>
<NcActionSeparator />
<!-- Call layout switcher -->
<NcActionButton v-if="showCallLayoutSwitch"
close-after-click
@click="changeView">
<template #icon>
<GridView v-if="!isGrid"
:size="20" />
<PromotedView v-else
:size="20" />
</template>
{{ changeViewText }}
</NcActionButton>
</template>

<!-- Call layout switcher -->
<NcActionButton v-if="showActions && isInCall"
close-after-click
@click="changeView">
<template #icon>
<GridView v-if="!isGrid"
:size="20" />
<PromotedView v-else
:size="20" />
</template>
{{ changeViewText }}
</NcActionButton>

<!-- Fullscreen -->
<NcActionButton :aria-label="t('spreed', 'Toggle full screen')"
close-after-click
Expand Down Expand Up @@ -370,6 +369,10 @@ export default {
return this.conversation.objectType === CONVERSATION.OBJECT_TYPE.BREAKOUT_ROOM
&& this.isInCall
},

showCallLayoutSwitch() {
return !this.$store.getters.isEmptyCallView
}
},

methods: {
Expand Down
9 changes: 9 additions & 0 deletions src/store/callViewStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const state = {
isViewerOverlay: false,
isGrid: false,
isStripeOpen: true,
isEmptyCallView: true,
lastIsGrid: null,
lastIsStripeOpen: null,
presentationStarted: false,
Expand All @@ -29,6 +30,7 @@ const getters = {
isViewerOverlay: (state) => state.isViewerOverlay,
isGrid: (state) => state.isGrid,
isStripeOpen: (state) => state.isStripeOpen,
isEmptyCallView: (state) => state.isEmptyCallView,
lastIsGrid: (state) => state.lastIsGrid,
lastIsStripeOpen: (state) => state.lastIsStripeOpen,
presentationStarted: (state) => state.presentationStarted,
Expand Down Expand Up @@ -68,6 +70,9 @@ const mutations = {
isStripeOpen(state, value) {
state.isStripeOpen = value
},
isEmptyCallView(state, value) {
state.isEmptyCallView = value
},
lastIsGrid(state, value) {
state.lastIsGrid = value
},
Expand Down Expand Up @@ -231,6 +236,10 @@ const actions = {
dismissQualityWarningTooltip(context) {
context.commit('setQualityWarningTooltipDismissed', { qualityWarningTooltipDismissed: true })
},

isEmptyCallView(context, value) {
context.commit('isEmptyCallView', value)
},
}

export default { state, mutations, getters, actions }

0 comments on commit fff4ccb

Please sign in to comment.