Skip to content

Commit

Permalink
Merge pull request #13185 from nextcloud/fix/13160/empty-call-view-en…
Browse files Browse the repository at this point in the history
…hancement
  • Loading branch information
Antreesy authored Sep 3, 2024
2 parents 7974c5c + 4cdab82 commit 0c85aca
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 21 deletions.
56 changes: 38 additions & 18 deletions src/components/CallView/shared/EmptyCallView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
:class="{
'empty-call-view--sidebar': isSidebar,
'empty-call-view--small': isSmall
}">
<div class="icon" :class="iconClass" />
}"
data-theme-dark>
<component :is="emptyCallViewIcon" :size="isSidebar ? 32 : 64" class="empty-call-view__icon" />
<h2>{{ title }}</h2>
<template v-if="!isSmall">
<p v-if="message" class="emptycontent-additional">
Expand All @@ -28,19 +29,37 @@
</template>

<script>
import IconAccountMultiple from 'vue-material-design-icons/AccountMultiple.vue'
import IconAlertOctagon from 'vue-material-design-icons/AlertOctagon.vue'
import IconLinkVariant from 'vue-material-design-icons/LinkVariant.vue'
import IconPhone from 'vue-material-design-icons/Phone.vue'

import { t } from '@nextcloud/l10n'

import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'

import { CONVERSATION, PARTICIPANT } from '../../../constants.js'
import { copyConversationLinkToClipboard } from '../../../utils/handleUrl.ts'

const STATUS_ERRORS = {
400: t('spreed', 'Recording consent is required'),
403: t('spreed', 'This conversation is read-only'),
404: t('spreed', 'Conversation not found or not joined'),
412: t('spreed', "Lobby is still active and you're not a moderator"),
}

export default {

name: 'EmptyCallView',

components: {
NcButton,
IconAccountMultiple,
IconAlertOctagon,
IconLinkVariant,
IconPhone,
NcLoadingIcon,
},

props: {
Expand Down Expand Up @@ -118,16 +137,15 @@ export default {
|| (this.conversation && this.conversation.participantType === PARTICIPANT.TYPE.GUEST_MODERATOR)
},

iconClass() {
emptyCallViewIcon() {
if (this.connectionFailed) {
return 'icon-error'
}
if (this.isConnecting) {
return 'icon-loading'
return IconAlertOctagon
} else if (this.isConnecting) {
return NcLoadingIcon
} else if (this.isPhoneConversation) {
return 'icon-phone'
return IconPhone
} else {
return this.isPublicConversation ? 'icon-public' : 'icon-contacts'
return this.isPublicConversation ? IconLinkVariant : IconAccountMultiple
}
},

Expand All @@ -148,18 +166,19 @@ export default {
},

helper() {
if (this.connectionFailed) {
return t('spreed', 'Please try to reload the page')
}
return ''
return this.connectionFailed ? t('spreed', 'Please try to reload the page') : ''
},

message() {
if (this.connectionFailed === 'consent') {
return t('spreed', 'Recording consent is required')
}

if (this.connectionFailed) {
const statusCode = this.connectionFailed?.meta?.statuscode
if (STATUS_ERRORS[statusCode]) {
return STATUS_ERRORS[statusCode]
}
if (this.connectionFailed?.data?.error) {
return this.connectionFailed.data.error
}

return t('spreed', 'Something went wrong')
}

Expand Down Expand Up @@ -232,8 +251,9 @@ export default {
margin: 4px auto;
}

&__icon,
h2, p {
color: #FFFFFF;
color: var(--color-main-text);
}

&--sidebar {
Expand Down
2 changes: 1 addition & 1 deletion src/store/participantsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ const mutations = {
},

connectionFailed(state, { token, payload }) {
Vue.set(state.connectionFailed, token, payload ?? 'failed')
Vue.set(state.connectionFailed, token, payload)
},

finishedConnecting(state, { token, sessionId }) {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/signaling.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,10 @@ Signaling.Base.prototype.joinCall = function(token, flags, silent, recordingCons
}.bind(this))
.catch(function(e) {
reject(new Error())
console.error('Connection failed, reason: ', e.response?.data?.ocs?.data?.error)
console.error('Connection failed, reason: ', e)
store.commit('connectionFailed', {
token,
payload: e.response?.data?.ocs?.data?.error,
payload: e.response?.data?.ocs,
})
})
})
Expand Down

0 comments on commit 0c85aca

Please sign in to comment.