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 the guides list

Kiran Kdd5aae2df3f1
diff --git a/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/guide-list.tsx b/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/guide-list.tsx
new file mode 100644
index 0000000000..9b9f84316b
--- /dev/null
+++ b/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/guide-list.tsx
@@ -0,0 +1,104 @@
+import { Shopify } from "@/ui/layout/sidebar/conversions/icons/shopify";
+import { Stripe } from "@/ui/layout/sidebar/conversions/icons/stripe";
+import { ToggleGroup } from "@dub/ui";
+import { Framer } from "lucide-react";
+
+export type IntegrationType = "no-code" | "code";
+
+export type Guide = {
+ type: IntegrationType;
+ title: string;
+ description?: string;
+ icon: JSX.Element;
+ recommended?: boolean;
+};
+
+interface GuidesListProps {
+ integrationType: IntegrationType;
+ onIntegrationTypeChange: (type: IntegrationType) => void;
+}
+
+export const guides: Guide[] = [
+ {
+ type: "no-code",
+ title: "Framer",
+ description: "Dub Analytics",
+ icon: <Framer />,
+ recommended: true,
+ },
+ {
+ type: "no-code",
+ title: "Shopify",
+ description: "Dub Analytics",
+ icon: <Shopify />,
+ },
+ {
+ type: "no-code",
+ title: "Webflow",
+ description: "Dub Analytics",
+ icon: <Stripe />,
+ },
+ {
+ type: "code",
+ title: "WordPress",
+ description: "Dub Analytics",
+ icon: <Shopify />,
+ },
+];
+
+export function GuidesList({
+ integrationType,
+ onIntegrationTypeChange,
+}: GuidesListProps) {
+ return (
+ <>
+ <div className="flex flex-col gap-4">
+ <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={onIntegrationTypeChange}
+ />
+ </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={guide.title}
+ className="group relative flex h-40 cursor-pointer flex-col justify-center rounded-lg bg-neutral-200/40 transition-colors duration-100 hover:bg-neutral-200/60"
+ >
+ {guide.recommended && (
+ <span className="absolute -top-2 left-1/2 z-10 -translate-x-1/2 rounded-md bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-600">
+ Recommended
+ </span>
+ )}
+
+ <div className="mb-4 flex h-16 items-center justify-center">
+ <IconWrapper>{guide.icon}</IconWrapper>
+ </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>
+ </div>
+ ))}
+ </div>
+ </>
+ );
+}
+
+const IconWrapper = ({ children }: { children: React.ReactNode }) => (
+ <div className="flex size-11 items-center justify-center">{children}</div>
+);
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 2ae24b51e4..ae30e28e3c 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
@@ -2,56 +2,12 @@
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, ToggleGroup } from "@dub/ui";
-import { Framer } from "lucide-react";
+import { Button } from "@dub/ui";
import { useAction } from "next-safe-action/hooks";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { toast } from "sonner";
-
-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,
- },
- {
- type: "no-code",
- title: "Shopify",
- description: "Dub Analytics",
- icon: <Shopify />,
- },
- {
- type: "no-code",
- title: "Webflow",
- description: "Dub Analytics",
- icon: <Stripe />,
- },
- {
- type: "code",
- title: "WordPress",
- description: "Dub Analytics",
- icon: <Shopify />,
- },
-];
-
-const IconWrapper = ({ children }: { children: React.ReactNode }) => (
- <div className="flex size-11 items-center justify-center">{children}</div>
-);
+import { GuidesList, type IntegrationType } from "./guide-list";
export function PageClient() {
const router = useRouter();
@@ -81,66 +37,27 @@ export function PageClient() {
};
return (
- <div className="space-y-10">
- <div className="space-y-6">
- <p className="text-sm text-neutral-600">
- 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">
- <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>
+ <p className="text-sm text-neutral-600">
+ Ensure your program is connected to your website, so you can track your
+ clicks, leads, and sales on your program.
+ </p>
+
+ <div className="mt-6 space-y-10">
+ <GuidesList
+ integrationType={integrationType}
+ onIntegrationTypeChange={setIntegrationType}
+ />
+
+ <Button
+ text="I'll do this later"
+ variant="secondary"
+ className="w-full"
+ loading={isPending || hasSubmitted}
+ type="button"
+ onClick={onClick}
+ />
</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={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"
- >
- {guide.recommended && (
- <span className="absolute -top-2 left-1/2 z-10 -translate-x-1/2 rounded-md bg-blue-100 px-2 py-0.5 text-xs font-medium text-blue-600">
- Recommended
- </span>
- )}
-
- <div className="mb-4 flex h-16 items-center justify-center">
- <IconWrapper>{guide.icon}</IconWrapper>
- </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>
- </div>
- ))}
- </div>
-
- <Button
- text="I'll do this later"
- variant="secondary"
- className="w-full"
- loading={isPending || hasSubmitted}
- type="button"
- onClick={onClick}
- />
</div>
);
}