🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Refactor Replay components for improved layout and functionality
Bill Yang09d75e80dd77
diff --git a/client/src/app/[site]/replay/components/ReplayBreadcrumbs.tsx b/client/src/app/[site]/replay/components/ReplayBreadcrumbs.tsxindex 880105bb2..2aadfa9ae 100644--- a/client/src/app/[site]/replay/components/ReplayBreadcrumbs.tsx+++ b/client/src/app/[site]/replay/components/ReplayBreadcrumbs.tsx@@ -233,7 +233,7 @@ export function ReplayBreadcrumbs() {<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)]">+ <ScrollArea className="h-[calc(100vh-215px)]"><div className="flex flex-col">{groupedEvents.map((group, index) => {const firstEvent = group.events[0];diff --git a/client/src/app/[site]/replay/components/player/ReplayPlayer.tsx b/client/src/app/[site]/replay/components/player/ReplayPlayer.tsxindex f795cef3f..900c705e8 100644--- a/client/src/app/[site]/replay/components/player/ReplayPlayer.tsx+++ b/client/src/app/[site]/replay/components/player/ReplayPlayer.tsx@@ -9,6 +9,7 @@ import { useReplayKeyboardShortcuts } from "./hooks/useReplayKeyboardShortcuts";import { ReplayPlayerControls } from "./ReplayPlayerControls";import { ReplayPlayerCore } from "./ReplayPlayerCore";import { SKIP_SECONDS } from "./utils/replayUtils";+import { ReplayPlayerTobar } from "./ReplayPlayerTopbar";export function ReplayPlayer({width,@@ -117,6 +118,7 @@ export function ReplayPlayer({return (<div className="flex flex-col bg-neutral-950">+ <ReplayPlayerTobar /><ReplayPlayerCoredata={data}width={width}@@ -139,4 +141,4 @@ export function ReplayPlayer({/></div>);-}\ No newline at end of file+}diff --git a/client/src/app/[site]/replay/components/player/ReplayPlayerControls.tsx b/client/src/app/[site]/replay/components/player/ReplayPlayerControls.tsxindex 696983053..02abb3016 100644--- a/client/src/app/[site]/replay/components/player/ReplayPlayerControls.tsx+++ b/client/src/app/[site]/replay/components/player/ReplayPlayerControls.tsx@@ -81,4 +81,4 @@ export function ReplayPlayerControls({</div></div>);-}\ No newline at end of file+}diff --git a/client/src/app/[site]/replay/components/player/ReplayPlayerTopbar.tsx b/client/src/app/[site]/replay/components/player/ReplayPlayerTopbar.tsxnew file mode 100644index 000000000..7f3a90b2b--- /dev/null+++ b/client/src/app/[site]/replay/components/player/ReplayPlayerTopbar.tsx@@ -0,0 +1,71 @@+import { ExternalLink, Monitor } from "lucide-react";+import Link from "next/link";+import { useParams } from "next/navigation";+import { useGetSessionReplayEvents } from "../../../../../api/analytics/sessionReplay/useGetSessionReplayEvents";+import { useReplayStore } from "../replayStore";++export function ReplayPlayerTobar() {+ const params = useParams();+ const siteId = Number(params.site);+ const { sessionId } = useReplayStore();++ const { data } = useGetSessionReplayEvents(siteId, sessionId);++ if (!data?.metadata) {+ return (+ <div className="border border-neutral-800 bg-neutral-900 px-2 py-2 rounded-lg">+ <div className="flex items-center justify-between">+ <div className="flex items-center gap-2">+ <div className="h-4 w-32 bg-neutral-700 rounded animate-pulse" />+ </div>+ <div className="flex items-center gap-2">+ <div className="h-4 w-24 bg-neutral-700 rounded animate-pulse" />+ </div>+ </div>+ </div>+ );+ }++ const { metadata } = data;+ const pageUrl = metadata.page_url;+ const screenDimensions = `${metadata.screen_width} × ${metadata.screen_height}`;++ // Extract pathname from full URL for display+ const getDisplayPath = (url: string): string => {+ try {+ const urlObj = new URL(url);+ return urlObj.pathname + urlObj.search + urlObj.hash;+ } catch {+ return url;+ }+ };++ return (+ <div className="border border-neutral-800 bg-neutral-900 px-2 py-2 rounded-lg">+ <div className="flex items-center justify-between">+ {/* Left side: Page path with external link */}+ <div className="flex items-center gap-1 min-w-0 flex-1">+ <span className="text-xs text-neutral-300 truncate" title={pageUrl}>+ {pageUrl}+ </span>+ {pageUrl && (+ <Link+ href={pageUrl}+ target="_blank"+ rel="noopener noreferrer"+ className="text-neutral-400 hover:text-white transition-colors flex-shrink-0"+ title={`Open ${pageUrl} in new tab`}+ >+ <ExternalLink className="h-3 w-3" />+ </Link>+ )}+ </div>++ {/* Right side: Screen dimensions */}+ <div className="flex items-center gap-2 text-xs text-neutral-400 flex-shrink-0">+ <span>{screenDimensions}</span>+ </div>+ </div>+ </div>+ );+}diff --git a/client/src/app/[site]/replay/components/player/utils/replayUtils.ts b/client/src/app/[site]/replay/components/player/utils/replayUtils.tsindex a7d032c1a..e95a73768 100644--- a/client/src/app/[site]/replay/components/player/utils/replayUtils.ts+++ b/client/src/app/[site]/replay/components/player/utils/replayUtils.ts@@ -50,6 +50,6 @@ export const PLAYBACK_SPEEDS = [{ value: "4", label: "4x" },];-export const CONTROLS_HEIGHT = 67;+export const CONTROLS_HEIGHT = 101;export const SKIP_SECONDS = 10000; // 10 seconds in milliseconds-export const OVERLAY_TIMEOUT = 800; // milliseconds\ No newline at end of file+export const OVERLAY_TIMEOUT = 800; // milliseconds