The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Added footer link and link inspector landing
cosmiclasagnadevc2e35108f331
diff --git a/app/dub.co/tools/inspect/content.tsx b/app/dub.co/tools/inspect/content.tsxnew file mode 100644index 0000000000..5cc254ec5f--- /dev/null+++ b/app/dub.co/tools/inspect/content.tsx@@ -0,0 +1,61 @@+"use client";++import { useEffect, useRef, useState } from "react";+import { LoadingSpinner } from "#/ui/icons";+import { useRouter } from "next/navigation";+import { CornerDownLeft, Link2 } from "lucide-react";++export default function LinkInspectorContent() {+ const router = useRouter();+ const [redirecting, setRedirecting] = useState(false);++ const formRef = useRef<HTMLFormElement>(null);+ const inputRef = useRef<HTMLInputElement>(null);+ useEffect(() => {+ inputRef.current?.select();+ }, []);++ return (+ <>+ <form+ ref={formRef}+ onSubmit={(e) => {+ e.preventDefault();+ setRedirecting(true);+ router.push(e.currentTarget.url.value);+ }}+ >+ <div className="relative flex items-center">+ <Link2 className="absolute inset-y-0 left-0 my-2 ml-3 w-5 text-gray-400" />+ <input+ name="url"+ type="url"+ ref={inputRef}+ defaultValue="https://dub.sh/github+"+ // match pattern regex for making sure the url starts with https://dub.sh/, has the slug in the middle, and ends with a ++ pattern="https://dub\.sh/[A-Za-z0-9]+\+"+ placeholder="Enter a dub.sh link to inspect (insert a '+' at the end)"+ autoComplete="off"+ required+ className="peer block w-full rounded-md border border-gray-200 bg-white p-2 pl-10 pr-12 shadow-lg focus:border-black focus:outline-none focus:ring-0 sm:text-sm"+ />+ <button+ type="submit"+ disabled={redirecting}+ className={`${+ redirecting+ ? "cursor-not-allowed bg-gray-100"+ : "hover:border-gray-700 hover:text-gray-700 peer-focus:text-gray-700"+ } absolute inset-y-0 right-0 my-1.5 mr-1.5 flex w-10 items-center justify-center rounded border border-gray-200 font-sans text-sm font-medium text-gray-400`}+ >+ {redirecting ? (+ <LoadingSpinner className="h-4 w-4" />+ ) : (+ <CornerDownLeft className="h-4 w-4" />+ )}+ </button>+ </div>+ </form>+ </>+ );+}diff --git a/app/dub.co/tools/inspect/launch.tsx b/app/dub.co/tools/inspect/launch.tsxnew file mode 100644index 0000000000..143e2d90c7--- /dev/null+++ b/app/dub.co/tools/inspect/launch.tsx@@ -0,0 +1,12 @@+import { getAndCacheTweet } from "#/lib/twitter";+import Tweet from "#/ui/tweet";++export default async function LaunchTweet() {+ const tweet = await getAndCacheTweet("1695798379836796961");+ if (!tweet) return null;+ return (+ <div className="text-left">+ <Tweet data={tweet} />+ </div>+ );+}diff --git a/app/dub.co/tools/inspect/page.tsx b/app/dub.co/tools/inspect/page.tsxnew file mode 100644index 0000000000..5f984d7159--- /dev/null+++ b/app/dub.co/tools/inspect/page.tsx@@ -0,0 +1,59 @@+import { Github, Twitter } from "@/components/shared/icons";+import { Suspense } from "react";+import Background from "#/ui/home/background";+import LaunchTweet from "./launch";+import { constructMetadata } from "#/lib/utils";+import LinkInspectorContent from "./content";++export const metadata = constructMetadata({+ title: "Link Inspector - Inspect a Short Link on Dub to Make Sure It's Safe",+ description:+ "Dub's Link Inspector is a simple tool for inspecting short links on Dub to make sure it's safe to click on. If you think this link is malicious, please report it.",+});++export default function LinkInspector() {+ return (+ <>+ <div className="z-10 mx-2 my-10 flex max-w-md flex-col space-y-5 px-2.5 text-center sm:mx-auto sm:max-w-lg sm:px-0 lg:mb-28">+ <a+ href="https://twitter.com/dubdotsh/status/1695798379836796961"+ target="_blank"+ rel="noreferrer"+ className="mx-auto flex max-w-fit items-center justify-center space-x-2 overflow-hidden rounded-full bg-blue-100 px-7 py-2 transition-all hover:bg-blue-200"+ >+ <Twitter className="h-5 w-5 text-[#1d9bf0]" />+ <p className="text-sm font-semibold text-[#1d9bf0]">+ Watch it in action+ </p>+ </a>++ <h1 className="font-display text-5xl font-extrabold leading-[1.15] text-black sm:text-6xl sm:leading-[1.15]">+ <span className="bg-gradient-to-r from-amber-500 via-orange-600 to-yellow-500 bg-clip-text text-transparent">+ Link Inspector+ </span>{" "}+ </h1>+ <h2 className="text-lg text-gray-600 sm:text-xl">+ Inspect a short link on Dub to make sure it's safe to click on. If you+ think this link is malicious, please report it.+ </h2>++ <LinkInspectorContent />++ <a+ href="https://github.com/steven-tey/dub/blob/be8a9f6ccf5aad8a9839cd0c8cc435a2095599e9/app/inspect/%5Bdomain%5D/%5Bkey%5D/page.tsx"+ target="_blank"+ rel="noreferrer"+ className="mx-auto mt-2 flex items-center justify-center space-x-2 text-sm text-gray-500 transition-all hover:text-black"+ >+ <Github className="h-4 w-4" />+ <p>View the source code</p>+ </a>++ <Suspense>+ <LaunchTweet />+ </Suspense>+ </div>+ <Background />+ </>+ );+}diff --git a/app/ui/home/footer.tsx b/app/ui/home/footer.tsxindex bc15c82136..bc9200e336 100644--- a/app/ui/home/footer.tsx+++ b/app/ui/home/footer.tsx@@ -17,7 +17,10 @@ const navigation = {{ name: "Blog", href: "/blog" },// { name: "About", href: "/about" },],- tools: [{ name: "Metatags API", href: "/tools/metatags" }],+ tools: [+ { name: "Metatags API", href: "/tools/metatags" },+ { name: "Link Inspector", href: "/tools/inspect" },+ ],legal: [{ name: "Privacy", href: "/privacy" },{ name: "Terms", href: "/terms" },diff --git a/app/ui/tweet.tsx b/app/ui/tweet.tsxindex 6711f93102..7530dae671 100644--- a/app/ui/tweet.tsx+++ b/app/ui/tweet.tsx@@ -162,7 +162,7 @@ export default function Tweet({<div className="my-3">{video && (<video- className="rounded-lg border border-gray-200 drop-shadow-sm"+ className="w-full rounded-lg border border-gray-200 drop-shadow-sm"loopautoPlaymuted