-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathToolbar.vue
More file actions
159 lines (146 loc) · 3.88 KB
/
Copy pathToolbar.vue
File metadata and controls
159 lines (146 loc) · 3.88 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<template>
<nav class="review-toolbar">
<button
class="btn btn-sm btn-light border me-3 d-md-none"
type="button"
title="Back to list"
@click="emit('back')"
>
<app-icon
variant="arrow_back"
no-margin
/>
</button>
<span class="border-end pe-3 me-3">
<app-icon
:variant="props.item.badgeIcon"
:class="typeClass"
/><span class="d-none d-sm-inline fw-bold text-uppercase">{{ props.item.displayType }}:</span> #{{ props.item.id }}
</span>
<button
class="btn btn-sm btn-primary"
@click="edit"
>
<app-icon
variant="edit_location_alt"
no-margin
/>
<span class="d-none d-sm-inline ms-2">Edit Here</span>
</button>
<button
class="btn btn-sm btn-light border ms-2"
:class="{ active: showDetails }"
aria-haspopup="true"
:aria-expanded="showDetails"
@click="toggleDetails"
>
<app-icon
variant="info"
no-margin
/>
</button>
<button
v-show="props.item.isChangeset || props.item.isNote"
class="btn btn-sm btn-light border ms-2"
:class="{ active: showDiscussion }"
aria-haspopup="true"
:aria-expanded="showDiscussion"
@click="toggleDiscussion"
>
<app-icon
variant="chat_bubble_outline"
no-margin
/>
<span
v-show="props.item.hasComments"
class="badge bg-primary ms-2"
>
{{ props.item.commentCount }}
</span>
</button>
<BPopover
content="Only validators and owners can resolve feedback"
placement="bottom"
:manual="isValidator"
>
<template #target>
<div class="d-inline-block ms-2">
<button
v-show="props.item.isFeedback && !props.item.isResolved"
class="btn btn-sm btn-success"
:disabled="!isValidator"
>
<app-icon
variant="check"
no-margin
/>
<span class="d-none d-sm-inline ms-2">Mark as Resolved</span>
</button>
</div>
</template>
</BPopover>
<BPopover
:disabled="isValidator"
content="Only validators and owners can resolve changesets reviews"
placement="bottom"
>
<template #target>
<div class="d-inline-block ms-2">
<button
v-show="props.item.isChangeset && props.item.needsReview"
class="btn btn-sm btn-success"
:disabled="!isValidator"
@click="resolveChangeset"
>
<app-icon
variant="check"
no-margin
/>
<span class="d-none d-sm-inline ms-2">Mark as Reviewed</span>
</button>
</div>
</template>
</BPopover>
</nav>
</template>
<script setup lang="ts">
import type { ReviewListItem } from '~/services/review';
interface Props {
item: ReviewListItem;
}
const props = defineProps<Props>();
const emit = defineEmits(['back', 'edit', 'resolve']);
const { isValidator } = useWorkspaceRole();
const typeClass = computed(() => props.item.badgeClass.replace('bg-', 'text-'));
const showDetails = defineModel<boolean>('showDetails');
const showDiscussion = defineModel<boolean>('showDiscussion');
function edit() {
emit('edit');
}
function resolveChangeset() {
emit('resolve');
}
function toggleDetails() {
showDetails.value = !showDetails.value;
}
function toggleDiscussion() {
showDiscussion.value = !showDiscussion.value;
}
</script>
<style lang="scss">
@import "assets/scss/theme.scss";
.review-toolbar {
display: flex;
align-items: center;
background-color: var(--bs-body-bg);
border-radius: var(--bs-border-radius);
padding: 1rem;
margin-bottom: 0.5rem;
white-space: nowrap;
box-shadow: var(--bs-box-shadow-lg);
overflow-x: auto;
@include media-breakpoint-down(sm) {
& { padding: 0.5rem; }
}
}
</style>