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.

Cleanup from review

Tim Wilsonf4548a7b62a4
diff --git a/apps/web/lib/partners/get-program-application-rewards.ts b/apps/web/lib/partners/get-program-application-rewards.ts
index 8910e5f444..8cde1c631e 100644
--- a/apps/web/lib/partners/get-program-application-rewards.ts
+++ b/apps/web/lib/partners/get-program-application-rewards.ts
@@ -22,12 +22,11 @@ export function getProgramApplicationRewardsAndDiscount({
program: Pick<ProgramWithLanderDataProps, "defaultDiscountId" | "landerData">;
}) {
const defaults = {
- rewards: rewards?.filter((r) => r.default),
- discount:
- discounts?.find((d) => d.id === program.defaultDiscountId) || null,
+ rewards: rewards.filter((r) => r.default),
+ discount: discounts.find((d) => d.id === program.defaultDiscountId) || null,
};
- if (!program?.landerData?.rewards) return defaults;
+ if (!program.landerData?.rewards) return defaults;
const landerRewards = program.landerData.rewards;
const result: {
@@ -39,7 +38,7 @@ export function getProgramApplicationRewardsAndDiscount({
result.discount =
landerRewards.discountId === "none"
? null
- : discounts?.find((d) => d.id === landerRewards.discountId) ||
+ : discounts.find((d) => d.id === landerRewards.discountId) ||
defaults.discount;
(["sale", "lead", "click"] as const).forEach((event) => {
@@ -56,7 +55,7 @@ export function getProgramApplicationRewardsAndDiscount({
// Still fall back to the default reward if there is no matching reward
const reward =
- rewards?.find((r) => r.id === landerReward && r.event === event) ||
+ rewards.find((r) => r.id === landerReward && r.event === event) ||
defaultReward;
if (!reward) return;
diff --git a/apps/web/ui/partners/design/modals/edit-rewards-modal.tsx b/apps/web/ui/partners/design/modals/edit-rewards-modal.tsx
index b5e17d1425..6a4cfd40e8 100644
--- a/apps/web/ui/partners/design/modals/edit-rewards-modal.tsx
+++ b/apps/web/ui/partners/design/modals/edit-rewards-modal.tsx
@@ -90,7 +90,7 @@ function EditRewardsModalInner({
REWARD_EVENTS.forEach(({ event }) => {
if (!override && landerDataRewards[`${event}RewardId`]) return;
- const defaultReward = rewards?.find(
+ const defaultReward = rewards.find(
(r) => r.event === event && r.default,
);
setValue(
@@ -111,7 +111,7 @@ function EditRewardsModalInner({
if (!override && landerDataRewards.discountId) return;
- const defaultDiscount = discounts?.find(
+ const defaultDiscount = discounts.find(
(d) => d.id === program?.defaultDiscountId,
);
diff --git a/apps/web/ui/partners/design/previews/lander-preview.tsx b/apps/web/ui/partners/design/previews/lander-preview.tsx
index 135705ab81..fa09f70fe5 100644
--- a/apps/web/ui/partners/design/previews/lander-preview.tsx
+++ b/apps/web/ui/partners/design/previews/lander-preview.tsx
@@ -185,8 +185,8 @@ export function LanderPreview({
{/* Program rewards */}
<div
className="group relative"
- data-touched={touchedBlockId === "hero"}
- onClick={() => isMobile && setTouchedBlockId("hero")}
+ data-touched={touchedBlockId === "rewards"}
+ onClick={() => isMobile && setTouchedBlockId("rewards")}
>
<EditIndicatorGrid />
<EditToolbar onEdit={() => setShowEditRewardsModal(true)} />