🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Refactor components to improve layout and prevent overflow
Bill Yang976f05b7c2a3
diff --git a/client/src/app/[site]/api-playground/components/EndpointList.tsx b/client/src/app/[site]/api-playground/components/EndpointList.tsxindex ba8167f78..052449d4c 100644--- a/client/src/app/[site]/api-playground/components/EndpointList.tsx+++ b/client/src/app/[site]/api-playground/components/EndpointList.tsx@@ -13,7 +13,7 @@ export function EndpointList() {<div className="p-3 border-b border-neutral-100 dark:border-neutral-850"><h2 className="text-sm font-semibold text-neutral-900 dark:text-neutral-100">Endpoints</h2></div>- <div className="p-2">+ <div className="p-2 overflow-x-hidden">{endpointCategories.map(category => (<div key={category.name} className="mb-4"><h3 className="px-2 py-1 text-xs font-medium text-neutral-500 dark:text-neutral-400 uppercase tracking-wider">diff --git a/client/src/app/[site]/components/SubHeader/LiveUserCount.tsx b/client/src/app/[site]/components/SubHeader/LiveUserCount.tsxindex 111c84172..985ac9697 100644--- a/client/src/app/[site]/components/SubHeader/LiveUserCount.tsx+++ b/client/src/app/[site]/components/SubHeader/LiveUserCount.tsx@@ -82,7 +82,7 @@ export function LiveUserCount() {className="h-[75vh]"maskClassName="before:from-white dark:before:from-neutral-950 after:from-white dark:after:from-neutral-950">- <div className="space-y-3 p-2 md:p-4 ">+ <div className="space-y-3 p-2 md:p-4 overflow-x-hidden">{isLoading ? (<SessionCardSkeleton count={5} />) : sessions.length === 0 ? (diff --git a/client/src/app/[site]/components/shared/StandardSection/StandardSection.tsx b/client/src/app/[site]/components/shared/StandardSection/StandardSection.tsxindex 19712ca0c..682be2746 100644--- a/client/src/app/[site]/components/shared/StandardSection/StandardSection.tsx+++ b/client/src/app/[site]/components/shared/StandardSection/StandardSection.tsx@@ -88,7 +88,7 @@ export function StandardSection({<div>{countLabel || "Sessions"}</div></div><ScrollArea className="h-[314px]">- <div className="flex flex-col gap-2">+ <div className="flex flex-col gap-2 overflow-x-hidden">{isLoading ? (<StandardSkeleton />) : error ? (diff --git a/client/src/app/[site]/events/components/EventList.tsx b/client/src/app/[site]/events/components/EventList.tsxindex d3d99922b..23a1f9d09 100644--- a/client/src/app/[site]/events/components/EventList.tsx+++ b/client/src/app/[site]/events/components/EventList.tsx@@ -118,7 +118,7 @@ export function EventList({ events, isLoading, size = "small" }: EventListProps)const maxCount = Math.max(...events.map(event => event.count));return (- <div className="flex flex-col gap-2">+ <div className="flex flex-col gap-2 overflow-x-hidden">{events.map(event => {const percentageOfMax = (event.count / maxCount) * 100;const percentage = (event.count / totalCount) * 100;diff --git a/client/src/app/[site]/events/components/EventLog.tsx b/client/src/app/[site]/events/components/EventLog.tsxindex e1ea4a259..60ed8e5fd 100644--- a/client/src/app/[site]/events/components/EventLog.tsx+++ b/client/src/app/[site]/events/components/EventLog.tsx@@ -73,7 +73,7 @@ export function EventLog() {return (<ScrollArea className="h-[80vh]">- <div ref={containerRef} className="h-full pr-2">+ <div ref={containerRef} className="h-full pr-2 overflow-x-hidden">{allEvents.map((event, index) => (<EventLogItem key={`${event.timestamp}-${index}`} event={event} />))}diff --git a/client/src/app/[site]/events/components/OutboundLinksList.tsx b/client/src/app/[site]/events/components/OutboundLinksList.tsxindex 8b3c3bd89..4fe4db85c 100644--- a/client/src/app/[site]/events/components/OutboundLinksList.tsx+++ b/client/src/app/[site]/events/components/OutboundLinksList.tsx@@ -117,7 +117,7 @@ export function OutboundLinksList({ outboundLinks, isLoading, size = "small" }:return (<ScrollArea className="h-[394px]">- <div className="flex flex-col gap-2 pr-2">+ <div className="flex flex-col gap-2 pr-2 overflow-x-hidden">{outboundLinks.map((link, index) => {const percentageOfMax = (link.count / maxCount) * 100;const percentage = (link.count / totalCount) * 100;diff --git a/client/src/app/[site]/replay/components/ReplayList.tsx b/client/src/app/[site]/replay/components/ReplayList.tsxindex 91edf2952..cff867522 100644--- a/client/src/app/[site]/replay/components/ReplayList.tsx+++ b/client/src/app/[site]/replay/components/ReplayList.tsx@@ -64,34 +64,36 @@ export function ReplayList() {</div><div className="rounded-lg border border-neutral-100 dark:border-neutral-800 flex flex-col"><ScrollArea className="h-[calc(100vh-130px)] rounded-lg">- {isLoading ? (- 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} />- ))}+ <div className="overflow-x-hidden">+ {isLoading ? (+ 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} />+ ))}- {/* Infinite scroll anchor and loading indicator */}- <div ref={ref} className="py-3 flex justify-center">- {isFetchingNextPage && (- <div className="flex items-center gap-2 text-neutral-600 dark:text-neutral-400 text-xs">- <Loader2 className="h-4 w-4 animate-spin" />- Loading more replays...- </div>- )}- {!hasNextPage && !isFetchingNextPage && flattenedData.length > 0 && (- <div className="text-neutral-500 dark:text-neutral-500 text-xs">All replays loaded</div>- )}- </div>- </>- )}+ {/* Infinite scroll anchor and loading indicator */}+ <div ref={ref} className="py-3 flex justify-center">+ {isFetchingNextPage && (+ <div className="flex items-center gap-2 text-neutral-600 dark:text-neutral-400 text-xs">+ <Loader2 className="h-4 w-4 animate-spin" />+ Loading more replays...+ </div>+ )}+ {!hasNextPage && !isFetchingNextPage && flattenedData.length > 0 && (+ <div className="text-neutral-500 dark:text-neutral-500 text-xs">All replays loaded</div>+ )}+ </div>+ </>+ )}+ </div></ScrollArea></div></div>diff --git a/client/src/components/replay/ReplayBreadcrumbs.tsx b/client/src/components/replay/ReplayBreadcrumbs.tsxindex fa055bc53..ec9979028 100644--- a/client/src/components/replay/ReplayBreadcrumbs.tsx+++ b/client/src/components/replay/ReplayBreadcrumbs.tsx@@ -269,7 +269,9 @@ export function ReplayBreadcrumbs() {id={data.metadata.user_id}size={24}lastActiveTime={- data.metadata.end_time ? DateTime.fromSQL(data.metadata.end_time, { zone: "utc" }).setZone(getTimezone()) : undefined+ data.metadata.end_time+ ? DateTime.fromSQL(data.metadata.end_time, { zone: "utc" }).setZone(getTimezone())+ : undefined}/><span className="truncate max-w-[120px]">{getUserDisplayName(data.metadata)}</span>@@ -284,47 +286,49 @@ export function ReplayBreadcrumbs() {{data.events.length} events captured ({groupedEvents.length} groups)</div><ScrollArea className="flex-1 rounded-lg">- {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-100 dark:border-neutral-800 bg-white dark:bg-neutral-900",- "hover:bg-neutral-50 dark:hover:bg-neutral-800/80 transition-colors cursor-pointer",- "flex items-center gap-2 group"- )}- onClick={() => handleGroupClick(group)}- >- <div className="text-xs text-neutral-600 dark:text-neutral-400 w-10">- {Duration.fromMillis(startTimeMs).toFormat("mm:ss")}- </div>- <Icon className={cn("w-4 h-4 shrink-0", color)} />- <div className="flex-1 min-w-0">- <div className="text-xs text-neutral-900 dark:text-neutral-200 font-medium truncate">- {description}+ <div className="overflow-x-hidden">+ {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-100 dark:border-neutral-800 bg-white dark:bg-neutral-900",+ "hover:bg-neutral-50 dark:hover:bg-neutral-800/80 transition-colors cursor-pointer",+ "flex items-center gap-2 group"+ )}+ onClick={() => handleGroupClick(group)}+ >+ <div className="text-xs text-neutral-600 dark:text-neutral-400 w-10">+ {Duration.fromMillis(startTimeMs).toFormat("mm:ss")}</div>- {group.count > 1 && durationMs > 0 && (- <div className="text-xs text-neutral-500 dark:text-neutral-500 mt-0.5">- {Duration.fromMillis(durationMs).toFormat("s.SSS")}s duration+ <Icon className={cn("w-4 h-4 shrink-0", color)} />+ <div className="flex-1 min-w-0">+ <div className="text-xs text-neutral-900 dark:text-neutral-200 font-medium truncate">+ {description}+ </div>+ {group.count > 1 && durationMs > 0 && (+ <div className="text-xs text-neutral-500 dark: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-700 dark:text-neutral-500 bg-neutral-100 dark:bg-neutral-800 px-1.5 py-0.5 rounded">+ {group.count}</div>)}</div>- {group.count > 5 && (- <div className="text-xs text-neutral-700 dark:text-neutral-500 bg-neutral-100 dark:bg-neutral-800 px-1.5 py-0.5 rounded">- {group.count}- </div>- )}- </div>- );- })}+ );+ })}+ </div></ScrollArea></div></div>