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.

903 B
Raw Blame
import './UserActivityIndicator.scss'

import clsx from 'clsx'

import { ProfilePicture } from 'lib/lemon-ui/ProfilePicture'

import { UserBasicType } from '~/types'

import { TZLabel } from '../TZLabel'

export interface UserActivityIndicatorProps {
    prefix?: string
    at: string | null | undefined
    by?: UserBasicType | null | undefined
    className?: string
}

export function UserActivityIndicator({
    at,
    by,
    prefix = 'Last modified',
    className,
}: UserActivityIndicatorProps): JSX.Element | null {
    return at || by ? (
        <div className={clsx('UserActivityIndicator', className)}>
            <div className="flex gap-x-1">
                <span>{prefix}</span>
                {at && <TZLabel time={at} />}
                {by && <span> by</span>}
            </div>
            {by && <ProfilePicture user={by} showName size="md" />}
        </div>
    ) : null
}