🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Remove @phosphor-icons/react dependency and update Sidebar component to use lucide-react icons
Bill Yang3e2c34a483ef
diff --git a/client/package-lock.json b/client/package-lock.jsonindex fd1d14db1..1987197f1 100644--- a/client/package-lock.json+++ b/client/package-lock.json@@ -15,7 +15,6 @@"@nivo/line": "0.96.0","@nivo/theming": "0.96.0","@number-flow/react": "0.5.9",- "@phosphor-icons/react": "2.1.7","@radix-ui/react-alert-dialog": "1.1.13","@radix-ui/react-checkbox": "^1.3.2","@radix-ui/react-dialog": "1.1.13",@@ -2659,19 +2658,6 @@"tslib": "^2.8.1"}},- "node_modules/@phosphor-icons/react": {- "version": "2.1.7",- "resolved": "https://registry.npmjs.org/@phosphor-icons/react/-/react-2.1.7.tgz",- "integrity": "sha512-g2e2eVAn1XG2a+LI09QU3IORLhnFNAFkNbo2iwbX6NOKSLOwvEMmTa7CgOzEbgNWR47z8i8kwjdvYZ5fkGx1mQ==",- "license": "MIT",- "engines": {- "node": ">=10"- },- "peerDependencies": {- "react": ">= 16.8",- "react-dom": ">= 16.8"- }- },"node_modules/@pivanov/utils": {"version": "0.0.2","resolved": "https://registry.npmjs.org/@pivanov/utils/-/utils-0.0.2.tgz",diff --git a/client/package.json b/client/package.jsonindex a979a658f..6447674c8 100644--- a/client/package.json+++ b/client/package.json@@ -17,7 +17,6 @@"@nivo/line": "0.96.0","@nivo/theming": "0.96.0","@number-flow/react": "0.5.9",- "@phosphor-icons/react": "2.1.7","@radix-ui/react-alert-dialog": "1.1.13","@radix-ui/react-checkbox": "^1.3.2","@radix-ui/react-dialog": "1.1.13",diff --git a/client/src/app/[site]/components/Sidebar/Sidebar.tsx b/client/src/app/[site]/components/Sidebar/Sidebar.tsxindex 119e340f8..6a9c793d5 100644--- a/client/src/app/[site]/components/Sidebar/Sidebar.tsx+++ b/client/src/app/[site]/components/Sidebar/Sidebar.tsx@@ -1,5 +1,4 @@"use client";-import { Funnel, Target } from "@phosphor-icons/react/dist/ssr";import {AlertTriangle,ChartColumnDecreasing,@@ -9,12 +8,14 @@ import {LayoutDashboard,LayoutGrid,Map,+ Target,MousePointerClick,Rewind,Settings,Split,User,Video,+ Funnel,} from "lucide-react";import { usePathname } from "next/navigation";import { useGetSite } from "../../../../api/admin/sites";@@ -87,7 +88,7 @@ export function Sidebar() {label="Goals"active={isActiveTab("goals")}href={getTabPath("goals")}- icon={<Target weight="bold" />}+ icon={<Target className="w-4 h-4" />}/><SidebarComponents.SectionHeader>Product Analytics</SidebarComponents.SectionHeader><div className="hidden md:block">@@ -102,7 +103,7 @@ export function Sidebar() {label="Funnels"active={isActiveTab("funnels")}href={getTabPath("funnels")}- icon={<Funnel weight="bold" />}+ icon={<Funnel className="w-4 h-4" />}/><SidebarComponents.Itemlabel="Journeys"diff --git a/client/src/app/[site]/funnels/page.tsx b/client/src/app/[site]/funnels/page.tsxindex a74f724c1..05a904598 100644--- a/client/src/app/[site]/funnels/page.tsx+++ b/client/src/app/[site]/funnels/page.tsx@@ -3,7 +3,7 @@import { SavedFunnel, useGetFunnels } from "../../../api/analytics/funnels/useGetFunnels";import { Skeleton } from "@/components/ui/skeleton";import { useStore } from "@/lib/store";-import { ArrowRight, FilterIcon } from "lucide-react";+import { ArrowRight, FilterIcon, Funnel } from "lucide-react";import { NothingFound } from "../../../components/NothingFound";import { CreateFunnelDialog } from "./components/CreateFunnel";import { FunnelRow } from "./components/FunnelRow";@@ -104,6 +104,7 @@ export default function FunnelsPage() {</div>) : (<NothingFound+ icon={<Funnel className="w-10 h-10" />}title={"No funnels yet"}description={"Create your first funnel to track conversions through your site's user journey"}action={<CreateFunnelDialog />}diff --git a/client/src/app/[site]/goals/page.tsx b/client/src/app/[site]/goals/page.tsxindex 6212cfe1c..f629bcffe 100644--- a/client/src/app/[site]/goals/page.tsx+++ b/client/src/app/[site]/goals/page.tsx@@ -10,6 +10,7 @@ import { GOALS_PAGE_FILTERS, useStore } from "../../../lib/store";import { SubHeader } from "../components/SubHeader/SubHeader";import CreateGoalButton from "./components/CreateGoalButton";import GoalsList from "./components/GoalsList";+import { Target } from "lucide-react";export default function GoalsPage() {useSetPageTitle("Rybbit · Goals");@@ -123,6 +124,7 @@ export default function GoalsPage() {</div>) : !goalsData || goalsData.data.length === 0 ? (<NothingFound+ icon={<Target className="w-10 h-10" />}title={"No goals found"}description={"Create your first conversion goal to start tracking important user actions."}action={<CreateGoalButton siteId={Number(site)} />}diff --git a/client/src/app/[site]/replay/components/ReplayList.tsx b/client/src/app/[site]/replay/components/ReplayList.tsxindex ac24d40c1..1f0d68d14 100644--- a/client/src/app/[site]/replay/components/ReplayList.tsx+++ b/client/src/app/[site]/replay/components/ReplayList.tsx@@ -1,6 +1,6 @@import { useEffect, useMemo } from "react";import { useIntersectionObserver } from "@uidotdev/usehooks";-import { Loader2 } from "lucide-react";+import { Loader2, Video } from "lucide-react";import { NothingFound } from "../../../../components/NothingFound";import { ReplayCard, ReplayCardSkeleton } from "./ReplayCard";import {@@ -12,17 +12,11 @@ import { ScrollArea } from "../../../../components/ui/scroll-area";import { Input } from "../../../../components/ui/input";export function ReplayList() {- const { sessionId, setSessionId, minDuration, setMinDuration } =- useReplayStore();+ const { sessionId, setSessionId, minDuration, setMinDuration } = useReplayStore();- const {- data,- isLoading,- error,- fetchNextPage,- hasNextPage,- isFetchingNextPage,- } = useGetSessionReplays({ minDuration });+ const { data, isLoading, error, fetchNextPage, hasNextPage, isFetchingNextPage } = useGetSessionReplays({+ minDuration,+ });// Use the intersection observer hook for infinite scrollconst [ref, entry] = useIntersectionObserver({@@ -44,26 +38,13 @@ export function ReplayList() {// Fetch next page when intersection observer detects the target is visibleuseEffect(() => {- if (- entry?.isIntersecting &&- hasNextPage &&- !isFetchingNextPage &&- !isLoading- ) {+ if (entry?.isIntersecting && hasNextPage && !isFetchingNextPage && !isLoading) {fetchNextPage();}- }, [- entry?.isIntersecting,- fetchNextPage,- hasNextPage,- isFetchingNextPage,- isLoading,- ]);+ }, [entry?.isIntersecting, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading]);if (error) {- return (- <div className="text-red-500 p-4">Error: {(error as Error).message}</div>- );+ return <div className="text-red-500 p-4">Error: {(error as Error).message}</div>;}return (@@ -86,21 +67,17 @@ export function ReplayList() {<div className="rounded-lg border border-neutral-800 flex flex-col"><ScrollArea className="h-[calc(100vh-178px)]">{isLoading ? (- Array.from({ length: 20 }).map((_, index) => (- <ReplayCardSkeleton key={`loading-${index}`} />- ))+ Array.from({ length: 20 }).map((_, index) => <ReplayCardSkeleton key={`loading-${index}`} />)) : flattenedData.length === 0 ? (<NothingFound+ icon={<Video className="w-10 h-10" />}title={"No session replays found"}description={"Try a different date range or filter"}/>) : (<>{flattenedData.map((replay: SessionReplayListItem, index) => (- <ReplayCard- key={`${replay.session_id}-${index}`}- replay={replay}- />+ <ReplayCard key={`${replay.session_id}-${index}`} replay={replay} />))}{/* Infinite scroll anchor and loading indicator */}@@ -111,13 +88,9 @@ export function ReplayList() {Loading more replays...</div>)}- {!hasNextPage &&- !isFetchingNextPage &&- flattenedData.length > 0 && (- <div className="text-neutral-500 text-xs">- All replays loaded- </div>- )}+ {!hasNextPage && !isFetchingNextPage && flattenedData.length > 0 && (+ <div className="text-neutral-500 text-xs">All replays loaded</div>+ )}</div></>)}diff --git a/client/src/app/[site]/replay/page.tsx b/client/src/app/[site]/replay/page.tsxindex a6bde15a5..a031b3dcb 100644--- a/client/src/app/[site]/replay/page.tsx+++ b/client/src/app/[site]/replay/page.tsx@@ -12,6 +12,7 @@ import { ReplayPlayer } from "./components/player/ReplayPlayer";import { NothingFound } from "../../../components/NothingFound";import { ReplayBreadcrumbs } from "./components/ReplayBreadcrumbs";import { useReplayStore } from "./components/replayStore";+import { Video } from "lucide-react";export default function SessionReplayPage() {useSetPageTitle("Rybbit · Session Replay");@@ -31,6 +32,7 @@ export default function SessionReplayPage() {<EnableSessionReplay />{hasNoReplays ? (<NothingFound+ icon={<Video className="w-10 h-10" />}title={"No session replays found"}description={"Replays will appear here once session replay is enabled."}/>diff --git a/client/src/app/[site]/retention/page.tsx b/client/src/app/[site]/retention/page.tsxindex d4426fabb..b0a0c6c96 100644--- a/client/src/app/[site]/retention/page.tsx+++ b/client/src/app/[site]/retention/page.tsx@@ -1,17 +1,18 @@"use client";+import { ChartColumnDecreasing } from "lucide-react";import { DateTime } from "luxon"; // Import Luxon for date formattingimport { Fragment, useMemo, useState } from "react";import { RetentionMode, useGetRetention } from "../../../api/analytics/useGetRetention";+import { DisabledOverlay } from "../../../components/DisabledOverlay";import { ThreeDotLoader } from "../../../components/Loaders";+import { NothingFound } from "../../../components/NothingFound";import { Card, CardContent, CardHeader, CardTitle } from "../../../components/ui/card";import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../components/ui/select";import { Tabs, TabsList, TabsTrigger } from "../../../components/ui/tabs";-import { RetentionChart } from "./RetentionChart";-import { NothingFound } from "../../../components/NothingFound";import { useSetPageTitle } from "../../../hooks/useSetPageTitle";-import { DisabledOverlay } from "../../../components/DisabledOverlay";import { MobileSidebar } from "../components/Sidebar/MobileSidebar";+import { RetentionChart } from "./RetentionChart";// Available time range options (in days)const RANGE_OPTIONS = [@@ -171,6 +172,7 @@ export default function RetentionPage() {return (<div className="p-2 md:p-4 max-w-[1300px] mx-auto flex flex-col gap-3"><NothingFound+ icon={<ChartColumnDecreasing className="w-10 h-10" />}title={"No retention data available"}description={"Try selecting a different time range or make sure you have tracking data in the system."}/>diff --git a/client/src/components/NothingFound.tsx b/client/src/components/NothingFound.tsxindex 72927c903..5b9520716 100644--- a/client/src/components/NothingFound.tsx+++ b/client/src/components/NothingFound.tsx@@ -1,5 +1,3 @@-import { PlusCircle } from "lucide-react";-export function NothingFound({title,description,@@ -13,15 +11,9 @@ export function NothingFound({}) {return (<div className="flex flex-col items-center justify-center py-10 text-center">- {icon && (- <div className="bg-neutral-100 dark:bg-neutral-800 rounded-full p-3 mb-4">- {icon}- </div>- )}+ {icon && <div className="p-3">{icon}</div>}<h3 className="text-lg font-medium mb-2">{title}</h3>- {description && (- <p className="text-neutral-500 max-w-md mb-6">{description}</p>- )}+ {description && <p className="text-neutral-500 max-w-md mb-6">{description}</p>}{action && action}</div>);diff --git a/client/src/components/Sessions/SessionsList.tsx b/client/src/components/Sessions/SessionsList.tsxindex bf2cfa143..7843d7b01 100644--- a/client/src/components/Sessions/SessionsList.tsx+++ b/client/src/components/Sessions/SessionsList.tsx@@ -3,17 +3,11 @@ import { useGetSessionsInfinite } from "../../api/analytics/userSessions";import { SessionCard, SessionCardSkeleton } from "./SessionCard";import { Button } from "../ui/button";import { NothingFound } from "../NothingFound";+import { Rewind } from "lucide-react";export default function SessionsList({ userId }: { userId?: string }) {// Get sessions data with infinite loading- const {- data,- isLoading,- error,- fetchNextPage,- hasNextPage,- isFetchingNextPage,- } = useGetSessionsInfinite(userId);+ const { data, isLoading, error, fetchNextPage, hasNextPage, isFetchingNextPage } = useGetSessionsInfinite(userId);// Combine all pages of dataconst flattenedData = useMemo(() => {@@ -24,29 +18,23 @@ export default function SessionsList({ userId }: { userId?: string }) {// Reference for the scroll containerconst containerRef = useRef<HTMLDivElement>(null);- if (error)- return (- <div className="text-red-500 p-4">Error: {(error as Error).message}</div>- );+ if (error) return <div className="text-red-500 p-4">Error: {(error as Error).message}</div>;return (- <div ref={containerRef} className="overflow-auto pr-2">+ <div ref={containerRef} className="overflow-auto ">{isLoading ? (// Show skeleton cards while loading<SessionCardSkeleton />) : flattenedData.length === 0 ? (<NothingFound+ icon={<Rewind className="w-10 h-10" />}title={"No sessions found"}description={"Try a different date range or filter"}/>) : (// Render session cards with more robust key generationflattenedData.map((session, index) => (- <SessionCard- key={`${session.session_id}-${index}`}- session={session}- userId={userId}- />+ <SessionCard key={`${session.session_id}-${index}`} session={session} userId={userId} />)))}@@ -58,11 +46,7 @@ export default function SessionsList({ userId }: { userId?: string }) {{hasNextPage && (<div className="flex justify-center py-2">- <Button- onClick={() => fetchNextPage()}- className="w-full"- variant="success"- >+ <Button onClick={() => fetchNextPage()} className="w-full" variant="success">Load more</Button></div>diff --git a/client/src/components/auth/SocialButtons.tsx b/client/src/components/auth/SocialButtons.tsxindex ad4c090ee..48a65a7ae 100644--- a/client/src/components/auth/SocialButtons.tsx+++ b/client/src/components/auth/SocialButtons.tsx@@ -1,7 +1,7 @@"use client";import { Button } from "@/components/ui/button";-import { GithubLogo, GoogleLogo } from "@phosphor-icons/react/dist/ssr";+import { SiGoogle, SiGithub } from "@icons-pack/react-simple-icons";import { authClient } from "@/lib/auth";import { IS_CLOUD } from "@/lib/const";@@ -12,17 +12,10 @@ interface SocialButtonsProps {className?: string;}-export function SocialButtons({- onError,- callbackURL,- mode = "signin",- className = "",-}: SocialButtonsProps) {+export function SocialButtons({ onError, callbackURL, mode = "signin", className = "" }: SocialButtonsProps) {if (!IS_CLOUD) return null;- const handleSocialAuth = async (- provider: "google" | "github" | "twitter"- ) => {+ const handleSocialAuth = async (provider: "google" | "github" | "twitter") => {try {await authClient.signIn.social({provider,@@ -46,7 +39,7 @@ export function SocialButtons({onClick={() => handleSocialAuth("google")}className="transition-all duration-300 hover:bg-muted bg-neutral-800/50 border-neutral-700">- <GoogleLogo weight="bold" className="mr-2" />+ <SiGoogle /></Button><Button@@ -55,7 +48,7 @@ export function SocialButtons({onClick={() => handleSocialAuth("github")}className="transition-all duration-300 hover:bg-muted bg-neutral-800/50 border-neutral-700">- <GithubLogo weight="bold" className="mr-2" />+ <SiGithub />GitHub</Button></div>