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.

make reward description compact

Kiran K3c00415d972a
diff --git a/apps/web/ui/partners/program-reward-description.tsx b/apps/web/ui/partners/program-reward-description.tsx
index 6fdd6e959c..dc2d077b4a 100644
--- a/apps/web/ui/partners/program-reward-description.tsx
+++ b/apps/web/ui/partners/program-reward-description.tsx
@@ -73,20 +73,21 @@ export function formatRewardDescription({
}: {
reward: RewardProps;
}): string {
+ const rewardAmount = constructRewardAmount(reward);
const parts: string[] = [];
- if (reward.amount > 0) {
- let rewardText = `Earn ${constructRewardAmount(reward)} for each ${reward.event}`;
+ parts.push(`${rewardAmount} per ${reward.event}`);
+ if (reward.event === "sale") {
if (reward.maxDuration === null) {
- rewardText += ` for the customer's lifetime.`;
- } else if (reward.maxDuration && reward.maxDuration > 1) {
- rewardText += `, and again every month for ${reward.maxDuration} months.`;
- } else {
- rewardText += `.`;
+ parts.push("for lifetime");
+ } else if (reward.maxDuration === 0) {
+ parts.push("for the first purchase");
+ } else if (reward.maxDuration && reward.maxDuration > 0) {
+ parts.push(
+ `for ${reward.maxDuration} ${pluralize("month", reward.maxDuration)}`,
+ );
}
-
- parts.push(rewardText);
}
return parts.join(" ");