-
-
Notifications
You must be signed in to change notification settings - Fork 712
Shortcut improvements #1573
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
Shortcut improvements #1573
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
84d0508
Added shortcuts (with tooltip) to the pagination
samejr 75ec976
WIP fixing the disabled hover state
samejr f341887
Styled the tooltip
samejr c5c1d1d
Added a shortcuts panel to the help menu
samejr 3d10901
Adds new shortcut to list
samejr afe13a8
Changes “meta” for “mod”
samejr 97e610a
Adds more shortcuts to the list
samejr 747caa6
Adding shortcut to open the shortcuts panel
samejr 13232e2
tweak gap between shortcut letters
samejr 2ac815f
button component now has icon spacing adjustment (for lucide icons)
samejr bef4432
Fixed some ilegal markup
samejr 113d2e4
Pagination uses disabled prop rather than a disabled wrapper
samejr 72d1381
Improved the Switch styles
samejr 277a69f
Merge branch 'main' into shortcut-improvements
samejr 0958943
Makes the shortcut modifier optional
samejr 2a50b09
Added new icon based shortcut keys for mac and win
samejr 225eae8
Updated PC modifier shortcuts
samejr 3e27fe9
Adds a new windows key icon
samejr b937cce
Allows variants and react nodes to be used as the modifier key
samejr e4446b2
Adds more shortcuts to the storybook
samejr 4dcf218
Adds missing focus-visible styles to the pagination
samejr ededd0d
Removed test modifier keys
samejr f8e97c6
number style is tabular
samejr ba16fcc
Merge branch 'main' into shortcut-improvements
samejr fe31906
Update apps/webapp/app/components/primitives/ShortcutKey.tsx
matt-aitken f189fc0
Tooltip now just 1 prop on the button component
samejr a1ec1c1
Merge branch 'main' into shortcut-improvements
samejr 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 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,17 @@ | ||
export function KeyboardDownIcon({ className }: { className?: string }) { | ||
return ( | ||
<svg | ||
className={className} | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M12.8779 16.3905C12.4989 17.0854 11.5011 17.0854 11.1221 16.3905L6.80665 8.47885C6.44317 7.81248 6.92548 7 7.68454 7L16.3155 7C17.0745 7 17.5568 7.81248 17.1934 8.47885L12.8779 16.3905Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
); | ||
} | ||
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,17 @@ | ||
export function KeyboardLeftIcon({ className }: { className?: string }) { | ||
return ( | ||
<svg | ||
className={className} | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
matt-aitken marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<path | ||
d="M7.60947 12.8779C6.91461 12.4989 6.91461 11.5011 7.60947 11.1221L15.5211 6.80665C16.1875 6.44317 17 6.92548 17 7.68454L17 16.3155C17 17.0745 16.1875 17.5568 15.5211 17.1934L7.60947 12.8779Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
); | ||
} |
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,17 @@ | ||
export function KeyboardRightIcon({ className }: { className?: string }) { | ||
return ( | ||
<svg | ||
className={className} | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M16.3905 11.1221C17.0854 11.5011 17.0854 12.4989 16.3905 12.8779L8.47885 17.1934C7.81248 17.5568 7 17.0745 7 16.3155L7 7.68454C7 6.92548 7.81248 6.44317 8.47885 6.80665L16.3905 11.1221Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
); | ||
} |
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,17 @@ | ||
export function KeyboardUpIcon({ className }: { className?: string }) { | ||
return ( | ||
<svg | ||
className={className} | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<path | ||
d="M11.1221 6.60947C11.5011 5.91461 12.4989 5.91461 12.8779 6.60947L17.1934 14.5211C17.5568 15.1875 17.0745 16 16.3155 16L7.68454 16C6.92548 16 6.44317 15.1875 6.80665 14.5211L11.1221 6.60947Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
); | ||
} |
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,17 @@ | ||
export function KeyboardWindowsIcon({ className }: { className?: string }) { | ||
return ( | ||
<svg | ||
className={className} | ||
width="12" | ||
height="16" | ||
viewBox="0 0 12 16" | ||
fill="none" | ||
xmlns="http://www.w3.org/2000/svg" | ||
> | ||
<rect x="1.66666" y="3.66663" width="4" height="4" fill="currentColor" /> | ||
<rect x="6.33334" y="3.66663" width="4" height="4" fill="currentColor" /> | ||
<rect x="1.66666" y="8.33337" width="4" height="4" fill="currentColor" /> | ||
<rect x="6.33334" y="8.33337" width="4" height="4" fill="currentColor" /> | ||
</svg> | ||
); | ||
} |
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,148 @@ | ||
import { Keyboard } from "lucide-react"; | ||
import { Header3 } from "./primitives/Headers"; | ||
import { Paragraph } from "./primitives/Paragraph"; | ||
import { | ||
Sheet, | ||
SheetContent, | ||
SheetDescription, | ||
SheetHeader, | ||
SheetTitle, | ||
SheetTrigger, | ||
} from "./primitives/SheetV3"; | ||
import { ShortcutKey } from "./primitives/ShortcutKey"; | ||
import { Button } from "./primitives/Buttons"; | ||
|
||
export function Shortcuts() { | ||
return ( | ||
<Sheet> | ||
<SheetTrigger asChild> | ||
<Button | ||
variant="small-menu-item" | ||
LeadingIcon={Keyboard} | ||
leadingIconClassName="text-blue-500" | ||
data-action="shortcuts" | ||
fullWidth | ||
textAlignLeft | ||
shortcut={{ modifiers: ["shift"], key: "?" }} | ||
className="gap-x-0 pl-0.5" | ||
iconSpacing="gap-x-0.5" | ||
> | ||
Shortcuts | ||
</Button> | ||
matt-aitken marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</SheetTrigger> | ||
<SheetContent> | ||
<SheetHeader> | ||
<SheetTitle> | ||
<div className="flex items-center gap-x-2"> | ||
<Keyboard className="size-5 text-indigo-500" /> | ||
<span className="font-sans text-base font-medium text-text-bright"> | ||
Keyboard shortcuts | ||
</span> | ||
</div> | ||
</SheetTitle> | ||
<div className="space-y-6 px-4 pb-4 pt-2"> | ||
<div className="space-y-3"> | ||
<Header3>General</Header3> | ||
<Shortcut name="Close"> | ||
<ShortcutKey shortcut={{ key: "esc" }} variant="medium/bright" /> | ||
</Shortcut> | ||
<Shortcut name="Confirm"> | ||
<ShortcutKey shortcut={{ modifiers: ["mod"] }} variant="medium/bright" /> | ||
<ShortcutKey shortcut={{ key: "enter" }} variant="medium/bright" /> | ||
</Shortcut> | ||
<Shortcut name="Filter"> | ||
<ShortcutKey shortcut={{ key: "f" }} variant="medium/bright" /> | ||
</Shortcut> | ||
<Shortcut name="Select filter"> | ||
<ShortcutKey shortcut={{ key: "1" }} variant="medium/bright" /> | ||
<Paragraph variant="small" className="ml-1.5"> | ||
to | ||
</Paragraph> | ||
<ShortcutKey shortcut={{ key: "9" }} variant="medium/bright" /> | ||
</Shortcut> | ||
<Shortcut name="Previous page"> | ||
<ShortcutKey shortcut={{ key: "j" }} variant="medium/bright" /> | ||
</Shortcut> | ||
<Shortcut name="Next page"> | ||
<ShortcutKey shortcut={{ key: "k" }} variant="medium/bright" /> | ||
</Shortcut> | ||
<Shortcut name="Help & Feedback"> | ||
<ShortcutKey shortcut={{ key: "h" }} variant="medium/bright" /> | ||
</Shortcut> | ||
</div> | ||
<div className="space-y-3"> | ||
<Header3>Runs page</Header3> | ||
<Shortcut name="Bulk action: Cancel runs"> | ||
<ShortcutKey shortcut={{ key: "c" }} variant="medium/bright" /> | ||
</Shortcut> | ||
matt-aitken marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<Shortcut name="Bulk action: Replay runs"> | ||
<ShortcutKey shortcut={{ key: "r" }} variant="medium/bright" /> | ||
</Shortcut> | ||
matt-aitken marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<Shortcut name="Bulk action: Clear selection"> | ||
<ShortcutKey shortcut={{ key: "esc" }} variant="medium/bright" /> | ||
</Shortcut> | ||
</div> | ||
<div className="space-y-3"> | ||
<Header3>Run page</Header3> | ||
<Shortcut name="Replay run"> | ||
<ShortcutKey shortcut={{ key: "r" }} variant="medium/bright" /> | ||
</Shortcut> | ||
<Shortcut name="Overview"> | ||
<ShortcutKey shortcut={{ key: "o" }} variant="medium/bright" /> | ||
</Shortcut> | ||
<Shortcut name="Details"> | ||
<ShortcutKey shortcut={{ key: "d" }} variant="medium/bright" /> | ||
</Shortcut> | ||
<Shortcut name="Context"> | ||
<ShortcutKey shortcut={{ key: "c" }} variant="medium/bright" /> | ||
</Shortcut> | ||
<Shortcut name="Metadata"> | ||
<ShortcutKey shortcut={{ key: "m" }} variant="medium/bright" /> | ||
</Shortcut> | ||
<Shortcut name="Navigate"> | ||
<ShortcutKey shortcut={{ key: "arrowup" }} variant="medium/bright" /> | ||
<ShortcutKey shortcut={{ key: "arrowdown" }} variant="medium/bright" /> | ||
<ShortcutKey shortcut={{ key: "arrowleft" }} variant="medium/bright" /> | ||
<ShortcutKey shortcut={{ key: "arrowright" }} variant="medium/bright" /> | ||
</Shortcut> | ||
<Shortcut name="Expand all"> | ||
<ShortcutKey shortcut={{ key: "e" }} variant="medium/bright" /> | ||
</Shortcut> | ||
<Shortcut name="Collapse all"> | ||
<ShortcutKey shortcut={{ key: "w" }} variant="medium/bright" /> | ||
</Shortcut> | ||
<Shortcut name="Toggle level"> | ||
<ShortcutKey shortcut={{ key: "0" }} variant="medium/bright" /> | ||
<Paragraph variant="small" className="ml-1.5"> | ||
to | ||
</Paragraph> | ||
<ShortcutKey shortcut={{ key: "9" }} variant="medium/bright" /> | ||
</Shortcut> | ||
</div> | ||
<div className="space-y-3"> | ||
<Header3>Schedules page</Header3> | ||
<Shortcut name="New schedule"> | ||
<ShortcutKey shortcut={{ key: "n" }} variant="medium/bright" /> | ||
</Shortcut> | ||
matt-aitken marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</div> | ||
<div className="space-y-3"> | ||
<Header3>Alerts page</Header3> | ||
<Shortcut name="New alert"> | ||
<ShortcutKey shortcut={{ key: "n" }} variant="medium/bright" /> | ||
</Shortcut> | ||
</div> | ||
</div> | ||
</SheetHeader> | ||
</SheetContent> | ||
</Sheet> | ||
); | ||
} | ||
|
||
function Shortcut({ children, name }: { children: React.ReactNode; name: string }) { | ||
return ( | ||
<div className="flex items-center justify-between gap-x-2"> | ||
<span className="text-sm text-text-dimmed">{name}</span> | ||
<span className="flex items-center gap-x-0.5">{children}</span> | ||
</div> | ||
); | ||
} |
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.
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.
Uh oh!
There was an error while loading. Please reload this page.