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.

Unpublished overview links and style updates

Marcus Farrellad40ae70023e
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.tsx
index 84d272a6f9..d6dfbc8264 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
@@ -9,14 +9,16 @@ import {
Brush,
Check,
Copy,
+ EyeSlash,
InputField,
Post,
+ Tooltip,
useCopyToClipboard,
Window,
} from "@dub/ui";
import { cn, getPrettyUrl, PARTNERS_DOMAIN } from "@dub/utils";
import Link from "next/link";
-import { useMemo } from "react";
+import { ComponentType, SVGProps, useMemo } from "react";
import { toast } from "sonner";
export function OverviewLinks() {
@@ -34,12 +36,20 @@ export function OverviewLinks() {
label: "Landing page",
href: `${PARTNERS_DOMAIN}/${program?.slug}`,
disabled: !defaultGroup?.landerPublishedAt,
+ disabledTooltip: unpublishedTooltip(
+ "landing page",
+ `/${slug}/program/groups/default/branding?tab=landing`,
+ ),
},
{
icon: InputField,
label: "Application form",
href: `${PARTNERS_DOMAIN}/${program?.slug}/apply`,
disabled: !defaultGroup?.applicationFormPublishedAt,
+ disabledTooltip: unpublishedTooltip(
+ "application form",
+ `/${slug}/program/groups/default/branding?tab=application`,
+ ),
},
{
icon: Window,
@@ -52,81 +62,111 @@ export function OverviewLinks() {
);
return (
- <ProgramOverviewCard className="py-4">
- <div className="flex justify-between px-4">
- <h2 className="text-content-emphasis text-sm font-medium">
+ <ProgramOverviewCard className="rounded-xl">
+ <div className="flex h-12 items-center justify-between gap-2 pl-4 pr-3">
+ <h2 className="text-content-emphasis text-sm font-semibold">
Program links
</h2>
<ButtonLink
href={`/${slug}/program/groups/default/branding`}
variant="secondary"
- className="-mr-1 -mt-1 h-7 px-2 text-sm"
+ className="h-7 px-2.5 text-sm"
>
- <Brush className="mr-1.5 size-4 shrink-0" />
+ <Brush className="mr-2 size-4 shrink-0" />
Branding
</ButtonLink>
</div>
- <div className="mt-3 flex flex-col px-2">
- {links.map((link) => {
- const [copied, copyToClipboard] = useCopyToClipboard();
- return (
- <div
- key={link.label}
- className={cn(
- "group relative transition-opacity",
- link.disabled && "pointer-events-none opacity-50",
- )}
- >
- <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 className="flex flex-col px-2 pb-2">
+ {links.map((link) => (
+ <ProgramLinkRow key={link.label} {...link} />
+ ))}
</div>
</ProgramOverviewCard>
);
}
+
+const unpublishedTooltip = (label: string, href: string) =>
+ `Your ${label} is not published yet.\\\nView your [${label}](${href}) to publish.`;
+
+function ProgramLinkRow({
+ icon: Icon,
+ label,
+ href,
+ disabled,
+ disabledTooltip,
+}: {
+ icon: ComponentType<SVGProps<SVGSVGElement>>;
+ label: string;
+ href: string;
+ disabled: boolean;
+ disabledTooltip?: string;
+}) {
+ const [copied, copyToClipboard] = useCopyToClipboard();
+
+ if (disabled) {
+ return (
+ <Tooltip content={disabledTooltip} disabled={!disabledTooltip}>
+ <div
+ tabIndex={0}
+ aria-disabled
+ className="hover:bg-bg-inverted/5 flex items-center gap-2.5 rounded-lg p-2 text-sm font-medium transition-colors"
+ >
+ <div className="flex size-9 shrink-0 items-center justify-center rounded-lg border border-neutral-200">
+ <EyeSlash className="text-content-muted size-[18px] shrink-0" />
+ </div>
+ <div className="flex min-w-0 flex-col">
+ <span className="text-content-muted min-w-0 truncate">{label}</span>
+ <span className="text-content-muted truncate text-xs font-medium">
+ {getPrettyUrl(href)}
+ </span>
+ </div>
+ </div>
+ </Tooltip>
+ );
+ }
+
+ return (
+ <div className="group relative">
+ <Link
+ href={href}
+ target="_blank"
+ className={cn(
+ "relative flex items-center justify-between gap-2 rounded-lg p-2 text-sm font-medium transition-colors",
+ "group-hover:bg-bg-inverted/5 group-hover:active:bg-bg-inverted/10",
+ )}
+ >
+ <div className="flex min-w-0 items-center gap-2.5">
+ <div className="flex size-9 shrink-0 items-center justify-center rounded-lg border border-neutral-200">
+ <Icon className="size-[18px] shrink-0" />
+ </div>
+ <div className="flex min-w-0 flex-col">
+ <div className="flex items-center gap-1">
+ <span className="min-w-0 truncate">{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-muted truncate text-xs font-medium">
+ {getPrettyUrl(href)}
+ </span>
+ </div>
+ </div>
+ </Link>
+ <button
+ type="button"
+ onClick={() =>
+ copyToClipboard(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>
+ );
+}
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-tasks.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-tasks.tsx
index 788fbcaf71..67b7c2b797 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-tasks.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-tasks.tsx
@@ -51,6 +51,8 @@ export function OverviewTasks() {
},
{
icon: UserCheck,
+ // UserCheck is drawn on a 14px grid, so its strokes render thicker than the 18px icons
+ iconClassName: "[&_path]:[stroke-width:1.17]",
label: "Review new applications",
count: applicationsCount,
href: `/${slug}/program/partners/applications`,
@@ -69,25 +71,31 @@ export function OverviewTasks() {
);
return (
- <ProgramOverviewCard className="py-4">
- <h2 className="text-content-emphasis px-4 text-sm font-medium">Tasks</h2>
- <div className="mt-4 flex flex-col px-2">
+ <ProgramOverviewCard className="rounded-xl">
+ <div className="flex h-12 items-center pl-4 pr-3">
+ <h2 className="text-content-emphasis text-sm font-semibold">Tasks</h2>
+ </div>
+ <div className="flex flex-col px-2 pb-2">
{tasks.map((task) => (
<Link
key={task.label}
href={task.href}
- className="hover:bg-bg-inverted/5 active:bg-bg-inverted/10 flex items-center justify-between gap-2 rounded-lg p-2 pl-3 text-sm font-semibold transition-colors"
+ className="hover:bg-bg-inverted/5 active:bg-bg-inverted/10 flex items-center justify-between gap-2.5 rounded-lg p-2 text-sm font-medium transition-colors"
>
<div className="flex min-w-0 items-center gap-2.5">
- <task.icon className="size-4 shrink-0" />
+ <div className="flex size-9 shrink-0 items-center justify-center rounded-lg border border-neutral-200">
+ <task.icon
+ className={cn("size-[18px] shrink-0", task.iconClassName)}
+ />
+ </div>
<span className="min-w-0 truncate">{task.label}</span>
</div>
<div
className={cn(
- "flex h-8 min-w-8 shrink-0 items-center justify-center rounded-lg bg-blue-50 px-1.5 text-sm font-semibold text-blue-600",
+ "flex h-9 min-w-9 shrink-0 items-center justify-center rounded-lg bg-blue-100 px-1.5 text-sm font-semibold text-blue-600",
!(task.count && task.count > 0) &&
- "bg-neutral-100 text-neutral-500",
+ "bg-neutral-100 text-neutral-400",
task.loading && "w-10 animate-pulse",
)}
>
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/page-client.tsx
index bf4a335b2d..b80806bec7 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/page-client.tsx
@@ -168,13 +168,13 @@ export default function ProgramOverviewPageClient() {
totalEventsLoading,
}}
>
- <div className="@4xl:grid-cols-[minmax(0,1fr)_400px] grid grid-cols-1 gap-6 rounded-2xl bg-neutral-100 p-4">
+ <div className="@4xl:grid-cols-[minmax(0,1fr)_400px] grid grid-cols-1 gap-3 rounded-2xl bg-neutral-100 p-3">
{/* Chart */}
<ProgramOverviewCard className="@4xl:h-full h-96 p-6">
<OverviewChart />
</ProgramOverviewCard>
- <div className="@4xl:grid-cols-1 @2xl:grid-cols-2 grid grid-cols-1 gap-6">
+ <div className="@4xl:grid-cols-1 @2xl:grid-cols-2 grid grid-cols-1 gap-3">
{/* Tasks */}
<OverviewTasks />