-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(issue-views): Change add view button to just + icon near starred views header' #87360
Changes from all commits
c58679b
c13f91b
0a2c4c5
b0708de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,6 +130,8 @@ export function IssueViewNavItemContent({ | |
|
||
const {startInteraction, endInteraction, isInteractingRef} = useNavContext(); | ||
|
||
const scrollPosition = window.scrollY || document.documentElement.scrollTop; | ||
|
||
return ( | ||
<StyledReorderItem | ||
as="div" | ||
|
@@ -148,13 +150,18 @@ export function IssueViewNavItemContent({ | |
}} | ||
dragListener={false} | ||
dragControls={controls} | ||
// This style is a hack to fix a framer-motion bug that causes views to | ||
// jump from the bottom of the nav bar to their correct positions | ||
// upon scrolling down on the page and triggering a page navigation. | ||
// See: https://github.com/motiondivision/motion/issues/2006 | ||
style={{ | ||
...(isDragging | ||
...(isDragging || scrollPosition === 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This kinda fixes that really annoying issue where views wouldn't animate in and out as a result of the originY styles. We only need to apply those styles if the user has scrolled down on the page, since that's what triggers the framer motion bug. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nice to add a comment here about why this is necessary since it will be very confusing to future readers! |
||
? {} | ||
: { | ||
originY: '0px', | ||
}), | ||
}} | ||
grabbing={isDragging === view.id} | ||
> | ||
<StyledSecondaryNavItem | ||
to={constructViewLink(baseUrl, view)} | ||
|
@@ -345,9 +352,9 @@ const hasUnsavedChanges = ( | |
|
||
// Reorder.Item does handle lifting an item being dragged above other items out of the box, | ||
// but we need to ensure the item is relatively positioned and has a background color for it to work | ||
const StyledReorderItem = styled(Reorder.Item)` | ||
const StyledReorderItem = styled(Reorder.Item)<{grabbing: boolean}>` | ||
position: relative; | ||
background-color: ${p => p.theme.translucentSurface200}; | ||
background-color: ${p => (p.grabbing ? p.theme.translucentSurface200 : 'transparent')}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
border-radius: ${p => p.theme.borderRadius}; | ||
`; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import {useCallback, useEffect, useMemo, useState} from 'react'; | ||
import {AnimatePresence, Reorder} from 'framer-motion'; | ||
import styled from '@emotion/styled'; | ||
import {Reorder} from 'framer-motion'; | ||
import debounce from 'lodash/debounce'; | ||
import isEqual from 'lodash/isEqual'; | ||
|
||
import {IssueViewAddViewButton} from 'sentry/components/nav/issueViews/issueViewAddViewButton'; | ||
import {IssueViewNavItemContent} from 'sentry/components/nav/issueViews/issueViewNavItemContent'; | ||
import {SecondaryNav} from 'sentry/components/nav/secondary'; | ||
import {normalizeDateTimeParams} from 'sentry/components/organizations/pageFilters/parse'; | ||
import {t} from 'sentry/locale'; | ||
import {trackAnalytics} from 'sentry/utils/analytics'; | ||
import {setApiQueryData, useQueryClient} from 'sentry/utils/queryClient'; | ||
import normalizeUrl from 'sentry/utils/url/normalizeUrl'; | ||
|
@@ -256,17 +259,25 @@ export function IssueViewNavItems({ | |
); | ||
|
||
return ( | ||
<Reorder.Group | ||
as="div" | ||
axis="y" | ||
values={views} | ||
onReorder={newOrder => setViews(newOrder)} | ||
initial={false} | ||
ref={sectionRef} | ||
<SecondaryNav.Section | ||
title={ | ||
<TitleWrapper> | ||
{t('Starred Views')} | ||
<IssueViewAddViewButton baseUrl={baseUrl} /> | ||
</TitleWrapper> | ||
} | ||
> | ||
Comment on lines
+262
to
269
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is moved in from navigation.tsx |
||
{views.map(view => ( | ||
<AnimatePresence key={view.id} mode="sync"> | ||
<Reorder.Group | ||
as="div" | ||
axis="y" | ||
values={views} | ||
onReorder={newOrder => setViews(newOrder)} | ||
initial={false} | ||
ref={sectionRef} | ||
> | ||
{views.map(view => ( | ||
<IssueViewNavItemContent | ||
key={view.id} | ||
view={view} | ||
sectionRef={sectionRef} | ||
isActive={view.id === viewId} | ||
|
@@ -278,10 +289,9 @@ export function IssueViewNavItems({ | |
isDragging={isDragging} | ||
setIsDragging={setIsDragging} | ||
/> | ||
</AnimatePresence> | ||
))} | ||
<IssueViewAddViewButton baseUrl={baseUrl} /> | ||
</Reorder.Group> | ||
))} | ||
</Reorder.Group> | ||
</SecondaryNav.Section> | ||
); | ||
} | ||
|
||
|
@@ -299,3 +309,9 @@ export const constructViewLink = (baseUrl: string, view: IssueView) => { | |
}, | ||
}); | ||
}; | ||
|
||
const TitleWrapper = styled('div')` | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idk why but there are top level sentry.css styles that are forcing margin and height properties on the loadingindicator.mini class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh I hate when we run into high specificity CSS styles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if adding
mini
is conflicting with theheight
prop you're sending?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might, but
mini
also controls the width of the loading ring. Without it here, the width looks too big relative to the space its contained in.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah that makes sense