@@ -68,6 +68,8 @@ import {
68
68
import { SpanView } from "../resources.orgs.$organizationSlug.projects.v3.$projectParam.runs.$runParam.spans.$spanParam/route" ;
69
69
import { number } from "zod" ;
70
70
import { useHotkeys } from "react-hotkeys-hook" ;
71
+ import { Popover , PopoverArrowTrigger , PopoverContent } from "~/components/primitives/Popover" ;
72
+ import { Header3 } from "~/components/primitives/Headers" ;
71
73
72
74
export const loader = async ( { request, params } : LoaderFunctionArgs ) => {
73
75
const userId = await requireUserId ( request ) ;
@@ -430,24 +432,34 @@ function TasksTreeView({
430
432
</ ResizablePanel >
431
433
</ ResizablePanelGroup >
432
434
< div className = "flex items-center justify-between gap-2 border-t border-grid-dimmed px-2" >
433
- < div className = "flex items-center gap-4" >
434
- < ArrowKeyShortcuts />
435
- < ShortcutWithAction
436
- shortcut = { { key : "e" } }
437
- action = { ( ) => expandAllBelowDepth ( 0 ) }
438
- title = "Expand all"
439
- />
440
- < ShortcutWithAction
441
- shortcut = { { key : "c" } }
442
- action = { ( ) => collapseAllBelowDepth ( 1 ) }
443
- title = "Collapse all"
444
- />
445
- < NumberShortcuts toggleLevel = { ( number ) => toggleExpandLevel ( number ) } />
446
- < ShortcutWithAction
447
- shortcut = { { key : "d" } }
448
- action = { ( ) => setShowDurations ( ( d ) => ! d ) }
449
- title = "Toggle durations"
450
- />
435
+ < div className = "grow @container" >
436
+ < div className = "hidden items-center gap-4 @[42rem]:flex" >
437
+ < KeyboardShortcuts
438
+ expandAllBelowDepth = { expandAllBelowDepth }
439
+ collapseAllBelowDepth = { collapseAllBelowDepth }
440
+ toggleExpandLevel = { toggleExpandLevel }
441
+ setShowDurations = { setShowDurations }
442
+ />
443
+ </ div >
444
+ < div className = "@[42rem]:hidden" >
445
+ < Popover >
446
+ < PopoverArrowTrigger > Shortcuts</ PopoverArrowTrigger >
447
+ < PopoverContent
448
+ className = "min-w-[20rem] overflow-y-auto p-2 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600"
449
+ align = "start"
450
+ >
451
+ < Header3 spacing > Keyboard shortcuts</ Header3 >
452
+ < div className = "flex flex-col gap-2" >
453
+ < KeyboardShortcuts
454
+ expandAllBelowDepth = { expandAllBelowDepth }
455
+ collapseAllBelowDepth = { collapseAllBelowDepth }
456
+ toggleExpandLevel = { toggleExpandLevel }
457
+ setShowDurations = { setShowDurations }
458
+ />
459
+ </ div >
460
+ </ PopoverContent >
461
+ </ Popover >
462
+ </ div >
451
463
</ div >
452
464
< div className = "flex items-center gap-4" >
453
465
< Slider
@@ -904,14 +916,48 @@ function ConnectedDevWarning() {
904
916
) ;
905
917
}
906
918
919
+ function KeyboardShortcuts ( {
920
+ expandAllBelowDepth,
921
+ collapseAllBelowDepth,
922
+ toggleExpandLevel,
923
+ setShowDurations,
924
+ } : {
925
+ expandAllBelowDepth : ( depth : number ) => void ;
926
+ collapseAllBelowDepth : ( depth : number ) => void ;
927
+ toggleExpandLevel : ( depth : number ) => void ;
928
+ setShowDurations : ( show : ( show : boolean ) => boolean ) => void ;
929
+ } ) {
930
+ return (
931
+ < >
932
+ < ArrowKeyShortcuts />
933
+ < ShortcutWithAction
934
+ shortcut = { { key : "e" } }
935
+ action = { ( ) => expandAllBelowDepth ( 0 ) }
936
+ title = "Expand all"
937
+ />
938
+ < ShortcutWithAction
939
+ shortcut = { { key : "c" } }
940
+ action = { ( ) => collapseAllBelowDepth ( 1 ) }
941
+ title = "Collapse all"
942
+ />
943
+ < NumberShortcuts toggleLevel = { ( number ) => toggleExpandLevel ( number ) } />
944
+ < ShortcutWithAction
945
+ shortcut = { { key : "d" } }
946
+ action = { ( ) => setShowDurations ( ( d ) => ! d ) }
947
+ title = "Toggle durations"
948
+ />
949
+ </ >
950
+ ) ;
951
+ }
952
+
907
953
function ArrowKeyShortcuts ( ) {
908
954
return (
909
955
< div className = "flex items-center gap-0.5" >
910
- < ShortcutKey shortcut = { { key : "arrowup" } } variant = "medium" />
911
- < ShortcutKey shortcut = { { key : "arrowdown" } } variant = "medium" />
912
- < ShortcutKey shortcut = { { key : "arrowleft" } } variant = "medium" />
913
- < ShortcutKey shortcut = { { key : "arrowright" } } variant = "medium" />
914
- < Paragraph variant = "extra-small" className = "ml-1.5" >
956
+ < ShortcutKey shortcut = { { key : "arrowup" } } variant = "medium" className = "ml-0 mr-0" />
957
+ < ShortcutKey shortcut = { { key : "arrowdown" } } variant = "medium" className = "ml-0 mr-0" />
958
+ < ShortcutKey shortcut = { { key : "arrowleft" } } variant = "medium" className = "ml-0 mr-0" />
959
+ < ShortcutKey shortcut = { { key : "arrowright" } } variant = "medium" className = "ml-0 mr-0" />
960
+ < Paragraph variant = "extra-small" className = "ml-1.5 whitespace-nowrap " >
915
961
Navigate
916
962
</ Paragraph >
917
963
</ div >
@@ -934,8 +980,8 @@ function ShortcutWithAction({
934
980
935
981
return (
936
982
< div className = "flex items-center gap-0.5" >
937
- < ShortcutKey shortcut = { shortcut } variant = "medium" />
938
- < Paragraph variant = "extra-small" className = "ml-1.5" >
983
+ < ShortcutKey shortcut = { shortcut } variant = "medium" className = "ml-0 mr-0" />
984
+ < Paragraph variant = "extra-small" className = "ml-1.5 whitespace-nowrap " >
939
985
{ title }
940
986
</ Paragraph >
941
987
</ div >
@@ -952,7 +998,7 @@ function NumberShortcuts({ toggleLevel }: { toggleLevel: (depth: number) => void
952
998
< span className = { cn ( variants . medium , "ml-0 mr-0" ) } > 0</ span >
953
999
< span className = "text-[0.75rem] text-text-dimmed" > –</ span >
954
1000
< span className = { cn ( variants . medium , "ml-0 mr-0" ) } > 9</ span >
955
- < Paragraph variant = "extra-small" className = "ml-1.5" >
1001
+ < Paragraph variant = "extra-small" className = "ml-1.5 whitespace-nowrap " >
956
1002
Toggle level
957
1003
</ Paragraph >
958
1004
</ div >
0 commit comments