Skip to content

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

update outbound link ui (#542)

Bill Yang903981e4584a
diff --git a/client/src/app/[site]/components/shared/StandardSection/Row.tsx b/client/src/app/[site]/components/shared/StandardSection/Row.tsx
index 712c79b6e..02b9849cb 100644
--- a/client/src/app/[site]/components/shared/StandardSection/Row.tsx
+++ b/client/src/app/[site]/components/shared/StandardSection/Row.tsx
@@ -13,9 +13,7 @@ const useFilterToggle = () => {
const toggleFilter = useCallback(
(parameter: FilterParameter, value: string) => {
- const foundFilter = filters.find(
- (f) => f.parameter === parameter && f.value.some((v) => v === value)
- );
+ const foundFilter = filters.find((f) => f.parameter === parameter && f.value.some((v) => v === value));
if (foundFilter) {
removeFilter(foundFilter);
} else {
@@ -69,27 +67,17 @@ const RowItem = ({
{leftContent}
{getLabel(item)}
{getLink && (
- <a
- href={getLink(item)}
- target="_blank"
- onClick={(e) => e.stopPropagation()}
- >
+ <a href={getLink(item)} target="_blank" onClick={(e) => e.stopPropagation()}>
<SquareArrowOutUpRight
- className="w-3 h-3 text-neutral-300 hover:text-neutral-100"
+ className="ml-0.5 w-3.5 h-3.5 text-neutral-300 hover:text-neutral-100"
strokeWidth={3}
/>
</a>
)}
</div>
<div className="text-xs flex gap-2">
- <div className="hidden group-hover:block text-neutral-400">
- {round(item.percentage, 1)}%
- </div>
- <NumberFlow
- respectMotionPreference={false}
- value={item.count}
- format={{ notation: "compact" }}
- />
+ <div className="hidden group-hover:block text-neutral-400">{round(item.percentage, 1)}%</div>
+ <NumberFlow respectMotionPreference={false} value={item.count} format={{ notation: "compact" }} />
</div>
</div>
</div>
@@ -129,9 +117,7 @@ const Subrows = ({
const itemsForDisplay = data?.data;
- const ratio = itemsForDisplay?.[0]?.percentage
- ? 100 / itemsForDisplay[0].percentage
- : 1;
+ const ratio = itemsForDisplay?.[0]?.percentage ? 100 / itemsForDisplay[0].percentage : 1;
if (isLoading || isFetching) {
return null;
diff --git a/client/src/app/[site]/components/shared/StandardSection/StandardSectionDialog.tsx b/client/src/app/[site]/components/shared/StandardSection/StandardSectionDialog.tsx
index 878d06c07..a1563a2b9 100644
--- a/client/src/app/[site]/components/shared/StandardSection/StandardSectionDialog.tsx
+++ b/client/src/app/[site]/components/shared/StandardSection/StandardSectionDialog.tsx
@@ -1,9 +1,4 @@
-import {
- Dialog,
- DialogContent,
- DialogHeader,
- DialogTitle,
-} from "@/components/ui/dialog";
+import { Dialog, DialogContent, DialogHeader, DialogTitle } from "@/components/ui/dialog";
import { Input } from "@/components/ui/input";
import {
createColumnHelper,
@@ -14,13 +9,7 @@ import {
useReactTable,
} from "@tanstack/react-table";
import { useDebounce, useIntersectionObserver } from "@uidotdev/usehooks";
-import {
- ChevronDown,
- ChevronUp,
- Loader2,
- Search,
- SquareArrowOutUpRight,
-} from "lucide-react";
+import { ChevronDown, ChevronUp, Loader2, Search, SquareArrowOutUpRight } from "lucide-react";
import { ReactNode, useEffect, useMemo, useState } from "react";
import { useInfiniteSingleCol } from "../../../../../api/analytics/useInfiniteSingleCol";
import { SingleColResponse } from "../../../../../api/analytics/useSingleCol";
@@ -57,25 +46,15 @@ export function StandardSectionDialog({
expanded,
close,
}: StandardSectionDialogProps) {
- const {
- data,
- isLoading,
- isFetching,
- error,
- refetch,
- fetchNextPage,
- hasNextPage,
- isFetchingNextPage,
- } = useInfiniteSingleCol({
- parameter: filterParameter,
- limit: 100,
- });
+ const { data, isLoading, isFetching, error, refetch, fetchNextPage, hasNextPage, isFetchingNextPage } =
+ useInfiniteSingleCol({
+ parameter: filterParameter,
+ limit: 100,
+ });
const [searchTerm, setSearchTerm] = useState("");
const debouncedSearchTerm = useDebounce(searchTerm, 200);
- const [sorting, setSorting] = useState<SortingState>([
- { id: "count", desc: true },
- ]);
+ const [sorting, setSorting] = useState<SortingState>([{ id: "count", desc: true }]);
// Use the intersection observer hook
const [ref, entry] = useIntersectionObserver({
@@ -97,14 +76,9 @@ export function StandardSectionDialog({
const labelFnToUse = getFilterLabel || getValue;
return allItems.filter((item: SingleColResponse) => {
- const label =
- typeof labelFnToUse(item) === "string"
- ? (labelFnToUse(item) as string)
- : labelFnToUse(item);
+ const label = typeof labelFnToUse(item) === "string" ? (labelFnToUse(item) as string) : labelFnToUse(item);
- return String(label)
- .toLowerCase()
- .includes(debouncedSearchTerm.toLowerCase());
+ return String(label).toLowerCase().includes(debouncedSearchTerm.toLowerCase());
});
}, [allItems, getFilterLabel, getValue, debouncedSearchTerm]);
@@ -116,13 +90,9 @@ export function StandardSectionDialog({
<div className="flex flex-row gap-1 items-center text-left">
{getLabel(row.original)}
{getLink && (
- <a
- href={getLink(row.original)}
- target="_blank"
- onClick={(e) => e.stopPropagation()}
- >
+ <a href={getLink(row.original)} target="_blank" onClick={(e) => e.stopPropagation()}>
<SquareArrowOutUpRight
- className="w-3 h-3 text-neutral-300 hover:text-neutral-100"
+ className="ml-0.5 w-3.5 h-3.5 text-neutral-300 hover:text-neutral-100"
strokeWidth={3}
/>
</a>
@@ -133,17 +103,13 @@ export function StandardSectionDialog({
columnHelper.accessor("count", {
header: "Sessions",
cell: (info) => (
- <div className="flex flex-row gap-1 items-center sm:justify-end">
- {info.getValue().toLocaleString()}
- </div>
+ <div className="flex flex-row gap-1 items-center sm:justify-end">{info.getValue().toLocaleString()}</div>
),
}),
columnHelper.accessor("percentage", {
header: "Session %",
cell: (info) => (
- <div className="flex flex-row gap-1 items-center sm:justify-end">
- {info.getValue().toFixed(1)}%
- </div>
+ <div className="flex flex-row gap-1 items-center sm:justify-end">{info.getValue().toFixed(1)}%</div>
),
}),
];
@@ -151,16 +117,13 @@ export function StandardSectionDialog({
// Only check for additional columns if we have data
if (filteredData.length > 0) {
const hasPageviews =
- filteredData[0]?.pageviews !== undefined &&
- filteredData[0]?.pageviews_percentage !== undefined;
+ filteredData[0]?.pageviews !== undefined && filteredData[0]?.pageviews_percentage !== undefined;
if (hasPageviews) {
cols.push(
columnHelper.accessor("pageviews", {
header: "Pageviews",
cell: (info) => (
- <div className="flex flex-row gap-1 items-center sm:justify-end">
- {info.getValue()?.toLocaleString()}
- </div>
+ <div className="flex flex-row gap-1 items-center sm:justify-end">{info.getValue()?.toLocaleString()}</div>
),
}) as any
);
@@ -168,9 +131,7 @@ export function StandardSectionDialog({
columnHelper.accessor("pageviews_percentage", {
header: "Pageviews %",
cell: (info) => (
- <div className="flex flex-row gap-1 items-center sm:justify-end">
- {info.getValue()?.toFixed(1)}%
- </div>
+ <div className="flex flex-row gap-1 items-center sm:justify-end">{info.getValue()?.toFixed(1)}%</div>
),
}) as any
);
@@ -182,11 +143,7 @@ export function StandardSectionDialog({
columnHelper.accessor("time_on_page_seconds", {
header: "Duration",
cell: (info) => (
- <div className="text-right">
- {formatSecondsAsMinutesAndSeconds(
- Math.round(info.getValue() ?? 0)
- )}
- </div>
+ <div className="text-right">{formatSecondsAsMinutesAndSeconds(Math.round(info.getValue() ?? 0))}</div>
),
}) as any
);
@@ -198,21 +155,10 @@ export function StandardSectionDialog({
// Fetch next page when intersection observer detects the target is visible
useEffect(() => {
- 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]);
// Set up table instance
const table = useReactTable({
@@ -276,18 +222,10 @@ export function StandardSectionDialog({
}}
onClick={header.column.getToggleSortingHandler()}
>
- <div
- className={cn(
- "flex items-center gap-1",
- index !== 0 && "justify-end"
- )}
- >
+ <div className={cn("flex items-center gap-1", index !== 0 && "justify-end")}>
{header.isPlaceholder
? null
- : flexRender(
- header.column.columnDef.header,
- header.getContext()
- )}
+ : flexRender(header.column.columnDef.header, header.getContext())}
{{
asc: <ChevronUp className="h-3 w-3" />,
desc: <ChevronDown className="h-3 w-3" />,
@@ -316,19 +254,10 @@ export function StandardSectionDialog({
}
>
{row.getVisibleCells().map((cell, cellIndex) => (
- <td
- key={cell.id}
- className={cn(
- "px-2 py-2 relative",
- cellIndex !== 0 && "text-right"
- )}
- >
+ <td key={cell.id} className={cn("px-2 py-2 relative", cellIndex !== 0 && "text-right")}>
{cellIndex === 0 && <div></div>}
<span className="relative z-0">
- {flexRender(
- cell.column.columnDef.cell,
- cell.getContext()
- )}
+ {flexRender(cell.column.columnDef.cell, cell.getContext())}
</span>
</td>
))}
@@ -348,9 +277,7 @@ export function StandardSectionDialog({
</div>
)}
{!hasNextPage && !isFetchingNextPage && (
- <div className="text-neutral-500 text-xs">
- All items loaded
- </div>
+ <div className="text-neutral-500 text-xs">All items loaded</div>
)}
</div>
)}
diff --git a/client/src/app/[site]/events/components/OutboundLinksList.tsx b/client/src/app/[site]/events/components/OutboundLinksList.tsx
index bf8697766..5d1002192 100644
--- a/client/src/app/[site]/events/components/OutboundLinksList.tsx
+++ b/client/src/app/[site]/events/components/OutboundLinksList.tsx
@@ -1,81 +1,65 @@
"use client";
import NumberFlow from "@number-flow/react";
-import { ExternalLink } from "lucide-react";
+import { ExternalLink, Info } from "lucide-react";
import { DateTime } from "luxon";
import { memo } from "react";
import { OutboundLink } from "../../../../api/analytics/events/useGetOutboundLinks";
import { cn } from "../../../../lib/utils";
// Skeleton component for OutboundLinksList
-const OutboundLinksListSkeleton = memo(
- ({ size = "small" }: { size?: "small" | "large" }) => {
- // Generate widths following Pareto principle with top item at 100%
- const widths = Array.from({ length: 10 }, (_, i) => {
- if (i === 0) {
- return 100;
- } else if (i === 1) {
- return 60 + Math.random() * 20;
- } else {
- const factor = 1 - (i - 2) / 8;
- return 10 + factor * 30;
- }
- });
+const OutboundLinksListSkeleton = memo(({ size = "small" }: { size?: "small" | "large" }) => {
+ // Generate widths following Pareto principle with top item at 100%
+ const widths = Array.from({ length: 10 }, (_, i) => {
+ if (i === 0) {
+ return 100;
+ } else if (i === 1) {
+ return 60 + Math.random() * 20;
+ } else {
+ const factor = 1 - (i - 2) / 8;
+ return 10 + factor * 30;
+ }
+ });
- const labelWidths = Array.from({ length: 10 }, (_, i) => {
- return i < 3 ? 150 + Math.random() * 100 : 80 + Math.random() * 120;
- });
+ const labelWidths = Array.from({ length: 10 }, (_, i) => {
+ return i < 3 ? 150 + Math.random() * 100 : 80 + Math.random() * 120;
+ });
- const valueWidths = Array.from(
- { length: 10 },
- () => 20 + Math.random() * 40
- );
+ const valueWidths = Array.from({ length: 10 }, () => 20 + Math.random() * 40);
- return (
- <div className="flex flex-col gap-2 pr-2">
- {Array.from({ length: 10 }).map((_, index) => (
+ return (
+ <div className="flex flex-col gap-2 pr-2">
+ {Array.from({ length: 10 }).map((_, index) => (
+ <div key={index} className={cn("relative flex items-center", size === "small" ? "h-6" : "h-9")}>
+ <div
+ className="absolute inset-0 bg-neutral-800 py-2 rounded-md animate-pulse"
+ style={{ width: `${widths[index]}%` }}
+ ></div>
<div
- key={index}
className={cn(
- "relative flex items-center",
- size === "small" ? "h-6" : "h-9"
+ "z-5 mx-2 flex justify-between items-center w-full",
+ size === "small" ? "text-xs" : "text-sm"
)}
>
- <div
- className="absolute inset-0 bg-neutral-800 py-2 rounded-md animate-pulse"
- style={{ width: `${widths[index]}%` }}
- ></div>
- <div
- className={cn(
- "z-5 mx-2 flex justify-between items-center w-full",
- size === "small" ? "text-xs" : "text-sm"
- )}
- >
- <div className="flex items-center gap-1">
- <div className="h-4 w-4 bg-neutral-800 rounded animate-pulse mr-1"></div>
- <div
- className="h-4 bg-neutral-800 rounded animate-pulse"
- style={{ width: `${labelWidths[index]}px` }}
- ></div>
- </div>
+ <div className="flex items-center gap-1">
+ <div className="h-4 w-4 bg-neutral-800 rounded animate-pulse mr-1"></div>
<div
- className={cn(
- "flex gap-2",
- size === "small" ? "text-xs" : "text-sm"
- )}
- >
- <div
- className="h-4 bg-neutral-800 rounded animate-pulse"
- style={{ width: `${valueWidths[index]}px` }}
- ></div>
- </div>
+ className="h-4 bg-neutral-800 rounded animate-pulse"
+ style={{ width: `${labelWidths[index]}px` }}
+ ></div>
+ </div>
+ <div className={cn("flex gap-2", size === "small" ? "text-xs" : "text-sm")}>
+ <div
+ className="h-4 bg-neutral-800 rounded animate-pulse"
+ style={{ width: `${valueWidths[index]}px` }}
+ ></div>
</div>
</div>
- ))}
- </div>
- );
- }
-);
+ </div>
+ ))}
+ </div>
+ );
+});
interface OutboundLinksListProps {
outboundLinks: OutboundLink[];
@@ -92,11 +76,11 @@ function truncateUrl(url: string, maxLength: number = 60) {
const urlObj = new URL(url);
const domain = urlObj.hostname;
const path = urlObj.pathname + urlObj.search;
-
+
if (domain.length + path.length <= maxLength) {
return `${domain}${path}`;
}
-
+
// If still too long, truncate the path
const availableSpace = maxLength - domain.length - 3; // 3 for "..."
if (availableSpace > 0) {
@@ -110,25 +94,16 @@ function truncateUrl(url: string, maxLength: number = 60) {
}
}
-export function OutboundLinksList({
- outboundLinks,
- isLoading,
- size = "small",
-}: OutboundLinksListProps) {
+export function OutboundLinksList({ outboundLinks, isLoading, size = "small" }: OutboundLinksListProps) {
if (isLoading) {
return <OutboundLinksListSkeleton size={size} />;
}
if (!outboundLinks || outboundLinks.length === 0) {
return (
- <div className="flex flex-col gap-2">
- <div className="text-neutral-100 w-full text-center mt-6 flex flex-row gap-2 items-center justify-center">
- <ExternalLink className="w-5 h-5" />
- No outbound clicks tracked
- </div>
- <div className="text-neutral-400 w-full text-center mt-2 text-sm">
- External link clicks will appear here
- </div>
+ <div className="text-neutral-300 w-full text-center mt-6 flex flex-row gap-2 items-center justify-center">
+ <Info className="w-5 h-5" />
+ No Data
</div>
);
}
@@ -153,44 +128,29 @@ export function OutboundLinksList({
)}
>
<div
- className="absolute inset-0 bg-purple-500 py-2 opacity-25 rounded-md"
+ className="absolute inset-0 bg-dataviz py-2 opacity-25 rounded-md"
style={{ width: `${percentage}%` }}
></div>
<div
- className={cn(
- "z-10 flex justify-between items-center w-full",
- size === "small" ? "text-xs" : "text-sm"
- )}
+ className={cn("z-10 flex justify-between items-center w-full", size === "small" ? "text-xs" : "text-sm")}
>
<div className="font-medium truncate max-w-[70%] flex items-center gap-1">
- <ExternalLink className="h-4 w-4 text-purple-400 flex-shrink-0" />
<a
href={link.url}
target="_blank"
rel="noopener noreferrer"
- className="text-purple-400 hover:text-purple-300 hover:underline truncate"
+ className="text-neutral-100 hover:underline truncate"
title={link.url}
>
{truncateUrl(link.url)}
</a>
</div>
- <div
- className={cn(
- "text-sm flex gap-2 items-center",
- size === "small" ? "text-xs" : "text-sm"
- )}
- >
+ <div className={cn("text-sm flex gap-2 items-center", size === "small" ? "text-xs" : "text-sm")}>
<div className="hidden group-hover:block text-neutral-400 text-xs">
{Math.round(percentage * 10) / 10}%
</div>
- <div className="hidden group-hover:block text-neutral-400 text-xs">
- {lastClicked.toRelative()}
- </div>
- <NumberFlow
- respectMotionPreference={false}
- value={link.count}
- format={{ notation: "compact" }}
- />
+ <div className="hidden group-hover:block text-neutral-400 text-xs">{lastClicked.toRelative()}</div>
+ <NumberFlow respectMotionPreference={false} value={link.count} format={{ notation: "compact" }} />
</div>
</div>
</div>
@@ -198,4 +158,4 @@ export function OutboundLinksList({
})}
</div>
);
-}
\ No newline at end of file
+}
diff --git a/client/src/app/[site]/main/components/sections/Events.tsx b/client/src/app/[site]/main/components/sections/Events.tsx
index c620e17aa..24d4e793e 100644
--- a/client/src/app/[site]/main/components/sections/Events.tsx
+++ b/client/src/app/[site]/main/components/sections/Events.tsx
@@ -1,52 +1,71 @@
import { useState } from "react";
-import {
- Tabs,
- TabsContent,
- TabsList,
- TabsTrigger,
-} from "../../../../../components/ui/basic-tabs";
-import {
- Card,
- CardContent,
- CardLoader,
-} from "../../../../../components/ui/card";
+import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../../../../components/ui/basic-tabs";
+import { Card, CardContent, CardLoader } from "../../../../../components/ui/card";
import { useGetEventNames } from "../../../../../api/analytics/events/useGetEventNames";
import { EventList } from "../../../events/components/EventList";
+import { OutboundLinksList } from "../../../events/components/OutboundLinksList";
+import { useGetOutboundLinks } from "../../../../../api/analytics/events/useGetOutboundLinks";
-type Tab = "events";
+type Tab = "events" | "outbound";
+
+function Events_() {
+ const { data: eventNamesData, isLoading: isLoadingEventNames } = useGetEventNames();
+
+ return (
+ <>
+ {isLoadingEventNames && (
+ <div className="absolute top-[-8px] left-0 w-full h-full">
+ <CardLoader />
+ </div>
+ )}
+ <div className="relative">
+ <div className="flex flex-row gap-2 justify-between pr-1 text-xs text-neutral-400 mb-2">
+ <div>Custom Events</div>
+ <div>Count</div>
+ </div>
+ <EventList events={eventNamesData || []} isLoading={isLoadingEventNames} />
+ </div>
+ </>
+ );
+}
+
+function OutboundLinks() {
+ const { data: outboundLinksData, isLoading: isLoadingOutboundLinks } = useGetOutboundLinks();
+
+ return (
+ <>
+ {isLoadingOutboundLinks && (
+ <div className="absolute top-[-8px] left-0 w-full h-full">
+ <CardLoader />
+ </div>
+ )}
+ <div className="relative">
+ <div className="flex flex-row gap-2 justify-between pr-1 text-xs text-neutral-400 mb-2">
+ <div>Outbound Links</div>
+ <div>Clicks</div>
+ </div>
+ <OutboundLinksList outboundLinks={outboundLinksData || []} isLoading={isLoadingOutboundLinks} />
+ </div>
+ </>
+ );
+}
export function Events() {
const [tab, setTab] = useState<Tab>("events");
- const { data: eventNamesData, isLoading: isLoadingEventNames } =
- useGetEventNames();
return (
<Card>
<CardContent className="mt-2">
- <Tabs
- defaultValue="events"
- value={tab}
- onValueChange={(value) => setTab(value as Tab)}
- >
+ <Tabs defaultValue="events" value={tab} onValueChange={(value) => setTab(value as Tab)}>
<TabsList>
<TabsTrigger value="events">Custom Events</TabsTrigger>
+ <TabsTrigger value="outbound">Outbound Links</TabsTrigger>
</TabsList>
<TabsContent value="events">
- {isLoadingEventNames && (
- <div className="absolute top-[-8px] left-0 w-full h-full">
- <CardLoader />
- </div>
- )}
- <div className="relative">
- <div className="flex flex-row gap-2 justify-between pr-1 text-xs text-neutral-400 mb-2">
- <div>Custom Events</div>
- <div>Count</div>
- </div>
- <EventList
- events={eventNamesData || []}
- isLoading={isLoadingEventNames}
- />
- </div>
+ <Events_ />
+ </TabsContent>
+ <TabsContent value="outbound">
+ <OutboundLinks />
</TabsContent>
</Tabs>
</CardContent>
diff --git a/client/src/app/[site]/main/components/sections/OutboundLinks.tsx b/client/src/app/[site]/main/components/sections/OutboundLinks.tsx
deleted file mode 100644
index ea36d9b70..000000000
--- a/client/src/app/[site]/main/components/sections/OutboundLinks.tsx
+++ /dev/null
@@ -1,55 +0,0 @@
-import { useState } from "react";
-import {
- Tabs,
- TabsContent,
- TabsList,
- TabsTrigger,
-} from "../../../../../components/ui/basic-tabs";
-import {
- Card,
- CardContent,
- CardLoader,
-} from "../../../../../components/ui/card";
-import { useGetOutboundLinks } from "../../../../../api/analytics/events/useGetOutboundLinks";
-import { OutboundLinksList } from "../../../events/components/OutboundLinksList";
-
-type Tab = "outbound";
-
-export function OutboundLinks() {
- const [tab, setTab] = useState<Tab>("outbound");
- const { data: outboundLinksData, isLoading: isLoadingOutboundLinks } =
- useGetOutboundLinks();
-
- return (
- <Card>
- <CardContent className="mt-2">
- <Tabs
- defaultValue="outbound"
- value={tab}
- onValueChange={(value) => setTab(value as Tab)}
- >
- <TabsList>
- <TabsTrigger value="outbound">Outbound Clicks</TabsTrigger>
- </TabsList>
- <TabsContent value="outbound">
- {isLoadingOutboundLinks && (
- <div className="absolute top-[-8px] left-0 w-full h-full">
- <CardLoader />
- </div>
- )}
- <div className="relative">
- <div className="flex flex-row gap-2 justify-between pr-1 text-xs text-neutral-400 mb-2">
- <div>External Links</div>
- <div>Clicks</div>
- </div>
- <OutboundLinksList
- outboundLinks={outboundLinksData || []}
- isLoading={isLoadingOutboundLinks}
- />
- </div>
- </TabsContent>
- </Tabs>
- </CardContent>
- </Card>
- );
-}
\ No newline at end of file
diff --git a/client/src/app/[site]/main/page.tsx b/client/src/app/[site]/main/page.tsx
index 89d1e7f61..89633c6b0 100644
--- a/client/src/app/[site]/main/page.tsx
+++ b/client/src/app/[site]/main/page.tsx
@@ -1,5 +1,4 @@
"use client";
-import { useGetSite } from "../../../api/admin/sites";
import { useSetPageTitle } from "../../../hooks/useSetPageTitle";
import { useStore } from "../../../lib/store";
import { SubHeader } from "../components/SubHeader/SubHeader";
@@ -7,7 +6,6 @@ import { MainSection } from "./components/MainSection/MainSection";
import { Countries } from "./components/sections/Countries";
import { Devices } from "./components/sections/Devices";
import { Events } from "./components/sections/Events";
-import { OutboundLinks } from "./components/sections/OutboundLinks";
import { Pages } from "./components/sections/Pages";
import { Referrers } from "./components/sections/Referrers";
import { Weekdays } from "./components/sections/Weekdays";
@@ -35,7 +33,6 @@ function MainPageContent() {
<Referrers />
<Countries />
<Events />
- <OutboundLinks />
<Weekdays />
</div>
</div>
diff --git a/client/src/app/[site]/performance/components/PerformanceTable.tsx b/client/src/app/[site]/performance/components/PerformanceTable.tsx
index d86d69c23..f04a7a619 100644
--- a/client/src/app/[site]/performance/components/PerformanceTable.tsx
+++ b/client/src/app/[site]/performance/components/PerformanceTable.tsx
@@ -1,14 +1,7 @@
"use client";
import { Skeleton } from "@/components/ui/skeleton";
-import {
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow,
-} from "@/components/ui/table";
+import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
import {
createColumnHelper,
flexRender,
@@ -36,11 +29,7 @@ import { Pagination } from "../../../../components/pagination";
import { FilterParameter } from "@rybbit/shared";
import { useStore, addFilter, removeFilter } from "../../../../lib/store";
import { PerformanceMetric, usePerformanceStore } from "../performanceStore";
-import {
- formatMetricValue,
- getMetricColor,
- getMetricUnit,
-} from "../utils/performanceUtils";
+import { formatMetricValue, getMetricColor, getMetricUnit } from "../utils/performanceUtils";
import { CountryFlag } from "../../components/shared/icons/CountryFlag";
import { Browser } from "../../components/shared/icons/Browser";
import { OperatingSystem } from "../../components/shared/icons/OperatingSystem";
@@ -64,9 +53,7 @@ const MetricCell = ({
return (
<span className={getMetricColor(metric, value)}>
{formatMetricValue(metric, value)}
- <span className="text-xs ml-1 text-neutral-400">
- {getMetricUnit(metric, value)}
- </span>
+ <span className="text-xs ml-1 text-neutral-400">{getMetricUnit(metric, value)}</span>
</span>
);
};
@@ -84,9 +71,7 @@ const useFilterToggle = () => {
const toggleFilter = useCallback(
(parameter: FilterParameter, value: string) => {
- const foundFilter = filters.find(
- (f) => f.parameter === parameter && f.value.some((v) => v === value)
- );
+ const foundFilter = filters.find((f) => f.parameter === parameter && f.value.some((v) => v === value));
if (foundFilter) {
removeFilter(foundFilter);
} else {
@@ -113,9 +98,7 @@ export function PerformanceTable({ dimension, title }: PerformanceTableProps) {
pageSize: 25,
});
- const [sorting, setSorting] = useState<SortingState>([
- { id: "event_count", desc: true },
- ]);
+ const [sorting, setSorting] = useState<SortingState>([{ id: "event_count", desc: true }]);
const {
data: performanceData,
@@ -152,8 +135,7 @@ export function PerformanceTable({ dimension, title }: PerformanceTableProps) {
: dimension.charAt(0).toUpperCase() + dimension.slice(1),
cell: (info) => {
const value = info.getValue();
- const displayValue =
- value || (dimension === "pathname" ? "/" : "Unknown");
+ const displayValue = value || (dimension === "pathname" ? "/" : "Unknown");
const handleClick = () => {
if (value) {
@@ -202,7 +184,7 @@ export function PerformanceTable({ dimension, title }: PerformanceTableProps) {
onClick={(e) => e.stopPropagation()}
>
<SquareArrowOutUpRight
- className="w-3 h-3 text-neutral-300 hover:text-neutral-100"
+ className="ml-0.5 w-3.5 h-3.5 text-neutral-300 hover:text-neutral-100"
strokeWidth={3}
/>
</a>
@@ -222,11 +204,7 @@ export function PerformanceTable({ dimension, title }: PerformanceTableProps) {
),
cell: (info) => (
<div className="text-center">
- <MetricCell
- metric="lcp"
- value={info.getValue() as number}
- percentile={selectedPercentile}
- />
+ <MetricCell metric="lcp" value={info.getValue() as number} percentile={selectedPercentile} />
</div>
),
}),
@@ -239,11 +217,7 @@ export function PerformanceTable({ dimension, title }: PerformanceTableProps) {
),
cell: (info) => (
<div className="text-center">
- <MetricCell
- metric="cls"
- value={info.getValue() as number}
- percentile={selectedPercentile}
- />
+ <MetricCell metric="cls" value={info.getValue() as number} percentile={selectedPercentile} />
</div>
),
}),
@@ -256,11 +230,7 @@ export function PerformanceTable({ dimension, title }: PerformanceTableProps) {
),
cell: (info) => (
<div className="text-center">
- <MetricCell
- metric="inp"
- value={info.getValue() as number}
- percentile={selectedPercentile}
- />
+ <MetricCell metric="inp" value={info.getValue() as number} percentile={selectedPercentile} />
</div>
),
}),
@@ -273,11 +243,7 @@ export function PerformanceTable({ dimension, title }: PerformanceTableProps) {
),
cell: (info) => (
<div className="text-center">
- <MetricCell
- metric="fcp"
- value={info.getValue() as number}
- percentile={selectedPercentile}
- />
+ <MetricCell metric="fcp" value={info.getValue() as number} percentile={selectedPercentile} />
</div>
),
}),
@@ -290,21 +256,13 @@ export function PerformanceTable({ dimension, title }: PerformanceTableProps) {
),
cell: (info) => (
<div className="text-center">
- <MetricCell
- metric="ttfb"
- value={info.getValue() as number}
- percentile={selectedPercentile}
- />
+ <MetricCell metric="ttfb" value={info.getValue() as number} percentile={selectedPercentile} />
</div>
),
}),
columnHelper.accessor("event_count", {
header: "Events",
- cell: (info) => (
- <div className="text-center text-neutral-300">
- {info.getValue()?.toLocaleString() ?? 0}
- </div>
- ),
+ cell: (info) => <div className="text-center text-neutral-300">{info.getValue()?.toLocaleString() ?? 0}</div>,
}),
],
[selectedPercentile]
@@ -334,8 +292,7 @@ export function PerformanceTable({ dimension, title }: PerformanceTableProps) {
getCanPreviousPage: () => pagination.pageIndex > 0,
getCanNextPage: () => pagination.pageIndex < totalPages - 1,
getPageCount: () => totalPages,
- setPageIndex: (index: number) =>
- setPagination((prev) => ({ ...prev, pageIndex: index })),
+ setPageIndex: (index: number) => setPagination((prev) => ({ ...prev, pageIndex: index })),
previousPage: () =>
setPagination((prev) => ({
...prev,
@@ -448,10 +405,7 @@ export function PerformanceTable({ dimension, title }: PerformanceTableProps) {
onClick={header.column.getToggleSortingHandler()}
>
<div className="flex items-center justify-center gap-1">
- {flexRender(
- header.column.columnDef.header,
- header.getContext()
- )}
+ {flexRender(header.column.columnDef.header, header.getContext())}
{header.column.getCanSort() && (
<div className="flex flex-col">
{header.column.getIsSorted() === "asc" ? (
@@ -472,26 +426,15 @@ export function PerformanceTable({ dimension, title }: PerformanceTableProps) {
<TableBody>
{table.getRowModel().rows.length === 0 ? (
<TableRow>
- <TableCell
- colSpan={columns.length}
- className="text-center text-neutral-500 py-8"
- >
+ <TableCell colSpan={columns.length} className="text-center text-neutral-500 py-8">
No performance data available
</TableCell>
</TableRow>
) : (
table.getRowModel().rows.map((row) => (
- <TableRow
- key={row.id}
- className="border-neutral-800 hover:bg-neutral-900/50"
- >
+ <TableRow key={row.id} className="border-neutral-800 hover:bg-neutral-900/50">
{row.getVisibleCells().map((cell) => (
- <TableCell key={cell.id}>
- {flexRender(
- cell.column.columnDef.cell,
- cell.getContext()
- )}
- </TableCell>
+ <TableCell key={cell.id}>{flexRender(cell.column.columnDef.cell, cell.getContext())}</TableCell>
))}
</TableRow>
))