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
|
<script>
import { GlPopover, GlButton } from '@gitlab/ui';
import { s__, sprintf } from '~/locale';
import { getCookie, parseBoolean, setCookie } from '~/lib/utils/common_utils';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { NEW_ACTIONS_POPOVER_KEY } from '~/issues/show/constants';
import { IssuableTypeText } from '~/issues/constants';
export default {
name: 'NewHeaderActionsPopover',
i18n: {
popoverText: s__(
'HeaderAction|Notifications and other %{issueType} actions have moved to this menu.',
),
confirmButtonText: s__('HeaderAction|Okay!'),
},
components: {
GlPopover,
GlButton,
},
mixins: [glFeatureFlagMixin()],
props: {
issueType: {
type: String,
required: true,
},
},
data() {
return {
dismissKey: NEW_ACTIONS_POPOVER_KEY,
popoverDismissed: parseBoolean(getCookie(`${NEW_ACTIONS_POPOVER_KEY}`)),
};
},
computed: {
popoverText() {
return sprintf(this.$options.i18n.popoverText, {
issueType: IssuableTypeText[this.issueType],
});
},
showPopover() {
return !this.popoverDismissed && this.isMrSidebarMoved;
},
isMrSidebarMoved() {
return this.glFeatures.movedMrSidebar;
},
},
methods: {
dismissPopover() {
this.popoverDismissed = true;
setCookie(this.dismissKey, this.popoverDismissed);
},
},
};
</script>
<template>
<div>
<gl-popover
v-if="showPopover"
target="new-actions-header-dropdown"
container="viewport"
placement="left"
:show="showPopover"
triggers="manual"
content="text"
:css-classes="['gl-p-2 new-header-popover']"
>
<template #title>
<div class="gl-font-base gl-font-weight-normal">
{{ popoverText }}
</div>
</template>
<gl-button
data-testid="confirm-button"
variant="confirm"
type="submit"
@click="dismissPopover"
>{{ $options.i18n.confirmButtonText }}</gl-button
>
</gl-popover>
</div>
</template>
|