🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Enhance user analytics and page navigation
Bill Yang243e52b86327
diff --git a/client/src/api/analytics/users.ts b/client/src/api/analytics/users.tsindex f6113a89d..0a3e885e8 100644--- a/client/src/api/analytics/users.ts+++ b/client/src/api/analytics/users.ts@@ -63,5 +63,7 @@ export function useGetUsers(options: GetUsersOptions) {sortOrder,}).then((res) => res.json());},+ staleTime: Infinity,+ refetchOnWindowFocus: false,});}diff --git a/client/src/app/[site]/users/page.tsx b/client/src/app/[site]/users/page.tsxindex 01ed44c41..ce9051113 100644--- a/client/src/app/[site]/users/page.tsx+++ b/client/src/app/[site]/users/page.tsx@@ -2,6 +2,7 @@import { useState } from "react";import { useParams, useRouter } from "next/navigation";+import Link from "next/link";import {createColumnHelper,flexRender,@@ -256,22 +257,35 @@ export default function UsersPage() {</td></tr>) : (- table.getRowModel().rows.map((row) => (- <tr- key={row.id}- className="border-b border-neutral-800 hover:bg-neutral-800 cursor-pointer"- onClick={() => handleRowClick(row.original.user_id)}- >- {row.getVisibleCells().map((cell) => (- <td key={cell.id} className="px-4 py-3">- {flexRender(- cell.column.columnDef.cell,- cell.getContext()- )}- </td>- ))}- </tr>- ))+ table.getRowModel().rows.map((row) => {+ const userId = row.original.user_id;+ const href = `/${site}/user/${userId}`;++ return (+ <tr+ key={row.id}+ className="border-b border-neutral-800 hover:bg-neutral-800 cursor-pointer group"+ >+ {row.getVisibleCells().map((cell) => (+ <td key={cell.id} className="px-4 py-3 relative">+ <Link+ href={href}+ className="absolute inset-0 z-10"+ aria-label={`View user ${userId}`}+ >+ <span className="sr-only">View user details</span>+ </Link>+ <span className="relative z-0">+ {flexRender(+ cell.column.columnDef.cell,+ cell.getContext()+ )}+ </span>+ </td>+ ))}+ </tr>+ );+ }))}</tbody></table>diff --git a/server/src/api/analytics/getUsers.ts b/server/src/api/analytics/getUsers.tsindex 3b5367891..f106e9575 100644--- a/server/src/api/analytics/getUsers.ts+++ b/server/src/api/analytics/getUsers.ts@@ -80,7 +80,7 @@ SELECTargMax(browser, timestamp) AS browser,argMax(operating_system, timestamp) AS operating_system,argMax(device_type, timestamp) AS device_type,- count() AS pageviews,+ countIf(type = 'pageview') AS pageviews,countIf(type = 'custom_event') AS events,count(distinct session_id) AS sessions,max(timestamp) AS last_seen,