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, actions, kea, path, reducers } from 'kea'

import { bindModalToUrl } from 'lib/logic/bindModalToUrl'

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

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

export type globalModalsLogicType = MakeLogicType<globalModalsLogicValues, globalModalsLogicActions>

export const globalModalsLogic = kea<globalModalsLogicType>([
    path(['layout', 'navigation', 'globalModalsLogic']),
    actions({
        showCreateOrganizationModal: true,
        hideCreateOrganizationModal: true,
        showCreateProjectModal: true,
        hideCreateProjectModal: true,
    }),
    reducers({
        isCreateOrganizationModalShown: [
            false,
            {
                showCreateOrganizationModal: () => true,
                hideCreateOrganizationModal: () => false,
            },
        ],
        isCreateProjectModalShown: [
            false,
            {
                showCreateProjectModal: () => true,
                hideCreateProjectModal: () => false,
            },
        ],
    }),
    bindModalToUrl({
        urlKey: 'create-organization',
        openActionKey: 'showCreateOrganizationModal',
        closeActionKey: 'hideCreateOrganizationModal',
        isOpenKey: 'isCreateOrganizationModalShown',
    }),
])