diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-13 03:10:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-13 03:10:17 +0300 |
commit | dce8d0c6a7fdc7cca4df3b00b11d68000d117e2f (patch) | |
tree | ae6060a584549cfcecced34eea93e2b4fe5c64ed /app/assets/javascripts/super_sidebar | |
parent | 74cb1a1df361969e97d1a85683c1dfca5ac8cad1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/super_sidebar')
3 files changed, 89 insertions, 94 deletions
diff --git a/app/assets/javascripts/super_sidebar/components/user_menu.vue b/app/assets/javascripts/super_sidebar/components/user_menu.vue index ed6c41e85c6..891e883b6c0 100644 --- a/app/assets/javascripts/super_sidebar/components/user_menu.vue +++ b/app/assets/javascripts/super_sidebar/components/user_menu.vue @@ -12,7 +12,7 @@ import NewNavToggle from '~/nav/components/new_nav_toggle.vue'; import Tracking from '~/tracking'; import PersistentUserCallout from '~/persistent_user_callout'; import { USER_MENU_TRACKING_DEFAULTS, DROPDOWN_Y_OFFSET, IMPERSONATING_OFFSET } from '../constants'; -import UserNameGroup from './user_name_group.vue'; +import UserMenuProfileItem from './user_menu_profile_item.vue'; // Left offset required for the dropdown to be aligned with the super sidebar const DROPDOWN_X_OFFSET_BASE = -211; @@ -40,7 +40,7 @@ export default { GlDisclosureDropdownItem, GlButton, NewNavToggle, - UserNameGroup, + UserMenuProfileItem, }, directives: { SafeHtml, @@ -247,7 +247,10 @@ export default { </gl-button> </template> - <user-name-group :user="data" /> + <gl-disclosure-dropdown-group> + <user-menu-profile-item :user="data" /> + </gl-disclosure-dropdown-group> + <gl-disclosure-dropdown-group bordered> <gl-disclosure-dropdown-item v-if="data.status.can_update" diff --git a/app/assets/javascripts/super_sidebar/components/user_menu_profile_item.vue b/app/assets/javascripts/super_sidebar/components/user_menu_profile_item.vue new file mode 100644 index 00000000000..95255ce3d8e --- /dev/null +++ b/app/assets/javascripts/super_sidebar/components/user_menu_profile_item.vue @@ -0,0 +1,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> diff --git a/app/assets/javascripts/super_sidebar/components/user_name_group.vue b/app/assets/javascripts/super_sidebar/components/user_name_group.vue deleted file mode 100644 index 29cc340116b..00000000000 --- a/app/assets/javascripts/super_sidebar/components/user_name_group.vue +++ /dev/null @@ -1,91 +0,0 @@ -<script> -import { - GlBadge, - GlDisclosureDropdownGroup, - 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, - GlDisclosureDropdownGroup, - 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-group> - <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> - </gl-disclosure-dropdown-group> -</template> |