From 78e4f666211fc5a0c9bb3f87fdf6f7d579f85620 Mon Sep 17 00:00:00 2001 From: David Newell Date: Tue, 23 Apr 2024 15:02:50 +0100 Subject: [PATCH] chore: use a single timestamp format (#21653) --- .../lib/lemon-ui/LemonSelect/LemonSelect.tsx | 1 + .../inspector/PlayerInspectorControls.tsx | 127 +++++++----------- .../components/PlayerInspectorListItem.tsx | 6 +- .../player/playerSettingsLogic.ts | 9 -- 4 files changed, 51 insertions(+), 92 deletions(-) diff --git a/frontend/src/lib/lemon-ui/LemonSelect/LemonSelect.tsx b/frontend/src/lib/lemon-ui/LemonSelect/LemonSelect.tsx index 8e06a932310ab..3e5a03c309fbd 100644 --- a/frontend/src/lib/lemon-ui/LemonSelect/LemonSelect.tsx +++ b/frontend/src/lib/lemon-ui/LemonSelect/LemonSelect.tsx @@ -62,6 +62,7 @@ export interface LemonSelectPropsBase | 'onClick' | 'tabIndex' | 'type' + | 'tooltip' > { options: LemonSelectOptions /** Callback fired when a value is selected, even if it already is set. */ diff --git a/frontend/src/scenes/session-recordings/player/inspector/PlayerInspectorControls.tsx b/frontend/src/scenes/session-recordings/player/inspector/PlayerInspectorControls.tsx index 7839f697042f8..344f520648255 100644 --- a/frontend/src/scenes/session-recordings/player/inspector/PlayerInspectorControls.tsx +++ b/frontend/src/scenes/session-recordings/player/inspector/PlayerInspectorControls.tsx @@ -1,4 +1,4 @@ -import { IconBug, IconClock, IconDashboard, IconInfo, IconTerminal, IconX } from '@posthog/icons' +import { IconBug, IconDashboard, IconInfo, IconTerminal, IconX } from '@posthog/icons' import { LemonButton, LemonCheckbox, LemonInput, LemonSelect, LemonTabs, Tooltip } from '@posthog/lemon-ui' import { useActions, useValues } from 'kea' import { FEATURE_FLAGS } from 'lib/constants' @@ -71,8 +71,8 @@ export function PlayerInspectorControls({ onClose }: { onClose: () => void }): J const inspectorLogic = playerInspectorLogic(logicProps) const { tab, windowIdFilter, windowIds, showMatchingEventsFilter } = useValues(inspectorLogic) const { setWindowIdFilter, setTab } = useActions(inspectorLogic) - const { showOnlyMatching, timestampMode, miniFilters, searchQuery } = useValues(playerSettingsLogic) - const { setShowOnlyMatching, setTimestampMode, setMiniFilter, setSearchQuery } = useActions(playerSettingsLogic) + const { showOnlyMatching, miniFilters, searchQuery } = useValues(playerSettingsLogic) + const { setShowOnlyMatching, setMiniFilter, setSearchQuery } = useActions(playerSettingsLogic) const mode = logicProps.mode ?? SessionRecordingPlayerMode.Standard @@ -101,7 +101,7 @@ export function PlayerInspectorControls({ onClose }: { onClose: () => void }): J } return ( -
+
@@ -110,7 +110,24 @@ export function PlayerInspectorControls({ onClose }: { onClose: () => void }): J
-
+
+
+ setSearchQuery(e)} + placeholder="Search..." + type="search" + value={searchQuery} + fullWidth + className="min-w-60" + suffix={ + }> + + + } + /> +
+
void }): J ))}
-
-
-
- setSearchQuery(e)} - placeholder="Search..." - type="search" - value={searchQuery} - fullWidth - suffix={ - }> - - - } - /> -
- - {windowIds.length > 1 ? ( -
- setWindowIdFilter(val || null)} - options={[ - { - value: null, - label: 'All windows', - icon: , - }, - ...windowIds.map((windowId, index) => ({ - value: windowId, - label: `Window ${index + 1}`, - icon: , - })), - ]} - /> - - - -
- ) : null} + {windowIds.length > 1 ? ( +
+ setWindowIdFilter(val || null)} + options={[ + { + value: null, + label: 'All windows', + icon: , + }, + ...windowIds.map((windowId, index) => ({ + value: windowId, + label: `Window ${index + 1}`, + icon: , + })), + ]} + tooltip="Each recording window translates to a distinct browser tab or window." + />
+ ) : null} -
- setTimestampMode(timestampMode === 'absolute' ? 'relative' : 'absolute')} - tooltipPlacement="left" - tooltip={ - timestampMode === 'absolute' - ? 'Showing absolute timestamps' - : 'Showing timestamps relative to the start of the recording' - } - > - - {capitalizeFirstLetter(timestampMode)}{' '} - - - -
-
{showMatchingEventsFilter ? ( -
- +
+ + Only events matching filters void }): J - -
) : null}
diff --git a/frontend/src/scenes/session-recordings/player/inspector/components/PlayerInspectorListItem.tsx b/frontend/src/scenes/session-recordings/player/inspector/components/PlayerInspectorListItem.tsx index 48066a4cdca9d..21bbbc007023d 100644 --- a/frontend/src/scenes/session-recordings/player/inspector/components/PlayerInspectorListItem.tsx +++ b/frontend/src/scenes/session-recordings/player/inspector/components/PlayerInspectorListItem.tsx @@ -13,7 +13,7 @@ import useResizeObserver from 'use-resize-observer' import { SessionRecordingPlayerTab } from '~/types' import { IconWindow } from '../../icons' -import { playerSettingsLogic } from '../../playerSettingsLogic' +import { playerSettingsLogic, TimestampFormat } from '../../playerSettingsLogic' import { sessionRecordingPlayerLogic } from '../../sessionRecordingPlayerLogic' import { InspectorListItem, playerInspectorLogic } from '../playerInspectorLogic' import { ItemConsoleLog } from './ItemConsoleLog' @@ -68,7 +68,7 @@ export function PlayerInspectorListItem({ }): JSX.Element { const { logicProps } = useValues(sessionRecordingPlayerLogic) const { tab, durationMs, end, expandedItems, windowIds } = useValues(playerInspectorLogic(logicProps)) - const { timestampMode } = useValues(playerSettingsLogic) + const { timestampFormat } = useValues(playerSettingsLogic) const { seekToTime } = useActions(sessionRecordingPlayerLogic) const { setItemExpanded } = useActions(playerInspectorLogic(logicProps)) @@ -201,7 +201,7 @@ export function PlayerInspectorListItem({ {!isExpanded ? ( seekToEvent()}> - {timestampMode === 'absolute' ? ( + {timestampFormat === TimestampFormat.Absolute ? ( ) : ( <> diff --git a/frontend/src/scenes/session-recordings/player/playerSettingsLogic.ts b/frontend/src/scenes/session-recordings/player/playerSettingsLogic.ts index a1c633a8dbd2e..381ab7d09a6e2 100644 --- a/frontend/src/scenes/session-recordings/player/playerSettingsLogic.ts +++ b/frontend/src/scenes/session-recordings/player/playerSettingsLogic.ts @@ -182,7 +182,6 @@ export const playerSettingsLogic = kea([ setHideViewedRecordings: (hideViewedRecordings: boolean) => ({ hideViewedRecordings }), setAutoplayDirection: (autoplayDirection: AutoplayDirection) => ({ autoplayDirection }), setTab: (tab: SessionRecordingPlayerTab) => ({ tab }), - setTimestampMode: (mode: 'absolute' | 'relative') => ({ mode }), setMiniFilter: (key: string, enabled: boolean) => ({ key, enabled }), setSearchQuery: (search: string) => ({ search }), setDurationTypeToShow: (type: DurationType) => ({ type }), @@ -278,14 +277,6 @@ export const playerSettingsLogic = kea([ }, ], - timestampMode: [ - 'relative' as 'absolute' | 'relative', - { persist: true }, - { - setTimestampMode: (_, { mode }) => mode, - }, - ], - selectedMiniFilters: [ ['all-automatic', 'console-all', 'events-all', 'performance-all'] as string[], { persist: true },