diff --git a/assets/styles/base.less b/assets/styles/base.less index 7014961ab3..555804b75f 100644 --- a/assets/styles/base.less +++ b/assets/styles/base.less @@ -185,14 +185,6 @@ a.link { &:extend(.font-flair); } -.context-menu { - p { - &:hover { - &:extend(.background-flair); - } - } -} - .simple-menu { .active { &:extend(.background-flair); diff --git a/components/interactables/ContextMenu/ContextMenu.html b/components/interactables/ContextMenu/ContextMenu.html index dce7ddf083..5f7975e4fa 100644 --- a/components/interactables/ContextMenu/ContextMenu.html +++ b/components/interactables/ContextMenu/ContextMenu.html @@ -2,7 +2,7 @@ class="context-menu" data-cy="context-menu" ref="contextMenu" - v-bind:style="{ left: ui.contextMenuPosition.x + 'px', + :style="{ left: ui.contextMenuPosition.x + 'px', top: ui.contextMenuPosition.y + 'px' }" v-click-outside="close" > @@ -11,7 +11,7 @@

{{ item.text }} diff --git a/components/interactables/ContextMenu/ContextMenu.less b/components/interactables/ContextMenu/ContextMenu.less index 88c78b34cc..0b455362d2 100644 --- a/components/interactables/ContextMenu/ContextMenu.less +++ b/components/interactables/ContextMenu/ContextMenu.less @@ -20,9 +20,19 @@ font-size: 14px; font-family: @secondary-font; &:hover { - &.red { - &:extend(.font-secondary); - &:extend(.background-danger); + background: @flair-color; + } + &.danger { + color: @red; + &:hover { + color: @light; + background: @red; + } + } + &.disabled { + opacity: 0.7; + &:hover { + background: none; } } } diff --git a/components/ui/ContextMenu/ContextMenu.vue b/components/ui/ContextMenu/ContextMenu.vue index c4541d9001..15349d6e15 100644 --- a/components/ui/ContextMenu/ContextMenu.vue +++ b/components/ui/ContextMenu/ContextMenu.vue @@ -47,10 +47,10 @@ v-if="item.text !== 'quickReaction'" :key="String(item.text) + '-action'" class="action-button" - :class="{ danger: item.type === 'danger' }" + :class="item?.type" @click="(e) => handleAction(e, item.func)" > - + {{ item.text }} @@ -137,18 +137,17 @@ export default Vue.extend({ margin: 0 @normal-spacing; &:extend(.background-semitransparent-dark); - &:extend(.font-secondary); &:extend(.round-corners); - .danger { - color: @red; - } - .action-button { height: 56px; justify-content: center; align-items: center; - width: @full; + width: 100%; + + &.disabled { + opacity: 0.7; + } &:not(:last-child) { border-bottom: 0.5px solid @foreground; diff --git a/components/ui/ContextMenu/ListItem/ListItem.vue b/components/ui/ContextMenu/ListItem/ListItem.vue deleted file mode 100644 index cb5e3b8e84..0000000000 --- a/components/ui/ContextMenu/ListItem/ListItem.vue +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/components/views/navigation/sidebar/list/item/Item.vue b/components/views/navigation/sidebar/list/item/Item.vue index 410cb98677..5842563242 100644 --- a/components/views/navigation/sidebar/list/item/Item.vue +++ b/components/views/navigation/sidebar/list/item/Item.vue @@ -66,12 +66,15 @@ export default Vue.extend({ contextMenuValues(): ContextMenuItem[] { return this.conversation?.type === 'direct' ? [ - { text: this.$t('context.send'), func: this.openConversation }, { - text: this.$t('context.profile'), - func: () => - this.$store.dispatch('ui/showProfile', this.conversation), + text: this.$t('context.voice'), + func: this.status === 'online' ? this.call : () => {}, + type: this.status === 'online' ? 'primary' : 'disabled', }, + // { + // text: this.$t('context.profile'), + // func: () => this.$store.dispatch('ui/showProfile', this.user), + // }, { text: this.$t('context.remove'), func: this.removeFriend, @@ -79,7 +82,12 @@ export default Vue.extend({ }, ] : [ - { text: this.$t('context.send'), func: this.openConversation }, + { + text: this.$t('context.voice'), + func: () => {}, + type: 'disabled', + }, + { text: this.$t('context.leave_group'), func: this.leaveGroup, @@ -193,6 +201,15 @@ export default Vue.extend({ } this.$router.push(`/chat/${this.conversation.id}`) }, + async call() { + await iridium.webRTC + .call({ + recipient: this.userId, + conversationId: this.conversationId, + kinds: ['audio'], + }) + .catch((e) => this.$toast.error(this.$t(e.message) as string)) + }, /** * @method markdownToHtml * @description convert text markdown to html diff --git a/locales/en-US.js b/locales/en-US.js index 1998aebb0b..552c0a22e8 100644 --- a/locales/en-US.js +++ b/locales/en-US.js @@ -862,8 +862,7 @@ export default { rename: 'Rename', delete: 'Delete', // SidebarListItem - send: 'Send Message', - voice: 'Start Call', + voice: 'Call', video: 'Video Call', remove: 'Remove Friend', leave_group: 'Leave Group', diff --git a/store/ui/types.ts b/store/ui/types.ts index 3509662ba5..915c295f89 100644 --- a/store/ui/types.ts +++ b/store/ui/types.ts @@ -62,7 +62,7 @@ export enum SettingsRoutes { REALMS = 'realms', } -export type ContextMenuItemTypes = 'primary' | 'danger' +export type ContextMenuItemTypes = 'primary' | 'danger' | 'disabled' export interface ContextMenuItem { text: string | TranslateResult