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.

Refactor DeepLinkActionButtons and DeepLinkPage components; add IOSAppStore icon. Updated button styles and layout for improved user experience.

Kiran K90871b2d8ef3
diff --git a/apps/web/app/deeplink/[domain]/[key]/action-buttons.tsx b/apps/web/app/deeplink/[domain]/[key]/action-buttons.tsx
index ea2b0f6fae..0ba7c24b4a 100644
--- a/apps/web/app/deeplink/[domain]/[key]/action-buttons.tsx
+++ b/apps/web/app/deeplink/[domain]/[key]/action-buttons.tsx
@@ -1,8 +1,7 @@
"use client";
import { EdgeLinkProps } from "@/lib/planetscale";
-import { Button, Check2, Copy, Wordmark } from "@dub/ui";
-import Link from "next/link";
+import { Button, IOSAppStore } from "@dub/ui";
import { useState } from "react";
export function DeepLinkActionButtons({ link }: { link: EdgeLinkProps }) {
@@ -18,34 +17,25 @@ export function DeepLinkActionButtons({ link }: { link: EdgeLinkProps }) {
console.error("Failed to copy:", err);
}
}
+
window.location.href = link.ios || link.url;
};
return (
- <div className="flex flex-col items-center gap-4 pt-8">
- <Link
- href="https://dub.co"
- target="_blank"
- className="flex items-center gap-1.5 whitespace-nowrap text-sm"
- >
- Powered by <Wordmark className="h-4 p-0.5" />
- </Link>
-
+ <div className="flex flex-col items-center gap-5">
<Button
text="Get the App"
- className="h-11 w-full rounded-xl"
+ className="h-12 w-full rounded-xl bg-neutral-900 text-white hover:bg-neutral-800"
variant="primary"
onClick={() => handleClick({ withCopy: true })}
- icon={
- copied ? <Check2 className="size-4" /> : <Copy className="size-4" />
- }
+ icon={<IOSAppStore className="size-6" />}
/>
<button
onClick={() => handleClick()}
- className="text-sm text-neutral-400"
+ className="text-base font-medium text-neutral-700 hover:text-neutral-900"
>
- Get the app without copying
+ Get the App without copying
</button>
</div>
);
diff --git a/apps/web/app/deeplink/[domain]/[key]/page.tsx b/apps/web/app/deeplink/[domain]/[key]/page.tsx
index dbedad04af..d517a896ff 100644
--- a/apps/web/app/deeplink/[domain]/[key]/page.tsx
+++ b/apps/web/app/deeplink/[domain]/[key]/page.tsx
@@ -1,11 +1,14 @@
import { getLinkViaEdge } from "@/lib/planetscale";
-import { BlurImage } from "@dub/ui";
-import { DUB_LOGO } from "@dub/utils";
+import { Grid, LinkLogo, Wordmark } from "@dub/ui";
+import { ArrowRight, Copy, IOSAppStore, MobilePhone } from "@dub/ui/icons";
+import { cn, getApexDomain } from "@dub/utils";
+import Link from "next/link";
import { notFound } from "next/navigation";
import { DeepLinkActionButtons } from "./action-buttons";
export const runtime = "edge";
+// /deeplink/[domain]/[key]
export default async function DeepLinkPage({
params,
}: {
@@ -14,34 +17,91 @@ export default async function DeepLinkPage({
const domain = params.domain;
const key = decodeURIComponent(params.key);
- // Get link data for displaying app info
const link = await getLinkViaEdge({ domain, key });
- console.log({ link });
if (!link) {
notFound();
}
return (
- <main className="flex h-dvh w-full flex-col justify-between bg-gray-50 px-4 py-8">
- {/* Top section with logo and title */}
- <div className="flex flex-col items-center gap-y-6">
- <div className="rounded-lg border border-neutral-200 p-2 shadow-md">
- <BlurImage
- src={DUB_LOGO}
- alt="Dub Logo"
- width={48}
- height={48}
- className="size-12"
+ <main className="flex h-dvh w-full flex-col bg-white">
+ <div className="absolute inset-0 isolate overflow-hidden bg-white">
+ <div
+ className={cn(
+ "absolute inset-y-0 left-1/2 w-[1200px] -translate-x-1/2",
+ "[mask-composite:intersect] [mask-image:linear-gradient(black,transparent_320px),linear-gradient(90deg,transparent,black_5%,black_95%,transparent)]",
+ )}
+ >
+ <Grid
+ cellSize={60}
+ patternOffset={[0.75, 0]}
+ className="text-neutral-200"
/>
</div>
- <h2 className="font-display text-xl font-bold text-gray-900">
- Open this page in the app
- </h2>
+ {[...Array(2)].map((_, idx) => (
+ <div
+ key={idx}
+ className={cn(
+ "absolute left-1/2 top-6 size-[80px] -translate-x-1/2 -translate-y-1/2 scale-x-[1.6]",
+ idx === 0 ? "mix-blend-overlay" : "opacity-10",
+ )}
+ >
+ {[...Array(idx === 0 ? 2 : 1)].map((_, idx) => (
+ <div
+ key={idx}
+ className={cn(
+ "absolute -inset-16 mix-blend-overlay blur-[50px] saturate-[2]",
+ "bg-[conic-gradient(from_90deg,#F00_5deg,#EAB308_63deg,#5CFF80_115deg,#1E00FF_170deg,#855AFC_220deg,#3A8BFD_286deg,#F00_360deg)]",
+ )}
+ />
+ ))}
+ </div>
+ ))}
</div>
- <DeepLinkActionButtons link={link} />
+ <div className="relative z-10 flex flex-1 flex-col px-8 py-8">
+ <div className="flex justify-center">
+ <Link
+ href="https://dub.co"
+ target="_blank"
+ className="flex items-center gap-1 whitespace-nowrap text-sm font-medium text-neutral-900"
+ >
+ Powered by <Wordmark className="text-content-emphasis h-3.5" />
+ </Link>
+ </div>
+
+ <div className="flex flex-1 flex-col justify-center gap-12">
+ <div className="flex flex-col items-center gap-y-6">
+ <div className="flex flex-col items-center gap-4">
+ <LinkLogo
+ apexDomain={getApexDomain(link.url)}
+ className="size-20 shrink-0"
+ />
+ <div className="text-xl font-semibold text-neutral-900">
+ {getApexDomain(link.url)}
+ </div>
+ </div>
+
+ <div className="flex h-40 w-full max-w-xs flex-col gap-6 rounded-xl border border-neutral-300 px-10 py-8">
+ <p className="text-center text-sm font-normal leading-5 text-neutral-700">
+ Clicking below will copy this page, and open it after you
+ install the app.
+ </p>
+
+ <div className="flex items-center justify-center gap-3">
+ <Copy className="text-content-default size-6" />
+ <ArrowRight className="text-content-subtle size-3" />
+ <IOSAppStore className="text-content-default size-6" />
+ <ArrowRight className="text-content-subtle size-3" />
+ <MobilePhone className="text-content-default size-6" />
+ </div>
+ </div>
+ </div>
+
+ <DeepLinkActionButtons link={link} />
+ </div>
+ </div>
</main>
);
}
diff --git a/packages/ui/src/icons/index.tsx b/packages/ui/src/icons/index.tsx
index f33ec2ea8a..cbd15f350d 100644
--- a/packages/ui/src/icons/index.tsx
+++ b/packages/ui/src/icons/index.tsx
@@ -12,6 +12,7 @@ export * from "./dub-crafted-shield";
export * from "./dub-links";
export * from "./dub-partners";
export * from "./expanding-arrow";
+export * from "./ios-app-store";
export * from "./magic";
export * from "./markdown-icon";
export * from "./matrix-lines";
diff --git a/packages/ui/src/icons/ios-app-store.tsx b/packages/ui/src/icons/ios-app-store.tsx
new file mode 100644
index 0000000000..cfae402c8b
--- /dev/null
+++ b/packages/ui/src/icons/ios-app-store.tsx
@@ -0,0 +1,44 @@
+export function IOSAppStore({ className }: { className?: string }) {
+ return (
+ <svg
+ width="25"
+ height="24"
+ viewBox="0 0 25 24"
+ fill="none"
+ xmlns="http://www.w3.org/2000/svg"
+ className={className}
+ >
+ <g clip-path="url(#clip0_24804_74166)">
+ <path
+ d="M19.652 0L5.348 0C2.669 0 0.5 2.169 0.5 4.848L0.5 19.155C0.5 21.831 2.669 24 5.348 24H19.655C22.331 24 24.503 21.831 24.503 19.152V4.848C24.5 2.169 22.331 0 19.652 0Z"
+ fill="url(#paint0_linear_24804_74166)"
+ />
+ <path
+ d="M12.398 5.51385L12.884 4.67385C13.184 4.14885 13.853 3.97185 14.378 4.27185C14.903 4.57185 15.08 5.24085 14.78 5.76585L10.097 13.8718H13.484C14.582 13.8718 15.197 15.1618 14.72 16.0558H4.79C4.184 16.0558 3.698 15.5698 3.698 14.9638C3.698 14.3578 4.184 13.8718 4.79 13.8718H7.574L11.138 7.69485L10.025 5.76285C9.725 5.23785 9.902 4.57485 10.427 4.26885C10.952 3.96885 11.615 4.14585 11.921 4.67085L12.398 5.51385ZM8.186 17.1808L7.136 19.0018C6.836 19.5268 6.167 19.7038 5.642 19.4038C5.117 19.1038 4.94 18.4348 5.24 17.9098L6.02 16.5598C6.902 16.2868 7.619 16.4968 8.186 17.1808ZM17.228 13.8778L20.069 13.8778C20.675 13.8778 21.161 14.3638 21.161 14.9698C21.161 15.5758 20.675 16.0618 20.069 16.0618H18.491L19.556 17.9098C19.856 18.4348 19.679 19.0978 19.154 19.4038C18.629 19.7038 17.966 19.5268 17.66 19.0018C15.866 15.8908 14.519 13.5628 13.625 12.0118C12.71 10.4338 13.364 8.84985 14.009 8.31285C14.726 9.54285 15.797 11.3998 17.228 13.8778Z"
+ fill="white"
+ />
+ </g>
+ <defs>
+ <linearGradient
+ id="paint0_linear_24804_74166"
+ x1="12.5015"
+ y1="0"
+ x2="12.5015"
+ y2="24"
+ gradientUnits="userSpaceOnUse"
+ >
+ <stop stop-color="#18BFFB" />
+ <stop offset="1" stop-color="#2072F3" />
+ </linearGradient>
+ <clipPath id="clip0_24804_74166">
+ <rect
+ width="24"
+ height="24"
+ fill="white"
+ transform="translate(0.5)"
+ />
+ </clipPath>
+ </defs>
+ </svg>
+ );
+}