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 dedicated guide page

Kiran K76eb204146b4
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 a03c46efdc..25d276302b 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
@@ -1,13 +1,13 @@
"use client";
import { ProgramData } from "@/lib/types";
+import { Guide } from "@/ui/guides/guide";
+import { GuideList } from "@/ui/guides/guide-list";
+import { guides, IntegrationGuide } from "@/ui/guides/integrations";
import { getDomainWithoutWWW } from "@dub/utils";
import { useSearchParams } from "next/navigation";
import { useEffect, useState } from "react";
import { useFormContext } from "react-hook-form";
-import { Guide } from "./guide";
-import { GuideList } from "./guide-list";
-import { guides, IntegrationGuide } from "./integration-guides";
interface PageClientProps {
markdown: string | null;
diff --git a/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/page.tsx b/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/page.tsx
index e45453b96b..c53b85fb90 100644
--- a/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/page.tsx
+++ b/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/page.tsx
@@ -1,9 +1,9 @@
+import { guides, IntegrationGuide } from "@/ui/guides/integrations";
import { readFileSync } from "fs";
import { notFound } from "next/navigation";
import { join } from "path";
import { Suspense } from "react";
import { StepPage } from "../step-page";
-import { guides, IntegrationGuide } from "./integration-guides";
import { PageClient } from "./page-client";
export default async function Page({
diff --git a/apps/web/app/(ee)/app.dub.co/[slug]/(guide)/tracking-guide/layout.tsx b/apps/web/app/(ee)/app.dub.co/[slug]/(guide)/tracking-guide/layout.tsx
new file mode 100644
index 0000000000..909dc48577
--- /dev/null
+++ b/apps/web/app/(ee)/app.dub.co/[slug]/(guide)/tracking-guide/layout.tsx
@@ -0,0 +1,15 @@
+"use client";
+
+export default function Layout({ children }: { children: React.ReactNode }) {
+ return (
+ <div className="min-h-screen bg-white">
+ <main className="mx-auto max-w-xl px-4 py-16 md:px-6 lg:px-8">
+ <h1 className="mb-2 text-2xl font-semibold leading-8 text-neutral-900">
+ Connecting Dub
+ </h1>
+
+ {children}
+ </main>
+ </div>
+ );
+}
diff --git a/apps/web/app/(ee)/app.dub.co/[slug]/(guide)/tracking-guide/page-client.tsx b/apps/web/app/(ee)/app.dub.co/[slug]/(guide)/tracking-guide/page-client.tsx
new file mode 100644
index 0000000000..e651cb679d
--- /dev/null
+++ b/apps/web/app/(ee)/app.dub.co/[slug]/(guide)/tracking-guide/page-client.tsx
@@ -0,0 +1,52 @@
+"use client";
+
+import { Guide } from "@/ui/guides/guide";
+import { GuideList } from "@/ui/guides/guide-list";
+import { guides, IntegrationGuide } from "@/ui/guides/integrations";
+import { useSearchParams } from "next/navigation";
+import { useEffect, useState } from "react";
+
+interface PageClientProps {
+ markdown: string | null;
+}
+
+export function PageClient({ markdown }: PageClientProps) {
+ const searchParams = useSearchParams();
+
+ const [selectedGuide, setSelectedGuide] = useState<IntegrationGuide | null>(
+ null,
+ );
+
+ useEffect(() => {
+ const guide = searchParams.get("guide");
+
+ if (!guide) {
+ setSelectedGuide(null);
+ return;
+ }
+
+ const integrationGuide = guides.find((g) => g.key === guide.toLowerCase());
+
+ if (integrationGuide) {
+ setSelectedGuide(integrationGuide);
+ }
+ }, [searchParams]);
+
+ return (
+ <div>
+ <p className="mb-6 text-sm text-neutral-600">
+ Ensure Dub is connected to your app, so you can track your clicks,
+ leads, and sales on your program. A developer might be required to
+ complete.
+ </p>
+
+ <div>
+ {selectedGuide ? (
+ <Guide selectedGuide={selectedGuide} markdown={markdown} />
+ ) : (
+ <GuideList showConnectLaterButton={false} />
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/app/(ee)/app.dub.co/[slug]/(guide)/tracking-guide/page.tsx b/apps/web/app/(ee)/app.dub.co/[slug]/(guide)/tracking-guide/page.tsx
new file mode 100644
index 0000000000..92891935ba
--- /dev/null
+++ b/apps/web/app/(ee)/app.dub.co/[slug]/(guide)/tracking-guide/page.tsx
@@ -0,0 +1,53 @@
+import { guides, IntegrationGuide } from "@/ui/guides/integrations";
+import { readFileSync } from "fs";
+import { notFound } from "next/navigation";
+import { join } from "path";
+import { Suspense } from "react";
+import { PageClient } from "./page-client";
+
+export default async function Page({
+ searchParams,
+}: {
+ searchParams: {
+ guide: string;
+ };
+}) {
+ let { guide } = searchParams;
+ let selectedGuide: IntegrationGuide | null = null;
+ let markdown: string | null = null;
+
+ if (guide) {
+ selectedGuide = guides.find((g) => g.key === guide.toLowerCase()) ?? null;
+
+ if (!selectedGuide) {
+ notFound();
+ }
+
+ markdown = getMarkdown(selectedGuide.key);
+
+ if (!markdown) {
+ notFound();
+ }
+ }
+
+ return (
+ <Suspense fallback={<div>Loading...</div>}>
+ <PageClient markdown={markdown} />
+ </Suspense>
+ );
+}
+
+function getMarkdown(guideKey: string): string | null {
+ const markdownPath = join(
+ process.cwd(),
+ "integration-guides",
+ `${guideKey}.md`,
+ );
+
+ try {
+ return readFileSync(markdownPath, "utf-8");
+ } catch (error) {
+ console.warn(`Guide content not found for: ${guideKey}`);
+ return null;
+ }
+}
diff --git a/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/guide-list.tsx b/apps/web/ui/guides/guide-list.tsx
similarity index 90%
rename from apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/guide-list.tsx
rename to apps/web/ui/guides/guide-list.tsx
index f45b1d75b5..6a1aa2ea8a 100644
--- a/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/guide-list.tsx
+++ b/apps/web/ui/guides/guide-list.tsx
@@ -9,15 +9,12 @@ import {
ProgramSheetAccordionTrigger,
} from "@/ui/partners/program-sheet-accordion";
import { Button, Copy, useCopyToClipboard } from "@dub/ui";
+import { cn } from "@dub/utils";
import { Check } from "lucide-react";
import Link from "next/link";
import { useState } from "react";
import { toast } from "sonner";
-import {
- guides,
- IntegrationGuide,
- IntegrationType,
-} from "./integration-guides";
+import { guides, IntegrationGuide, IntegrationType } from "./integrations";
const sections: {
type: IntegrationType;
@@ -50,7 +47,11 @@ const sections: {
},
];
-export function GuideList() {
+interface GuideListProps {
+ showConnectLaterButton?: boolean;
+}
+
+export function GuideList({ showConnectLaterButton = true }: GuideListProps) {
const { slug: workspaceSlug } = useWorkspace();
const [copied, copyToClipboard] = useCopyToClipboard();
@@ -185,7 +186,12 @@ export function GuideList() {
})}
</ProgramSheetAccordion>
- <div className="mt-10 flex items-center justify-between gap-4">
+ <div
+ className={cn(
+ "mt-6 flex items-center justify-between gap-4",
+ !showConnectLaterButton && "justify-center",
+ )}
+ >
<Button
text="Share with a developer"
className="h-8 w-fit rounded-lg"
@@ -200,13 +206,15 @@ export function GuideList() {
}}
/>
- <Link href={`/${workspaceSlug}/program/new/overview`}>
- <Button
- text="I'll connect Dub later"
- className="h-8 w-fit rounded-lg"
- variant="secondary"
- />
- </Link>
+ {showConnectLaterButton && (
+ <Link href={`/${workspaceSlug}/program/new/overview`}>
+ <Button
+ text="I'll connect Dub later"
+ className="h-8 w-fit rounded-lg"
+ variant="secondary"
+ />
+ </Link>
+ )}
</div>
</div>
);
diff --git a/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/guide.tsx b/apps/web/ui/guides/guide.tsx
similarity index 99%
rename from apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/guide.tsx
rename to apps/web/ui/guides/guide.tsx
index 0a507d44f7..44ad352a43 100644
--- a/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/guide.tsx
+++ b/apps/web/ui/guides/guide.tsx
@@ -3,7 +3,7 @@
import useWorkspace from "@/lib/swr/use-workspace";
import { Button } from "@dub/ui";
import { useRouter } from "next/navigation";
-import { IntegrationGuide, IntegrationType } from "./integration-guides";
+import { IntegrationGuide, IntegrationType } from "./integrations";
import { Markdown } from "./markdown";
interface GuideProps {
diff --git a/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/integration-guides.ts b/apps/web/ui/guides/integrations.ts
similarity index 100%
rename from apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/integration-guides.ts
rename to apps/web/ui/guides/integrations.ts
diff --git a/apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/markdown.tsx b/apps/web/ui/guides/markdown.tsx
similarity index 100%
rename from apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/markdown.tsx
rename to apps/web/ui/guides/markdown.tsx