Skip to content

Commit

Permalink
replace NcAvatar with AvatarWrapper in call components
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy committed Oct 2, 2023
1 parent 0473b2c commit 973a735
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 155 deletions.
63 changes: 0 additions & 63 deletions src/assets/avatar.scss

This file was deleted.

42 changes: 12 additions & 30 deletions src/components/CallView/shared/LocalVideo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-
- @author Grigorii Shartsev <me@shgk.me>
-
- @license GNU AGPL version 3 or any later version
- @license AGPL-3.0-or-later
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -42,19 +42,13 @@
<VideoBackground v-if="isGrid || isStripe"
:display-name="displayName"
:user="userId" />
<NcAvatar v-if="userId"
<AvatarWrapper :id="userId"
:name="displayName"
:source="actorType"
:size="avatarSize"
:disable-menu="true"
:disable-tooltip="true"
:show-user-status="false"
:user="userId"
:display-name="displayName"
disable-menu
disable-tooltip
:class="avatarClass" />
<div v-if="!userId"
:class="guestAvatarClass"
class="avatar guest">
{{ firstLetterOfGuestName }}
</div>
</div>

<div v-if="mouseover && isSelectable" class="hover-shadow" />
Expand All @@ -76,9 +70,9 @@ import SHA1 from 'crypto-js/sha1.js'

import { showError, showInfo, TOAST_PERMANENT_TIMEOUT } from '@nextcloud/dialogs'

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

import AvatarWrapper from '../../AvatarWrapper/AvatarWrapper.vue'
import VideoBackground from './VideoBackground.vue'

import video from '../../../mixins/video.js'
Expand All @@ -90,7 +84,7 @@ export default {
name: 'LocalVideo',

components: {
NcAvatar,
AvatarWrapper,
NcButton,
VideoBackground,
},
Expand Down Expand Up @@ -187,13 +181,12 @@ export default {
return this.$store.getters.getUserId()
},

displayName() {
return this.$store.getters.getDisplayName()
actorType() {
return this.$store.getters.getActorType()
},

firstLetterOfGuestName() {
const customName = this.guestName !== t('spreed', 'Guest') ? this.guestName : '?'
return customName.charAt(0)
displayName() {
return this.$store.getters.getDisplayName()
},

sessionHash() {
Expand Down Expand Up @@ -223,12 +216,6 @@ export default {
}
},

guestAvatarClass() {
return Object.assign(this.avatarClass, {
['avatar-' + this.avatarSize + 'px']: true,
})
},

localStreamVideoError() {
return this.localMediaModel.attributes.localStream && this.localMediaModel.attributes.localStreamRequestVideoError
},
Expand Down Expand Up @@ -364,11 +351,6 @@ export default {
</script>

<style lang="scss" scoped>
@import '../../../assets/variables';
@import '../../../assets/avatar';
@include avatar-mixin(64px);
@include avatar-mixin(128px);

.not-connected {
video,
.avatar-container {
Expand Down
61 changes: 23 additions & 38 deletions src/components/CallView/shared/VideoVue.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!--
- @copyright Copyright (c) 2019, Daniel Calviño Sánchez (danxuliu@gmail.com)
-
- @license GNU AGPL version 3 or any later version
- @license AGPL-3.0-or-later
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -50,24 +50,14 @@
<div v-if="showBackgroundAndAvatar"
:key="'backgroundAvatar'"
class="avatar-container">
<template v-if="participantUserId">
<VideoBackground :display-name="participantName"
:user="participantUserId" />
<NcAvatar :size="avatarSize"
:disable-menu="true"
:disable-tooltip="true"
:user="participantUserId"
:display-name="participantName"
:show-user-status="false"
:class="avatarClass" />
</template>
<template v-else>
<VideoBackground :display-name="participantName" />
<div :class="guestAvatarClass"
class="avatar guest">
{{ firstLetterOfGuestName }}
</div>
</template>
<VideoBackground :display-name="participantName" :user="participantUserId" />
<AvatarWrapper :id="participantUserId"
:name="participantName"
:source="participantActorType"
:size="avatarSize"
disable-menu
disable-tooltip
:class="avatarClass" />
</div>
</TransitionWrapper>
<TransitionWrapper name="fade">
Expand Down Expand Up @@ -101,8 +91,7 @@ import SHA1 from 'crypto-js/sha1.js'

import AccountCircle from 'vue-material-design-icons/AccountCircle.vue'

import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'

import AvatarWrapper from '../../AvatarWrapper/AvatarWrapper.vue'
import TransitionWrapper from '../../TransitionWrapper.vue'
import Screen from './Screen.vue'
import VideoBackground from './VideoBackground.vue'
Expand All @@ -119,7 +108,7 @@ export default {
name: 'VideoVue',

components: {
NcAvatar,
AvatarWrapper,
TransitionWrapper,
VideoBackground,
AccountCircle,
Expand Down Expand Up @@ -317,23 +306,12 @@ export default {
}
},

guestAvatarClass() {
return Object.assign(this.avatarClass, {
['avatar-' + this.avatarSize + 'px']: true,
})
},

connectionMessageClass() {
return {
'below-avatar': this.showBackgroundAndAvatar,
}
},

firstLetterOfGuestName() {
const customName = this.participantName && this.participantName !== t('spreed', 'Guest') ? this.participantName : '?'
return customName.charAt(0)
},

sessionHash() {
return Hex.stringify(SHA1(this.peerId))
},
Expand Down Expand Up @@ -361,6 +339,18 @@ export default {
}) || {}
},

participantActorType() {
if (this.participant?.actorType) {
return this.participant.actorType
} else if (this.peerData?.actorType) {
return this.peerData.actorType
} else {
return this.participantUserId
? ATTENDEE.ACTOR_TYPE.USERS
: ATTENDEE.ACTOR_TYPE.GUESTS
}
},

participantUserId() {
if (this.model.attributes.userId) {
return this.model.attributes.userId
Expand Down Expand Up @@ -588,11 +578,6 @@ export default {
</script>

<style lang="scss" scoped>
@import '../../../assets/avatar';
@import '../../../assets/variables';
@include avatar-mixin(64px);
@include avatar-mixin(128px);

.forced-white {
filter: drop-shadow(1px 1px 4px var(--color-box-shadow));
}
Expand Down
37 changes: 13 additions & 24 deletions src/components/MediaSettings/MediaSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
-
- @author Marco Ambrosini <[email protected]>
-
- @license GNU AGPL version 3 or any later version
- @license AGPL-3.0-or-later
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -40,17 +40,12 @@
class="preview__novideo">
<VideoBackground :display-name="displayName"
:user="userId" />
<NcAvatar v-if="userId"
<AvatarWrapper :id="userId"
:name="displayName"
:source="actorType"
:size="128"
:disable-menu="true"
:disable-tooltip="true"
:show-user-status="false"
:user="userId"
:display-name="displayName" />
<div v-if="!userId"
class="avatar avatar-128px guest">
{{ firstLetterOfGuestName }}
</div>
disable-menu
disable-tooltip />
</div>
</div>

Expand Down Expand Up @@ -190,13 +185,13 @@ import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'

import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js'
import NcModal from '@nextcloud/vue/dist/Components/NcModal.js'
import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip.js'

import AvatarWrapper from '../AvatarWrapper/AvatarWrapper.vue'
import VideoBackground from '../CallView/shared/VideoBackground.vue'
import MediaDevicesSelector from '../MediaDevicesSelector.vue'
import CallButton from '../TopBar/CallButton.vue'
Expand All @@ -219,14 +214,14 @@ export default {
},

components: {
AvatarWrapper,
Bell,
BellOff,
CallButton,
Cog,
Creation,
NcActionButton,
NcActions,
NcAvatar,
NcButton,
NcCheckboxRadioSwitch,
NcModal,
Expand Down Expand Up @@ -279,15 +274,14 @@ export default {
)
},

firstLetterOfGuestName() {
const customName = this.guestName !== t('spreed', 'Guest') ? this.guestName : '?'
return customName.charAt(0)
},

userId() {
return this.$store.getters.getUserId()
},

actorType() {
return this.$store.getters.getActorType()
},

token() {
return this.$store.getters.getToken()
},
Expand Down Expand Up @@ -557,11 +551,6 @@ export default {
</script>

<style lang="scss" scoped>
@import '../../assets/variables';
@import '../../assets/avatar';
@include avatar-mixin(64px);
@include avatar-mixin(128px);

.media-settings {
padding: calc(var(--default-grid-baseline)*4);
background-color: var(--color-main-background);
Expand Down Expand Up @@ -608,7 +597,7 @@ export default {
}

&__call-preferences {
height: $clickable-area;
height: var(--default-clickable-area);
display: flex;
justify-content: center;
align-items: center;
Expand Down

0 comments on commit 973a735

Please sign in to comment.