🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Add skeleton components for Funnels and Goals pages
Bill Yang11944cda6a00
diff --git a/client/src/app/[site]/funnels/page.tsx b/client/src/app/[site]/funnels/page.tsxindex 464e91680..6a59b3924 100644--- a/client/src/app/[site]/funnels/page.tsx+++ b/client/src/app/[site]/funnels/page.tsx@@ -7,6 +7,62 @@ import { PlusCircle } from "lucide-react";import { MobileSidebar } from "../../../components/MobileSidebar";import { CreateFunnelDialog } from "./components/CreateFunnel";import { FunnelRow } from "./components/FunnelRow";+import {+ ArrowRight,+ ChevronDown,+ FileText,+ FilterIcon,+ MousePointerClick,+} from "lucide-react";++// Skeleton for the funnel row component+const FunnelRowSkeleton = () => (+ <div className="rounded-md shadow-sm bg-neutral-900 border border-neutral-800 mb-4 overflow-hidden">+ <div className="flex items-center justify-between py-2 px-5 animate-pulse">+ <div className="flex items-center flex-grow">+ <div className="mt-1 text-xs flex flex-col gap-3 w-full">+ {/* Funnel name and steps skeleton */}+ <div className="flex flex-wrap gap-1 items-center">+ <div className="h-5 bg-neutral-800 rounded w-32 mb-1"></div>+ <div className="flex items-center">+ <div className="rounded bg-neutral-800 px-1.5 py-0.5 w-20 h-5 flex items-center">+ <div className="w-3 h-3 bg-neutral-700 rounded-full mr-1"></div>+ <div className="h-3 bg-neutral-700 rounded w-12 ml-1"></div>+ </div>+ <ArrowRight className="h-3 w-3 mx-1 text-neutral-600" />+ <div className="rounded bg-neutral-800 px-1.5 py-0.5 w-24 h-5 flex items-center">+ <div className="w-3 h-3 bg-neutral-700 rounded-full mr-1"></div>+ <div className="h-3 bg-neutral-700 rounded w-16 ml-1"></div>+ </div>+ <ArrowRight className="h-3 w-3 mx-1 text-neutral-600" />+ <div className="rounded bg-neutral-800 px-1.5 py-0.5 w-20 h-5 flex items-center">+ <div className="w-3 h-3 bg-neutral-700 rounded-full mr-1"></div>+ <div className="h-3 bg-neutral-700 rounded w-12 ml-1"></div>+ </div>+ </div>+ </div>++ {/* Filters skeleton */}+ <div className="flex items-center gap-1">+ <FilterIcon className="h-3 w-3 text-neutral-600" />+ <div className="flex flex-wrap gap-1">+ <div className="rounded bg-neutral-800 px-1.5 py-0.5 w-24 h-5"></div>+ <div className="rounded bg-neutral-800 px-1.5 py-0.5 w-20 h-5"></div>+ </div>+ </div>+ </div>+ </div>++ <div className="flex items-center gap-4">+ <div className="flex">+ <div className="h-8 w-8 bg-neutral-800 rounded-md mr-1"></div>+ <div className="h-8 w-8 bg-neutral-800 rounded-md mr-1"></div>+ <div className="h-8 w-8 bg-neutral-800 rounded-md"></div>+ </div>+ </div>+ </div>+ </div>+);export default function FunnelsPage() {const { site } = useStore();@@ -22,7 +78,7 @@ export default function FunnelsPage() {<Skeleton className="h-10 w-32" /></div>{[1, 2, 3].map((i) => (- <Skeleton key={i} className="h-20 w-full mb-4" />+ <FunnelRowSkeleton key={i} />))}</div>);diff --git a/client/src/app/[site]/goals/page.tsx b/client/src/app/[site]/goals/page.tsxindex ad764d722..9a15fa470 100644--- a/client/src/app/[site]/goals/page.tsx+++ b/client/src/app/[site]/goals/page.tsx@@ -7,6 +7,7 @@ import { SESSION_PAGE_FILTERS, useStore } from "../../../lib/store";import { SubHeader } from "../components/SubHeader/SubHeader";import CreateGoalButton from "./components/CreateGoalButton";import GoalsList from "./components/GoalsList";+import { ThreeDotLoader } from "../../../components/Loaders";export default function GoalsPage() {const { time, filters, site, setTime } = useStore();@@ -37,6 +38,46 @@ export default function GoalsPage() {});};+ // Goal card skeleton component+ const GoalCardSkeleton = () => (+ <div className="rounded-lg bg-neutral-900 border border-neutral-800 overflow-hidden relative animate-pulse">+ <div className="px-4 py-3 flex items-center mb-1">+ {/* Left section skeleton */}+ <div className="flex-1 pr-4">+ <div className="flex items-center gap-2">+ <div className="w-4 h-4 bg-neutral-800 rounded-full"></div>+ <div className="h-5 bg-neutral-800 rounded w-36"></div>+ </div>+ <div className="mt-2">+ <div className="h-4 bg-neutral-800 rounded w-48 mt-1"></div>+ </div>+ </div>++ {/* Center section skeleton */}+ <div className="flex-1 flex justify-center">+ <div className="grid grid-cols-2 gap-4 w-full">+ <div className="text-center">+ <div className="h-5 bg-neutral-800 rounded w-12 mx-auto"></div>+ <div className="h-3 bg-neutral-800 rounded w-16 mx-auto mt-1"></div>+ </div>+ <div className="text-center">+ <div className="h-5 bg-neutral-800 rounded w-12 mx-auto"></div>+ <div className="h-3 bg-neutral-800 rounded w-16 mx-auto mt-1"></div>+ </div>+ </div>+ </div>++ {/* Right section skeleton */}+ <div className="flex flex-shrink-0 gap-1 pl-4">+ <div className="w-7 h-7 bg-neutral-800 rounded"></div>+ <div className="w-7 h-7 bg-neutral-800 rounded"></div>+ </div>+ </div>+ <div className="bg-neutral-700 h-1.5 w-full absolute bottom-0 left-0"></div>+ <div className="bg-neutral-800 h-1.5 w-1/3 absolute bottom-0 left-0"></div>+ </div>+ );+return (<div className="p-2 md:p-4 max-w-[1400px] mx-auto space-y-3"><SubHeader availableFilters={SESSION_PAGE_FILTERS} />@@ -46,8 +87,12 @@ export default function GoalsPage() {</div>{isLoading ? (- <div className="flex justify-center py-8">- <div className="animate-pulse">Loading goals data...</div>+ <div className="space-y-3">+ {Array(3)+ .fill(0)+ .map((_, index) => (+ <GoalCardSkeleton key={`skeleton-${index}`} />+ ))}</div>) : !goalsData || goalsData.data.length === 0 ? (<div className="py-10 text-center">