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.2 KB
Raw Blame
import { MakeLogicType, kea, path, props, selectors } from 'kea'

import { Scene } from 'scenes/sceneTypes'

import { Breadcrumb } from '~/types'

export interface SiteLogicProps {
    url: string
}

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

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

export type siteLogicType = MakeLogicType<siteLogicValues, {}, SiteLogicProps, siteLogicMeta>

export const siteLogic = kea<siteLogicType>([
    path(['scenes', 'sites', 'siteLogic']),
    props({} as SiteLogicProps),
    selectors({
        breadcrumbs: [
            (_, p) => [p.url],
            (url: string): Breadcrumb[] => [
                {
                    key: Scene.Site,
                    name: `Site`,
                    iconType: 'heatmap',
                },
                {
                    key: [Scene.Site, url],
                    name: url,
                    iconType: 'heatmap',
                },
            ],
        ],
    }),
])