🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Enhance HomePage and Card components for improved user engagement and clarity
Bill Yangb4a62b0f3904
diff --git a/docs/src/app/(home)/page.tsx b/docs/src/app/(home)/page.tsxindex edababeda..79f66cc7e 100644--- a/docs/src/app/(home)/page.tsx+++ b/docs/src/app/(home)/page.tsx@@ -11,6 +11,16 @@ import { Tilt_Warp } from "next/font/google";import Image from "next/image";import Link from "next/link";import { DEFAULT_EVENT_LIMIT } from "../../lib/const";+import { UserBehaviorTrends } from "../../components/Cards/UserBehaviorTrends";+import { RealTimeAnalytics } from "../../components/Cards/RealTimeAnalytics";+import { SessionReplay } from "../../components/Cards/SessionReplay";+import WebVitals from "../../components/Cards/WebVitals";+import { UserProfiles } from "../../components/Cards/UserProfiles";+import { UserSessions } from "../../components/Cards/UserSessions";+import { UserFlowAnalysis } from "../../components/Cards/UserFlowAnalysis";+import { EventTracking } from "../../components/Cards/EventTracking";+import { GoalConversion } from "../../components/Cards/GoalConversion";+import { Funnels } from "../../components/Cards/Funnels";const tilt_wrap = Tilt_Warp({subsets: ["latin"],@@ -197,7 +207,7 @@ export default function HomePage() {<div className="max-w-6xl mx-auto px-4"><div className="text-center mb-10 md:mb-12"><p className="text-neutral-400 text-sm uppercase tracking-wider font-medium">- Trusted by 2000+ companies worldwide+ Trusted by 4,000+ organizations worldwide</p></div><div className="grid grid-cols-2 md:grid-cols-4 gap-8 items-center justify-items-center">@@ -281,28 +291,41 @@ export default function HomePage() {</div></div></section>-<section className="py-14 md:py-20 w-full max-w-6xl px-4">- <div className="bg-neutral-900/30 backdrop-blur-sm border border-neutral-800/50 rounded-2xl p-4 md:p-8">- <div className="grid grid-cols-1 md:grid-cols-3 gap-8 md:gap-12\0">- {features.map(feature => {- const Icon = feature.icon;- return (- <div key={feature.title} className="space-y-4">- <div className="w-10 h-10 rounded-xl bg-gradient-to-br from-emerald-500/20 to-emerald-600/10 border border-emerald-500/30 shadow-md shadow-emerald-500/10 flex items-center justify-center">- <Icon className="w-5 h-5 text-emerald-400" />- </div>- <h3 className="text-2xl font-medium tracking-tight">{feature.title}</h3>- <p className="text-neutral-300 text-base">{feature.description}</p>+ {/* <div className="bg-neutral-900/30 backdrop-blur-sm border border-neutral-800/50 rounded-2xl p-4 md:p-8"> */}+ <div className="grid grid-cols-1 md:grid-cols-3 gap-10 md:gap-16">+ {features.map(feature => {+ const Icon = feature.icon;+ return (+ <div key={feature.title} className="space-y-4">+ <div className="w-10 h-10 rounded-xl bg-gradient-to-br from-emerald-500/20 to-emerald-600/10 border border-emerald-500/30 shadow-md shadow-emerald-500/10 flex items-center justify-center">+ <Icon className="w-5 h-5 text-emerald-400" /></div>- );- })}- </div>+ <h3 className="text-2xl font-medium tracking-tight">{feature.title}</h3>+ <p className="text-neutral-300 text-base">{feature.description}</p>+ </div>+ );+ })}+ </div>+ {/* </div> */}+ </section>+ <section className="py-14 md:py-20 w-full max-w-6xl px-4">+ <div className="text-center mb-10 md:mb-16">+ <SectionBadge className="mb-4"> Analytics Reimagined</SectionBadge>+ <h2 className="text-3xl md:text-5xl font-bold tracking-tight">Features</h2>+ <p className="mt-4 text-base md:text-xl text-neutral-300 max-w-2xl mx-auto font-light">+ Everything you need to understand your audience and grow your business, without the complexity.+ </p>+ </div>+ <div className="grid grid-cols-1 md:grid-cols-2 gap-3 md:gap-4">+ <RealTimeAnalytics />+ <SessionReplay />+ <UserSessions />+ <Funnels /></div></section><Integrations />-{/* Testimonial Section */}<section className="py-10 md:py-16 w-full"><div className="max-w-7xl mx-auto px-4">diff --git a/docs/src/components/Avatar.tsx b/docs/src/components/Avatar.tsxnew file mode 100644index 000000000..7441775e6--- /dev/null+++ b/docs/src/components/Avatar.tsx@@ -0,0 +1,28 @@+import BoringAvatar from "boring-avatars";++export const AVATAR_COLORS = [+ "#ec4899",+ "#be185d",+ "#f97316",+ "#c2410c",+ "#eab308",+ "#a16207",+ "#10b981",+ "#059669",+ "#14b8a6",+ "#0d9488",+ "#06b6d4",+ "#0e7490",+ "#3b82f6",+ "#1d4ed8",+ "#6366f1",+ "#8b5cf6",+ "#475569",+ "#6b7280",+ "#9ca3af",+ "#d1d5db",+];++export function Avatar({ id, size = 20 }: { id: string; size?: number }) {+ return <BoringAvatar size={size} name={id} variant="beam" colors={AVATAR_COLORS} />;+}diff --git a/docs/src/components/Cards/Card.tsx b/docs/src/components/Cards/Card.tsxindex 3b6e88476..15700c258 100644--- a/docs/src/components/Cards/Card.tsx+++ b/docs/src/components/Cards/Card.tsx@@ -1,17 +1,24 @@import { cn } from "@/lib/utils";+import { LucideIcon } from "lucide-react";interface CardProps {title: string;description?: string;children: React.ReactNode;className?: string;+ icon?: LucideIcon;}-export function Card({ title, description, children, className }: CardProps) {+export function Card({ title, description, children, className, icon: Icon }: CardProps) {return (- <div className={cn("bg-neutral-800/20 p-6 rounded-xl border border-neutral-800/50", className)}>- <h3 className="text-xl font-semibold mb-3">{title}</h3>- {description && <p className="text-neutral-300 mb-4">{description}</p>}+ <div className={cn("bg-neutral-800/20 p-4 md:p-6 rounded-xl border border-neutral-800/50", className)}>+ {Icon && (+ <div className="w-8 h-8 rounded-lg bg-gradient-to-br from-emerald-500/20 to-emerald-600/10 border border-emerald-500/30 shadow-md shadow-emerald-500/10 flex items-center justify-center mb-3">+ <Icon className="w-4 h-4 text-emerald-400" />+ </div>+ )}+ <h3 className="text-xl font-semibold mb-2">{title}</h3>+ {description && <p className="text-neutral-300 text-sm mb-3">{description}</p>}{children}</div>);diff --git a/docs/src/components/Cards/Funnels.tsx b/docs/src/components/Cards/Funnels.tsxindex c5397d529..2b4e83bff 100644--- a/docs/src/components/Cards/Funnels.tsx+++ b/docs/src/components/Cards/Funnels.tsx@@ -1,15 +1,68 @@import { Card } from "./Card";-import { Filter } from "lucide-react";+import { Eye, Filter } from "lucide-react";++const funnelData = [+ {+ step: 1,+ label: "Homepage",+ users: 608,+ },+ {+ step: 2,+ label: "Signup",+ users: 59,+ },+ {+ step: 4,+ label: "Purchase",+ users: 5,+ },+];export function Funnels() {+ const totalUsers = funnelData[0].users;+return (<Cardtitle="Conversion Funnels"description="Visualize user journeys and identify where users drop off."+ icon={Filter}>- <div className="bg-neutral-900 rounded-lg p-4 h-[200px] flex items-center justify-center">- <Filter className="w-16 h-16 text-neutral-600 rotate-180" />+ {/* Funnel Steps */}+ <div className="space-y-4 mt-4">+ {funnelData.map((item, index) => {+ const overallConversion = (item.users / totalUsers) * 100;+ const previousUsers = index > 0 ? funnelData[index - 1].users : item.users;++ return (+ <div key={item.step} className="flex items-center gap-3">+ {/* Step number */}+ <div className="flex-shrink-0 w-8 h-8 mt-7 bg-neutral-800 rounded-full flex items-center justify-center text-xs">+ {item.step}+ </div>++ {/* Step info and bars */}+ <div className="flex-1">+ {/* Label and counts */}+ <div className="flex items-center gap-2 mb-2">+ <Eye className="w-4 h-4 text-blue-400" />+ <span className="text-sm font-medium">{item.label}</span>+ </div>++ <div className="h-8 bg-neutral-800 relative">+ <div+ className="h-8 bg-emerald-600 rounded flex items-center justify-end pr-3"+ style={{ width: `${overallConversion}%` }}+ />+ <div className="absolute top-2 right-1.5 text-right text-xs">+ {overallConversion.toFixed(overallConversion === 100 ? 0 : 2)}%+ </div>+ </div>+ </div>+ </div>+ );+ })}</div></Card>);-}\ No newline at end of file+}diff --git a/docs/src/components/Cards/RealTimeAnalytics.tsx b/docs/src/components/Cards/RealTimeAnalytics.tsxindex d6f4c675b..2cf21b70f 100644--- a/docs/src/components/Cards/RealTimeAnalytics.tsx+++ b/docs/src/components/Cards/RealTimeAnalytics.tsx@@ -1,6 +1,6 @@"use client";-import { Clock, Eye, Laptop, MousePointerClick, Smartphone } from "lucide-react";+import { Clock, Eye, Laptop, MousePointerClick, Smartphone, Activity } from "lucide-react";import { useEffect, useState } from "react";import { Browser } from "../Browser";import { CountryFlag } from "../Country";@@ -109,19 +109,19 @@ function EventCard({ event, index, isNew }: { event: Event; index: number; isNewreturn (<div- className="absolute w-full rounded-lg bg-neutral-800/50 overflow-hidden p-3 flex flex-col transition-all duration-500"+ className="absolute w-full rounded-lg bg-neutral-800/50 overflow-hidden p-2 flex flex-col transition-all duration-500"style={{- transform: isAnimating && index === 0 ? `translateY(-82px)` : `translateY(${index * 82}px)`,+ transform: isAnimating && index === 0 ? `translateY(-70px)` : `translateY(${index * 70}px)`,opacity: isAnimating && index === 0 ? 0 : index < 4 ? 1 : 0,zIndex: 10 - index,}}>- <div className="flex items-center gap-2 text-sm text-neutral-100 mb-2">+ <div className="flex items-center gap-2 text-sm text-neutral-100 mb-1.5"><div className="flex items-center gap-2">{isPageview ? (- <Eye className="w-4 h-4 text-blue-500" />+ <Eye className="w-4 h-4 text-blue-400" />) : (- <MousePointerClick className="w-4 h-4 text-amber-500" />+ <MousePointerClick className="w-4 h-4 text-amber-400" />)}</div>@@ -196,20 +196,12 @@ export function RealTimeAnalytics() {<Cardtitle="Real-time Analytics"description="See your site performance as it happens with instant data updates and live visitor activity."+ icon={Activity}>- <div className="bg-neutral-900 rounded-lg p-4">- <div className="flex items-center justify-between mb-3">- <h4 className="font-medium">Live Visitors</h4>- <span className="bg-emerald-500/20 text-emerald-400 font-medium px-2 py-1 rounded text-sm animate-pulse">- {onlineCount} online- </span>- </div>-- <div className="relative" style={{ height: "328px" }}>- {events.map((event, index) => (- <EventCard key={event.id} event={event} index={index} isNew={event.isNew} />- ))}- </div>+ <div className="relative" style={{ height: "280px" }}>+ {events.map((event, index) => (+ <EventCard key={event.id} event={event} index={index} isNew={event.isNew} />+ ))}</div></Card>);diff --git a/docs/src/components/Cards/SessionReplay.tsx b/docs/src/components/Cards/SessionReplay.tsxindex 5060af7c5..25e4b1b8e 100644--- a/docs/src/components/Cards/SessionReplay.tsx+++ b/docs/src/components/Cards/SessionReplay.tsx@@ -1,15 +1,7 @@"use client";import { Card } from "./Card";-import {- Play,- Pause,- SkipBack,- SkipForward,- Maximize2,- Volume2,- Laptop,-} from "lucide-react";+import { Play, Pause, SkipBack, SkipForward, Maximize2, Volume2, Laptop, Film } from "lucide-react";import { useState, useEffect } from "react";import { CountryFlag } from "../Country";import { Browser } from "../Browser";@@ -26,7 +18,7 @@ export function SessionReplay() {const interval = setInterval(() => {// Animate cursor movement- setCursorPosition((prev) => {+ setCursorPosition(prev => {const paths = [{ x: 48, y: 32 },{ x: 120, y: 80 },@@ -35,9 +27,7 @@ export function SessionReplay() {{ x: 200, y: 120 },{ x: 120, y: 180 },];- const currentIndex = paths.findIndex(- (p) => p.x === prev.x && p.y === prev.y- );+ const currentIndex = paths.findIndex(p => p.x === prev.x && p.y === prev.y);const nextIndex = (currentIndex + 1) % paths.length;// Trigger click effect on product@@ -61,74 +51,75 @@ export function SessionReplay() {<Cardtitle="Session Replay"description="Watch real user sessions to understand their behavior and identify pain points."+ icon={Film}><div className="bg-neutral-900 rounded-lg overflow-hidden">{/* Video player container */}<div className="relative bg-black">{/* Mock website content */}- <div className="aspect-video bg-neutral-950 relative overflow-hidden">+ <div className="bg-neutral-950 relative overflow-hidden">{/* Browser chrome */}- <div className="bg-neutral-800 h-8 flex items-center px-3 gap-2">- <div className="flex gap-1.5">- <div className="w-3 h-3 rounded-full bg-red-500"></div>- <div className="w-3 h-3 rounded-full bg-yellow-500"></div>- <div className="w-3 h-3 rounded-full bg-green-500"></div>+ <div className="bg-neutral-800 h-7 flex items-center px-2 gap-2">+ <div className="flex gap-1">+ <div className="w-2 h-2 rounded-full bg-red-500"></div>+ <div className="w-2 h-2 rounded-full bg-yellow-500"></div>+ <div className="w-2 h-2 rounded-full bg-green-500"></div></div>- <div className="flex-1 mx-4">- <div className="bg-neutral-700 rounded px-3 py-1 text-xs text-neutral-300">+ <div className="flex-1 mx-3">+ <div className="bg-neutral-700 rounded px-2 py-0.5 text-[10px] text-neutral-300">https://example.com/products</div></div></div>{/* Mock website content */}- <div className="p-4 bg-white">+ <div className="p-3 bg-white">{/* Header */}- <div className="flex items-center justify-between mb-6">- <div className="w-24 h-6 bg-neutral-300 rounded"></div>- <div className="flex gap-4">- <div className="w-16 h-4 bg-neutral-200 rounded"></div>- <div className="w-16 h-4 bg-neutral-200 rounded"></div>- <div className="w-16 h-4 bg-neutral-200 rounded"></div>+ <div className="flex items-center justify-between mb-4">+ <div className="w-20 h-4 bg-neutral-300 rounded"></div>+ <div className="flex gap-3">+ <div className="w-12 h-3 bg-neutral-200 rounded"></div>+ <div className="w-12 h-3 bg-neutral-200 rounded"></div>+ <div className="w-12 h-3 bg-neutral-200 rounded"></div></div></div>{/* Hero section */}- <div className="mb-6">- <div className="w-48 h-8 bg-neutral-800 rounded mb-2"></div>- <div className="w-64 h-4 bg-neutral-200 rounded"></div>+ <div className="mb-4">+ <div className="w-40 h-6 bg-neutral-800 rounded mb-1.5"></div>+ <div className="w-52 h-3 bg-neutral-200 rounded"></div></div>{/* Product grid */}- <div className="grid grid-cols-3 gap-3">+ <div className="grid grid-cols-3 gap-2"><div- className={`bg-neutral-100 rounded p-2 transition-all duration-300 ${+ className={`bg-neutral-100 rounded p-1.5 transition-all duration-300 ${hoveredProduct === 0 ? "shadow-lg scale-105" : ""}`}>- <div className="w-full h-20 bg-neutral-300 rounded mb-2"></div>- <div className="w-full h-3 bg-neutral-200 rounded mb-1"></div>- <div className="w-16 h-3 bg-emerald-500 rounded"></div>+ <div className="w-full h-16 bg-neutral-300 rounded mb-1.5"></div>+ <div className="w-full h-2 bg-neutral-200 rounded mb-1"></div>+ <div className="w-12 h-2 bg-emerald-500 rounded"></div></div><div- className={`bg-neutral-100 rounded p-2 transition-all duration-300 ${+ className={`bg-neutral-100 rounded p-1.5 transition-all duration-300 ${hoveredProduct === 1 ? "shadow-lg scale-105" : ""}`}>- <div className="w-full h-20 bg-neutral-300 rounded mb-2 relative">- <div className="absolute top-1 left-1 w-8 h-3 bg-red-500 rounded"></div>+ <div className="w-full h-16 bg-neutral-300 rounded mb-1.5 relative">+ <div className="absolute top-0.5 left-0.5 w-6 h-2 bg-red-500 rounded"></div></div>- <div className="w-full h-3 bg-neutral-200 rounded mb-1"></div>- <div className="w-16 h-3 bg-emerald-500 rounded"></div>+ <div className="w-full h-2 bg-neutral-200 rounded mb-1"></div>+ <div className="w-12 h-2 bg-emerald-500 rounded"></div></div><div- className={`bg-neutral-100 rounded p-2 transition-all duration-300 ${+ className={`bg-neutral-100 rounded p-1.5 transition-all duration-300 ${hoveredProduct === 2 ? "shadow-lg scale-105" : ""}`}>- <div className="w-full h-20 bg-neutral-300 rounded mb-2"></div>- <div className="w-full h-3 bg-neutral-200 rounded mb-1"></div>- <div className="w-16 h-3 bg-emerald-500 rounded"></div>+ <div className="w-full h-16 bg-neutral-300 rounded mb-1.5"></div>+ <div className="w-full h-2 bg-neutral-200 rounded mb-1"></div>+ <div className="w-12 h-2 bg-emerald-500 rounded"></div></div></div></div>@@ -141,17 +132,8 @@ export function SessionReplay() {top: `${cursorPosition.y}px`,}}>- <svg- viewBox="0 0 24 24"- fill="none"- className="w-full h-full drop-shadow-sm"- >- <path- d="M5.5 3.5L20.5 12L12 14.5L9.5 22L5.5 3.5Z"- fill="white"- stroke="black"- strokeWidth="1"- />+ <svg viewBox="0 0 24 24" fill="none" className="w-full h-full drop-shadow-sm">+ <path d="M5.5 3.5L20.5 12L12 14.5L9.5 22L5.5 3.5Z" fill="white" stroke="black" strokeWidth="1" /></svg></div>@@ -176,69 +158,30 @@ export function SessionReplay() {</div>{/* Video controls */}- <div className="bg-neutral-800/50 backdrop-blur-sm p-3">- {/* Progress bar */}- <div className="mb-3">- <div className="flex items-center justify-between text-xs text-neutral-400 mb-1">- <span>2:34</span>- <span>5:12</span>- </div>- <div className="relative h-1 bg-neutral-700 rounded-full overflow-hidden">- <div className="absolute left-0 top-0 h-full w-1/2 bg-emerald-500 rounded-full"></div>- <div className="absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2 w-3 h-3 bg-emerald-400 rounded-full shadow-lg"></div>- </div>- </div>-- {/* Control buttons */}- <div className="flex items-center justify-between">- <div className="flex items-center gap-3">- <button className="text-neutral-300 hover:text-white transition-colors">- <SkipBack className="w-4 h-4" />- </button>- <button- onClick={() => setIsPlaying(!isPlaying)}- className="bg-emerald-600 hover:bg-emerald-500 text-white rounded-full p-2 transition-colors"- >- {isPlaying ? (- <Pause className="w-4 h-4" />- ) : (- <Play className="w-4 h-4" />- )}- </button>- <button className="text-neutral-300 hover:text-white transition-colors">- <SkipForward className="w-4 h-4" />- </button>- </div>-- <div className="flex items-center gap-3">- <button className="text-neutral-300 hover:text-white transition-colors">- <Volume2 className="w-4 h-4" />- </button>- <button className="text-neutral-300 hover:text-white transition-colors">- <Maximize2 className="w-4 h-4" />- </button>- </div>- </div>- </div>+ <div className="bg-neutral-800/50 backdrop-blur-sm p-2">+ <div className="flex items-center gap-3">+ {/* Play/Pause button */}+ <button+ onClick={() => setIsPlaying(!isPlaying)}+ className="bg-emerald-600 hover:bg-emerald-500 text-white rounded-full p-1.5 transition-colors"+ >+ {isPlaying ? <Pause className="w-3.5 h-3.5" /> : <Play className="w-3.5 h-3.5" />}+ </button>- {/* Session info */}- <div className="p-4 border-t border-neutral-800">- <div className="flex items-center justify-between text-sm">- <div>- <div className="text-neutral-300">Session #48291</div>- <div className="text-xs text-neutral-500">- User clicked "Add to Cart" 3 times+ {/* Progress bar */}+ <div className="flex-1">+ <div className="relative h-1 bg-neutral-700 rounded-full overflow-hidden">+ <div className="absolute left-0 top-0 h-full w-1/2 bg-emerald-500 rounded-full"></div></div></div>- <div className="flex items-center gap-2">- <CountryFlag country="US" />- <Browser browser="Chrome" />- <OperatingSystem os="Windows" />- <Laptop className="w-4 h-4" />++ {/* Time display */}+ <div className="text-[10px] text-neutral-400 tabular-nums">+ 2:34 / 5:12</div></div></div></div></Card>);-}\ No newline at end of file+}diff --git a/docs/src/components/Cards/UserProfiles.tsx b/docs/src/components/Cards/UserProfiles.tsxindex e794ecb0a..9e5851d6f 100644--- a/docs/src/components/Cards/UserProfiles.tsx+++ b/docs/src/components/Cards/UserProfiles.tsx@@ -1,32 +1,22 @@-import Avatar from "boring-avatars";import { Laptop } from "lucide-react";import { cn } from "@/lib/utils";import { Browser } from "../Browser";import { CountryFlag } from "../Country";import { OperatingSystem } from "../OperatingSystem";import { Card } from "./Card";--+import { Avatar } from "../Avatar";export function UserProfiles() {return (- <Card- title="User Profiles"- description="Know who your users are and exactly what they do."- >+ <Card title="User Profiles" description="Know who your users are and exactly what they do."><div className="bg-neutral-900 p-4 rounded-md"><div className="flex items-start gap-4">{/* User basic info */}<div className="flex-1"><div className="flex items-center gap-2 mb-4">- <Avatar- size={32}- name={"bill"}- variant="marble"- colors={["#226756", "#6eaaa3", "#e8e8e8", "#bbc1e2", "#7182d6"]}- />+ <Avatar size={32} id="john-doe" /><div>- <div className="text-neutral-50">8a4f3d7e</div>+ <div className="text-neutral-50">John Doe</div><div className="flex items-center gap-2 text-sm text-neutral-400"><CountryFlag country="US" /><OperatingSystem os="macOS" />@@ -35,7 +25,7 @@ export function UserProfiles() {</div></div></div>-+{/* Stats grid */}<div className="grid grid-cols-2 gap-3 mb-4"><div className="bg-neutral-800/50 p-2 rounded-md">@@ -57,7 +47,7 @@ export function UserProfiles() {</div></div></div>-+{/* Activity calendar grid */}<div className="mt-4"><div className="text-xs text-neutral-400 mb-2">Activity</div>@@ -68,32 +58,30 @@ export function UserProfiles() {<div className="text-[9px] text-neutral-500">Feb</div><div className="text-[9px] text-neutral-500">Mar</div></div>-+{/* Calendar grid */}<div className="grid grid-cols-18 gap-1">- {Array(54).fill(null).map((_, i) => {- // Randomly determine activity level (0-4)- const activityLevel = Math.floor(Math.random() * 5);-- // Set color based on activity level- let bgColor = 'bg-neutral-800';- if (activityLevel === 1) bgColor = 'bg-emerald-900';- if (activityLevel === 2) bgColor = 'bg-emerald-800';- if (activityLevel === 3) bgColor = 'bg-emerald-700';- if (activityLevel === 4) bgColor = 'bg-emerald-600';-- return (- <div- key={i}- className={cn("w-3 h-3 rounded-sm", bgColor)}- title={`${activityLevel} visits`}- />- );- })}+ {Array(54)+ .fill(null)+ .map((_, i) => {+ // Randomly determine activity level (0-4)+ const activityLevel = Math.floor(Math.random() * 5);++ // Set color based on activity level+ let bgColor = "bg-neutral-800";+ if (activityLevel === 1) bgColor = "bg-emerald-900";+ if (activityLevel === 2) bgColor = "bg-emerald-800";+ if (activityLevel === 3) bgColor = "bg-emerald-700";+ if (activityLevel === 4) bgColor = "bg-emerald-600";++ return (+ <div key={i} className={cn("w-3 h-3 rounded-sm", bgColor)} title={`${activityLevel} visits`} />+ );+ })}</div></div></div></div></Card>);-}\ No newline at end of file+}diff --git a/docs/src/components/Cards/UserSessions.tsx b/docs/src/components/Cards/UserSessions.tsxindex 1f8f9897f..7dabf2cc2 100644--- a/docs/src/components/Cards/UserSessions.tsx+++ b/docs/src/components/Cards/UserSessions.tsx@@ -1,38 +1,33 @@-import Avatar from "boring-avatars";-import { Clock, Eye, Laptop, MousePointerClick } from "lucide-react";+import { Clock, Eye, Laptop, MousePointerClick, Users } from "lucide-react";import { Browser } from "../Browser";import { CountryFlag } from "../Country";import { OperatingSystem } from "../OperatingSystem";import { Card } from "./Card";+import { Avatar } from "../Avatar";export function UserSessions() {return (<Cardtitle="User Sessions"description="Track complete user journeys through your site with detailed session timelines."+ icon={Users}>- <div className="mt-4 bg-neutral-900 p-4 rounded-md">- <div className="flex justify-between items-center mb-4">- <div className="flex items-center gap-2">- <Avatar- size={32}- name={"billy"}- variant="marble"- colors={["#226756", "#6eaaa3", "#e8e8e8", "#bbc1e2", "#7182d6"]}- />- <div>- <div className="text-sm">2c49ae3</div>- <div className="text-xs text-neutral-400">Today, 14:22 - 14:36 (14m)</div>- </div>- </div>- <div className="flex items-center gap-2">- <CountryFlag country="US" />- <Browser browser="Chrome" />- <OperatingSystem os="macOS" />- <Laptop className="w-4 h-4" />+ <div className="flex justify-between items-center mb-3">+ <div className="flex items-center gap-2">+ <Avatar size={28} id="john-doe" />+ <div>+ <div className="text-sm">John Doe</div>+ <div className="text-xs text-neutral-400">Today, 14:22 - 14:36 (14m)</div></div></div>- {/*+ <div className="flex items-center gap-1.5">+ <CountryFlag country="US" />+ <Browser browser="Chrome" />+ <OperatingSystem os="macOS" />+ <Laptop className="w-4 h-4" />+ </div>+ </div>+ {/*<div className="flex gap-2 mb-3"><div className="flex items-center gap-1 text-xs bg-blue-500/20 text-blue-400 px-2 py-1 rounded"><Eye className="w-3 h-3" />@@ -44,118 +39,116 @@ export function UserSessions() {</div></div> */}- {/* Timeline */}- <div className="px-1 py-2">- {/* Event 1 */}- <div className="flex mb-3">- <div className="relative flex-shrink-0">- <div className="absolute top-8 left-4 w-[1px] bg-neutral-700 h-[calc(100%-20px)]" />- <div className="flex items-center justify-center w-8 h-8 rounded-full bg-blue-900/30 border border-blue-500/50">- <span className="text-sm font-medium">1</span>- </div>+ {/* Timeline */}+ <div className="px-1 py-1">+ {/* Event 1 */}+ <div className="flex mb-2">+ <div className="relative flex-shrink-0">+ <div className="absolute top-7 left-3.5 w-[1px] bg-neutral-700 h-[calc(100%-16px)]" />+ <div className="flex items-center justify-center w-7 h-7 rounded-full bg-blue-900/30 border border-blue-500/50">+ <span className="text-xs font-medium">1</span></div>+ </div>- <div className="flex flex-col ml-3 flex-1">- <div className="flex items-center flex-1 py-1">- <Eye className="w-4 h-4 text-blue-500 mr-3" />- <div className="flex-1 min-w-0 mr-4">- <div className="text-sm truncate">/home</div>- </div>- <div className="text-xs text-neutral-400">14:22:05</div>+ <div className="flex flex-col ml-2 flex-1">+ <div className="flex items-center flex-1 py-0.5">+ <Eye className="w-3.5 h-3.5 text-blue-400 mr-2" />+ <div className="flex-1 min-w-0 mr-3">+ <div className="text-sm truncate">/home</div></div>- <div className="flex items-center pl-7 mt-1">- <div className="text-xs text-neutral-400">- <Clock className="w-3 h-3 inline mr-1" />- 1m 32s- </div>+ <div className="text-xs text-neutral-400">14:22:05</div>+ </div>+ <div className="flex items-center pl-5 mt-0.5">+ <div className="text-xs text-neutral-400">+ <Clock className="w-3 h-3 inline mr-1" />+ 1m 32s</div></div></div>- {/* Event 2 */}- <div className="flex mb-3">- <div className="relative flex-shrink-0">- <div className="absolute top-8 left-4 w-[1px] bg-neutral-700 h-[calc(100%-20px)]" />- <div className="flex items-center justify-center w-8 h-8 rounded-full bg-amber-900/30 border border-amber-500/50">- <span className="text-sm font-medium">2</span>- </div>+ </div>+ {/* Event 2 */}+ <div className="flex mb-2">+ <div className="relative flex-shrink-0">+ <div className="absolute top-7 left-3.5 w-[1px] bg-neutral-700 h-[calc(100%-16px)]" />+ <div className="flex items-center justify-center w-7 h-7 rounded-full bg-amber-900/30 border border-amber-500/50">+ <span className="text-xs font-medium">2</span></div>+ </div>- <div className="flex flex-col ml-3 flex-1">- <div className="flex items-center flex-1 py-1">- <MousePointerClick className="w-4 h-4 text-amber-500 mr-3" />- <div className="flex-1 min-w-0 mr-4">- <div className="text-sm truncate">button_click</div>- </div>- <div className="text-xs text-neutral-400">14:25:55</div>+ <div className="flex flex-col ml-2 flex-1">+ <div className="flex items-center flex-1 py-0.5">+ <MousePointerClick className="w-3.5 h-3.5 text-amber-400 mr-2" />+ <div className="flex-1 min-w-0 mr-3">+ <div className="text-sm truncate">button_click</div></div>- <div className="flex items-center pl-7 mt-1">- <div className="flex flex-wrap gap-2">- <div className="px-1.5 py-0 h-5 text-xs bg-neutral-800 rounded border border-neutral-700">- <span className="text-neutral-400 font-light mr-1">button_id:</span>- <span>pricing</span>- </div>- <div className="px-1.5 py-0 h-5 text-xs bg-neutral-800 rounded border border-neutral-700">- <span className="text-neutral-400 font-light mr-1">section:</span>- <span>features</span>- </div>+ <div className="text-xs text-neutral-400">14:25:55</div>+ </div>+ <div className="flex items-center pl-5 mt-0.5">+ <div className="flex flex-wrap gap-1.5">+ <div className="px-1.5 py-0 h-5 text-xs bg-neutral-800 rounded border border-neutral-700">+ <span className="text-neutral-400 font-light mr-1">button_id:</span>+ <span>pricing</span>+ </div>+ <div className="px-1.5 py-0 h-5 text-xs bg-neutral-800 rounded border border-neutral-700">+ <span className="text-neutral-400 font-light mr-1">section:</span>+ <span>features</span></div></div></div></div>+ </div>- {/* Event 3 */}- <div className="flex mb-3">- <div className="relative flex-shrink-0">- <div className="absolute top-8 left-4 w-[1px] bg-neutral-700 h-[calc(100%-20px)]" />- <div className="flex items-center justify-center w-8 h-8 rounded-full bg-blue-900/30 border border-blue-500/50">- <span className="text-sm font-medium">3</span>- </div>+ {/* Event 3 */}+ <div className="flex mb-2">+ <div className="relative flex-shrink-0">+ <div className="absolute top-7 left-3.5 w-[1px] bg-neutral-700 h-[calc(100%-16px)]" />+ <div className="flex items-center justify-center w-7 h-7 rounded-full bg-blue-900/30 border border-blue-500/50">+ <span className="text-xs font-medium">3</span></div>+ </div>- <div className="flex flex-col ml-3 flex-1">- <div className="flex items-center flex-1 py-1">- <Eye className="w-4 h-4 text-blue-500 mr-3" />- <div className="flex-1 min-w-0 mr-4">- <div className="text-sm truncate">/pricing</div>- </div>- <div className="text-xs text-neutral-400">14:25:58</div>+ <div className="flex flex-col ml-2 flex-1">+ <div className="flex items-center flex-1 py-0.5">+ <Eye className="w-3.5 h-3.5 text-blue-400 mr-2" />+ <div className="flex-1 min-w-0 mr-3">+ <div className="text-sm truncate">/pricing</div></div>- <div className="flex items-center pl-7 mt-1">- <div className="text-xs text-neutral-400">- <Clock className="w-3 h-3 inline mr-1" />- 4m 42s- </div>+ <div className="text-xs text-neutral-400">14:25:58</div>+ </div>+ <div className="flex items-center pl-5 mt-0.5">+ <div className="text-xs text-neutral-400">+ <Clock className="w-3 h-3 inline mr-1" />+ 4m 42s</div></div></div>+ </div>- {/* Event 4 */}- <div className="flex mb-3">- <div className="relative flex-shrink-0">- <div className="absolute top-8 left-4 w-[1px] bg-neutral-700 h-[calc(100%-20px)]" />- <div className="flex items-center justify-center w-8 h-8 rounded-full bg-amber-900/30 border border-amber-500/50">- <span className="text-sm font-medium">4</span>- </div>+ {/* Event 4 */}+ <div className="flex mb-2">+ <div className="relative flex-shrink-0">+ <div className="flex items-center justify-center w-7 h-7 rounded-full bg-amber-900/30 border border-amber-500/50">+ <span className="text-xs font-medium">4</span></div>+ </div>- <div className="flex flex-col ml-3 flex-1">- <div className="flex items-center flex-1 py-1">- <MousePointerClick className="w-4 h-4 text-amber-500 mr-3" />- <div className="flex-1 min-w-0 mr-4">- <div className="text-sm truncate">form_submit</div>- </div>- <div className="text-xs text-neutral-400">14:30:40</div>+ <div className="flex flex-col ml-2 flex-1">+ <div className="flex items-center flex-1 py-0.5">+ <MousePointerClick className="w-3.5 h-3.5 text-amber-400 mr-2" />+ <div className="flex-1 min-w-0 mr-3">+ <div className="text-sm truncate">form_submit</div></div>- <div className="flex items-center pl-7 mt-1">- <div className="flex flex-wrap gap-2">- <div className="px-1.5 py-0 h-5 text-xs bg-neutral-800 rounded border border-neutral-700">- <span className="text-neutral-400 font-light mr-1">form_id:</span>- <span>contact-form</span>- </div>- <div className="px-1.5 py-0 h-5 text-xs bg-neutral-800 rounded border border-neutral-700">- <span className="text-neutral-400 font-light mr-1">success:</span>- <span>true</span>- </div>+ <div className="text-xs text-neutral-400">14:30:40</div>+ </div>+ <div className="flex items-center pl-5 mt-0.5">+ <div className="flex flex-wrap gap-1.5">+ <div className="px-1.5 py-0 h-5 text-xs bg-neutral-800 rounded border border-neutral-700">+ <span className="text-neutral-400 font-light mr-1">form_id:</span>+ <span>contact-form</span>+ </div>+ <div className="px-1.5 py-0 h-5 text-xs bg-neutral-800 rounded border border-neutral-700">+ <span className="text-neutral-400 font-light mr-1">success:</span>+ <span>true</span></div></div></div>