11<template >
22 <div class =" event-header" >
33 <div class =" event-layout__container" >
4- <span
5- v-if =" !loading"
6- class =" event-header__date"
7- >
8- {{ formattedFullDate }}
9- </span >
4+ <div class =" event-header__top-right" >
5+ <span
6+ v-if =" !loading"
7+ class =" event-header__date"
8+ >
9+ {{ formattedFullDate }}
10+ </span >
11+ <CdxButton
12+ v-if =" isAdmin"
13+ class =" event-header__button--more"
14+ secondary
15+ icon =" EtcHorisontal"
16+ @click =" onMoreClick"
17+ />
18+ </div >
1019
1120 <div
1221 v-if =" workspace"
@@ -130,10 +139,14 @@ import { Workspace } from '@/types/workspaces';
130139import { projectBadges } from ' ../../mixins/projectBadges' ;
131140import ProjectBadge from ' ../project/ProjectBadge.vue' ;
132141import { JavaScriptAddons } from ' @hawk.so/types' ;
142+ import { Button as CdxButton , usePopover } from ' @codexteam/ui/vue' ;
143+ import EventActionsMenu from ' ./EventActionsMenu.vue' ;
144+ import Icon from ' ../utils/Icon.vue' ;
133145
134146export default defineComponent ({
135147 name: ' EventHeader' ,
136148 components: {
149+ CdxButton ,
137150 TabBar ,
138151 ViewedBy ,
139152 UiButton ,
@@ -153,6 +166,14 @@ export default defineComponent({
153166 validator : prop => typeof prop === ' object' || prop === null ,
154167 },
155168 },
169+ setup() {
170+ const { showPopover, hide } = usePopover ();
171+
172+ return {
173+ showPopover ,
174+ hidePopover: hide ,
175+ };
176+ },
156177 data() {
157178 return {
158179 /**
@@ -253,6 +274,13 @@ export default defineComponent({
253274 return this .$store .getters .getWorkspaceByProjectId (this .projectId );
254275 },
255276
277+ /**
278+ * Is current user admin in workspace with this project
279+ */
280+ isAdmin(): boolean {
281+ return this .workspace ? this .$store .getters .isCurrentUserAdmin (this .workspace .id ) : false ;
282+ },
283+
256284 /**
257285 * Computed property that returns formatted full date for event timestamp
258286 */
@@ -302,6 +330,33 @@ export default defineComponent({
302330 window .open (this .event .taskManagerItem .url , ' _blank' , ' noopener' );
303331 }
304332 },
333+
334+ /**
335+ * Open the "more options" context menu near the 3-dot button
336+ *
337+ * @param event - native click mouse event
338+ */
339+ onMoreClick(event : MouseEvent ) {
340+ if (! this .isAdmin ) {
341+ return ;
342+ }
343+
344+ this .showPopover ({
345+ targetEl: event .currentTarget as HTMLElement ,
346+ with: {
347+ component: EventActionsMenu ,
348+ props: {
349+ projectId: this .projectId ,
350+ eventId: this .$route .params .eventId ,
351+ onClose : () => this .hidePopover (),
352+ },
353+ },
354+ align: {
355+ vertically: ' below' ,
356+ horizontally: ' right' ,
357+ },
358+ });
359+ },
305360 },
306361});
307362 </script >
@@ -352,8 +407,14 @@ export default defineComponent({
352407 text-overflow : ellipsis ;
353408 }
354409
355- &__date {
410+ &__top-right {
411+ display : flex ;
356412 float : right ;
413+ align-items : center ;
414+ gap : 12px ;
415+ }
416+
417+ &__date {
357418 font-size : 12px ;
358419 line-height : 23px ;
359420 }
@@ -395,6 +456,7 @@ export default defineComponent({
395456 &:hover {
396457 color : var (--color-text-main )
397458 }
459+
398460 }
399461
400462 &__nav-bar, &__viewed-by {
0 commit comments