Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Enhance ReplayBreadcrumbs and user components with improved layout and functionality

Bill Yanga1ca40a27c74
diff --git a/client/src/app/[site]/replay/components/ReplayBreadcrumbs.tsx b/client/src/app/[site]/replay/components/ReplayBreadcrumbs.tsx
index 144feb9b0..880105bb2 100644
--- a/client/src/app/[site]/replay/components/ReplayBreadcrumbs.tsx
+++ b/client/src/app/[site]/replay/components/ReplayBreadcrumbs.tsx
@@ -16,6 +16,9 @@ import { useGetSessionReplayEvents } from "../../../../api/analytics/sessionRepl
import { ScrollArea } from "../../../../components/ui/scroll-area";
import { cn } from "../../../../lib/utils";
import { useReplayStore } from "./replayStore";
+import { Avatar } from "../../../../components/Avatar";
+import Link from "next/link";
+import { Button } from "../../../../components/ui/button";
// Event type mapping based on rrweb event types
const EVENT_TYPE_INFO = {
@@ -213,56 +216,70 @@ export function ReplayBreadcrumbs() {
};
return (
- <div className="rounded-lg border border-neutral-800 flex flex-col">
- <div className="p-2 border-b border-neutral-800 bg-neutral-900 text-xs text-neutral-400">
- {data.events.length} events captured ({groupedEvents.length} groups)
+ <div className="flex flex-col gap-2">
+ <div className="rounded-lg border border-neutral-800 bg-neutral-900 flex items-center justify-between gap-2 p-2 text-xs text-neutral-200">
+ <div className="flex items-center gap-2">
+ <Avatar name={data.metadata.user_id} size={20} />
+ {data.metadata.user_id.slice(0, 20)}
+ </div>
+ <Link
+ href={`/${siteId}/user/${data.metadata.user_id}`}
+ className="flex items-center gap-2"
+ >
+ <Button size="sm">View User</Button>
+ </Link>
</div>
- <ScrollArea className="h-[calc(100vh-156px)]">
- <div className="flex flex-col">
- {groupedEvents.map((group, index) => {
- const firstEvent = group.events[0];
- const Icon = getEventIcon(firstEvent);
- const color = getEventColor(firstEvent);
- const description = getGroupDescription(group);
- const startTimeMs = getTime(group.startTime);
- const endTimeMs = getTime(group.endTime);
- const durationMs = endTimeMs - startTimeMs;
-
- return (
- <div
- key={`${group.startTime}-${index}`}
- className={cn(
- "p-2 border-b border-neutral-800 bg-neutral-900",
- "hover:bg-neutral-800/80 transition-colors cursor-pointer",
- "flex items-center gap-2 group"
- )}
- onClick={() => handleGroupClick(group)}
- >
- <div className="text-xs text-neutral-400 w-10">
- {Duration.fromMillis(startTimeMs).toFormat("mm:ss")}
- </div>
- <Icon className={cn("w-4 h-4 flex-shrink-0", color)} />
- <div className="flex-1 min-w-0">
- <div className="text-xs text-neutral-200 font-medium truncate">
- {description}
+ <div className="rounded-lg border border-neutral-800 flex flex-col">
+ <div className="p-2 border-b border-neutral-800 bg-neutral-900 text-xs text-neutral-400">
+ {data.events.length} events captured ({groupedEvents.length} groups)
+ </div>
+ <ScrollArea className="h-[calc(100vh-156px)]">
+ <div className="flex flex-col">
+ {groupedEvents.map((group, index) => {
+ const firstEvent = group.events[0];
+ const Icon = getEventIcon(firstEvent);
+ const color = getEventColor(firstEvent);
+ const description = getGroupDescription(group);
+ const startTimeMs = getTime(group.startTime);
+ const endTimeMs = getTime(group.endTime);
+ const durationMs = endTimeMs - startTimeMs;
+
+ return (
+ <div
+ key={`${group.startTime}-${index}`}
+ className={cn(
+ "p-2 border-b border-neutral-800 bg-neutral-900",
+ "hover:bg-neutral-800/80 transition-colors cursor-pointer",
+ "flex items-center gap-2 group"
+ )}
+ onClick={() => handleGroupClick(group)}
+ >
+ <div className="text-xs text-neutral-400 w-10">
+ {Duration.fromMillis(startTimeMs).toFormat("mm:ss")}
</div>
- {group.count > 1 && durationMs > 0 && (
- <div className="text-xs text-neutral-500 mt-0.5">
- {Duration.fromMillis(durationMs).toFormat("s.SSS")}s
- duration
+ <Icon className={cn("w-4 h-4 flex-shrink-0", color)} />
+ <div className="flex-1 min-w-0">
+ <div className="text-xs text-neutral-200 font-medium truncate">
+ {description}
+ </div>
+ {group.count > 1 && durationMs > 0 && (
+ <div className="text-xs text-neutral-500 mt-0.5">
+ {Duration.fromMillis(durationMs).toFormat("s.SSS")}s
+ duration
+ </div>
+ )}
+ </div>
+ {group.count > 5 && (
+ <div className="text-xs text-neutral-500 bg-neutral-800 px-1.5 py-0.5 rounded">
+ {group.count}
</div>
)}
</div>
- {group.count > 5 && (
- <div className="text-xs text-neutral-500 bg-neutral-800 px-1.5 py-0.5 rounded">
- {group.count}
- </div>
- )}
- </div>
- );
- })}
- </div>
- </ScrollArea>
+ );
+ })}
+ </div>
+ </ScrollArea>
+ </div>
</div>
);
}
diff --git a/client/src/app/[site]/user/[userId]/page.tsx b/client/src/app/[site]/user/[userId]/page.tsx
index e0ee6ccc4..c66c2b706 100644
--- a/client/src/app/[site]/user/[userId]/page.tsx
+++ b/client/src/app/[site]/user/[userId]/page.tsx
@@ -1,7 +1,6 @@
"use client";
import SessionsList from "@/components/Sessions/SessionsList";
-import Avatar from "boring-avatars";
import {
ArrowLeft,
Calendar,
@@ -29,6 +28,7 @@ import { Browser } from "../../components/shared/icons/Browser";
import { CountryFlag } from "../../components/shared/icons/CountryFlag";
import { OperatingSystem } from "../../components/shared/icons/OperatingSystem";
import { VisitCalendar } from "./components/Calendar";
+import { Avatar } from "../../../../components/Avatar";
export default function UserPage() {
useSetPageTitle("Rybbit · User");
@@ -58,12 +58,7 @@ export default function UserPage() {
<div>
<MobileSidebar />
</div>
- <Avatar
- size={40}
- name={userId as string}
- variant="marble"
- colors={["#92A1C6", "#146A7C", "#F0AB3D", "#C271B4", "#C20D90"]}
- />
+ <Avatar size={40} name={userId as string} />
{userId?.slice(0, 10)}
</h1>
<div className="bg-neutral-900 p-3 rounded-lg flex flex-col gap-1 border border-neutral-750 text-sm mb-3">
diff --git a/client/src/app/[site]/users/page.tsx b/client/src/app/[site]/users/page.tsx
index 7f8ad55f2..a14e6114a 100644
--- a/client/src/app/[site]/users/page.tsx
+++ b/client/src/app/[site]/users/page.tsx
@@ -9,7 +9,6 @@ import {
SortingState,
useReactTable,
} from "@tanstack/react-table";
-import Avatar from "boring-avatars";
import {
ArrowDown,
ArrowUp,
@@ -39,6 +38,7 @@ import { CountryFlag } from "../components/shared/icons/CountryFlag";
import { OperatingSystem } from "../components/shared/icons/OperatingSystem";
import { SubHeader } from "../components/SubHeader/SubHeader";
import { DisabledOverlay } from "../../../components/DisabledOverlay";
+import { Avatar } from "../../../components/Avatar";
// Set up column helper
const columnHelper = createColumnHelper<UsersResponse>();
@@ -115,12 +115,7 @@ export default function UsersPage() {
cell: (info) => (
<Link href={`/${site}/user/${info.getValue()}`}>
<div className=" truncate flex items-center gap-2 text-neutral-250 hover:text-neutral-100 hover:underline">
- <Avatar
- size={20}
- name={info.getValue() as string}
- variant="marble"
- colors={["#92A1C6", "#146A7C", "#F0AB3D", "#C271B4", "#C20D90"]}
- />
+ <Avatar size={20} name={info.getValue() as string} />
{info.getValue().slice(0, 6)}
</div>
</Link>
diff --git a/client/src/components/Avatar.tsx b/client/src/components/Avatar.tsx
new file mode 100644
index 000000000..bd43b5b64
--- /dev/null
+++ b/client/src/components/Avatar.tsx
@@ -0,0 +1,12 @@
+import BoringAvatar from "boring-avatars";
+
+export function Avatar({ name, size = 20 }: { name: string; size?: number }) {
+ return (
+ <BoringAvatar
+ size={size}
+ name={name}
+ variant="marble"
+ colors={["#92A1C6", "#146A7C", "#F0AB3D", "#C271B4", "#C20D90"]}
+ />
+ );
+}
diff --git a/client/src/components/Sessions/SessionDetails.tsx b/client/src/components/Sessions/SessionDetails.tsx
index 6749c3d23..687bc1ab5 100644
--- a/client/src/components/Sessions/SessionDetails.tsx
+++ b/client/src/components/Sessions/SessionDetails.tsx
@@ -3,7 +3,6 @@ import { Alert, AlertDescription } from "@/components/ui/alert";
import { Badge } from "@/components/ui/badge";
import { Skeleton } from "@/components/ui/skeleton";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
-import Avatar from "boring-avatars";
import {
ArrowRight,
Clock,
@@ -31,6 +30,7 @@ import { formatDuration } from "../../lib/dateTimeUtils";
import { Button } from "../ui/button";
import { hour12 } from "../../lib/dateTimeUtils";
import { useGetRegionName } from "../../lib/geo";
+import { Avatar } from "../Avatar";
// Component to display a single pageview or event
function PageviewItem({
@@ -373,18 +373,7 @@ export function SessionDetails({ session, userId }: SessionDetailsProps) {
{sessionDetails?.user_id && (
<div className="flex items-center gap-2">
<div className="h-7 w-7 bg-neutral-800 rounded-full flex items-center justify-center flex-shrink-0">
- <Avatar
- size={24}
- name={sessionDetails.user_id}
- variant="marble"
- colors={[
- "#92A1C6",
- "#146A7C",
- "#F0AB3D",
- "#C271B4",
- "#C20D90",
- ]}
- />
+ <Avatar size={24} name={sessionDetails.user_id} />
</div>
<div>
<div className="text-sm text-gray-400 flex items-center">