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.

move the integrations under settings

Kiran K7b1e4ad5e9bc
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
deleted file mode 100644
index 4589e09fdf..0000000000
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-client.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-"use client";
-
-import useWorkspace from "@/lib/swr/use-workspace";
-import { InstalledIntegrationProps } from "@/lib/types";
-import IntegrationCard from "@/ui/oauth-apps/integration-card";
-import { redirect } from "next/navigation";
-
-export default function IntegrationsPageClient({
- integrations,
-}: {
- integrations: InstalledIntegrationProps[];
-}) {
- const { slug, flags } = useWorkspace();
-
- if (!flags?.integrations) {
- redirect(`/${slug}`);
- }
-
- return (
- <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.tsx
deleted file mode 100644
index 42235bf759..0000000000
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page-header.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-"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/[integrationSlug]/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/[integrationSlug]/page-client.tsx
similarity index 91%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/[integrationSlug]/page-client.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/[integrationSlug]/page-client.tsx
index 8688bc111a..cb50b8196b 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/[integrationSlug]/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/[integrationSlug]/page-client.tsx
@@ -30,7 +30,6 @@ export default function IntegrationPageClient({
integration: InstalledIntegrationInfoProps;
}) {
const { slug } = useWorkspace();
-
const [openPopover, setOpenPopover] = useState(false);
const { UninstallIntegrationModal, setShowUninstallIntegrationModal } =
@@ -39,16 +38,16 @@ export default function IntegrationPageClient({
});
return (
- <MaxWidthWrapper className="my-10 grid max-w-screen-lg gap-8">
+ <MaxWidthWrapper className="grid max-w-screen-lg gap-8">
{integration.installed && <UninstallIntegrationModal />}
<Link
- href={`/${slug}/integrations`}
+ href={`/${slug}/settings/integrations`}
className="flex items-center gap-x-1"
>
<ChevronLeft className="size-4" />
<p className="text-sm font-medium text-gray-500">Integrations</p>
</Link>
- <div className="flex justify-between">
+ <div className="flex justify-between gap-2">
<div className="flex items-center gap-x-3">
<div className="rounded-md border border-gray-200 bg-gradient-to-t from-gray-100 p-2">
{integration.logo ? (
@@ -68,6 +67,7 @@ export default function IntegrationPageClient({
<p className="text-sm text-gray-500">{integration.description}</p>
</div>
</div>
+
{integration.installed && (
<Popover
align="end"
@@ -105,7 +105,7 @@ export default function IntegrationPageClient({
{integration.installed && (
<div className="flex items-center gap-2">
<Avatar user={integration.installed.by} className="size-8" />
- <div>
+ <div className="flex flex-col gap-1">
<p className="text-xs text-gray-500">INSTALLED BY</p>
<p className="text-sm font-medium text-gray-700">
{integration.installed.by.name}
@@ -118,20 +118,24 @@ export default function IntegrationPageClient({
</div>
</div>
)}
- <div>
+
+ <div className="flex flex-col gap-1">
<p className="text-xs text-gray-500">DEVELOPER</p>
<div className="flex items-center gap-x-1 text-sm font-medium text-gray-700">
- <OfficeBuilding className="size-4" />
+ <OfficeBuilding className="size-3" />
{integration.developer}
</div>
</div>
- <div>
+
+ <div className="flex flex-col gap-1">
<p className="text-xs text-gray-500">WEBSITE</p>
<a
href={integration.website}
className="flex items-center gap-x-1 text-sm font-medium text-gray-700"
+ target="_blank"
+ rel="noopener noreferrer"
>
- <Globe className="size-4" />
+ <Globe className="size-3" />
{getPrettyUrl(integration.website)}
</a>
</div>
@@ -143,7 +147,7 @@ export default function IntegrationPageClient({
<p className="text-sm font-medium text-gray-700">Overview</p>
</div>
- {integration.screenshots?.length && (
+ {integration.screenshots && integration.screenshots.length > 0 ? (
<Carousel autoplay={{ delay: 5000 }} className="bg-white p-8">
<CarouselContent>
{integration.screenshots.map((src, idx) => (
@@ -160,7 +164,7 @@ export default function IntegrationPageClient({
</CarouselContent>
<CarouselNavBar variant="floating" />
</Carousel>
- )}
+ ) : null}
{integration.readme && (
<Markdown
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/[integrationSlug]/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/[integrationSlug]/page.tsx
similarity index 100%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/[integrationSlug]/page.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/[integrationSlug]/page.tsx
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page-client.tsx
new file mode 100644
index 0000000000..4ab62dadc2
--- /dev/null
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page-client.tsx
@@ -0,0 +1,50 @@
+"use client";
+
+import useWorkspace from "@/lib/swr/use-workspace";
+import { InstalledIntegrationProps } from "@/lib/types";
+import IntegrationCard from "@/ui/oauth-apps/integration-card";
+import { buttonVariants } from "@dub/ui";
+import { cn } from "@dub/utils";
+import Link from "next/link";
+import { redirect } from "next/navigation";
+
+export default function IntegrationsPageClient({
+ integrations,
+}: {
+ integrations: InstalledIntegrationProps[];
+}) {
+ const { slug, flags } = useWorkspace();
+
+ if (!flags?.integrations) {
+ redirect(`/${slug}`);
+ }
+
+ return (
+ <div className="flex flex-col gap-5">
+ <div className="flex flex-wrap justify-between">
+ <div className="flex items-center gap-x-2">
+ <h1 className="text-2xl font-semibold tracking-tight text-black">
+ Integrations
+ </h1>
+ </div>
+ <div className="flex w-full items-center gap-3 sm:w-auto">
+ <Link
+ href={`/${slug}/settings/oauth-apps`}
+ className={cn(
+ buttonVariants({ variant: "primary" }),
+ "flex h-10 items-center justify-center whitespace-nowrap rounded-lg border px-4 text-sm",
+ )}
+ >
+ Create Integration
+ </Link>
+ </div>
+ </div>
+
+ <div className="grid gap-3 sm:grid-cols-2">
+ {integrations.map((integration) => (
+ <IntegrationCard key={integration.clientId} {...integration} />
+ ))}
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page.tsx
similarity index 57%
rename from apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page.tsx
rename to apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page.tsx
index 1cf29e5fdf..90aa8206f7 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/integrations/page.tsx
@@ -1,32 +1,21 @@
import { prisma } from "@/lib/prisma";
import OAuthAppPlaceholder from "@/ui/oauth-apps/oauth-app-placeholder";
-import { MaxWidthWrapper } from "@dub/ui";
import { Suspense } from "react";
import IntegrationsPageClient from "./page-client";
-import PageHeader from "./page-header";
export const revalidate = 300; // 5 minutes
-export default async function IntegrationsPage({
- params,
-}: {
- params: { slug: string };
-}) {
- const { slug } = params;
-
+export default async function IntegrationsPage() {
return (
<>
- <PageHeader slug={slug} />
- <MaxWidthWrapper className="flex flex-col gap-3 py-4">
- <Suspense fallback={<Loader />}>
- <Integrations slug={slug} />
- </Suspense>
- </MaxWidthWrapper>
+ <Suspense fallback={<Loader />}>
+ <Integrations />
+ </Suspense>
</>
);
}
-const Integrations = async ({ slug }: { slug: string }) => {
+const Integrations = async () => {
const integrations = await prisma.oAuthApp.findMany({
where: {
verified: true,
@@ -52,8 +41,8 @@ const Integrations = async ({ slug }: { slug: string }) => {
const Loader = () => {
return (
- <div className="grid gap-4 sm:grid-cols-3">
- {Array.from({ length: 3 }).map((_, i) => (
+ <div className="grid gap-3 sm:grid-cols-2">
+ {Array.from({ length: 4 }).map((_, i) => (
<OAuthAppPlaceholder key={i} />
))}
</div>
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/[appId]/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/[appId]/page-client.tsx
index bbb61de666..2ed8ca3780 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/[appId]/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/[appId]/page-client.tsx
@@ -66,7 +66,7 @@ export default function OAuthAppManagePageClient({ appId }: { appId: string }) {
Back to OAuth Apps
</p>
</Link>
- <div className="flex justify-between">
+ <div className="flex justify-between gap-2">
{isLoading ? (
<div className="flex items-center gap-x-3">
<div className="rounded-md border border-gray-200 bg-gradient-to-t from-gray-100 p-2">
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page-client.tsx
index 9973058a36..515f79538f 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/oauth-apps/page-client.tsx
@@ -34,7 +34,7 @@ export default function OAuthAppsPageClient() {
<InfoTooltip
content={
<TooltipContent
- title="Learn more about how to add, configure, and verify OAuth applications on Dub."
+ title="Learn more about how to manage OAuth applications on Dub."
href="https://dub.co/help/category/custom-domains"
target="_blank"
cta="Learn more"
diff --git a/apps/web/ui/oauth-apps/integration-card.tsx b/apps/web/ui/oauth-apps/integration-card.tsx
index 01bff3b2c1..d3172c2782 100644
--- a/apps/web/ui/oauth-apps/integration-card.tsx
+++ b/apps/web/ui/oauth-apps/integration-card.tsx
@@ -17,7 +17,7 @@ export default function IntegrationCard(
return (
<Link
- href={`/${slug}/integrations/${integration.slug}`}
+ href={`/${slug}/settings/integrations/${integration.slug}`}
className="relative rounded-xl border border-gray-200 bg-white px-5 py-4 transition-[filter] hover:[filter:drop-shadow(0_8px_12px_#222A350d)_drop-shadow(0_32px_80px_#2f30370f)]"
>
{installed && (