Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Merge branch 'tim/events-list' of https://github.com/dubinc/dub into tim/events-list

Tim Wilson4c1e18ae7b98
diff --cc apps/web/ui/analytics/events/events-table.tsx
index 94a126f62d,081af8cf0f..8ceef7bc24
--- a/apps/web/ui/analytics/events/events-table.tsx
+++ b/apps/web/ui/analytics/events/events-table.tsx
@@@ -31,15 -31,15 +32,16 @@@ import
useReactTable,
} from "@tanstack/react-table";
import { AnimatePresence, motion } from "framer-motion";
+ import Link from "next/link";
-import { useContext, useEffect, useMemo } from "react";
+import { useContext, useEffect, useMemo, useRef, useState } from "react";
import useSWR from "swr";
import z from "zod";
import { AnalyticsContext } from "../analytics-provider";
import DeviceIcon from "../device-icon";
+import EventsTableMenu from "./events-table-menu";
import usePagination from "./use-pagination";
- const PAGE_SIZE = 500;
+ const PAGE_SIZE = 100;
const tableCellClassName =
"border-r border-b border-gray-200 px-4 py-2.5 text-left text-sm leading-6 whitespace-nowrap overflow-hidden [&>.flex]:pr-4";
@@@ -105,14 -83,13 +107,21 @@@ const eventColumns: Record
},
};
+const getDefaultColumnVisibility = (event: EventType) =>
+ Object.fromEntries(
+ eventColumns[event].all.map((id) => [
+ id,
+ eventColumns[event].defaultVisible.includes(id),
+ ]),
+ );
+
+ const FilterButton = () => (
+ <div className="group-hover:animate-slide-left-fade absolute right-0 rounded-lg border border-gray-200 bg-white p-1 opacity-0 shadow-lg group-hover:opacity-100">
+ <span className="sr-only">Filter</span>
+ <Filter className="h-3 w-3 text-black" />
+ </div>
+ );
+
export default function EventsTable() {
const { searchParams, queryParams } = useRouterStuff();
const tab = searchParams.get("tab") || "clicks";
@@@ -216,24 -211,10 +247,25 @@@
className="h-4 w-4"
/>
<span>{COUNTRIES[getValue()] ?? getValue()}</span>
- </div>
+ <FilterButton />
+ </Link>
),
},
+ {
+ id: "city",
+ header: "City",
+ accessorKey: "city",
+ cell: ({ getValue, row }) => (
+ <div className="flex items-center gap-3">
+ <img
+ alt={row.original.country}
+ src={`https://hatscripts.github.io/circle-flags/flags/${row.original.country.toLowerCase()}.svg`}
+ className="h-4 w-4"
+ />
+ <span>{getValue()}</span>
+ </div>
+ ),
+ },
{
id: "device",
header: "Device",
@@@ -246,39 -237,10 +288,40 @@@
className="h-4 w-4"
/>
<span>{getValue()}</span>
- </div>
+ <FilterButton />
+ </Link>
),
},
+ {
+ id: "browser",
+ header: "Browser",
+ accessorKey: "browser",
+ cell: ({ getValue }) => (
+ <div className="flex items-center gap-3">
+ <DeviceIcon
+ display={capitalize(getValue()) ?? getValue()}
+ tab="browsers"
+ className="h-4 w-4"
+ />
+ <span>{getValue()}</span>
+ </div>
+ ),
+ },
+ {
+ id: "os",
+ header: "OS",
+ accessorKey: "os",
+ cell: ({ getValue }) => (
+ <div className="flex items-center gap-3">
+ <DeviceIcon
+ display={capitalize(getValue()) ?? getValue()}
+ tab="os"
+ className="h-4 w-4"
+ />
+ <span>{getValue()}</span>
+ </div>
+ ),
+ },
// Date
{
id: "timestamp",