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.

738 B
Raw Blame
export type TodaySidebarSectionState = 'loading' | 'error' | 'empty' | 'no-matches' | 'ready'

export interface TodaySidebarSectionInput {
    loading: boolean
    failed: boolean
    total: number
    shown: number
}

export function todaySidebarSectionState({
    loading,
    failed,
    total,
    shown,
}: TodaySidebarSectionInput): TodaySidebarSectionState {
    if (total === 0) {
        return loading ? 'loading' : failed ? 'error' : 'empty'
    }
    return shown === 0 ? 'no-matches' : 'ready'
}

export function todayRecentClearLabel(searching: boolean, filtering: boolean): string {
    if (searching && filtering) {
        return 'Clear search and filters'
    }
    return searching ? 'Clear search' : 'Clear filters'
}