({ allViewers, uniqueViewers, allViews }: { allViewers: number, uniqueViewers: number, allViews: ViewerData[] })
| 6 | import { ViewerData } from "@/types/supabase" |
| 7 | |
| 8 | export default function Analytics({ allViewers, uniqueViewers, allViews }: { allViewers: number, uniqueViewers: number, allViews: ViewerData[] }) { |
| 9 | return ( |
| 10 | <div className="w-full max-w-2xl mx-auto space-y-4"> |
| 11 | <div className="grid gap-4 grid-cols-1 sm:grid-cols-2"> |
| 12 | <Card className="w-full"> |
| 13 | <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2"> |
| 14 | <CardTitle className="text-sm font-medium pr-4"> |
| 15 | Total Views |
| 16 | </CardTitle> |
| 17 | <Activity className="h-4 w-4 text-muted-foreground" /> |
| 18 | </CardHeader> |
| 19 | <CardContent> |
| 20 | <div className="text-2xl font-bold">{allViewers}</div> |
| 21 | </CardContent> |
| 22 | </Card> |
| 23 | <Card className="w-full"> |
| 24 | <CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2"> |
| 25 | <CardTitle className="text-sm font-medium pr-4"> |
| 26 | Unique Views |
| 27 | </CardTitle> |
| 28 | <Users className="h-4 w-4 text-muted-foreground" /> |
| 29 | </CardHeader> |
| 30 | <CardContent> |
| 31 | <div className="text-2xl font-bold">{uniqueViewers}</div> |
| 32 | </CardContent> |
| 33 | </Card> |
| 34 | </div> |
| 35 | <Card className="w-full"> |
| 36 | <CardHeader> |
| 37 | <CardTitle>Recent Views</CardTitle> |
| 38 | <CardDescription> |
| 39 | {allViewers > 0 |
| 40 | ? `More information about your views` |
| 41 | : "No views yet"} |
| 42 | </CardDescription> |
| 43 | </CardHeader> |
| 44 | <CardContent> |
| 45 | <Viewers allViews={allViews} /> |
| 46 | </CardContent> |
| 47 | </Card> |
| 48 | </div> |
| 49 | ) |
| 50 | } |
nothing calls this directly
no outgoing calls
no test coverage detected