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.

Update page-client.tsx

Kiran K63c6168df332
diff --git a/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/page-client.tsx b/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/page-client.tsx
index b86784fb21..a5cb133db0 100644
--- a/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/page-client.tsx
+++ b/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/page-client.tsx
@@ -4,30 +4,57 @@ import { onboardProgramAction } from "@/lib/actions/partners/onboard-program";
import useWorkspace from "@/lib/swr/use-workspace";
import { Shopify } from "@/ui/layout/sidebar/conversions/icons/shopify";
import { Stripe } from "@/ui/layout/sidebar/conversions/icons/stripe";
-import { Button } from "@dub/ui";
+import { Button, ToggleGroup } from "@dub/ui";
+import { Framer } from "lucide-react";
import { useAction } from "next-safe-action/hooks";
-import Link from "next/link";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { toast } from "sonner";
-const GUIDES = [
+type IntegrationType = "no-code" | "code";
+
+type Guide = {
+ type: IntegrationType;
+ title: string;
+ description?: string;
+ icon: JSX.Element;
+ recommended?: boolean;
+};
+
+const guides: Guide[] = [
+ {
+ type: "no-code",
+ title: "Framer",
+ description: "Dub Analytics",
+ icon: <Framer />,
+ recommended: true,
+ },
{
- name: "Connecting to Stripe",
- icon: Stripe,
- href: "https://dub.co/docs/conversions/sales/stripe",
+ type: "no-code",
+ title: "Shopify",
+ description: "Dub Analytics",
+ icon: <Shopify />,
},
{
- name: "Connecting to Shopify",
- icon: Shopify,
- href: "https://dub.co/docs/conversions/sales/shopify",
+ type: "no-code",
+ title: "Webflow",
+ description: "Dub Analytics",
+ icon: <Stripe />,
},
-] as const;
+ {
+ type: "code",
+ title: "WordPress",
+ description: "Dub Analytics",
+ icon: <Shopify />,
+ },
+];
export function PageClient() {
const router = useRouter();
- const { id: workspaceId, slug: workspaceSlug, mutate } = useWorkspace();
const [hasSubmitted, setHasSubmitted] = useState(false);
+ const { id: workspaceId, slug: workspaceSlug, mutate } = useWorkspace();
+ const [integrationType, setIntegrationType] =
+ useState<IntegrationType>("no-code");
const { executeAsync, isPending } = useAction(onboardProgramAction, {
onSuccess: () => {
@@ -53,37 +80,58 @@ export function PageClient() {
<div className="space-y-10">
<div className="space-y-6">
<p className="text-sm text-neutral-600">
- Depending on your payment processor, select from the following guides
- to learn how to connect Dub and start tracking conversions.
+ Ensure your program is connected to your website, so you can track
+ your clicks, leads, and sales on your program.
</p>
<div className="flex flex-col gap-4">
- {GUIDES.map(({ name, icon: Icon, href }) => (
+ <ToggleGroup
+ className="flex w-full items-center gap-1 rounded-md border border-neutral-200 bg-neutral-100 p-1"
+ optionClassName="h-8 flex items-center justify-center rounded-md flex-1 text-sm font-medium transition-colors text-neutral-800"
+ indicatorClassName="bg-white shadow border-none rounded-md"
+ options={[
+ { value: "no-code", label: "No-code integrations" },
+ { value: "code", label: "Developer integrations" },
+ ]}
+ selected={integrationType}
+ selectAction={(id: IntegrationType) => setIntegrationType(id)}
+ />
+ </div>
+ </div>
+
+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3">
+ {guides
+ .filter((g) => g.type === integrationType)
+ .map((guide) => (
<div
- key={name}
- className="flex items-center justify-between rounded-lg border border-neutral-200 bg-neutral-50 p-4"
+ key={guide.title}
+ className="group relative flex h-40 flex-col justify-center rounded-lg bg-neutral-200/40 transition-colors duration-100 hover:bg-neutral-200/60"
>
- <div className="flex items-center gap-3">
- <Icon className="size-8" />
- <span className="text-sm font-medium text-neutral-900">
- {name}
+ {guide.recommended && (
+ <span className="absolute left-4 top-4 rounded-md bg-blue-100 px-2 py-0.5 text-xs font-semibold text-blue-700">
+ Recommended
</span>
+ )}
+
+ <div className="mb-4 flex h-16 items-center justify-center">
+ {guide.icon}
+ </div>
+
+ <div className="text-center">
+ <div className="text-sm font-semibold text-[##171717]">
+ {guide.title}
+ </div>
+ <div className="text-sm font-medium text-[#737373]">
+ {guide.description}
+ </div>
</div>
- <Link href={href} target="_blank" rel="noopener noreferrer">
- <Button
- type="button"
- text="Read guide"
- variant="secondary"
- className="h-8 w-fit px-3"
- />
- </Link>
</div>
))}
- </div>
</div>
<Button
- text="Continue"
+ text="I'll do this later"
+ variant="secondary"
className="w-full"
loading={isPending || hasSubmitted}
type="button"