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 partner details sheet UI

Tim Wilson9938efb41202
diff --git a/apps/web/ui/partners/partner-details-sheet.tsx b/apps/web/ui/partners/partner-details-sheet.tsx
index e9b647fa8d..0f16dccdff 100644
--- a/apps/web/ui/partners/partner-details-sheet.tsx
+++ b/apps/web/ui/partners/partner-details-sheet.tsx
@@ -13,12 +13,11 @@ import {
Sheet,
StatusBadge,
Table,
- ToggleGroup,
useRouterStuff,
useTable,
useTablePagination,
} from "@dub/ui";
-import { GreekTemple, LinesY } from "@dub/ui/icons";
+import { CursorRays, GreekTemple, LinesY, Link4 } from "@dub/ui/icons";
import {
cn,
COUNTRIES,
@@ -62,8 +61,8 @@ function PartnerDetailsSheetContent({
return (
<>
- <div>
- <div className="flex items-start justify-between border-b border-neutral-200 p-6">
+ <div className="flex grow flex-col">
+ <div className="flex items-start justify-between p-6">
<Sheet.Title className="text-xl font-semibold">
Partner details
</Sheet.Title>
@@ -75,7 +74,7 @@ function PartnerDetailsSheetContent({
/>
</Sheet.Close>
</div>
- <div className="p-6">
+ <div className="border-y border-neutral-200 bg-neutral-50 p-6">
{/* Basic info */}
<div className="flex items-start justify-between gap-6">
<div className="flex flex-col">
@@ -95,25 +94,21 @@ function PartnerDetailsSheetContent({
)}
</div>
</div>
- <div className="flex min-w-[40%] shrink grow basis-1/2 flex-wrap items-center justify-end gap-2">
+ <div className="flex min-w-[40%] shrink grow basis-1/2 flex-col items-end justify-end gap-2">
{partner.link && (
- <a
- href={`/${slug}/analytics?domain=${partner.link.domain}&key=${partner.link.key}`}
- target="_blank"
- className="group flex min-w-0 items-center gap-1.5 overflow-hidden rounded-full bg-neutral-100 px-2.5 py-1 text-xs text-neutral-700 transition-colors duration-100 hover:bg-neutral-200/70 active:bg-neutral-200"
- >
- <LinesY className="size-3.5" />
+ <div className="group flex min-w-0 items-center gap-1 overflow-hidden rounded-full border border-neutral-200 bg-white px-1.5 py-0.5 text-xs text-neutral-700">
+ <Link4 className="size-3.5" />
<span className="truncate">
{getPrettyUrl(partner.link.shortLink)}
</span>
- </a>
+ </div>
)}
{partner.country && (
- <div className="flex min-w-20 items-center gap-2 rounded-full bg-neutral-100 px-2.5 py-1 text-xs text-neutral-700">
+ <div className="flex min-w-20 items-center gap-2 rounded-full border border-neutral-200 bg-white px-1.5 py-0.5 text-xs text-neutral-700">
<img
alt=""
src={`https://flag.vercel.app/m/${partner.country}.svg`}
- className="h-3 w-4"
+ className="h-3 w-4 rounded-sm"
/>
<span className="truncate">{COUNTRIES[partner.country]}</span>
</div>
@@ -122,87 +117,99 @@ function PartnerDetailsSheetContent({
</div>
{/* Stats */}
- <div className="mt-6 flex divide-x divide-neutral-200">
- {[
- [
- "Clicks",
- !partner.link
- ? "-"
- : nFormatter(partner.link?.clicks, { full: true }),
- ],
- [
- "Leads",
- !partner.link
- ? "-"
- : nFormatter(partner.link?.leads, { full: true }),
- ],
- [
- "Sales",
- !partner.link
- ? "-"
- : nFormatter(partner.link?.sales, { full: true }),
- ],
- [
- "Revenue",
- !partner.link
- ? "-"
- : currencyFormatter(saleAmount, {
- minimumFractionDigits: saleAmount % 1 === 0 ? 0 : 2,
- maximumFractionDigits: 2,
- }),
- ],
- [
- "Earnings",
- currencyFormatter(earnings, {
- minimumFractionDigits: earnings % 1 === 0 ? 0 : 2,
- maximumFractionDigits: 2,
- }),
- ],
- ].map(([label, value]) => (
- <div key={label} className="flex flex-col px-5 first:pl-0">
- <span className="text-xs text-neutral-500">{label}</span>
- <span className="text-base text-neutral-900">{value}</span>
- </div>
- ))}
- </div>
-
- <div className="mt-6">
- <ToggleGroup
- className="grid w-full grid-cols-2 rounded-lg border-transparent bg-neutral-100 p-0.5"
- optionClassName="justify-center text-neutral-600 hover:text-neutral-700"
- indicatorClassName="rounded-md bg-white"
- options={[
- { value: "overview", label: "Overview" },
- { value: "payouts", label: "Payouts" },
- ]}
- selected={selectedTab}
- selectAction={(value) => setSelectedTab(value as any)}
- />
- </div>
- <div className="mt-6">
- {selectedTab === "overview" && (
- <div className="flex flex-col gap-6 text-sm text-neutral-500">
- <h3 className="text-base font-semibold text-neutral-900">
- About this partner
- </h3>
-
- <div>
- <h4 className="font-semibold text-neutral-900">
- Description
- </h4>
- <p className="mt-1.5">
- {partner.bio || (
- <span className="italic text-neutral-400">
- No description provided
- </span>
- )}
- </p>
+ {partner.status === "approved" && (
+ <div className="xs:grid-cols-4 mt-6 grid grid-cols-2 gap-px overflow-hidden rounded-lg border border-neutral-200 bg-neutral-200">
+ {[
+ [
+ "Clicks",
+ !partner.link
+ ? "-"
+ : nFormatter(partner.link?.clicks, { full: true }),
+ ],
+ [
+ "Leads",
+ !partner.link
+ ? "-"
+ : nFormatter(partner.link?.leads, { full: true }),
+ ],
+ [
+ "Sales",
+ !partner.link
+ ? "-"
+ : nFormatter(partner.link?.sales, { full: true }),
+ ],
+ [
+ "Revenue",
+ !partner.link
+ ? "-"
+ : currencyFormatter(saleAmount, {
+ minimumFractionDigits: saleAmount % 1 === 0 ? 0 : 2,
+ maximumFractionDigits: 2,
+ }),
+ ],
+ // [
+ // "Earnings",
+ // currencyFormatter(earnings, {
+ // minimumFractionDigits: earnings % 1 === 0 ? 0 : 2,
+ // maximumFractionDigits: 2,
+ // }),
+ // ],
+ ].map(([label, value]) => (
+ <div key={label} className="flex flex-col bg-neutral-50 p-3">
+ <span className="text-xs text-neutral-500">{label}</span>
+ <span className="text-base text-neutral-900">{value}</span>
</div>
- </div>
- )}
+ ))}
+ </div>
+ )}
- {selectedTab === "payouts" && <PartnerPayouts partner={partner} />}
- </div>
+ {partner.link && (
+ <div className="xs:grid-cols-2 mt-4 grid grid-cols-1 gap-3">
+ <Link
+ href={`/${slug}/analytics?domain=${partner.link.domain}&key=${partner.link.key}`}
+ className={cn(
+ buttonVariants({ variant: "secondary" }),
+ "flex h-8 items-center justify-center gap-2 rounded-lg border px-2 text-sm",
+ )}
+ >
+ <LinesY className="size-4 text-neutral-900" />
+ Analytics
+ </Link>
+ <Link
+ href={`/${slug}/events?domain=${partner.link.domain}&key=${partner.link.key}`}
+ className={cn(
+ buttonVariants({ variant: "secondary" }),
+ "flex h-8 items-center justify-center gap-2 rounded-lg border px-2 text-sm",
+ )}
+ >
+ <CursorRays className="size-4 text-neutral-900" />
+ Events
+ </Link>
+ </div>
+ )}
+ </div>
+
+ <div className="grow p-6">
+ {partner.status === "approved" ? (
+ <PartnerPayouts partner={partner} />
+ ) : (
+ <div className="flex flex-col gap-6 text-sm text-neutral-500">
+ <h3 className="text-base font-semibold text-neutral-900">
+ About this partner
+ </h3>
+
+ <div>
+ <h4 className="font-semibold text-neutral-900">Description</h4>
+ <p className="mt-1.5">
+ {partner.bio || (
+ <span className="italic text-neutral-400">
+ No description provided
+ </span>
+ )}
+ </p>
+ </div>
+ </div>
+ )}
</div>
</div>
diff --git a/packages/ui/src/icons/nucleo/index.ts b/packages/ui/src/icons/nucleo/index.ts
index 2782e598eb..aceabd3286 100644
--- a/packages/ui/src/icons/nucleo/index.ts
+++ b/packages/ui/src/icons/nucleo/index.ts
@@ -97,6 +97,7 @@ export * from "./key";
export * from "./layout-sidebar";
export * from "./lines-y";
export * from "./link-broken";
+export * from "./link4";
export * from "./location-pin";
export * from "./magnifier";
export * from "./map-position";
diff --git a/packages/ui/src/icons/nucleo/link4.tsx b/packages/ui/src/icons/nucleo/link4.tsx
new file mode 100644
index 0000000000..590cd26367
--- /dev/null
+++ b/packages/ui/src/icons/nucleo/link4.tsx
@@ -0,0 +1,43 @@
+import { SVGProps } from "react";
+
+export function Link4(props: SVGProps<SVGSVGElement>) {
+ return (
+ <svg
+ height="18"
+ width="18"
+ viewBox="0 0 18 18"
+ xmlns="http://www.w3.org/2000/svg"
+ {...props}
+ >
+ <g fill="currentColor">
+ <path
+ d="M5.75,7.25v-2.25c0-1.795,1.455-3.25,3.25-3.25h0c1.795,0,3.25,1.455,3.25,3.25v2.25"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <path
+ d="M5.75,10.75v2.25c0,1.795,1.455,3.25,3.25,3.25h0c1.795,0,3.25-1.455,3.25-3.25v-2.25"
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ />
+ <line
+ fill="none"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ x1="9"
+ x2="9"
+ y1="11.25"
+ y2="6.75"
+ />
+ </g>
+ </svg>
+ );
+}