The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
add loading state
Kiran K3b7aed480cb4
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.tsxindex 368cc86862..94274a4043 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@@ -3,9 +3,6 @@import useWorkspace from "@/lib/swr/use-workspace";import { InstalledIntegrationProps } 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";export default function IntegrationsPageClient({@@ -20,44 +17,10 @@ export default function IntegrationsPageClient({}return (- <>- <div className="flex h-36 w-full items-center border-b border-gray-200 bg-white">- <MaxWidthWrapper>- <div className="flex items-center justify-between">- <h1 className="text-2xl font-semibold tracking-tight text-black">- Integrations- </h1>- <div className="flex gap-2">- <Link- href={`/${slug}/integrations/new`}- className={cn(- buttonVariants({ variant: "primary" }),- "flex h-10 items-center justify-center whitespace-nowrap rounded-lg border px-4 text-sm",- )}- >- Create Integration- </Link>- <Link- href={`/${slug}/integrations/manage`}- className={cn(- buttonVariants({ variant: "secondary" }),- "flex h-10 items-center justify-center whitespace-nowrap rounded-lg border px-4 text-sm",- )}- >- My Integrations- </Link>- </div>- </div>- </MaxWidthWrapper>- </div>-- <MaxWidthWrapper className="flex flex-col gap-3 py-4">- <div className="grid gap-4 sm:grid-cols-3">- {integrations.map((integration) => (- <IntegrationCard key={integration.clientId} {...integration} />- ))}- </div>- </MaxWidthWrapper>- </>+ <div className="grid gap-4 sm:grid-cols-3">+ {integrations.map((integration) => (+ <IntegrationCard key={integration.clientId} {...integration} />+ ))}+ </div>);}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-header.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-header.tsxnew file mode 100644index 0000000000..42235bf759--- /dev/null+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-header.tsx@@ -0,0 +1,39 @@+"use client";++import { buttonVariants, MaxWidthWrapper } from "@dub/ui";+import { cn } from "@dub/utils";+import Link from "next/link";++export default function PageHeader({ slug }: { slug: string }) {+ return (+ <div className="flex h-36 w-full items-center border-b border-gray-200 bg-white">+ <MaxWidthWrapper>+ <div className="flex items-center justify-between">+ <h1 className="text-2xl font-semibold tracking-tight text-black">+ Integrations+ </h1>+ <div className="flex gap-2">+ <Link+ href={`/${slug}/integrations/new`}+ className={cn(+ buttonVariants({ variant: "primary" }),+ "flex h-10 items-center justify-center whitespace-nowrap rounded-lg border px-4 text-sm",+ )}+ >+ Create Integration+ </Link>+ <Link+ href={`/${slug}/integrations/manage`}+ className={cn(+ buttonVariants({ variant: "secondary" }),+ "flex h-10 items-center justify-center whitespace-nowrap rounded-lg border px-4 text-sm",+ )}+ >+ My Integrations+ </Link>+ </div>+ </div>+ </MaxWidthWrapper>+ </div>+ );+}diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page.tsxindex 9ce35a3ba8..d8799f90e9 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page.tsx@@ -1,11 +1,30 @@import { prisma } from "@/lib/prisma";+import OAuthAppPlaceholder from "@/ui/integrations/oauth-app-placeholder";+import { MaxWidthWrapper } from "@dub/ui";+import { Suspense } from "react";import IntegrationsPageClient from "./page-client";+import PageHeader from "./page-header";export default async function IntegrationsPage({params,}: {params: { slug: string };}) {+ const { slug } = params;++ return (+ <>+ <PageHeader slug={slug} />+ <MaxWidthWrapper className="flex flex-col gap-3 py-4">+ <Suspense fallback={<Loader />}>+ <Integrations slug={slug} />+ </Suspense>+ </MaxWidthWrapper>+ </>+ );+}++const Integrations = async ({ slug }: { slug: string }) => {const integrations = await prisma.oAuthApp.findMany({where: {verified: true,@@ -19,7 +38,7 @@ export default async function IntegrationsPage({authorizedApps: {where: {project: {- slug: params.slug,+ slug,},},},@@ -35,4 +54,14 @@ export default async function IntegrationsPage({}))}/>);-}+};++const Loader = () => {+ return (+ <div className="grid gap-4 sm:grid-cols-3">+ {Array.from({ length: 3 }).map((_, i) => (+ <OAuthAppPlaceholder key={i} />+ ))}+ </div>+ );+};