The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Update overview-links.tsx
Steven Teycef98f31c308
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-links.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-links.tsxindex c30be9c1d8..5f7e9f4e87 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-links.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-links.tsx@@ -5,13 +5,14 @@ import { ButtonLink } from "@/ui/placeholders/button-link";import {ArrowUpRight,Brush,+ Check,Copy,InputField,Post,useCopyToClipboard,Window,} from "@dub/ui";-import { cn, PARTNERS_DOMAIN } from "@dub/utils";+import { cn, getPrettyUrl, PARTNERS_DOMAIN } from "@dub/utils";import Link from "next/link";import { useMemo } from "react";import { toast } from "sonner";@@ -20,8 +21,6 @@ export function OverviewLinks() {const { slug } = useWorkspace();const { program } = useProgram();- const [_, copyToClipboard] = useCopyToClipboard();-const links = useMemo(() => [{@@ -62,51 +61,65 @@ export function OverviewLinks() {</ButtonLink></div><div className="mt-3 flex flex-col px-2">- {links.map((link) => (- <div- key={link.label}- className={cn(- "group relative transition-opacity",- link.disabled && "pointer-events-none opacity-50",- )}- >- <Link+ {links.map((link) => {+ const [copied, copyToClipboard] = useCopyToClipboard();+ return (+ <divkey={link.label}- href={link.href}- target="_blank"- className={cn(- "relative flex items-center justify-between gap-2 rounded-lg p-2 pl-3 text-sm font-semibold transition-colors",- "group-hover:bg-bg-inverted/5 group-hover:active:bg-bg-inverted/10",- )}- {...(link.disabled && { "aria-disabled": true, tabIndex: -1 })}- >- <div className="flex min-w-0 items-center gap-2.5">- <link.icon className="size-4 shrink-0" />- <span className="min-w-0 truncate">{link.label}</span>- <ArrowUpRight className="size-3 shrink-0 -translate-x-0.5 opacity-0 transition-[transform,opacity] group-hover:translate-x-0 group-hover:opacity-100 [&_*]:stroke-2" />- </div>-- <div className="h-8 w-12" />- </Link>- <button- type="button"- onClick={() =>- copyToClipboard(link.href, {- onSuccess: () => {- toast.success("Copied to clipboard");- },- })- }className={cn(- "text-content-default bg-bg-inverted/5 absolute right-2 top-1/2 flex h-8 -translate-y-1/2 items-center rounded-lg px-4 transition-[opacity,background-color]",- "opacity-0 focus-visible:opacity-100 group-hover:opacity-100",- "hover:bg-bg-inverted/10 active:bg-bg-inverted/15",+ "group relative transition-opacity",+ link.disabled && "pointer-events-none opacity-50",)}>- <Copy className="size-4" />- </button>- </div>- ))}+ <Link+ key={link.label}+ href={link.href}+ target="_blank"+ className={cn(+ "relative flex items-center justify-between gap-2 rounded-lg p-2 pl-3 text-sm font-semibold transition-colors",+ "group-hover:bg-bg-inverted/5 group-hover:active:bg-bg-inverted/10",+ )}+ {...(link.disabled && { "aria-disabled": true, tabIndex: -1 })}+ >+ <div className="flex min-w-0 items-center gap-3">+ <div className="border-border-default rounded-md border p-2">+ <link.icon className="size-4 shrink-0" />+ </div>+ <div className="flex flex-col gap-0.5">+ <div className="flex items-center gap-1">+ <span className="min-w-0 truncate">{link.label}</span>+ <ArrowUpRight className="size-3 shrink-0 -translate-x-0.5 opacity-0 transition-[transform,opacity] group-hover:translate-x-0 group-hover:opacity-100 [&_*]:stroke-2" />+ </div>+ <span className="text-content-subtle text-xs font-normal">+ {getPrettyUrl(link.href)}+ </span>+ </div>+ </div>+ </Link>+ <button+ type="button"+ onClick={() =>+ copyToClipboard(link.href, {+ onSuccess: () => {+ toast.success("Copied to clipboard");+ },+ })+ }+ className={cn(+ "text-content-default bg-bg-inverted/5 absolute right-2 top-1/2 flex size-8 -translate-y-1/2 items-center justify-center rounded-lg transition-[opacity,background-color]",+ "opacity-0 focus-visible:opacity-100 group-hover:opacity-100",+ "hover:bg-bg-inverted/10 active:bg-bg-inverted/15",+ )}+ >+ {copied ? (+ <Check className="size-4" />+ ) : (+ <Copy className="size-4" />+ )}+ </button>+ </div>+ );+ })}</div></ProgramOverviewCard>);