Skip to content
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

feat: mini filters 4000 #26329

Merged
merged 41 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
5a86bf8
feat: mini filters 4000
pauldambra Nov 21, 2024
8018bf8
fix
pauldambra Nov 21, 2024
a5c221e
base icon is invisible
pauldambra Nov 21, 2024
bffeb07
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 21, 2024
c0d88f7
more
pauldambra Nov 21, 2024
cce2b6b
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 21, 2024
bdfba76
more
pauldambra Nov 21, 2024
b5496dc
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 21, 2024
324aab2
more fiddling
pauldambra Nov 21, 2024
bcd0470
fix
pauldambra Nov 21, 2024
fd4e37b
count them
pauldambra Nov 21, 2024
c2462a5
fix
pauldambra Nov 21, 2024
6003d04
fix
pauldambra Nov 22, 2024
083aaa3
Merge branch 'master' into feat/mini-filters
pauldambra Nov 22, 2024
231cd23
fix
pauldambra Nov 22, 2024
9f744ce
stuff
pauldambra Nov 22, 2024
bd609d2
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 22, 2024
cc9a112
disabled states in bottom bar
pauldambra Nov 22, 2024
dac4139
fix
pauldambra Nov 22, 2024
26b2fdb
when config needs toggling on
pauldambra Nov 22, 2024
775afe7
smaller top tabs
pauldambra Nov 22, 2024
a26624f
don't show empty navigation item values
pauldambra Nov 22, 2024
d234d81
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 22, 2024
76bc0ab
fix
pauldambra Nov 22, 2024
3b10483
and that
pauldambra Nov 22, 2024
50eb416
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 22, 2024
aa48fc7
inspector summary
pauldambra Nov 24, 2024
bf7b7d6
fix
pauldambra Nov 24, 2024
9b8435d
fix
pauldambra Nov 24, 2024
1c3d96a
fix
pauldambra Nov 24, 2024
bba9095
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 24, 2024
631bec8
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 24, 2024
1bae688
icons
pauldambra Nov 24, 2024
a6f811d
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 24, 2024
a5c0e91
fix
pauldambra Nov 24, 2024
2fa9ab3
fix
pauldambra Nov 24, 2024
7313cdc
Fix
pauldambra Nov 24, 2024
07716cc
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 24, 2024
97e5513
Update UI snapshots for `chromium` (2)
github-actions[bot] Nov 24, 2024
aca0055
inactivity context
pauldambra Nov 25, 2024
fdc274a
fix
pauldambra Nov 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions frontend/src/lib/lemon-ui/LemonCheckbox/LemonCheckbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@
}
}

&.LemonCheckbox--xsmall {
label {
min-height: 1.625rem;
padding: 0 0.375rem;
}
}

.Field--error & {
label {
border: 1px solid var(--danger);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/lemon-ui/LemonCheckbox/LemonCheckbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface LemonCheckboxProps {
className?: string
labelClassName?: string
fullWidth?: boolean
size?: 'small' | 'medium'
size?: 'xsmall' | 'small' | 'medium'
bordered?: boolean
/** @deprecated See https://github.com/PostHog/posthog/pull/9357#pullrequestreview-933783868. */
color?: string
Expand Down
23 changes: 16 additions & 7 deletions frontend/src/lib/lemon-ui/LemonMenu/LemonMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,21 @@ export function LemonMenu({
setTimeout(() => itemsRef?.current?.[activeItemIndex]?.current?.scrollIntoView({ block: 'center' }), 0)
}
},
// no need to update this when itemsRef changes
// eslint-disable-next-line react-hooks/exhaustive-deps
[onVisibilityChange, activeItemIndex]
)

return (
<LemonDropdown
overlay={<LemonMenuOverlay items={items} tooltipPlacement={tooltipPlacement} itemsRef={itemsRef} />}
overlay={
<LemonMenuOverlay
buttonSize={dropdownProps.buttonSize || 'small'}
items={items}
tooltipPlacement={tooltipPlacement}
itemsRef={itemsRef}
/>
}
closeOnClickInside
referenceRef={referenceRef}
onVisibilityChange={_onVisibilityChange}
Expand All @@ -128,7 +137,7 @@ export interface LemonMenuOverlayProps {
tooltipPlacement?: TooltipProps['placement']
itemsRef?: React.RefObject<React.RefObject<HTMLButtonElement>[]>
/** @default 'small' */
buttonSize?: 'small' | 'medium'
buttonSize?: 'xsmall' | 'small' | 'medium'
}

export function LemonMenuOverlay({
Expand Down Expand Up @@ -159,7 +168,7 @@ export function LemonMenuOverlay({

interface LemonMenuSectionListProps {
sections: LemonMenuSection[]
buttonSize: 'small' | 'medium'
buttonSize: 'xsmall' | 'small' | 'medium'
tooltipPlacement: TooltipProps['placement'] | undefined
itemsRef: React.RefObject<React.RefObject<HTMLButtonElement>[]> | undefined
}
Expand Down Expand Up @@ -208,7 +217,7 @@ export function LemonMenuSectionList({

interface LemonMenuItemListProps {
items: LemonMenuItem[]
buttonSize: 'small' | 'medium'
buttonSize: 'xsmall' | 'small' | 'medium'
tooltipPlacement: TooltipProps['placement'] | undefined
itemsRef: React.RefObject<React.RefObject<HTMLButtonElement>[]> | undefined
itemIndexOffset?: number
Expand Down Expand Up @@ -241,7 +250,7 @@ export function LemonMenuItemList({

interface LemonMenuItemButtonProps {
item: LemonMenuItem
size: 'small' | 'medium'
size: 'xsmall' | 'small' | 'medium'
tooltipPlacement: TooltipProps['placement'] | undefined
}

Expand Down Expand Up @@ -280,8 +289,8 @@ const LemonMenuItemButton: FunctionComponent<LemonMenuItemButtonProps & React.Re
items={items}
tooltipPlacement={tooltipPlacement}
placement={placement || 'right-start'}
closeOnClickInside={custom ? false : true}
closeParentPopoverOnClickInside={custom ? false : true}
closeOnClickInside={!custom}
closeParentPopoverOnClickInside={!custom}
>
{button}
</LemonMenu>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ export const humanFriendlyMilliseconds = (timestamp: number | undefined): string

return `${(timestamp / 1000).toFixed(2)}s`
}

export function humanFriendlyDuration(
d: string | number | null | undefined,
{
Expand Down
19 changes: 8 additions & 11 deletions frontend/src/lib/utils/eventUsageLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { Holdout } from 'scenes/experiments/holdoutsLogic'
import { isFilterWithDisplay, isFunnelsFilter, isTrendsFilter } from 'scenes/insights/sharedUtils'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { EventIndex } from 'scenes/session-recordings/player/eventIndex'
import { MiniFilterKey } from 'scenes/session-recordings/player/inspector/miniFiltersLogic'
import { InspectorListItemType } from 'scenes/session-recordings/player/inspector/playerInspectorLogic'
import { filtersFromUniversalFilterGroups } from 'scenes/session-recordings/utils'
import { NewSurvey, SurveyTemplateType } from 'scenes/surveys/constants'
import { userLogic } from 'scenes/userLogic'
Expand Down Expand Up @@ -63,7 +65,6 @@ import {
RecordingUniversalFilters,
Resource,
SessionPlayerData,
SessionRecordingPlayerTab,
SessionRecordingType,
SessionRecordingUsageType,
Survey,
Expand Down Expand Up @@ -442,11 +443,10 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportRecordingPlayerSeekbarEventHovered: true,
reportRecordingPlayerSpeedChanged: (newSpeed: number) => ({ newSpeed }),
reportRecordingPlayerSkipInactivityToggled: (skipInactivity: boolean) => ({ skipInactivity }),
reportRecordingInspectorTabViewed: (tab: SessionRecordingPlayerTab) => ({ tab }),
reportRecordingInspectorItemExpanded: (tab: SessionRecordingPlayerTab, index: number) => ({ tab, index }),
reportRecordingInspectorMiniFilterViewed: (tab: SessionRecordingPlayerTab, minifilterKey: string) => ({
tab,
reportRecordingInspectorItemExpanded: (tab: InspectorListItemType, index: number) => ({ tab, index }),
reportRecordingInspectorMiniFilterViewed: (minifilterKey: MiniFilterKey, enabled: boolean) => ({
minifilterKey,
enabled,
}),
reportNextRecordingTriggered: (automatic: boolean) => ({
automatic,
Expand Down Expand Up @@ -954,14 +954,11 @@ export const eventUsageLogic = kea<eventUsageLogicType>([
reportRecordingPlayerSkipInactivityToggled: ({ skipInactivity }) => {
posthog.capture('recording player skip inactivity toggled', { skip_inactivity: skipInactivity })
},
reportRecordingInspectorTabViewed: ({ tab }) => {
posthog.capture('recording inspector tab viewed', { tab })
},
reportRecordingInspectorItemExpanded: ({ tab, index }) => {
posthog.capture('recording inspector item expanded', { tab, index })
posthog.capture('recording inspector item expanded', { tab: 'replay-4000', type: tab, index })
},
reportRecordingInspectorMiniFilterViewed: ({ tab, minifilterKey }) => {
posthog.capture('recording inspector minifilter selected', { tab, minifilterKey })
reportRecordingInspectorMiniFilterViewed: ({ minifilterKey, enabled }) => {
posthog.capture('recording inspector minifilter selected', { tab: 'replay-4000', enabled, minifilterKey })
},
reportNextRecordingTriggered: ({ automatic }) => {
posthog.capture('recording next recording triggered', { automatic })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,21 @@ function itemToPerformanceValues(item: PerformanceEvent): {

export function PerformanceCardRow({ item }: { item: PerformanceEvent }): JSX.Element {
const performanceValues = itemToPerformanceValues(item)

return (
<OverviewGrid>
{Object.entries(summaryMapping).map(([key, summary]) => (
<OverviewGridItem key={key} description={summary.description} label={summary.label}>
<PerformanceDuration
benchmarks={summary.scoreBenchmarks}
value={performanceValues[key]}
loading={summary.allowLoadingIndicator && !performanceValues.loaded}
/>
</OverviewGridItem>
))}
{Object.entries(summaryMapping)
.filter(([key]) => performanceValues[key] !== undefined)
.map(([key, summary]) => {
return (
<OverviewGridItem key={key} description={summary.description} label={summary.label}>
<PerformanceDuration
benchmarks={summary.scoreBenchmarks}
value={performanceValues[key]}
loading={summary.allowLoadingIndicator && !performanceValues.loaded}
/>
</OverviewGridItem>
)
})}
</OverviewGrid>
)
}
Expand All @@ -219,15 +222,17 @@ export function PerformanceCardDescriptions({
const performanceValues = itemToPerformanceValues(item)
return (
<div className={clsx('p-2 text-xs border-t', !expanded && 'hidden')}>
{Object.entries(summaryMapping).map(([key, summary]) => (
<PerformanceCardDescription
key={key}
benchmarks={summary.scoreBenchmarks}
description={summary.description}
label={summary.label}
value={performanceValues[key]}
/>
))}
{Object.entries(summaryMapping)
.filter(([key]) => performanceValues[key] !== undefined)
.map(([key, summary]) => (
<PerformanceCardDescription
key={key}
benchmarks={summary.scoreBenchmarks}
description={summary.description}
label={summary.label}
value={performanceValues[key]}
/>
))}
</div>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@ import {
initiatorToAssetTypeMapping,
itemSizeInfo,
} from 'scenes/session-recordings/apm/performance-event-utils'
import { miniFiltersLogic } from 'scenes/session-recordings/player/inspector/miniFiltersLogic'
import { InspectorListItemBase } from 'scenes/session-recordings/player/inspector/playerInspectorLogic'
import {
sessionRecordingDataLogic,
SessionRecordingDataLogicProps,
} from 'scenes/session-recordings/player/sessionRecordingDataLogic'

import { PerformanceEvent, RecordingEventType, SessionRecordingPlayerTab } from '~/types'
import { FilterableInspectorListItemTypes, PerformanceEvent, RecordingEventType } from '~/types'

import type { performanceEventDataLogicType } from './performanceEventDataLogicType'

export type InspectorListItemPerformance = InspectorListItemBase & {
type: SessionRecordingPlayerTab.NETWORK
type: FilterableInspectorListItemTypes.NETWORK
data: PerformanceEvent
}

Expand Down Expand Up @@ -105,12 +104,7 @@ export const performanceEventDataLogic = kea<performanceEventDataLogicType>([
key((props: PerformanceEventDataLogicProps) => `${props.key}-${props.sessionRecordingId}`),
connect((props: PerformanceEventDataLogicProps) => ({
actions: [],
values: [
miniFiltersLogic,
['showOnlyMatching', 'tab', 'miniFiltersByKey', 'searchQuery'],
sessionRecordingDataLogic(props),
['sessionPlayerData', 'webVitalsEvents'],
],
values: [sessionRecordingDataLogic(props), ['sessionPlayerData', 'webVitalsEvents']],
})),
selectors(() => ({
allPerformanceEvents: [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { LemonButton, LemonButtonProps } from 'lib/lemon-ui/LemonButton'
import { LemonMenu, LemonMenuItem, LemonMenuProps } from 'lib/lemon-ui/LemonMenu/LemonMenu'
import { Tooltip } from 'lib/lemon-ui/Tooltip'

/**
* TODO the lemon button font only has 700 and 800 weights available.
* Ideally these buttons would use more like 400 and 500 weights.
* or even 300 and 400 weights.
* when inactive / active respectively.
*/

interface SettingsMenuProps extends Omit<LemonMenuProps, 'items' | 'children'> {
label: string
items: LemonMenuItem[]
icon: JSX.Element
isAvailable?: boolean
whenUnavailable?: LemonMenuItem
}

export function SettingsMenu({
label,
items,
icon,
isAvailable = true,
whenUnavailable,
...props
}: SettingsMenuProps): JSX.Element {
const active = items.some((cf) => !!cf.active)
return (
<LemonMenu
buttonSize="xsmall"
closeOnClickInside={false}
items={isAvailable ? items : whenUnavailable ? [whenUnavailable] : []}
{...props}
>
<LemonButton status={active ? 'danger' : 'default'} size="xsmall" icon={icon}>
{label}
</LemonButton>
</LemonMenu>
)
}

export function SettingsToggle({
title,
icon,
label,
active,
...props
}: Omit<LemonButtonProps, 'status' | 'sideAction'> & {
active: boolean
title: string
icon?: JSX.Element | null
label: JSX.Element | string
}): JSX.Element {
const button = (
<LemonButton icon={icon} size="xsmall" status={active ? 'danger' : 'default'} {...props}>
{label}
</LemonButton>
)

// otherwise the tooltip shows instead of the disabled reason
return props.disabledReason ? button : <Tooltip title={title}>{button}</Tooltip>
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export function PlayerSidebar(): JSX.Element {
label: capitalizeFirstLetter(tabId),
}))}
barClassName="mb-0"
size="small"
/>
<div className="flex flex-1 border-b shrink-0" />
<div className="flex gap-1 border-b end">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { PlayerInspectorBottomSettings } from 'scenes/session-recordings/player/inspector/PlayerInspectorBottomSettings'
import { PlayerInspectorControls } from 'scenes/session-recordings/player/inspector/PlayerInspectorControls'
import { PlayerInspectorList } from 'scenes/session-recordings/player/inspector/PlayerInspectorList'

Expand All @@ -6,6 +7,7 @@ export function PlayerInspector(): JSX.Element {
<>
<PlayerInspectorControls />
<PlayerInspectorList />
<PlayerInspectorBottomSettings />
</>
)
}
Loading
Loading