1
1
import { Fragment , useEffect , useState } from 'react' ;
2
+ import { css } from '@emotion/react' ;
2
3
import styled from '@emotion/styled' ;
3
4
import { motion , Reorder , useDragControls } from 'framer-motion' ;
4
5
@@ -72,15 +73,16 @@ export function IssueViewNavItemContent({
72
73
const organization = useOrganization ( ) ;
73
74
const location = useLocation ( ) ;
74
75
const navigate = useNavigate ( ) ;
76
+ const { projects} = useProjects ( ) ;
77
+
78
+ const hasIssueViewSharing = organization . features . includes ( 'issue-view-sharing' ) ;
75
79
76
80
const controls = useDragControls ( ) ;
77
81
78
82
const baseUrl = `/organizations/${ organization . slug } /issues` ;
79
83
const [ isEditing , setIsEditing ] = useState ( false ) ;
80
84
const { hasUnsavedChanges, changedParams} = useIssueViewUnsavedChanges ( ) ;
81
85
82
- const { projects} = useProjects ( ) ;
83
-
84
86
useEffect ( ( ) => {
85
87
if ( isActive ) {
86
88
if ( Object . keys ( location . query ) . length === 0 ) {
@@ -159,16 +161,20 @@ export function IssueViewNavItemContent({
159
161
trailingItems = {
160
162
< TrailingItemsWrapper
161
163
onClickCapture = { e => {
162
- e . preventDefault ( ) ;
164
+ if ( ! hasIssueViewSharing ) {
165
+ e . preventDefault ( ) ;
166
+ }
163
167
} }
164
168
>
165
169
< IssueViewNavQueryCount view = { view } isActive = { isActive } />
166
- < IssueViewNavEllipsisMenu
167
- isLastView = { isLastView }
168
- setIsEditing = { setIsEditing }
169
- view = { view }
170
- sectionRef = { sectionRef }
171
- />
170
+ { ! hasIssueViewSharing && (
171
+ < IssueViewNavEllipsisMenu
172
+ isLastView = { isLastView }
173
+ setIsEditing = { setIsEditing }
174
+ view = { view }
175
+ sectionRef = { sectionRef }
176
+ />
177
+ ) }
172
178
</ TrailingItemsWrapper >
173
179
}
174
180
onPointerDown = { e => {
@@ -185,14 +191,19 @@ export function IssueViewNavItemContent({
185
191
}
186
192
} }
187
193
analyticsItemName = "issues_view_starred"
194
+ hasIssueViewSharing = { hasIssueViewSharing }
188
195
>
189
- < IssueViewNavEditableTitle
190
- view = { view }
191
- isEditing = { isEditing }
192
- setIsEditing = { setIsEditing }
193
- isDragging = { ! ! isDragging }
194
- isActive = { isActive }
195
- />
196
+ { hasIssueViewSharing ? (
197
+ view . label
198
+ ) : (
199
+ < IssueViewNavEditableTitle
200
+ view = { view }
201
+ isEditing = { isEditing }
202
+ setIsEditing = { setIsEditing }
203
+ isDragging = { ! ! isDragging }
204
+ isActive = { isActive }
205
+ />
206
+ ) }
196
207
{ isActive && hasUnsavedChanges && changedParams && (
197
208
< Tooltip
198
209
title = { constructUnsavedTooltipTitle ( changedParams ) }
@@ -261,15 +272,19 @@ const TrailingItemsWrapper = styled('div')`
261
272
margin-right: ${ space ( 0.25 ) } ;
262
273
` ;
263
274
264
- const StyledSecondaryNavItem = styled ( SecondaryNav . Item ) `
275
+ const StyledSecondaryNavItem = styled ( SecondaryNav . Item ) < { hasIssueViewSharing : boolean } > `
265
276
position: relative;
266
277
padding-right: ${ space ( 0.5 ) } ;
267
278
268
279
/* Hide the ellipsis menu if the item is not hovered */
269
280
:not(:hover) {
270
- [data-ellipsis-menu-trigger]:not([aria-expanded='true']) {
271
- ${ p => p . theme . visuallyHidden }
272
- }
281
+ ${ p =>
282
+ ! p . hasIssueViewSharing &&
283
+ css `
284
+ [data-ellipsis-menu-trigger ]: not ([aria-expanded = 'true' ]) {
285
+ ${ p . theme . visuallyHidden }
286
+ }
287
+ ` }
273
288
274
289
[data-drag-icon] {
275
290
${ p => p . theme . visuallyHidden }
@@ -278,9 +293,14 @@ const StyledSecondaryNavItem = styled(SecondaryNav.Item)`
278
293
279
294
/* Hide the query count if the ellipsis menu is not expanded */
280
295
:hover {
281
- [data-issue-view-query-count] {
282
- ${ p => p . theme . visuallyHidden }
283
- }
296
+ ${ p =>
297
+ ! p . hasIssueViewSharing &&
298
+ css `
299
+ [data-issue-view-query-count ] {
300
+ ${ p . theme . visuallyHidden }
301
+ }
302
+ ` }
303
+
284
304
[data-project-icon] {
285
305
${ p => p . theme . visuallyHidden }
286
306
}
0 commit comments