Skip to content

Commit ef63107

Browse files
authored
2.3.0 (#795)
* 2.3.0 * Update session replay API endpoint path for consistency - Changed the session replay recording endpoint from `/sites/:siteId/session-replay/record` to `/session-replay/record/:siteId` to align with the standardized path structure. - This update enhances clarity and consistency across the API routes. * Refactor Sidebar component to improve layout consistency - Moved the API Playground item out of the conditional rendering block to ensure it is always displayed on larger screens. - This change enhances the visibility of the API Playground option in the Sidebar, improving user experience. * Refactor EventLog component to utilize Intersection Observer for infinite scrolling - Replaced manual scroll event handling with the Intersection Observer API to improve performance and simplify the code. - Updated session replay API endpoint paths for consistency across components. - Enhanced the SpinningGlobe component to use the correct API endpoint format for fetching session data. * Remove deprecated 'Get Organization Sites' endpoint and update API documentation - Deleted the 'Get Organization Sites' endpoint from the endpoint configuration to streamline the API. - Updated the API documentation to reflect the removal of the endpoint and added details for the 'sites' array in the organization response. - Enhanced the 'getMyOrganizations' API to include associated sites for each organization, improving the data returned to users. * Update Weekdays component color class and refactor Footer component to use Button - Changed the default color class in the Weekdays component for better visual consistency. - Refactored the Footer component to replace the anchor tag with a Button component for improved styling and user interaction.
1 parent a0808ec commit ef63107

File tree

15 files changed

+336
-385
lines changed

15 files changed

+336
-385
lines changed

client/package-lock.json

Lines changed: 170 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "client",
3-
"version": "2.2.4",
3+
"version": "2.3.0",
44
"private": true,
55
"scripts": {
66
"dev": "next dev -p 3002 --turbopack",

client/src/api/analytics/endpoints/sessionReplay.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export async function fetchSessionReplays(
9595
...toQueryParams(params),
9696
limit: params.limit,
9797
offset: params.offset,
98-
min_duration: params.minDuration,
98+
minDuration: params.minDuration,
9999
};
100100

101101
const response = await authedFetch<SessionReplayListResponse>(`/sites/${site}/session-replay/list`, queryParams);

client/src/app/[site]/api-playground/utils/endpointConfig.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,6 @@ export const endpointCategories: EndpointCategory[] = [
9393
description: "Returns all organizations the authenticated user is a member of, including all members for each organization",
9494
hasCommonParams: false,
9595
},
96-
{
97-
method: "GET",
98-
path: "/organizations/:organizationId/sites",
99-
name: "Get Organization Sites",
100-
description: "Returns all sites within an organization with session counts and subscription info",
101-
hasCommonParams: false,
102-
pathParams: ["organizationId"],
103-
},
10496
{
10597
method: "POST",
10698
path: "/organizations/:organizationId/sites",

client/src/app/[site]/components/Sidebar/Sidebar.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,14 @@ function SidebarContent() {
105105
href={getTabPath("goals")}
106106
icon={<Target className="w-4 h-4" />}
107107
/>
108-
{IS_CLOUD && (
109-
<div className="hidden md:block">
110-
<SidebarComponents.Item
111-
label="API Playground"
112-
active={isActiveTab("api-playground")}
113-
href={getTabPath("api-playground")}
114-
icon={<Code className="w-4 h-4" />}
115-
/>
116-
</div>
117-
)}
108+
<div className="hidden md:block">
109+
<SidebarComponents.Item
110+
label="API Playground"
111+
active={isActiveTab("api-playground")}
112+
href={getTabPath("api-playground")}
113+
icon={<Code className="w-4 h-4" />}
114+
/>
115+
</div>
118116
<SidebarComponents.SectionHeader>Product Analytics</SidebarComponents.SectionHeader>
119117
<div className="hidden md:block">
120118
{!subscription?.planName?.startsWith("appsumo") && !isSubscriptionLoading && (

client/src/app/[site]/events/components/EventLog.tsx

Lines changed: 20 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client";
22

3-
import { useCallback, useEffect, useRef } from "react";
3+
import { useIntersectionObserver } from "@uidotdev/usehooks";
4+
import { useEffect } from "react";
45
import { useGetEventsInfinite } from "../../../../api/analytics/hooks/events/useGetEvents";
56
import { NothingFound } from "../../../../components/NothingFound";
67
import { formatter } from "../../../../lib/utils";
@@ -9,41 +10,24 @@ import { ErrorState } from "../../../../components/ErrorState";
910
import { ScrollArea } from "../../../../components/ui/scroll-area";
1011

1112
export function EventLog() {
12-
const containerRef = useRef<HTMLDivElement>(null);
13-
const loadMoreRef = useRef<HTMLDivElement>(null);
14-
1513
// Fetch events with infinite scrolling
1614
const { data, isLoading, isError, fetchNextPage, hasNextPage, isFetchingNextPage } = useGetEventsInfinite({
1715
pageSize: 100,
1816
});
1917

20-
// Handle scroll for infinite loading
21-
const handleScroll = useCallback(() => {
22-
if (!loadMoreRef.current || !containerRef.current || !hasNextPage || isFetchingNextPage) {
23-
return;
24-
}
25-
26-
const container = containerRef.current;
27-
const loadMoreElement = loadMoreRef.current;
28-
const containerRect = container.getBoundingClientRect();
29-
const loadMoreRect = loadMoreElement.getBoundingClientRect();
18+
// Use the intersection observer hook
19+
const [ref, entry] = useIntersectionObserver({
20+
threshold: 0,
21+
root: null,
22+
rootMargin: "0px 0px 100px 0px",
23+
});
3024

31-
// Check if the load more element is visible in the viewport
32-
if (loadMoreRect.top <= containerRect.bottom + 100) {
25+
// Fetch next page when intersection observer detects the target is visible
26+
useEffect(() => {
27+
if (entry?.isIntersecting && hasNextPage && !isFetchingNextPage && !isLoading) {
3328
fetchNextPage();
3429
}
35-
}, [fetchNextPage, hasNextPage, isFetchingNextPage]);
36-
37-
// Set up scroll event listener
38-
useEffect(() => {
39-
const container = containerRef.current;
40-
if (!container) return;
41-
42-
container.addEventListener("scroll", handleScroll);
43-
return () => {
44-
container.removeEventListener("scroll", handleScroll);
45-
};
46-
}, [handleScroll]);
30+
}, [entry?.isIntersecting, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading]);
4731

4832
// Flatten all pages of data
4933
const allEvents = data?.pages.flatMap(page => page.data) || [];
@@ -73,22 +57,19 @@ export function EventLog() {
7357

7458
return (
7559
<ScrollArea className="h-[80vh]">
76-
<div ref={containerRef} className="h-full pr-2 overflow-x-hidden">
60+
<div className="h-full pr-2 overflow-x-hidden">
7761
{allEvents.map((event, index) => (
7862
<EventLogItem key={`${event.timestamp}-${index}`} event={event} />
7963
))}
8064

81-
{/* Loading state for next page */}
82-
{hasNextPage && (
83-
<div className="py-2">
84-
{Array.from({ length: 3 }).map((_, index) => (
65+
{/* Infinite scroll sentinel */}
66+
<div ref={ref} className="py-2">
67+
{isFetchingNextPage && (
68+
Array.from({ length: 3 }).map((_, index) => (
8569
<EventLogItemSkeleton key={`next-page-${index}`} />
86-
))}
87-
</div>
88-
)}
89-
90-
{/* Invisible element for scroll detection */}
91-
{hasNextPage && <div ref={loadMoreRef} className="h-1" />}
70+
))
71+
)}
72+
</div>
9273
</div>
9374
{/* Pagination info */}
9475
{data?.pages[0]?.pagination && (

client/src/app/[site]/main/components/sections/Weekdays.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export function Weekdays() {
208208
heatmapData[day].length > hour
209209
? heatmapData[day][hour]
210210
: 0;
211-
const colorClass = value > 0 ? getColorIntensity(value) : "bg-neutral-200 dark:bg-neutral-800";
211+
const colorClass = value > 0 ? getColorIntensity(value) : "bg-neutral-50 dark:bg-neutral-850";
212212
return (
213213
<Tooltip key={day}>
214214
<TooltipTrigger asChild>

0 commit comments

Comments
 (0)