-
Notifications
You must be signed in to change notification settings - Fork 2
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
Adds quick settings button to the new launcher #52
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
200d245
getting closer
andrewfulton9 7779eb2
working menu button
andrewfulton9 07a9550
fully functioning
andrewfulton9 3f0da52
clean
andrewfulton9 1b5bbbd
jlpm run lint
andrewfulton9 44bade1
add trans to command labels
andrewfulton9 6d4a2d7
Update src/launcher.tsx
andrewfulton9 7b210e0
Update src/types.ts
andrewfulton9 d26f624
Use menuSVG instead of menu for auto checkmark handling
andrewfulton9 e03dc79
lint
andrewfulton9 57f1a64
add open settings editor. Conform capitalization
andrewfulton9 8f06072
update playwright test images
andrewfulton9 f055411
Add quick-settings open menu test
andrewfulton9 2539166
update playwright tests
andrewfulton9 55f7e7f
merge conflict fix
andrewfulton9 6aef227
prettier
andrewfulton9 7433b3d
Update src/components/quick-settings.tsx
andrewfulton9 77e59c1
improve test
andrewfulton9 5befeba
prettier
andrewfulton9 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
There are no files selected for viewing
This file contains 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 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 { TranslationBundle } from '@jupyterlab/translation'; | ||
import type { CommandRegistry } from '@lumino/commands'; | ||
import { MenuSvg, settingsIcon } from '@jupyterlab/ui-components'; | ||
import * as React from 'react'; | ||
|
||
import { CommandIDs } from '../types'; | ||
|
||
export function QuickSettings(props: { | ||
trans: TranslationBundle; | ||
commands: CommandRegistry; | ||
}): React.ReactElement { | ||
const { commands } = props; | ||
|
||
const menu = new MenuSvg({ commands: commands }); | ||
menu.addItem({ command: CommandIDs.showStarred }); | ||
menu.addItem({ command: CommandIDs.searchAllSections }); | ||
menu.addItem({ command: CommandIDs.openSettings }); | ||
|
||
const iconRef = React.useRef<HTMLDivElement>(null); | ||
|
||
const onClickHandler = (event: React.MouseEvent) => { | ||
const current = iconRef.current; | ||
let x, y; | ||
if (current) { | ||
const position = current.getBoundingClientRect(); | ||
x = position.left; | ||
y = position.bottom; | ||
} else { | ||
x = event.clientX; | ||
y = event.clientY; | ||
} | ||
menu.open(x, y); | ||
}; | ||
|
||
return ( | ||
<div | ||
className="jp-Launcher-TypeCard jp-LauncherCard jp-Launcher-QuickSettings" | ||
ref={iconRef} | ||
onClick={event => { | ||
onClickHandler(event); | ||
}} | ||
> | ||
<div className="jp-LauncherCard-icon"> | ||
<settingsIcon.react /> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains 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 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 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
Binary file modified
BIN
+11.7 KB
(140%)
ui-tests/tests/jupyterlab_new_launcher.spec.ts-snapshots/launcher-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+46.1 KB
...jupyterlab_new_launcher.spec.ts-snapshots/launcher-open-quicksettings-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+11.8 KB
(140%)
...pyterlab_new_launcher.spec.ts-snapshots/launcher-search-in-individual-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+15.3 KB
(150%)
...tests/jupyterlab_new_launcher.spec.ts-snapshots/launcher-with-starred-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Currently the menu is positioned within the browser window:
I wonder if it would be nicer if it was positioned relative to the launcher body or the button. You can pass a third argument to
menu.open()
withMenu.IOpenOptions
object. Once jupyterlab/lumino#700 is released we will be able to pass a customhost
but for now we could only try usingforceX
to improve the positioning.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 currently should be positioned to the button. It's just shifting the menu so it fits in the window. This is what it looks like when the panel isn't directly next the edge of the window:
If I use
forceX
the part of the menu isn't viewable which I think may be worse:I wonder if there is a way to align it so the top-right corner of the menu aligns with the bottom right corner of the button. In my opinion that would look the cleanest.
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.
💯 agree. There is no way as of today. Can you open a feature request on lumino, and another issue here to track it as a follow-up enhancement?
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.
Sounds good. I opened Lumino#709 for this