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.

981 B
Raw Blame
import type { ReactElement } from 'react'
import { Text } from 'react-native'
import { useProjectScope } from '@/auth/useProjectScope'
import { useColors } from '@/ui/theme'
import { type ObjectRef, objectWebUrl } from './objectTags'
import { openReplyUrl } from './webLinks'

export function ObjectChip({ target }: { target: ObjectRef }): ReactElement {
    const colors = useColors()
    const scope = useProjectScope()
    const url = scope && objectWebUrl(scope.host, scope.projectId, target.kind, target.id)
    return (
        <Text
            accessibilityRole={url ? 'link' : undefined}
            style={url ? { color: colors.blue, backgroundColor: colors.sunken } : undefined}
            onPress={
                url
                    ? () => {
                          openReplyUrl(url, 'object_chip', { objectKind: target.kind })
                      }
                    : undefined
            }
        >
            {target.label}
        </Text>
    )
}