Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sidebar): add context call option #4640

Merged
merged 1 commit into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions assets/styles/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,6 @@ a.link {
&:extend(.font-flair);
}

.context-menu {
p {
&:hover {
&:extend(.background-flair);
}
}
}

.simple-menu {
.active {
&:extend(.background-flair);
Expand Down
4 changes: 2 additions & 2 deletions components/interactables/ContextMenu/ContextMenu.html
Original file line number Diff line number Diff line change
Expand Up @@ -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"
>
Expand All @@ -11,7 +11,7 @@
<p
v-if="item.text !== 'quickReaction'"
data-cy="context-menu-option"
:class="{'red': item.type === 'danger'}"
:class="item?.type"
@click="handle(item.func)"
>
{{ item.text }}
Expand Down
16 changes: 13 additions & 3 deletions components/interactables/ContextMenu/ContextMenu.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down
15 changes: 7 additions & 8 deletions components/ui/ContextMenu/ContextMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
>
<TypographyText :class="{ danger: item.type === 'danger' }">
<TypographyText :color="item?.type === 'danger' ? 'error' : 'body'">
{{ item.text }}
</TypographyText>
</button>
Expand Down Expand Up @@ -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;
Expand Down
22 changes: 0 additions & 22 deletions components/ui/ContextMenu/ListItem/ListItem.vue

This file was deleted.

27 changes: 22 additions & 5 deletions components/views/navigation/sidebar/list/item/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,28 @@ 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,
type: 'danger',
},
]
: [
{ 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,
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion store/ui/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down