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.

1014 B
Raw Blame
import { LiveAnimatedTable } from './LiveAnimatedTable'
import { PathItem } from './LiveWebAnalyticsMetricsTypes'

interface LiveTopPathsTableProps {
    paths: PathItem[]
    isLoading: boolean
    className?: string
    totalPageviews: number
}

const renderPathLabel = (item: PathItem): { node: React.ReactNode; tooltipTitle: string } => ({
    node: <span className="font-mono text-xs truncate">{item.path}</span>,
    tooltipTitle: item.path,
})

export const LiveTopPathsTable = ({
    paths,
    isLoading,
    className,
    totalPageviews,
}: LiveTopPathsTableProps): JSX.Element => (
    <LiveAnimatedTable
        items={paths}
        keyExtractor={(item) => item.path}
        viewsExtractor={(item) => item.views}
        renderLabel={renderPathLabel}
        title="Top pages (last 30 minutes)"
        columnLabel="Path"
        emptyMessage="No pageviews recorded in the last 30 minutes"
        isLoading={isLoading}
        totalPageviews={totalPageviews}
        className={className}
    />
)