The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix loading state
Kiran K35fcd0611094
diff --git a/apps/web/scripts/backfill-customers.ts b/apps/web/scripts/backfill-customers.tsindex 044e602a37..e00162f4de 100644--- a/apps/web/scripts/backfill-customers.ts+++ b/apps/web/scripts/backfill-customers.ts@@ -1,6 +1,6 @@+import "dotenv-flow/config";import { getClickEvent, getLeadEvent } from "@/lib/tinybird";import { prisma } from "@dub/prisma";-import "dotenv-flow/config";// Backfill new customer columns such as linkId, clickId, country@@ -12,7 +12,7 @@ async function main() {select: {id: true,},- take: 1,+ take: 10,});if (customers.length === 0) {@@ -60,7 +60,7 @@ async function main() {linkId: clickEvent.link_id,clickId: clickEvent.click_id,country: clickEvent.country,- clickedAt: clickEvent.timestamp,+ clickedAt: new Date(clickEvent.timestamp),},select: {id: true,diff --git a/apps/web/ui/partners/customer-details-sheet.tsx b/apps/web/ui/partners/customer-details-sheet.tsxindex c093e22ea1..bd89b7ad37 100644--- a/apps/web/ui/partners/customer-details-sheet.tsx+++ b/apps/web/ui/partners/customer-details-sheet.tsx@@ -11,7 +11,6 @@ import {CopyButton,CursorRays,FilterBars,- GreekTemple,Link4,MoneyBill2,Sheet,@@ -32,7 +31,6 @@ import { UserPlus2 } from "lucide-react";import Link from "next/link";import { Dispatch, SetStateAction, useState } from "react";import useSWR from "swr";-import { AnimatedEmptyState } from "../shared/animated-empty-state";interface CustomerDetailsSheetProps {customer: Customer;@@ -45,11 +43,10 @@ function CustomerDetailsSheetContent({}: CustomerDetailsSheetProps) {const { id: workspaceId, slug } = useWorkspace();- const { data: customerActivity, isLoading } =- useSWR<CustomerActivityResponse>(- `/api/customers/${customer.id}/activity?workspaceId=${workspaceId}`,- fetcher,- );+ let { data: customerActivity, isLoading } = useSWR<CustomerActivityResponse>(+ `/api/customers/${customer.id}/activity?workspaceId=${workspaceId}`,+ fetcher,+ );const link = customerActivity?.link;const events = customerActivity?.activity;@@ -96,7 +93,7 @@ function CustomerDetailsSheetContent({<FilterBars className="hidden size-3 transition-transform group-hover:block" /></Link>) : (- <div className="h-4 w-20 animate-pulse rounded-full bg-neutral-200 px-1.5 py-0.5" />+ <div className="h-5 w-20 animate-pulse rounded-full bg-neutral-200" />)}{customer.country && (@@ -237,20 +234,12 @@ function CustomerDetailsSheetContent({</div><div className="flex grow flex-col p-6">- {isLoading || !customerActivity ? (- <AnimatedEmptyState- className="md:min-h-80"- title="No activities"- description="This customer has no activities yet."- cardContent={() => (- <>- <div className="flex size-7 items-center justify-center rounded-md border border-neutral-200 bg-neutral-50">- <GreekTemple className="size-4 text-neutral-700" />- </div>- <div className="h-2.5 w-28 min-w-0 rounded-sm bg-neutral-200" />- </>- )}- />+ {isLoading && !events ? (+ <div className="flex flex-col gap-5">+ <ActivitySkeleton />+ <ActivitySkeleton />+ <ActivitySkeleton />+ </div>) : (<ul className="flex flex-col gap-5">{(events || []).map((activity, index) => (@@ -325,6 +314,21 @@ function Activity({);}+function ActivitySkeleton() {+ return (+ <div className="flex items-center">+ <div className="relative mr-3 flex-shrink-0">+ <div className="size-4 animate-pulse rounded-md bg-neutral-200" />+ <div className="absolute left-1/2 mt-1 h-4 border-l border-neutral-300" />+ </div>+ <div className="flex-grow">+ <div className="h-4 w-1/2 animate-pulse rounded bg-neutral-200" />+ </div>+ <div className="ml-2 h-4 w-16 animate-pulse rounded bg-neutral-200" />+ </div>+ );+}+function CustomerDetailsSheet({isOpen,...rest