'use client'
import { formatNumber } from '@ciphera-net/ui'
import { Files } from '@phosphor-icons/react'
import type { FrustrationByPage } from '@/lib/api/stats'
interface FrustrationByPageTableProps {
pages: FrustrationByPage[]
loading: boolean
}
function SkeletonRows() {
return (
{Array.from({ length: 5 }).map((_, i) => (
))}
)
}
export default function FrustrationByPageTable({ pages, loading }: FrustrationByPageTableProps) {
const hasData = pages.length > 0
const maxTotal = Math.max(...pages.map(p => p.total), 1)
return (
Frustration by Page
Pages with the most frustration signals
{loading ? (
) : hasData ? (
{/* Header */}
Page
Rage
Dead
Total
Elements
{/* Rows */}
{pages.map((page) => {
const barWidth = (page.total / maxTotal) * 75
return (
{/* Background bar */}
{page.page_path}
{formatNumber(page.rage_clicks)}
{formatNumber(page.dead_clicks)}
{formatNumber(page.total)}
{page.unique_elements}
)
})}
) : (
No frustration signals detected
Page-level frustration data will appear here once rage clicks or dead clicks are detected on your site.
View setup guide
)}
)
}