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 header

Kiran K98d85f7290e0
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/(new)/layout.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/(new)/layout.tsx
index fb71cc856e..dc86594e02 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/(new)/layout.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/(new)/layout.tsx
@@ -1,36 +1,11 @@
-import { Button, Wordmark } from "@dub/ui";
import RootProviders from "app/providers";
-import Link from "next/link";
+import { Header } from "./new/header";
import { Steps } from "./new/steps";
export default function Layout({ children }: { children: React.ReactNode }) {
return (
<div className="min-h-screen bg-white">
- <header className="sticky top-0 z-30 flex h-14 items-center justify-between border-b border-neutral-200 bg-white px-4">
- <div className="flex items-center gap-5">
- <Link href="/" className="flex items-center">
- <Wordmark className="h-7" />
- </Link>
- <h1 className="hidden text-base font-semibold text-neutral-700 md:block">
- Create partner program
- </h1>
- </div>
- <div className="flex items-center gap-2">
- <Link
- href="/"
- className="group flex h-7 w-auto items-center justify-center gap-2 whitespace-nowrap rounded-md border border-transparent px-4 text-sm text-neutral-600 transition-all hover:bg-neutral-100"
- >
- Cancel
- </Link>
-
- <Button
- text="Save and exit"
- variant="secondary"
- className="h-7 w-auto"
- />
- </div>
- </header>
-
+ <Header />
<div className="md:grid md:grid-cols-[240px_minmax(0,1fr)]">
<Steps />
<main className="px-4 py-6 md:px-8">
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/(new)/new/header.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/(new)/new/header.tsx
new file mode 100644
index 0000000000..e138cf4ae3
--- /dev/null
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/programs/(new)/new/header.tsx
@@ -0,0 +1,46 @@
+"use client";
+
+import useWorkspace from "@/lib/swr/use-workspace";
+import { Button, Wordmark } from "@dub/ui";
+import Link from "next/link";
+import { useRouter } from "next/navigation";
+import { useState } from "react";
+
+export function Header() {
+ const router = useRouter();
+ const [saving, setSaving] = useState(false);
+ const { id: workspaceId } = useWorkspace();
+
+ const handleSaveAndExit = async () => {
+ if (!workspaceId) return;
+ };
+
+ return (
+ <header className="sticky top-0 z-30 flex h-14 items-center justify-between border-b border-neutral-200 bg-white px-4">
+ <div className="flex items-center gap-5">
+ <Link href="/" className="flex items-center">
+ <Wordmark className="h-7" />
+ </Link>
+ <h1 className="hidden text-base font-semibold text-neutral-700 md:block">
+ Create partner program
+ </h1>
+ </div>
+ <div className="flex items-center gap-2">
+ <Link
+ href="/"
+ className="group flex h-7 w-auto items-center justify-center gap-2 whitespace-nowrap rounded-md border border-transparent px-4 text-sm text-neutral-600 transition-all hover:bg-neutral-100"
+ >
+ Cancel
+ </Link>
+
+ <Button
+ text="Save and exit"
+ variant="secondary"
+ className="h-7 w-auto"
+ loading={saving}
+ onClick={handleSaveAndExit}
+ />
+ </div>
+ </header>
+ );
+}