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.

fix(replay): reply new UI rearranges (#126194)

Hayne Ryuc6879ae14c1b
diff --git a/frontend/src/scenes/session-recordings/player/PlayerSidebar.tsx b/frontend/src/scenes/session-recordings/player/PlayerSidebar.tsx
index b6acdf40d563..24cf61294d2e 100644
--- a/frontend/src/scenes/session-recordings/player/PlayerSidebar.tsx
+++ b/frontend/src/scenes/session-recordings/player/PlayerSidebar.tsx
@@ -8,7 +8,6 @@ import { LemonButton, LemonTabs } from '@posthog/lemon-ui'
import { Resizer } from 'lib/components/Resizer/Resizer'
import { ResizerLogicProps, resizerLogic } from 'lib/components/Resizer/resizerLogic'
import { FEATURE_FLAGS } from 'lib/constants'
-import { integrationsLogic } from 'lib/integrations/integrationsLogic'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { capitalizeFirstLetter, splitKebabCase } from 'lib/utils/strings'
@@ -20,6 +19,7 @@ import { playerSettingsLogic } from './playerSettingsLogic'
import { sessionRecordingPlayerLogic } from './sessionRecordingPlayerLogic'
import { playerSidebarLogic } from './sidebar/playerSidebarLogic'
import { PlayerSidebarTab } from './sidebar/PlayerSidebarTab'
+import { useLinkedIssuesAvailable } from './sidebar/useLinkedIssuesAvailable'
import { DebugTabBar } from './watch/DebugTabBar'
export function PlayerSidebar({
@@ -45,8 +45,8 @@ export function PlayerSidebar({
const { setSidebarOpen, setDebugMode, setPreferredSidebarStacking } = useActions(playerSettingsLogic)
const open = tabs ? debugMode : sidebarOpen
const setOpen = tabs ? setDebugMode : setSidebarOpen
- const { getIntegrationsByKind } = useValues(integrationsLogic)
const { sessionPlayerMetaData, logicProps } = useValues(sessionRecordingPlayerLogic)
+ const linkedIssuesAvailable = useLinkedIssuesAvailable()
const { featureFlags } = useValues(featureFlagLogic)
const logicKey = `player-sidebar-${isVerticallyStacked ? 'vertical' : 'horizontal'}`
@@ -81,11 +81,7 @@ export function PlayerSidebar({
sidebarTabs.push(SessionRecordingSidebarTab.SESSIONS)
}
- // Show linked issues tab if there are integrations or existing references
- const sessionReplayIntegrations = getIntegrationsByKind(['linear', 'github', 'gitlab', 'jira'])
- const externalReferences = sessionPlayerMetaData?.external_references ?? []
-
- if (!tabs && (sessionReplayIntegrations.length > 0 || externalReferences.length > 0)) {
+ if (!tabs && linkedIssuesAvailable) {
sidebarTabs.push(SessionRecordingSidebarTab.LINKED_ISSUES)
}
diff --git a/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx b/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx
index 8a46cc57554e..7cde29eb0503 100644
--- a/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx
+++ b/frontend/src/scenes/session-recordings/player/SessionRecordingPlayer.tsx
@@ -24,7 +24,8 @@ import {
SessionRecordingPlayerMode,
sessionRecordingPlayerLogic,
} from './sessionRecordingPlayerLogic'
-import { DEBUG_TAB_KEYS } from './watch/DebugTabBar'
+import { useLinkedIssuesAvailable } from './sidebar/useLinkedIssuesAvailable'
+import { debugTabKeys } from './watch/DebugTabBar'
import { WatchPanel } from './watch/WatchPanel'
export { createPlaybackSpeedKey } from './PurePlayer'
@@ -111,6 +112,7 @@ function SessionRecordingPlayerInternal({
const { logicProps, isFullScreen } = useValues(sessionRecordingPlayerLogic)
const { featureFlags } = useValues(featureFlagLogic)
const { user } = useValues(userLogic)
+ const linkedIssuesAvailable = useLinkedIssuesAvailable()
const showDebugReplayButton = featureFlags[FEATURE_FLAGS.REPLAY_DEBUG_WITH_AI] || user?.is_impersonated
// The player modal covers the side panel, so the conversation would open out of sight.
const debugReplayAction = showDebugReplayButton && logicProps.playerKey !== 'modal' ? <DebugReplayButton /> : null
@@ -137,7 +139,7 @@ function SessionRecordingPlayerInternal({
</div>
{rightDock && (
<PlayerSidebar
- tabs={DEBUG_TAB_KEYS}
+ tabs={debugTabKeys(linkedIssuesAvailable)}
stacking={SessionRecordingSidebarStacking.Horizontal}
onToggleStacking={() => setWatchDebugDock('bottom')}
/>
diff --git a/frontend/src/scenes/session-recordings/player/player-meta/PlayerMetaLinks.tsx b/frontend/src/scenes/session-recordings/player/player-meta/PlayerMetaLinks.tsx
index cae17cdc1e14..f82e52670c21 100644
--- a/frontend/src/scenes/session-recordings/player/player-meta/PlayerMetaLinks.tsx
+++ b/frontend/src/scenes/session-recordings/player/player-meta/PlayerMetaLinks.tsx
@@ -32,7 +32,11 @@ import { AccessControlLevel, AccessControlResourceType } from '~/types'
import { PlayerMetaBreakpoints } from './PlayerMeta'
-export function PinToPlaylistButton(): JSX.Element {
+export function PinToPlaylistButton({
+ size = 'xsmall',
+ type,
+ labelled = false,
+}: Pick<LemonButtonProps, 'size' | 'type'> & { labelled?: boolean } = {}): JSX.Element {
const { logicProps } = useValues(sessionRecordingPlayerLogic)
const tooltip = logicProps.pinned ? 'Remove from collection' : 'Add to collection'
@@ -40,14 +44,17 @@ export function PinToPlaylistButton(): JSX.Element {
return logicProps.setPinned && !logicProps.pinned ? (
<LemonButton
- size="xsmall"
+ size={size}
+ type={type}
onClick={() => {
logicProps.setPinned?.(true)
}}
tooltip={tooltip}
data-attr="pin-to-this-list"
icon={<IconPlusSmall />}
- />
+ >
+ {labelled ? description : null}
+ </LemonButton>
) : (
<AccessControlAction
resourceType={AccessControlResourceType.SessionRecording}
@@ -57,7 +64,8 @@ export function PinToPlaylistButton(): JSX.Element {
tooltip={tooltip}
setPinnedInCurrentPlaylist={logicProps.setPinned}
icon={logicProps.pinned ? <IconMinusSmall /> : <IconPlusSmall />}
- size="xsmall"
+ size={size}
+ type={type}
>
{description}
</PlaylistPopoverButton>
diff --git a/frontend/src/scenes/session-recordings/player/playerSettingsLogic.ts b/frontend/src/scenes/session-recordings/player/playerSettingsLogic.ts
index ea35d50a01d0..d323c3cdb67a 100644
--- a/frontend/src/scenes/session-recordings/player/playerSettingsLogic.ts
+++ b/frontend/src/scenes/session-recordings/player/playerSettingsLogic.ts
@@ -15,7 +15,7 @@ import { urls } from 'scenes/urls'
import { AutoplayDirection, ReplayTabs, SessionRecordingSidebarStacking } from '~/types'
-export type WatchPanelSection = 'overview' | 'linked-issues'
+export type WatchPanelSection = 'overview'
export type WatchDebugDock = 'bottom' | 'right'
export enum TimestampFormat {
@@ -125,7 +125,7 @@ export interface playerSettingsLogicActions {
dock: WatchDebugDock
}
toggleWatchPanelSection: (section: WatchPanelSection) => {
- section: WatchPanelSection
+ section: 'overview'
}
}
diff --git a/frontend/src/scenes/session-recordings/player/sidebar/useLinkedIssuesAvailable.ts b/frontend/src/scenes/session-recordings/player/sidebar/useLinkedIssuesAvailable.ts
new file mode 100644
index 000000000000..2df3d36f1f59
--- /dev/null
+++ b/frontend/src/scenes/session-recordings/player/sidebar/useLinkedIssuesAvailable.ts
@@ -0,0 +1,13 @@
+import { useValues } from 'kea'
+
+import { integrationsLogic } from 'lib/integrations/integrationsLogic'
+import { sessionRecordingPlayerLogic } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
+
+export function useLinkedIssuesAvailable(): boolean {
+ const { getIntegrationsByKind } = useValues(integrationsLogic)
+ const { sessionPlayerMetaData } = useValues(sessionRecordingPlayerLogic)
+ return (
+ getIntegrationsByKind(['linear', 'github', 'gitlab', 'jira']).length > 0 ||
+ (sessionPlayerMetaData?.external_references ?? []).length > 0
+ )
+}
diff --git a/frontend/src/scenes/session-recordings/player/watch/DebugModeBanner.tsx b/frontend/src/scenes/session-recordings/player/watch/DebugModeBanner.tsx
index 1716333de1c2..c1a41f01e718 100644
--- a/frontend/src/scenes/session-recordings/player/watch/DebugModeBanner.tsx
+++ b/frontend/src/scenes/session-recordings/player/watch/DebugModeBanner.tsx
@@ -31,7 +31,7 @@ export function DebugModeBanner(): JSX.Element | null {
},
}}
>
- Looking for the inspector or network waterfall? They are under Debug now.
+ Looking for the inspector, network waterfall or linked issues? They are under Debug now.
</LemonBanner>
)
}
diff --git a/frontend/src/scenes/session-recordings/player/watch/DebugTabBar.tsx b/frontend/src/scenes/session-recordings/player/watch/DebugTabBar.tsx
index f42435d88168..750de0d40061 100644
--- a/frontend/src/scenes/session-recordings/player/watch/DebugTabBar.tsx
+++ b/frontend/src/scenes/session-recordings/player/watch/DebugTabBar.tsx
@@ -1,6 +1,6 @@
import { ReactNode } from 'react'
-import { IconPulse } from '@posthog/icons'
+import { IconBug, IconPulse } from '@posthog/icons'
import { IconUnverifiedEvent } from 'lib/lemon-ui/icons'
import { PaneTabBar } from 'scenes/session-recordings/components/PaneTabBar'
@@ -9,6 +9,10 @@ import { SessionRecordingSidebarTab } from '~/types'
export const DEBUG_TAB_KEYS = [SessionRecordingSidebarTab.INSPECTOR, SessionRecordingSidebarTab.NETWORK_WATERFALL]
+export function debugTabKeys(withLinkedIssues: boolean): SessionRecordingSidebarTab[] {
+ return withLinkedIssues ? [...DEBUG_TAB_KEYS, SessionRecordingSidebarTab.LINKED_ISSUES] : DEBUG_TAB_KEYS
+}
+
const DEBUG_TABS: Partial<Record<SessionRecordingSidebarTab, { label: string; icon: ReactNode; dataAttr: string }>> = {
[SessionRecordingSidebarTab.INSPECTOR]: {
label: 'Inspector',
@@ -20,6 +24,11 @@ const DEBUG_TABS: Partial<Record<SessionRecordingSidebarTab, { label: string; ic
icon: <IconPulse />,
dataAttr: 'watch-panel-debug-network',
},
+ [SessionRecordingSidebarTab.LINKED_ISSUES]: {
+ label: 'Linked issues',
+ icon: <IconBug />,
+ dataAttr: 'watch-panel-debug-linked-issues',
+ },
}
export function DebugTabBar({
diff --git a/frontend/src/scenes/session-recordings/player/watch/PlayerModeBar.tsx b/frontend/src/scenes/session-recordings/player/watch/PlayerModeBar.tsx
index 9bf01be63ac0..554e02ff7755 100644
--- a/frontend/src/scenes/session-recordings/player/watch/PlayerModeBar.tsx
+++ b/frontend/src/scenes/session-recordings/player/watch/PlayerModeBar.tsx
@@ -25,10 +25,11 @@ import { playerSettingsLogic } from 'scenes/session-recordings/player/playerSett
import { sessionRecordingPlayerLogic } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
import { PlayerShareMenu } from 'scenes/session-recordings/player/share/PlayerShareMenu'
import { playerSidebarLogic } from 'scenes/session-recordings/player/sidebar/playerSidebarLogic'
+import { useLinkedIssuesAvailable } from 'scenes/session-recordings/player/sidebar/useLinkedIssuesAvailable'
import { SessionRecordingSidebarTab } from '~/types'
-import { DEBUG_TAB_KEYS } from './DebugTabBar'
+import { debugTabKeys } from './DebugTabBar'
type PlayerMode = 'watch' | 'debug'
@@ -41,13 +42,14 @@ export function PlayerModeBar(): JSX.Element {
const { activeTab } = useValues(playerSidebarLogic)
const { setTab } = useActions(playerSidebarLogic)
const chromeItems = usePlayerChromeMenuItems()
+ const debugTabs = debugTabKeys(useLinkedIssuesAvailable())
const { ref, size } = useResizeBreakpoints({ 0: 'small', 600: 'normal' })
const mode: PlayerMode = debugMode ? 'debug' : 'watch'
const setMode = (next: PlayerMode): void => {
posthog.capture('session recording mode changed', { mode: next })
setDebugMode(next === 'debug')
- if (next === 'debug' && !DEBUG_TAB_KEYS.includes(activeTab)) {
+ if (next === 'debug' && !debugTabs.includes(activeTab)) {
setTab(SessionRecordingSidebarTab.INSPECTOR)
}
}
diff --git a/frontend/src/scenes/session-recordings/player/watch/RecordingDebugSection.tsx b/frontend/src/scenes/session-recordings/player/watch/RecordingDebugSection.tsx
index 436356bc550c..24dfd8e41689 100644
--- a/frontend/src/scenes/session-recordings/player/watch/RecordingDebugSection.tsx
+++ b/frontend/src/scenes/session-recordings/player/watch/RecordingDebugSection.tsx
@@ -3,27 +3,28 @@ import { useActions, useValues } from 'kea'
import { IconSidePanel } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
-import { NetworkView } from 'scenes/session-recordings/apm/NetworkView'
-import { PlayerInspector } from 'scenes/session-recordings/player/inspector/PlayerInspector'
import { playerSettingsLogic } from 'scenes/session-recordings/player/playerSettingsLogic'
import { playerSidebarLogic } from 'scenes/session-recordings/player/sidebar/playerSidebarLogic'
+import { PlayerSidebarTab } from 'scenes/session-recordings/player/sidebar/PlayerSidebarTab'
+import { useLinkedIssuesAvailable } from 'scenes/session-recordings/player/sidebar/useLinkedIssuesAvailable'
import { SessionRecordingSidebarTab } from '~/types'
-import { DEBUG_TAB_KEYS, DebugTabBar } from './DebugTabBar'
+import { DebugTabBar, debugTabKeys } from './DebugTabBar'
export function RecordingDebugSection(): JSX.Element {
const { activeTab } = useValues(playerSidebarLogic)
const { setTab } = useActions(playerSidebarLogic)
const { setWatchDebugDock } = useActions(playerSettingsLogic)
- const tab = DEBUG_TAB_KEYS.includes(activeTab) ? activeTab : SessionRecordingSidebarTab.INSPECTOR
+ const tabs = debugTabKeys(useLinkedIssuesAvailable())
+ const tab = tabs.includes(activeTab) ? activeTab : SessionRecordingSidebarTab.INSPECTOR
return (
<div
className="flex flex-col border rounded bg-surface-primary overflow-hidden h-[calc(45cqh-1.5rem)] min-h-48"
data-attr="watch-panel-debug"
>
- <DebugTabBar tabs={DEBUG_TAB_KEYS} activeTab={tab} onChange={setTab}>
+ <DebugTabBar tabs={tabs} activeTab={tab} onChange={setTab}>
<LemonButton
size="small"
icon={<IconSidePanel />}
@@ -35,7 +36,7 @@ export function RecordingDebugSection(): JSX.Element {
/>
</DebugTabBar>
<div className="flex flex-col flex-1 min-w-0 overflow-hidden">
- {tab === SessionRecordingSidebarTab.NETWORK_WATERFALL ? <NetworkView /> : <PlayerInspector />}
+ <PlayerSidebarTab tab={tab} />
</div>
</div>
)
diff --git a/frontend/src/scenes/session-recordings/player/watch/RecordingOverviewDisclosure.tsx b/frontend/src/scenes/session-recordings/player/watch/RecordingOverviewDisclosure.tsx
index 6c10e2ca5895..4be8401b875a 100644
--- a/frontend/src/scenes/session-recordings/player/watch/RecordingOverviewDisclosure.tsx
+++ b/frontend/src/scenes/session-recordings/player/watch/RecordingOverviewDisclosure.tsx
@@ -1,5 +1,4 @@
import { useActions, useValues } from 'kea'
-import { ReactNode } from 'react'
import { LemonCollapse } from '@posthog/lemon-ui'
@@ -7,32 +6,24 @@ import { playerSettingsLogic } from 'scenes/session-recordings/player/playerSett
import { RecordingOverviewPanels } from './RecordingOverviewPanels'
-export function RecordingOverviewDisclosure({ actions }: { actions?: ReactNode }): JSX.Element {
+export function RecordingOverviewDisclosure(): JSX.Element {
const { watchPanelOpenSections } = useValues(playerSettingsLogic)
const { toggleWatchPanelSection } = useActions(playerSettingsLogic)
const open = watchPanelOpenSections.includes('overview')
return (
- <div className="relative">
- <LemonCollapse
- size="small"
- panels={[
- {
- key: 'overview',
- header: 'Overview',
- content: <RecordingOverviewPanels />,
- dataAttr: 'watch-panel-section-overview',
- },
- ]}
- activeKey={open ? 'overview' : null}
- onChange={() => toggleWatchPanelSection('overview')}
- />
- {actions && (
- // Height of a small LemonButton, which is what the collapse header renders as.
- <div className="absolute right-1 top-0 h-[2.0625rem] max-w-[70%] flex items-center gap-2">
- {actions}
- </div>
- )}
- </div>
+ <LemonCollapse
+ size="small"
+ panels={[
+ {
+ key: 'overview',
+ header: 'Overview',
+ content: <RecordingOverviewPanels />,
+ dataAttr: 'watch-panel-section-overview',
+ },
+ ]}
+ activeKey={open ? 'overview' : null}
+ onChange={() => toggleWatchPanelSection('overview')}
+ />
)
}
diff --git a/frontend/src/scenes/session-recordings/player/watch/RecordingSections.tsx b/frontend/src/scenes/session-recordings/player/watch/RecordingSections.tsx
deleted file mode 100644
index 5b4032206c2b..000000000000
--- a/frontend/src/scenes/session-recordings/player/watch/RecordingSections.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import { useActions, useValues } from 'kea'
-
-import { LemonCollapse } from '@posthog/lemon-ui'
-
-import { integrationsLogic } from 'lib/integrations/integrationsLogic'
-import { WatchPanelSection, playerSettingsLogic } from 'scenes/session-recordings/player/playerSettingsLogic'
-import { sessionRecordingPlayerLogic } from 'scenes/session-recordings/player/sessionRecordingPlayerLogic'
-import { PlayerSidebarLinkedIssuesTab } from 'scenes/session-recordings/player/sidebar/PlayerSidebarLinkedIssuesTab'
-
-export function RecordingSections(): JSX.Element | null {
- const { sessionPlayerMetaData } = useValues(sessionRecordingPlayerLogic)
- const { getIntegrationsByKind } = useValues(integrationsLogic)
- const { watchPanelOpenSections } = useValues(playerSettingsLogic)
- const { toggleWatchPanelSection } = useActions(playerSettingsLogic)
-
- const showLinkedIssues =
- getIntegrationsByKind(['linear', 'github', 'gitlab', 'jira']).length > 0 ||
- (sessionPlayerMetaData?.external_references ?? []).length > 0
-
- const panels = [
- showLinkedIssues && {
- key: 'linked-issues' as WatchPanelSection,
- header: 'Linked issues',
- content: <PlayerSidebarLinkedIssuesTab />,
- dataAttr: 'watch-panel-section-linked-issues',
- },
- ].filter((panel): panel is Exclude<typeof panel, false> => !!panel)
-
- if (panels.length === 0) {
- return null
- }
- const sectionKeys = panels.map((panel) => panel.key)
- const activeKeys = watchPanelOpenSections.filter((section) => sectionKeys.includes(section))
-
- return (
- <LemonCollapse
- size="small"
- multiple
- panels={panels}
- activeKeys={activeKeys}
- onChange={(next: WatchPanelSection[]) => {
- for (const key of sectionKeys) {
- if (activeKeys.includes(key) !== next.includes(key)) {
- toggleWatchPanelSection(key)
- }
- }
- }}
- />
- )
-}
diff --git a/frontend/src/scenes/session-recordings/player/watch/RecordingTitleBlock.tsx b/frontend/src/scenes/session-recordings/player/watch/RecordingTitleBlock.tsx
index c48681f48882..1ee4ad48e8a0 100644
--- a/frontend/src/scenes/session-recordings/player/watch/RecordingTitleBlock.tsx
+++ b/frontend/src/scenes/session-recordings/player/watch/RecordingTitleBlock.tsx
@@ -1,4 +1,5 @@
import { useActions, useValues } from 'kea'
+import { ReactNode } from 'react'
import { IconChevronRight } from '@posthog/icons'
import { LemonButton } from '@posthog/lemon-ui'
@@ -21,7 +22,7 @@ import { asDisplay, asLink } from 'products/persons/frontend/person-utils'
import { sessionRecordingPlayerLogic } from '../sessionRecordingPlayerLogic'
-export function RecordingTitleBlock(): JSX.Element {
+export function RecordingTitleBlock({ actions }: { actions?: ReactNode }): JSX.Element {
const { logicProps, sessionPlayerMetaData } = useValues(sessionRecordingPlayerLogic)
const { sessionPerson, loading, startTime } = useValues(playerMetaLogic(logicProps))
const { recordingPropertiesById } = useValues(sessionRecordingsListPropertiesLogic)
@@ -29,6 +30,13 @@ export function RecordingTitleBlock(): JSX.Element {
const { filterByPerson } = useActions(sessionRecordingsPlaylistLogic)
const { setPlaylistCollapsed } = useActions(playerSettingsLogic)
+ const actionBar = (
+ <div className="shrink-0 flex items-center gap-2" data-attr="watch-panel-title-actions">
+ {actions}
+ <PinToPlaylistButton size="small" type="secondary" labelled />
+ </div>
+ )
+
if (loading) {
return (
<div className="flex items-center gap-3">
@@ -37,6 +45,7 @@ export function RecordingTitleBlock(): JSX.Element {
<LemonSkeleton className="w-1/3 h-5" />
<LemonSkeleton className="w-1/2 h-4" />
</div>
+ {actionBar}
</div>
)
}
@@ -57,7 +66,7 @@ export function RecordingTitleBlock(): JSX.Element {
}
return (
- <div className="flex items-start gap-3 min-w-0" data-attr="watch-panel-title">
+ <div className="flex items-start gap-3 min-w-0 flex-wrap" data-attr="watch-panel-title">
{sessionPerson && <PersonIcon person={sessionPerson} size="lg" className="mr-0 shrink-0" />}
<div className="flex flex-col gap-0.5 min-w-0 flex-1">
<h2 className="text-base font-semibold truncate m-0 ph-no-capture">
@@ -96,9 +105,7 @@ export function RecordingTitleBlock(): JSX.Element {
<PlayerMetaExperimentTags />
</div>
</div>
- <div className="shrink-0">
- <PinToPlaylistButton />
- </div>
+ {actionBar}
</div>
)
}
diff --git a/frontend/src/scenes/session-recordings/player/watch/WatchPanel.tsx b/frontend/src/scenes/session-recordings/player/watch/WatchPanel.tsx
index a05b18039540..3e8312b593ea 100644
--- a/frontend/src/scenes/session-recordings/player/watch/WatchPanel.tsx
+++ b/frontend/src/scenes/session-recordings/player/watch/WatchPanel.tsx
@@ -11,7 +11,6 @@ import { MomentTicker } from './MomentTicker'
import { RecordingCommentsList } from './RecordingCommentsList'
import { RecordingDebugSection } from './RecordingDebugSection'
import { RecordingOverviewDisclosure } from './RecordingOverviewDisclosure'
-import { RecordingSections } from './RecordingSections'
import { RecordingTitleBlock } from './RecordingTitleBlock'
export function WatchPanel({
@@ -31,13 +30,12 @@ export function WatchPanel({
<div className="flex flex-col gap-4 px-1 pt-3 pb-6" data-attr="watch-panel">
<DebugModeBanner />
{vision && <MomentTicker sessionId={sessionRecordingId} />}
- <RecordingTitleBlock />
- <RecordingOverviewDisclosure
+ <RecordingTitleBlock
actions={vision ? <SummarizeRecordingBar inline extraActions={summaryActions} /> : summaryActions}
/>
+ <RecordingOverviewDisclosure />
<RecordingCommentsList sessionId={sessionRecordingId} />
{debugMode && watchDebugDock === 'bottom' && <RecordingDebugSection />}
- <RecordingSections />
</div>
)
}
diff --git a/frontend/src/scenes/session-recordings/playlist/OngoingRecordingsGroup.tsx b/frontend/src/scenes/session-recordings/playlist/OngoingRecordingsGroup.tsx
index 368d490c2fde..cc3a128e762f 100644
--- a/frontend/src/scenes/session-recordings/playlist/OngoingRecordingsGroup.tsx
+++ b/frontend/src/scenes/session-recordings/playlist/OngoingRecordingsGroup.tsx
@@ -6,10 +6,12 @@ import { LemonBadge, LemonButton } from '@posthog/lemon-ui'
export function OngoingRecordingsGroup({
count,
holdsActive,
+ defaultOpen = false,
children,
}: {
count: number
holdsActive: boolean
+ defaultOpen?: boolean
children: ReactNode
}): JSX.Element | null {
// null follows the selection. A click pins a choice until the selection next moves into the group
@@ -24,7 +26,7 @@ export function OngoingRecordingsGroup({
if (count === 0) {
return null
}
- const expanded = choice ?? holdsActive
+ const expanded = choice ?? (holdsActive || defaultOpen)
return (
<div className="border-b">
diff --git a/frontend/src/scenes/session-recordings/playlist/Playlist.tsx b/frontend/src/scenes/session-recordings/playlist/Playlist.tsx
index 7d855e50a45e..e09e05debb58 100644
--- a/frontend/src/scenes/session-recordings/playlist/Playlist.tsx
+++ b/frontend/src/scenes/session-recordings/playlist/Playlist.tsx
@@ -29,6 +29,7 @@ import { RecordingsUniversalFiltersEmbedButton } from 'scenes/session-recordings
import { playerSettingsLogic } from 'scenes/session-recordings/player/playerSettingsLogic'
import { OngoingRecordingsGroup } from 'scenes/session-recordings/playlist/OngoingRecordingsGroup'
import { playlistFiltersLogic } from 'scenes/session-recordings/playlist/playlistFiltersLogic'
+import { splitOngoingRecordings } from 'scenes/session-recordings/playlist/playlistUtils'
import { ReplayFilterBar } from 'scenes/session-recordings/playlist/ReplayFilterBar'
import { isFeedReplayLayout, isNewReplayLayout } from 'scenes/session-recordings/playlist/replayLayout'
import { ReplayListHeader } from 'scenes/session-recordings/playlist/ReplayListHeader'
@@ -170,10 +171,10 @@ export function Playlist({
<SessionRecordingPreview recording={item} isActive={isActive} selectable />
)
- // Still-ingesting recordings fold above the results in the watch layout, so the list opens on finished ones.
- const ongoingRecordings = newLayout ? otherRecordings.filter((r) => r.ongoing) : []
- const finishedRecordings =
- ongoingRecordings.length > 0 ? otherRecordings.filter((r) => !r.ongoing) : otherRecordings
+ const { ongoing: ongoingRecordings, finished: finishedRecordings } = splitOngoingRecordings(
+ otherRecordings,
+ newLayout
+ )
const sections: PlaylistSection[] = []
@@ -281,7 +282,22 @@ export function Playlist({
const activeItemId = activeSessionRecordingId === undefined ? controlledActiveItemId : activeSessionRecordingId
const emptyState =
- type === 'collection' ? (
+ ongoingRecordings.length > 0 ? (
+ <div className="flex flex-col items-center gap-2 p-4 text-secondary text-sm">
+ <span>Only live recordings so far</span>
+ {hasNext && (
+ <LemonButton
+ type="secondary"
+ size="small"
+ loading={sessionRecordingsResponseLoading}
+ onClick={() => maybeLoadSessionRecordings('older')}
+ data-attr="list-load-older"
+ >
+ Load more
+ </LemonButton>
+ )}
+ </div>
+ ) : type === 'collection' ? (
<CollectionEmptyState isSynthetic={isSynthetic} description={description} />
) : (
<ListEmptyState listEmptyState={listEmptyState} />
@@ -408,6 +424,7 @@ export function Playlist({
<OngoingRecordingsGroup
count={ongoingRecordings.length}
holdsActive={ongoingRecordings.some((r) => r.id === activeItemId)}
+ defaultOpen={finishedRecordings.length === 0}
>
<ListSection
key="ongoing"
diff --git a/frontend/src/scenes/session-recordings/playlist/playlistUtils.test.ts b/frontend/src/scenes/session-recordings/playlist/playlistUtils.test.ts
index 468697adf5da..4f178fb99694 100644
--- a/frontend/src/scenes/session-recordings/playlist/playlistUtils.test.ts
+++ b/frontend/src/scenes/session-recordings/playlist/playlistUtils.test.ts
@@ -1,5 +1,6 @@
import {
comparableRecordingFilters,
+ splitOngoingRecordings,
stripSessionIds,
summarizePlaylistFilters,
} from 'scenes/session-recordings/playlist/playlistUtils'
@@ -241,3 +242,17 @@ describe('comparableRecordingFilters()', () => {
expect(comparableRecordingFilters(filters as any)).toEqual(expected)
})
})
+
+describe('splitOngoingRecordings()', () => {
+ const live = { id: 'live', ongoing: true }
+ const done = { id: 'done', ongoing: false }
+
+ it.each([
+ ['folds ongoing recordings away from finished ones', [live, done], true, [live], [done]],
+ ['folds every row when all of them are still recording', [live, live], true, [live, live], []],
+ ['keeps every row when none are still recording', [done], true, [], [done]],
+ ['keeps every row outside the watch layout', [live, done], false, [], [live, done]],
+ ])('%s', (_, recordings, enabled, ongoing, finished) => {
+ expect(splitOngoingRecordings(recordings, enabled)).toEqual({ ongoing, finished })
+ })
+})
diff --git a/frontend/src/scenes/session-recordings/playlist/playlistUtils.ts b/frontend/src/scenes/session-recordings/playlist/playlistUtils.ts
index ae3013a1f36b..0446649d8737 100644
--- a/frontend/src/scenes/session-recordings/playlist/playlistUtils.ts
+++ b/frontend/src/scenes/session-recordings/playlist/playlistUtils.ts
@@ -24,6 +24,16 @@ import {
UniversalFilterValue,
} from '~/types'
+export function splitOngoingRecordings<T extends { ongoing?: boolean }>(
+ recordings: T[],
+ enabled: boolean
+): { ongoing: T[]; finished: T[] } {
+ if (!enabled || !recordings.some((r) => r.ongoing)) {
+ return { ongoing: [], finished: recordings }
+ }
+ return { ongoing: recordings.filter((r) => r.ongoing), finished: recordings.filter((r) => !r.ongoing) }
+}
+
// Pre-seeded session ids and the person picked from the player belong to the open list, not to a saved filter.
export function stripSessionIds<T extends Partial<RecordingUniversalFilters> | undefined | null>(filters: T): T {
if (!filters || !('session_ids' in filters || 'person_uuid' in filters)) {