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.

1.8 KB
Raw Blame
import { MakeLogicType, kea, path, props, selectors } from 'kea'

import { Scene } from 'scenes/sceneTypes'
import { urls } from 'scenes/urls'

import { Breadcrumb, SessionRecordingType } from '~/types'

export interface SessionRecordingDetailLogicProps {
    id?: SessionRecordingType['id']
}

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface sessionRecordingDetailLogicValues {
    breadcrumbs: Breadcrumb[]
}

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface sessionRecordingDetailLogicMeta {
    __keaTypeGenInternalSelectorTypes: {
        breadcrumbs: (arg: SessionRecordingType['id']) => Breadcrumb[]
    }
}

export type sessionRecordingDetailLogicType = MakeLogicType<
    sessionRecordingDetailLogicValues,
    {},
    SessionRecordingDetailLogicProps,
    sessionRecordingDetailLogicMeta
>

export const sessionRecordingDetailLogic = kea<sessionRecordingDetailLogicType>([
    path(['scenes', 'session-recordings', 'detail', 'sessionRecordingDetailLogic']),
    props({} as SessionRecordingDetailLogicProps),
    selectors({
        breadcrumbs: [
            () => [(_, props) => props.id as SessionRecordingType['id']],
            (sessionRecordingId: SessionRecordingType['id']): Breadcrumb[] => [
                {
                    key: Scene.Replay,
                    name: `Replay`,
                    path: urls.replay(),
                    iconType: 'session_replay',
                },
                {
                    key: [Scene.ReplaySingle, sessionRecordingId],
                    name: sessionRecordingId ?? 'Not Found',
                    path: sessionRecordingId ? urls.replaySingle(sessionRecordingId) : undefined,
                    iconType: 'session_replay',
                },
            ],
        ],
    }),
])