1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
<script>
import { GlBadge, GlDisclosureDropdownItem, GlTooltip } from '@gitlab/ui';
import SafeHtml from '~/vue_shared/directives/safe_html';
import { s__ } from '~/locale';
import { USER_MENU_TRACKING_DEFAULTS } from '../constants';
export default {
i18n: {
user: {
busy: s__('UserProfile|Busy'),
},
},
components: {
GlBadge,
GlDisclosureDropdownItem,
GlTooltip,
},
directives: {
SafeHtml,
},
props: {
user: {
required: true,
type: Object,
},
},
computed: {
menuItem() {
const item = {
text: this.user.name,
};
if (this.user.has_link_to_profile) {
item.href = this.user.link_to_profile;
item.extraAttrs = {
...USER_MENU_TRACKING_DEFAULTS,
'data-track-label': 'user_profile',
'data-testid': 'user-profile-link',
};
}
return item;
},
},
};
</script>
<template>
<gl-disclosure-dropdown-item :item="menuItem">
<template #list-item>
<span class="gl-display-flex gl-flex-direction-column">
<span>
<span class="gl-font-weight-bold">
{{ user.name }}
</span>
<gl-badge v-if="user.status.busy" size="sm" variant="warning">
{{ $options.i18n.user.busy }}
</gl-badge>
</span>
<span class="gl-text-gray-400 gl-word-break-all">@{{ user.username }}</span>
<span
v-if="user.status.customized"
ref="statusTooltipTarget"
data-testid="user-menu-status"
class="gl-display-flex gl-align-items-baseline gl-mt-2 gl-font-sm"
>
<gl-emoji :data-name="user.status.emoji" class="gl-mr-1" />
<span v-safe-html="user.status.message_html" class="gl-text-truncate"></span>
<gl-tooltip
v-if="user.status.message_html"
:target="() => $refs.statusTooltipTarget"
boundary="viewport"
placement="bottom"
>
<span v-safe-html="user.status.message_html"></span>
</gl-tooltip>
</span>
</span>
</template>
</gl-disclosure-dropdown-item>
</template>
|