Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(logs): collapse keyboard shortcuts into tooltip (#65156)

Jon McCallum7980b6e7a3ba
diff --git a/products/logs/frontend/components/LogsViewer/LogsViewerToolbar.tsx b/products/logs/frontend/components/LogsViewer/LogsViewerToolbar.tsx
index cc02fc6c0d2d..d3426c35d8bb 100644
--- a/products/logs/frontend/components/LogsViewer/LogsViewerToolbar.tsx
+++ b/products/logs/frontend/components/LogsViewer/LogsViewerToolbar.tsx
@@ -1,7 +1,7 @@
import { useActions, useValues } from 'kea'
-import { IconExpand45 } from '@posthog/icons'
-import { LemonButton, LemonCheckbox, LemonSegmentedButton } from '@posthog/lemon-ui'
+import { IconExpand45, IconKeyboard } from '@posthog/icons'
+import { LemonButton, LemonCheckbox, LemonSegmentedButton, Tooltip } from '@posthog/lemon-ui'
import { humanFriendlyNumber } from 'lib/utils/numbers'
@@ -63,23 +63,43 @@ export const LogsViewerToolbar = ({
{totalLogsCount !== undefined && totalLogsCount > 0 && (
<span className="text-muted text-xs">{humanFriendlyNumber(totalLogsCount)} logs</span>
)}
- <span className="text-muted text-xs flex items-center gap-1">
- <KeyboardShortcut arrowup />
- <KeyboardShortcut arrowdown />
- or
- <KeyboardShortcut j />
- <KeyboardShortcut k />
- navigate
- <span className="mx-1">·</span>
- <KeyboardShortcut enter />
- expand
- <span className="mx-1">·</span>
- <KeyboardShortcut p />
- prettify
- <span className="mx-1">·</span>
- <KeyboardShortcut r />
- refresh
- </span>
+ <Tooltip
+ title={
+ <div className="flex flex-col gap-1.5 p-1">
+ <div className="flex items-center justify-between gap-4">
+ <span>Navigate</span>
+ <span className="flex items-center gap-1">
+ <KeyboardShortcut arrowup />
+ <KeyboardShortcut arrowdown />
+ or
+ <KeyboardShortcut j />
+ <KeyboardShortcut k />
+ </span>
+ </div>
+ <div className="flex items-center justify-between gap-4">
+ <span>Expand</span>
+ <KeyboardShortcut enter />
+ </div>
+ <div className="flex items-center justify-between gap-4">
+ <span>Prettify</span>
+ <KeyboardShortcut p />
+ </div>
+ <div className="flex items-center justify-between gap-4">
+ <span>Refresh</span>
+ <KeyboardShortcut r />
+ </div>
+ </div>
+ }
+ >
+ <button
+ type="button"
+ className="text-muted text-xs flex items-center gap-1 cursor-help bg-transparent border-none p-0"
+ aria-label="Keyboard shortcuts"
+ >
+ <IconKeyboard className="text-base" />
+ Shortcuts
+ </button>
+ </Tooltip>
</div>
</div>
)