Repository navigation
feat(settings): Add scope navigation rail #128341
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
Merged
Merged
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
026f07e
feat(settings): Add scope navigation rail
priscilawebdev 183561b
fix(settings): Match scope header and back button design
priscilawebdev 177add1
fix(settings): Keep scope header and sections in sync
priscilawebdev 706ffdd
Merge branch 'master' into feat/settings-scope-navigation
priscilawebdev 048cf4c
feat(settings): Refine V3 scope navigation and project selection
priscilawebdev 3171838
ref(settings): Simplify scope navigation and touch handling
priscilawebdev c266529
ref(settings): Use router matching for settings navigation
priscilawebdev f455a47
docs(nav): Explain secondary navigation header props
priscilawebdev 2762093
fix(settings): Restore the organization projects link
priscilawebdev c74a099
fix(settings): Preserve project list and selector navigation
priscilawebdev 32c7f47
docs(settings): Explain account navigation filtering
priscilawebdev b0339b6
ref(nav): Extract the secondary navigation toggle
priscilawebdev 4353148
ref(nav): Introduce an expandable secondary navigation header
priscilawebdev 495a067
ref(nav): Clarify the header with sidebar toggle name
priscilawebdev 0302cec
ref(nav): Use Disclosure for collapsible navigation sections
priscilawebdev ca19ff3
revert(nav): Keep the existing collapsible navigation sections
priscilawebdev 86f7eb6
ref(settings): Clarify navigation item title selection
priscilawebdev 29d19cf
Merge branch 'master' into feat/settings-scope-navigation
priscilawebdev 850c643
ref(navigation): Compose secondary navigation headers
priscilawebdev b33605d
fix(settings): Restore navigation controls and safe project switching
priscilawebdev 47dc77c
fix(settings): Hide sidebar toggle pending design review
priscilawebdev 0c936b1
fix(settings): Keep the mobile navigation close control
priscilawebdev 274f1e1
ref(settings): Reuse the router handle type
priscilawebdev 3a51d2f
fix(settings): Reset navigation scope and preserve the current project
priscilawebdev e1b60a8
fix(settings): Always show the sidebar toggle
priscilawebdev fba5756
ref(navigation): Render the sidebar toggle inside the header
priscilawebdev 4e757e3
fix(navigation): Align sidebar header controls consistently
priscilawebdev 20a9547
Merge remote-tracking branch 'origin/master' into feat/settings-scope…
priscilawebdev 5c09b84
ref(settings): Supply the General nav title from navigation config
priscilawebdev 2922cdd
ref(settings): Add a shared project switch route handle
priscilawebdev 12380ce
feat(settings): Return to the page Settings was entered from
priscilawebdev 7f60cf6
ref(settings): Share settings scope derivation in one hook
priscilawebdev ab98f8b
fix(navigation): Drop the active group override when the route group …
priscilawebdev 5491c6c
ref(settings): Declare project pages with a single settingsProject ha…
priscilawebdev b316f59
Revert "ref(settings): Declare project pages with a single settingsPr…
priscilawebdev bfaeaaf
ref(navigation): Derive section collapsibility from the title
priscilawebdev a1358bb
ref(navigation): Make the return path hook generic and link Back to app
priscilawebdev 3320823
fix(navigation): Scope the settings return path by organization
priscilawebdev a5f9891
Merge branch 'master' into feat/settings-scope-navigation
priscilawebdev a21e5b2
fix(navigation): Clear stale active group overrides and derive projec…
priscilawebdev 250366c
Merge remote-tracking branch 'origin/feat/settings-scope-navigation' …
priscilawebdev 4f74e88
fix(settings): Only derive a settings scope inside settings
priscilawebdev 1284e7e
fix(navigation): Keep the Seer secondary navigation title styled
sentry-junior[bot] 62849e3
fix(settings): Keep account pages out of the V3 Org sidebar
sentry-junior[bot] a0abe69
ref(settings): Drop unreachable project settings navigation branches
sentry-junior[bot] 12dc9be
test(settings): Simplify settings v3 navigation tests
sentry-junior[bot] ec4f39b
fix(navigation): Only return to same-site paths from settings
sentry-junior[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import {renderHookWithProviders} from 'sentry-test/reactTestingLibrary'; | ||
|
|
||
| import {getReturnPath, useCaptureReturnPath} from 'sentry/utils/useReturnPath'; | ||
|
|
||
| const KEY = 'test-return-path'; | ||
| const options = {key: KEY, excludePrefix: '/settings'}; | ||
|
|
||
| describe('useReturnPath', () => { | ||
| beforeEach(() => { | ||
| sessionStorage.clear(); | ||
| }); | ||
|
|
||
| it('captures locations outside the excluded prefix', () => { | ||
| renderHookWithProviders(() => useCaptureReturnPath(options), { | ||
| initialRouterConfig: { | ||
| location: {pathname: '/issues/', query: {query: 'is:unresolved'}}, | ||
| }, | ||
| }); | ||
|
|
||
| expect(getReturnPath(KEY, '/fallback/')).toBe('/issues/?query=is%3Aunresolved'); | ||
| }); | ||
|
|
||
| it('does not capture without a key', () => { | ||
| renderHookWithProviders( | ||
| () => useCaptureReturnPath({key: null, excludePrefix: '/settings'}), | ||
| {initialRouterConfig: {location: {pathname: '/issues/'}}} | ||
| ); | ||
|
|
||
| expect(getReturnPath(KEY, '/fallback/')).toBe('/fallback/'); | ||
| }); | ||
|
|
||
| it('does not capture locations under the excluded prefix', () => { | ||
| renderHookWithProviders(() => useCaptureReturnPath(options), { | ||
| initialRouterConfig: {location: {pathname: '/settings/org-slug/members/'}}, | ||
| }); | ||
|
|
||
| expect(getReturnPath(KEY, '/fallback/')).toBe('/fallback/'); | ||
| }); | ||
|
|
||
| it.each(['//attacker.example/', '/\\attacker.example/', 'https://attacker.example/'])( | ||
| 'falls back instead of returning to another site via %s', | ||
| path => { | ||
| sessionStorage.setItem(KEY, path); | ||
|
|
||
| expect(getReturnPath(KEY, '/fallback/')).toBe('/fallback/'); | ||
| } | ||
| ); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import {useEffect} from 'react'; | ||
| import {matchPath} from 'react-router'; | ||
|
|
||
| import {sessionStorageWrapper} from 'sentry/utils/sessionStorage'; | ||
| import {useLocation} from 'sentry/utils/useLocation'; | ||
|
|
||
| interface CaptureReturnPathOptions { | ||
| /** | ||
| * Locations under this path prefix (e.g. `/settings`) are not captured. | ||
| */ | ||
| excludePrefix: string; | ||
| /** | ||
| * The session storage key the return path is stored under. Nothing is | ||
| * captured while this is null, e.g. when the key depends on something that | ||
| * is not known yet. | ||
| */ | ||
| key: string | null; | ||
| } | ||
|
|
||
| /** | ||
| * Remembers the last page the user visited outside of a section of the app, so | ||
| * a "back" control inside that section can return there. Browser history is | ||
| * not reliable for this because users navigate between several pages of the | ||
| * section before leaving. | ||
| * | ||
| * Must be mounted outside of the section it excludes. | ||
| */ | ||
| export function useCaptureReturnPath({key, excludePrefix}: CaptureReturnPathOptions) { | ||
| const {pathname, search, hash} = useLocation(); | ||
|
|
||
| useEffect(() => { | ||
| if (key === null || matchPath({path: excludePrefix, end: false}, pathname)) { | ||
| return; | ||
| } | ||
| sessionStorageWrapper.setItem(key, `${pathname}${search}${hash}`); | ||
| }, [key, excludePrefix, pathname, search, hash]); | ||
| } | ||
|
|
||
| // A path on this site. Links treat `//host` and `/\host` as another site, and | ||
| // unmatched routes can capture such a pathname. | ||
| const SAME_ORIGIN_PATH = /^\/(?![/\\])/; | ||
|
|
||
| /** | ||
| * The page captured by `useCaptureReturnPath`, or `fallback` when none was | ||
| * captured, e.g. when the section was entered directly. | ||
| */ | ||
| export function getReturnPath(key: string, fallback: string): string { | ||
| const path = sessionStorageWrapper.getItem(key); | ||
| return path && SAME_ORIGIN_PATH.test(path) ? path : fallback; | ||
| } | ||
|
priscilawebdev marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Keeping the settings prefix for convention, but we can rename this later. When settings-v3 is GA we can remove the project crumb (type: 'project' entries and their to), but settingsBreadcrumb stays for the other crumbs