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.

Update online presence UI

Tim Wilson0c11ddd268e9
diff --git a/apps/web/lib/zod/schemas/partners.ts b/apps/web/lib/zod/schemas/partners.ts
index f0149390ee..929212f105 100644
--- a/apps/web/lib/zod/schemas/partners.ts
+++ b/apps/web/lib/zod/schemas/partners.ts
@@ -126,6 +126,8 @@ export const PartnerOnlinePresenceSchema = z.object({
.nullable()
.describe("The partner's YouTube channel username (e.g. `johndoe`)."),
youtubeVerifiedAt: z.date().nullable(),
+ youtubeSubscriberCount: z.number(),
+ youtubeViewCount: z.number(),
twitter: z
.string()
.nullable()
diff --git a/apps/web/ui/partners/online-presence-summary.tsx b/apps/web/ui/partners/online-presence-summary.tsx
index 2140d6a4d4..d7708587b0 100644
--- a/apps/web/ui/partners/online-presence-summary.tsx
+++ b/apps/web/ui/partners/online-presence-summary.tsx
@@ -1,19 +1,32 @@
import { EnrolledPartnerProps } from "@/lib/types";
import { Tooltip } from "@dub/ui";
-import { BadgeCheck2Fill } from "@dub/ui/icons";
-import { cn, getPrettyUrl } from "@dub/utils";
+import {
+ ArrowUpRight,
+ BadgeCheck2Fill,
+ Globe,
+ Icon,
+ Instagram,
+ LinkedIn,
+ TikTok,
+ Twitter,
+ YouTube,
+} from "@dub/ui/icons";
+import { cn, getPrettyUrl, nFormatter } from "@dub/utils";
import { Fragment } from "react";
const fields: {
label: string;
+ icon: Icon;
data: (partner: EnrolledPartnerProps) => {
value: string | null;
verified: boolean;
href: string | null;
+ info?: string[];
};
}[] = [
{
label: "Website",
+ icon: Globe,
data: (partner) => ({
value: partner.website ? getPrettyUrl(partner.website) : null,
verified: !!partner.websiteVerifiedAt,
@@ -21,15 +34,25 @@ const fields: {
}),
},
{
- label: "Youtube",
+ label: "YouTube",
+ icon: YouTube,
data: (partner) => ({
value: partner.youtube ? `@${partner.youtube}` : null,
verified: !!partner.youtubeVerifiedAt,
href: `https://youtube.com/@${partner.youtube}`,
+ info: [
+ partner.youtubeSubscriberCount > 0
+ ? `${nFormatter(partner.youtubeSubscriberCount)} subscribers`
+ : null,
+ partner.youtubeViewCount > 0
+ ? `${nFormatter(partner.youtubeViewCount)} views`
+ : null,
+ ].filter(Boolean),
}),
},
{
- label: "Twitter",
+ label: "X/Twitter",
+ icon: Twitter,
data: (partner) => ({
value: partner.twitter ? `@${partner.twitter}` : null,
verified: !!partner.twitterVerifiedAt,
@@ -38,6 +61,7 @@ const fields: {
},
{
label: "LinkedIn",
+ icon: LinkedIn,
data: (partner) => ({
value: partner.linkedin,
verified: !!partner.linkedinVerifiedAt,
@@ -46,6 +70,7 @@ const fields: {
},
{
label: "Instagram",
+ icon: Instagram,
data: (partner) => ({
value: partner.instagram ? `@${partner.instagram}` : null,
verified: !!partner.instagramVerifiedAt,
@@ -54,6 +79,7 @@ const fields: {
},
{
label: "Tiktok",
+ icon: TikTok,
data: (partner) => ({
value: partner.tiktok ? `@${partner.tiktok}` : null,
verified: !!partner.tiktokVerifiedAt,
@@ -70,35 +96,54 @@ export function OnlinePresenceSummary({
className?: string;
}) {
const fieldData = fields
- .map((field) => ({ label: field.label, ...field.data(partner) }))
+ .map((field) => ({
+ label: field.label,
+ icon: field.icon,
+ ...field.data(partner),
+ }))
.filter((field) => field.value && field.href);
return fieldData.length ? (
<div
className={cn(
- "grid grid-cols-[max-content_minmax(0,1fr)] items-center gap-x-4 gap-y-1 text-sm md:gap-x-16",
+ "grid grid-cols-[max-content_minmax(0,1fr)] items-center gap-x-4 gap-y-5 text-sm md:gap-x-16",
className,
)}
>
- {fieldData.map(({ label, value, verified, href }) => {
+ {fieldData.map(({ label, icon: Icon, value, verified, href, info }) => {
return (
<Fragment key={label}>
- <span className="font-medium text-neutral-600">{label}</span>
+ <span className="text-content-default font-medium">{label}</span>
<div>
<a
target="_blank"
href={href!}
rel="noopener noreferrer"
- className="inline-flex h-7 max-w-full items-center gap-1 rounded-lg px-2 text-neutral-600 hover:bg-neutral-50"
+ className="border-border-subtle group flex max-w-full items-center justify-between gap-4 rounded-lg border p-3 text-neutral-600 transition-colors hover:bg-neutral-50 active:bg-neutral-100"
>
- <span className="min-w-0 truncate">{value}</span>
- {verified && (
- <Tooltip content="Verified" disableHoverableContent>
- <div>
- <BadgeCheck2Fill className="size-4 text-green-600" />
+ <div className="flex items-center gap-3">
+ <div className="border-border-subtle text-content-default flex size-8 items-center justify-center rounded-full border bg-white">
+ <Icon className="size-4" />
+ </div>
+ <div>
+ <div className="flex items-center gap-1">
+ <span className="min-w-0 truncate">{value}</span>
+ {verified && (
+ <Tooltip content="Verified" disableHoverableContent>
+ <div>
+ <BadgeCheck2Fill className="size-4 text-green-600" />
+ </div>
+ </Tooltip>
+ )}
</div>
- </Tooltip>
- )}
+ {info && info.length > 0 && (
+ <div className="text-content-subtle text-xs">
+ {info.join(" • ")}
+ </div>
+ )}
+ </div>
+ </div>
+ <ArrowUpRight className="text-content-subtle mr-1 size-4 -translate-x-0.5 translate-y-0.5 opacity-0 transition-[opacity,transform] group-hover:translate-x-0 group-hover:translate-y-0 group-hover:opacity-100" />
</a>
</div>
</Fragment>
diff --git a/apps/web/ui/partners/partner-application-sheet.tsx b/apps/web/ui/partners/partner-application-sheet.tsx
index 9fd44d2ad0..c7742d369b 100644
--- a/apps/web/ui/partners/partner-application-sheet.tsx
+++ b/apps/web/ui/partners/partner-application-sheet.tsx
@@ -66,27 +66,28 @@ function PartnerApplicationSheetContent({
function PendingPartnerSummary({ partner }: { partner: EnrolledPartnerProps }) {
return (
- <div className="grid grid-cols-1 gap-8 text-sm text-neutral-500">
+ <div className="grid grid-cols-1 gap-6 text-sm text-neutral-600">
<div>
- <h4 className="font-semibold text-neutral-900">Online presence</h4>
- <OnlinePresenceSummary partner={partner} className="mt-2" />
- </div>
- <div>
- <h4 className="font-semibold text-neutral-900">Description</h4>
- <p className="mt-2">
+ <h4 className="text-content-emphasis font-semibold">Description</h4>
+ <p className="mt-1">
{partner.description || (
- <span className="italic text-neutral-400">
+ <span className="text-content-muted italic">
No description provided
</span>
)}
</p>
</div>
+ <hr className="border-neutral-200" />
{partner.applicationId && (
<>
- <hr className="border-neutral-200" />
<PartnerApplication applicationId={partner.applicationId} />
+ <hr className="border-neutral-200" />
</>
)}
+ <div>
+ <h4 className="text-content-emphasis font-semibold">Online presence</h4>
+ <OnlinePresenceSummary partner={partner} className="mt-3" />
+ </div>
</div>
);
}
@@ -114,11 +115,11 @@ function PartnerApplication({ applicationId }: { applicationId: string }) {
];
return (
- <div className="grid grid-cols-1 gap-6">
+ <div className="grid grid-cols-1 gap-6 text-sm">
{fields.map((field) => (
<div key={field.title}>
- <h4 className="font-semibold text-neutral-900">{field.title}</h4>
- <div className="mt-1.5">
+ <h4 className="text-content-emphasis font-semibold">{field.title}</h4>
+ <div className="mt-1">
{field.value || field.value === "" ? (
<Linkify
as="p"
@@ -129,7 +130,11 @@ function PartnerApplication({ applicationId }: { applicationId: string }) {
"underline underline-offset-4 text-neutral-400 hover:text-neutral-700",
}}
>
- {field.value || "No response provided"}
+ {field.value || (
+ <span className="text-content-muted italic">
+ No response provided
+ </span>
+ )}
</Linkify>
) : (
<div className="h-5 w-28 min-w-0 animate-pulse rounded-md bg-neutral-200" />