The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Add empty states
Tim Wilsone7da94de8208
diff --git a/apps/web/ui/analytics/events/empty-state.tsx b/apps/web/ui/analytics/events/empty-state.tsxnew file mode 100644index 0000000000..f9880b6257--- /dev/null+++ b/apps/web/ui/analytics/events/empty-state.tsx@@ -0,0 +1,31 @@+import { Button } from "@dub/ui";+import { InvoiceDollar } from "@dub/ui/src/icons";++export default function EmptyState() {+ return (+ <div className="flex flex-col items-center justify-center">+ <div className="flex h-16 w-16 items-center justify-center rounded-2xl border border-gray-200 bg-gray-50">+ <InvoiceDollar className="h-8 w-8 text-black" strokeWidth={0.75} />+ </div>+ <p className="mt-8 text-center font-medium text-gray-950">+ Lead and sales analytics+ </p>+ <p className="mt-4 max-w-md text-center text-gray-500">+ Collect insights on lead generation and sales with metrics. Learn about+ top-converting leads and best-selling products.+ </p>+ <div className="mt-8">+ <Button+ onClick={() => window.open("https://dub.co/docs", "_blank")}+ className="h-8"+ variant="secondary"+ text={+ <span className="bg-gradient-to-r from-violet-600 to-pink-600 bg-clip-text text-transparent">+ Enable Sales Analytics+ </span>+ }+ />+ </div>+ </div>+ );+}diff --git a/apps/web/ui/analytics/events/events-table.tsx b/apps/web/ui/analytics/events/events-table.tsxindex 5173ae094c..afeeb9609e 100644--- a/apps/web/ui/analytics/events/events-table.tsx+++ b/apps/web/ui/analytics/events/events-table.tsx@@ -38,6 +38,7 @@ import z from "zod";import { AnalyticsContext } from "../analytics-provider";import DeviceIcon from "../device-icon";import EditColumnsButton from "./edit-columns-button";+import EmptyState from "./empty-state";import EventsLinkType from "./events-link-type";import ExportButton from "./export-button";import usePagination from "./use-pagination";@@ -632,8 +633,14 @@ export default function EventsTable() {</table></div>) : (- <div className="flex h-64 w-full items-center justify-center text-sm text-gray-500">- {error ? "Failed to fetch data" : "No data available"}+ <div className="flex h-96 w-full items-center justify-center text-sm text-gray-500">+ {error ? (+ "Failed to fetch data"+ ) : tab === "clicks" ? (+ "No data available"+ ) : (+ <EmptyState />+ )}</div>)}<div className="sticky bottom-0 flex items-center justify-between rounded-b-[inherit] border-t border-gray-200 bg-white px-4 py-3.5 text-sm leading-6 text-gray-600">diff --git a/packages/ui/src/button.tsx b/packages/ui/src/button.tsxindex e88f0a7c17..8c8343a597 100644--- a/packages/ui/src/button.tsx+++ b/packages/ui/src/button.tsx@@ -34,7 +34,7 @@ const buttonVariants = cva(export interface ButtonPropsextends React.ButtonHTMLAttributes<HTMLButtonElement>,VariantProps<typeof buttonVariants> {- text?: string;+ text?: ReactNode | string;loading?: boolean;icon?: ReactNode;shortcut?: string;diff --git a/packages/ui/src/icons/nucleo/invoice-dollar.tsx b/packages/ui/src/icons/nucleo/invoice-dollar.tsxindex 526f30f4ed..6d21136234 100644--- a/packages/ui/src/icons/nucleo/invoice-dollar.tsx+++ b/packages/ui/src/icons/nucleo/invoice-dollar.tsx@@ -1,6 +1,9 @@import { SVGProps } from "react";-export function InvoiceDollar(props: SVGProps<SVGSVGElement>) {+export function InvoiceDollar({+ strokeWidth = 1.5,+ ...props+}: SVGProps<SVGSVGElement>) {return (<svgheight="18"@@ -16,7 +19,7 @@ export function InvoiceDollar(props: SVGProps<SVGSVGElement>) {stroke="currentColor"strokeLinecap="round"strokeLinejoin="round"- strokeWidth="1.5"+ strokeWidth={strokeWidth}/><pathd="M10.724,6.556c-.374-.885-1.122-1.086-1.688-1.086-.526,0-1.907,.28-1.779,1.606,.09,.931,.967,1.277,1.734,1.414s1.88,.429,1.907,1.551c.023,.949-.83,1.597-1.861,1.597-.985,0-1.67-.383-1.934-1.25"@@ -24,14 +27,14 @@ export function InvoiceDollar(props: SVGProps<SVGSVGElement>) {stroke="currentColor"strokeLinecap="round"strokeLinejoin="round"- strokeWidth="1.5"+ strokeWidth={strokeWidth}/><linefill="none"stroke="currentColor"strokeLinecap="round"strokeLinejoin="round"- strokeWidth="1.5"+ strokeWidth={strokeWidth}x1="9"x2="9"y1="4.75"@@ -42,7 +45,7 @@ export function InvoiceDollar(props: SVGProps<SVGSVGElement>) {stroke="currentColor"strokeLinecap="round"strokeLinejoin="round"- strokeWidth="1.5"+ strokeWidth={strokeWidth}x1="9"x2="9"y1="11.638"