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.

only show when partnersEnabled

Steven Tey6cc75d2702ba
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/notifications/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/notifications/page-client.tsx
index e23765bec4..32258af808 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/notifications/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/notifications/page-client.tsx
@@ -24,7 +24,6 @@ export default function NotificationsSettingsPageClient() {
icon: Globe,
title: "Domain configuration updates",
description: "Updates to your custom domain configuration.",
- show: true,
},
{
type: "linkUsageSummary",
@@ -32,15 +31,18 @@ export default function NotificationsSettingsPageClient() {
title: "Monthly links usage summary",
description:
"Monthly summary email of your top 5 links by usage & total links created.",
- show: true,
- },
- {
- type: "newPartnerSale",
- icon: DollarSign,
- title: "New referral sales",
- description: "Alert when a new sale is made on your referral program.",
- show: partnersEnabled,
},
+ ...(partnersEnabled
+ ? [
+ {
+ type: "newPartnerSale",
+ icon: DollarSign,
+ title: "New referral sales",
+ description:
+ "Alert when a new sale is made on your referral program.",
+ },
+ ]
+ : []),
],
[partnersEnabled],
);
@@ -92,52 +94,50 @@ export default function NotificationsSettingsPageClient() {
</p>
</div>
<div className="mt-2 grid grid-cols-1 gap-3">
- {notifications
- .filter(({ show }) => show)
- .map(({ type, icon: Icon, title, description }) => (
- <div
- key={type}
- className="flex items-center justify-between gap-4 rounded-xl border border-neutral-200 bg-white p-5"
- >
- <div className="flex min-w-0 items-center gap-4">
- <div className="hidden rounded-full border border-neutral-200 sm:block">
- <div className="rounded-full border border-white bg-gradient-to-t from-neutral-100 p-1 md:p-3">
- <Icon className="size-5" />
- </div>
+ {notifications.map(({ type, icon: Icon, title, description }) => (
+ <div
+ key={type}
+ className="flex items-center justify-between gap-4 rounded-xl border border-neutral-200 bg-white p-5"
+ >
+ <div className="flex min-w-0 items-center gap-4">
+ <div className="hidden rounded-full border border-neutral-200 sm:block">
+ <div className="rounded-full border border-white bg-gradient-to-t from-neutral-100 p-1 md:p-3">
+ <Icon className="size-5" />
+ </div>
+ </div>
+ <div className="overflow-hidden">
+ <div className="flex items-center gap-1.5 sm:gap-2.5">
+ <div className="truncate text-sm font-medium">{title}</div>
</div>
- <div className="overflow-hidden">
- <div className="flex items-center gap-1.5 sm:gap-2.5">
- <div className="truncate text-sm font-medium">{title}</div>
- </div>
- <div className="mt-1 flex items-center gap-1 text-xs">
- <span className="whitespace-pre-wrap text-neutral-500">
- {description}
- </span>
- </div>
+ <div className="mt-1 flex items-center gap-1 text-xs">
+ <span className="whitespace-pre-wrap text-neutral-500">
+ {description}
+ </span>
</div>
</div>
- <Switch
- checked={preferences?.[type] ?? false}
- disabled={isLoading}
- fn={(checked: boolean) => {
- if (!preferences) return;
-
- update(
- () =>
- handleUpdate({
- type,
- value: checked,
- currentPreferences: preferences,
- }),
- {
- ...preferences,
- [type]: checked,
- },
- );
- }}
- />
</div>
- ))}
+ <Switch
+ checked={preferences?.[type] ?? false}
+ disabled={isLoading}
+ fn={(checked: boolean) => {
+ if (!preferences) return;
+
+ update(
+ () =>
+ handleUpdate({
+ type,
+ value: checked,
+ currentPreferences: preferences,
+ }),
+ {
+ ...preferences,
+ [type]: checked,
+ },
+ );
+ }}
+ />
+ </div>
+ ))}
</div>
</div>
);