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.4 KB
Raw Blame
import { MakeLogicType, actions, kea, path, reducers } from 'kea'

/** localStorage key for the evidence rail preference on the report detail (see `evidenceRailCollapsed`). */
export const INBOX_DETAIL_RAIL_STORAGE_KEY = 'inbox-detail-evidence-rail-collapsed'

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface inboxDetailLayoutLogicValues {
    evidenceRailCollapsed: boolean
}

// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface inboxDetailLayoutLogicActions {
    toggleEvidenceRail: () => { value: true }
}

export type inboxDetailLayoutLogicType = MakeLogicType<inboxDetailLayoutLogicValues, inboxDetailLayoutLogicActions>

/**
 * Whether the report detail hides its evidence rail so the report column takes the full width.
 * One preference for every report rather than per-report state: a reviewer who hides the rail to
 * read diffs wants it hidden on the next report too.
 */
export const inboxDetailLayoutLogic = kea<inboxDetailLayoutLogicType>([
    path(['scenes', 'inbox', 'logics', 'inboxDetailLayoutLogic']),

    actions({
        toggleEvidenceRail: true,
    }),

    reducers({
        evidenceRailCollapsed: [
            false as boolean,
            { persist: true, storageKey: INBOX_DETAIL_RAIL_STORAGE_KEY },
            {
                toggleEvidenceRail: (state) => !state,
            },
        ],
    }),
])