-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Sidebar design update #76868
Sidebar design update #76868
Conversation
❌ 1 Tests Failed:
View the top 1 failed tests by shortest run time
To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard |
3d6f516
to
3234afd
Compare
17a232c
to
c9f785e
Compare
4dbe461
to
09276af
Compare
1eea734
to
cdbe206
Compare
2b096c5
to
8553647
Compare
/> | ||
); | ||
if (hasNewNav && hasOrganization) { | ||
issues = ( | ||
<SubnavMenu |
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.
Most of the functional markup changes are handled by a new SubnavMenu
component, which projects children into the secondary sidebar panel as needed
// issue subnav matches against issue groups in search params | ||
if (location.pathname.startsWith('/issues/') && item?.to?.includes('/issues/')) { | ||
const search = new URLSearchParams(location.search); | ||
const itemSearch = new URLSearchParams(item.search); | ||
const itemQuery = itemSearch.get('query'); | ||
const query = search.get('query'); | ||
if (item?.label === 'All') { | ||
return !query && !itemQuery; | ||
} | ||
if (itemQuery && query) { | ||
let match = false; | ||
for (const key of itemQuery?.split(' ')) { | ||
match = query.includes(key); | ||
if (!match) break; | ||
} | ||
return match; | ||
} | ||
return !itemQuery; | ||
} |
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.
This is new "active" matching logic for the Issues subnav which required special consideration of search params.
See also: #76868 (comment)
useLayoutEffect(() => { | ||
if (!containerRef.current) return; | ||
if (containerRef.current.children.length === 0) { | ||
document.body.dataset.navLevel = '1'; | ||
} else { | ||
document.body.dataset.navLevel = '2'; | ||
} | ||
}); |
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.
Not the cleanest pattern, but since the sidebar uses position: fixed
, we need an effect that surfaces how many navigation levels are active so we can adjust the static app layout from inside the render tree.
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.
heh
would there ever be a world where we have more layers than just 2?
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.
Good question! I don't imagine there would be, so this could be treated as a boolean
attribute or class name.
v2_width: '80px', | ||
v2_panelWidth: '160px', |
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.
Slight adjustments from the spec'd designs to accommodate font rendering differences
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.
buncha nit comments!
{issues} | ||
{projects} | ||
</SidebarSection> | ||
<SidebarWrapper> |
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 i see
iiuc, we're using the SubnavContainer
component here as the main panel? (then in the children determines, whether to render a secondary panel OR the accordion?)
Do we need this wrapper anymore then or can we move the styles here to the container/primary wrapper?
Also - wonder if we should rename the SubnavContainer
to just be NavContainer
😅
)} | ||
{hasOrganization && ( | ||
<SidebarSectionGroup hasNewNav={hasNewNav}> | ||
{/* What are the onboarding sidebars? */} |
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.
oops - was this a comment i left?? 😅
can probably remove
const SidebarSectionGroup = styled('div')<{hasNewNav?: boolean}>` | ||
${responsiveFlex}; | ||
flex-shrink: 0; /* prevents shrinking on Safari */ | ||
gap: 1px; | ||
${p => p.hasNewNav && `align-items: center;`} | ||
gap: 8px; |
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.
do we have any consts for this? maybe space(1)
or something?
exact?: boolean | ||
): boolean { | ||
// issue subnav matches against issue groups in search params | ||
if (location.pathname.startsWith('/issues/') && item?.to?.includes('/issues/')) { |
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.
Will this only be relevant for issues subnav?
Will we ever need to implement logic for other routes?
wondering about scalability and how we might structure this or break this out to be more composable 🤷
useLayoutEffect(() => { | ||
if (!containerRef.current) return; | ||
if (containerRef.current.children.length === 0) { | ||
document.body.dataset.navLevel = '1'; | ||
} else { | ||
document.body.dataset.navLevel = '2'; | ||
} | ||
}); |
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.
heh
would there ever be a world where we have more layers than just 2?
organization: {...organization, features: ['navigation-sidebar-v2']}, | ||
}); | ||
|
||
expect(await screen.findByText('Issues')).toBeInTheDocument(); |
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.
Should it be findByRole('link', {name: 'Issues'})
? Or is it a button findByRole('button', {name: 'Issues'})
Bundle ReportChanges will increase total bundle size by 35.6kB (0.12%) ⬆️. This is within the configured threshold ✅ Detailed changes
|
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.
The profiling flamechart might do something similar to this. I remember they had a full-screen view first then replay did something similar afterwards.
I'm not confident that old code survived or not, but that'd be a view to double-check.
Closing in favor of #77665. The new PR should be much easier to review, since it introduces entirely new components for the navigation. |
This PR updates the sidebar design across the Sentry frontend, behind the
navigation-sidebar-v2
flag. This PR supercedes #76577.TODO
Follow-up