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.

add empty states

Steven Tey8db070cb4f62
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/manage/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/manage/page-client.tsx
index a547e936eb..261e8548ff 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/manage/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/manage/page-client.tsx
@@ -2,7 +2,10 @@
import useWorkspace from "@/lib/swr/use-workspace";
import { OAuthAppProps } from "@/lib/types";
-import { LoadingSpinner, MaxWidthWrapper, buttonVariants } from "@dub/ui";
+import IntegrationCardPlaceholder from "@/ui/integrations/integration-card-placeholder";
+import EmptyState from "@/ui/shared/empty-state";
+import { MaxWidthWrapper, buttonVariants } from "@dub/ui";
+import { HexadecagonStar } from "@dub/ui/src/icons";
import { cn, fetcher } from "@dub/utils";
import Link from "next/link";
import { redirect } from "next/navigation";
@@ -45,15 +48,25 @@ export default function IntegrationConsolePageClient() {
</div>
<MaxWidthWrapper className="flex flex-col gap-3 py-4">
- <div className="grid gap-4 sm:grid-cols-3">
- {isLoading ? (
- <LoadingSpinner />
- ) : (
- integrations?.map((integration) => (
- <IntegrationCard key={integration.id} {...integration} />
- ))
- )}
- </div>
+ {integrations && integrations.length === 0 ? (
+ <div className="flex w-full items-center justify-center rounded-xl border border-gray-200 bg-white py-10">
+ <EmptyState
+ icon={HexadecagonStar}
+ title="No integrations found"
+ description="You haven't added any integrations yet."
+ />
+ </div>
+ ) : (
+ <div className="grid gap-4 sm:grid-cols-3">
+ {isLoading || !integrations
+ ? Array.from({ length: 3 }).map((_, i) => (
+ <IntegrationCardPlaceholder key={i} />
+ ))
+ : integrations.map((integration) => (
+ <IntegrationCard key={integration.id} {...integration} />
+ ))}
+ </div>
+ )}
</MaxWidthWrapper>
</>
);
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-client.tsx
index 030a233991..c980076946 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-client.tsx
@@ -2,11 +2,11 @@
import useWorkspace from "@/lib/swr/use-workspace";
import { OAuthAppProps } from "@/lib/types";
+import IntegrationCard from "@/ui/integrations/integration-card";
import { MaxWidthWrapper, buttonVariants } from "@dub/ui";
import { cn } from "@dub/utils";
import Link from "next/link";
import { redirect } from "next/navigation";
-import IntegrationCard from "./integration-card";
export default function IntegrationsPageClient({
integrations,
diff --git a/apps/web/ui/integrations/integration-card-placeholder.tsx b/apps/web/ui/integrations/integration-card-placeholder.tsx
new file mode 100644
index 0000000000..ce7b9ba44a
--- /dev/null
+++ b/apps/web/ui/integrations/integration-card-placeholder.tsx
@@ -0,0 +1,18 @@
+export default function IntegrationCardPlaceholder() {
+ return (
+ <div className="relative grid gap-4 rounded-xl border border-gray-200 bg-white px-5 py-4">
+ <div className="flex items-center gap-2">
+ <div className="flex h-10 w-10 items-center justify-center rounded-full bg-gray-100" />
+ <div className="flex flex-col gap-1">
+ <div className="h-3 w-20 rounded-full bg-gray-100"></div>
+ <div className="h-3 w-28 rounded-full bg-gray-100"></div>
+ </div>
+ </div>
+
+ <div className="flex flex-col gap-2">
+ <div className="h-4 w-36 rounded-full bg-gray-100"></div>
+ <div className="h-4 w-48 rounded-full bg-gray-100"></div>
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/integration-card.tsx b/apps/web/ui/integrations/integration-card.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/integration-card.tsx
rename to apps/web/ui/integrations/integration-card.tsx