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.

swap activity and partner details, update device icon

Steven Teyc2cd4a48a771
diff --git a/apps/web/app/api/partner-profile/programs/[programId]/customers/[customerId]/route.ts b/apps/web/app/api/partner-profile/programs/[programId]/customers/[customerId]/route.ts
index 6c60023700..8ef1fc4375 100644
--- a/apps/web/app/api/partner-profile/programs/[programId]/customers/[customerId]/route.ts
+++ b/apps/web/app/api/partner-profile/programs/[programId]/customers/[customerId]/route.ts
@@ -6,6 +6,7 @@ import { getProgramEnrollmentOrThrow } from "@/lib/api/programs/get-program-enro
import { parseRequestBody } from "@/lib/api/utils";
import { withWorkspace } from "@/lib/auth";
import { withPartnerProfile } from "@/lib/auth/partner";
+import { generateRandomName } from "@/lib/names";
import {
CustomerEnrichedSchema,
CustomerSchema,
@@ -66,6 +67,7 @@ export const GET = withPartnerProfile(
PartnerProfileCustomerSchema.parse(
transformCustomer({
...customer,
+ email: customer.email || customer.name || generateRandomName(),
link: customer.link
? {
...customer.link,
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/customers/[customerId]/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/customers/[customerId]/page-client.tsx
index c3a7f79072..89d91efacd 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/customers/[customerId]/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/customers/[customerId]/page-client.tsx
@@ -93,16 +93,6 @@ export function CustomerPageClient() {
<SalesTable customerId={customerId} />
</section>
- <section className="flex flex-col">
- <h2 className="py-3 text-lg font-semibold text-neutral-900">
- Activity
- </h2>
- <CustomerActivityList
- activity={customerActivity}
- isLoading={!customer || isCustomerActivityLoading}
- />
- </section>
-
{customer?.programId && customer.partner && (
<section className="flex flex-col">
<h2 className="py-3 text-lg font-semibold text-neutral-900">
@@ -146,6 +136,16 @@ export function CustomerPageClient() {
</div>
</section>
)}
+
+ <section className="flex flex-col">
+ <h2 className="py-3 text-lg font-semibold text-neutral-900">
+ Activity
+ </h2>
+ <CustomerActivityList
+ activity={customerActivity}
+ isLoading={!customer || isCustomerActivityLoading}
+ />
+ </section>
</div>
{/* Right side details */}
diff --git a/apps/web/ui/analytics/device-icon.tsx b/apps/web/ui/analytics/device-icon.tsx
index d4c92db205..2d4b28bd89 100644
--- a/apps/web/ui/analytics/device-icon.tsx
+++ b/apps/web/ui/analytics/device-icon.tsx
@@ -3,6 +3,7 @@ import { Chrome, Safari } from "@/ui/shared/icons/devices";
import { BlurImage } from "@dub/ui";
import {
AppleLogo,
+ Cube,
CursorRays,
Desktop,
GamingConsole,
@@ -11,6 +12,7 @@ import {
TV,
Tablet,
Watch,
+ Window,
} from "@dub/ui/icons";
export default function DeviceIcon({
@@ -40,44 +42,51 @@ export default function DeviceIcon({
return <Desktop className={className} />;
}
} else if (tab === "browsers") {
- if (display === "Chrome") {
- return <Chrome className={className} />;
- } else if (display === "Safari" || display === "Mobile Safari") {
- return <Safari className={className} />;
- } else {
- return (
- <BlurImage
- src={`https://faisalman.github.io/ua-parser-js/images/browsers/${display.toLowerCase()}.png`}
- alt={display}
- width={20}
- height={20}
- className={className}
- />
- );
+ switch (display) {
+ case "Chrome":
+ return <Chrome className={className} />;
+ case "Safari":
+ case "Mobile Safari":
+ return <Safari className={className} />;
+ case "Unknown":
+ return <Window className={className} />;
+ default:
+ return (
+ <BlurImage
+ src={`https://faisalman.github.io/ua-parser-js/images/browsers/${display.toLowerCase()}.png`}
+ alt={display}
+ width={20}
+ height={20}
+ className={className}
+ />
+ );
}
} else if (tab === "os") {
- if (display === "Mac OS") {
- return (
- <BlurImage
- src="https://assets.dub.co/misc/icons/macos.png"
- alt={display}
- width={20}
- height={20}
- className="h-4 w-4"
- />
- );
- } else if (display === "iOS") {
- return <AppleLogo className="-ml-1 h-5 w-5" />;
- } else {
- return (
- <BlurImage
- src={`https://faisalman.github.io/ua-parser-js/images/os/${display.toLowerCase()}.png`}
- alt={display}
- width={30}
- height={20}
- className="h-4 w-5"
- />
- );
+ switch (display) {
+ case "Mac OS":
+ return (
+ <BlurImage
+ src="https://assets.dub.co/misc/icons/macos.png"
+ alt={display}
+ width={20}
+ height={20}
+ className="h-4 w-4"
+ />
+ );
+ case "iOS":
+ return <AppleLogo className="-ml-1 h-5 w-5" />;
+ case "Unknown":
+ return <Cube className={className} />;
+ default:
+ return (
+ <BlurImage
+ src={`https://faisalman.github.io/ua-parser-js/images/os/${display.toLowerCase()}.png`}
+ alt={display}
+ width={30}
+ height={20}
+ className="h-4 w-5"
+ />
+ );
}
} else if (tab === "triggers") {
if (display === "qr") {
diff --git a/apps/web/ui/customers/customer-details-column.tsx b/apps/web/ui/customers/customer-details-column.tsx
index aa3db0fefc..c56eff8dfd 100644
--- a/apps/web/ui/customers/customer-details-column.tsx
+++ b/apps/web/ui/customers/customer-details-column.tsx
@@ -66,17 +66,6 @@ export function CustomerDetailsColumn({
)}
{click
? [
- {
- key: "os",
- icon: (
- <DeviceIcon
- display={capitalize(click.os)!}
- tab="os"
- className="size-3.5 shrink-0"
- />
- ),
- value: click.os,
- },
{
key: "device",
icon: (
@@ -99,6 +88,17 @@ export function CustomerDetailsColumn({
),
value: click.browser,
},
+ {
+ key: "os",
+ icon: (
+ <DeviceIcon
+ display={capitalize(click.os)!}
+ tab="os"
+ className="size-3.5 shrink-0"
+ />
+ ),
+ value: click.os,
+ },
]
.filter(({ value }) => value)
.map(({ key, icon, value }) => (