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.

WIP earnings calculator block

Tim Wilson2c445c623d7a
diff --git a/apps/web/ui/partners/design/modals/earnings-calculator-block-modal.tsx b/apps/web/ui/partners/design/modals/earnings-calculator-block-modal.tsx
index 9b21ed7a80..20d696bf7d 100644
--- a/apps/web/ui/partners/design/modals/earnings-calculator-block-modal.tsx
+++ b/apps/web/ui/partners/design/modals/earnings-calculator-block-modal.tsx
@@ -95,18 +95,26 @@ function EarningsCalculatorBlockModalInner({
>
Average product price
</label>
- <div className="mt-2 rounded-md shadow-sm">
+ <div className="relative mt-2 rounded-md shadow-sm">
+ <span className="absolute inset-y-0 left-0 flex items-center pl-3 text-sm text-neutral-400">
+ $
+ </span>
<input
id={`${id}-price`}
type="text"
placeholder="30"
autoFocus={!isMobile}
className={cn(
- "block w-full rounded-md border-neutral-300 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm",
+ "block w-full rounded-md border-neutral-300 pl-6 text-neutral-900 placeholder-neutral-400 focus:border-neutral-500 focus:outline-none focus:ring-neutral-500 sm:text-sm",
errors.productPrice &&
"border-red-600 focus:border-red-500 focus:ring-red-600",
)}
- {...register("productPrice")}
+ {...register("productPrice", {
+ required: true,
+ valueAsNumber: true,
+ min: 0,
+ max: 10_000_00,
+ })}
/>
</div>
</div>
diff --git a/apps/web/ui/partners/lander-blocks/earnings-calculator-block.tsx b/apps/web/ui/partners/lander-blocks/earnings-calculator-block.tsx
index 6da4626b44..37e2284f55 100644
--- a/apps/web/ui/partners/lander-blocks/earnings-calculator-block.tsx
+++ b/apps/web/ui/partners/lander-blocks/earnings-calculator-block.tsx
@@ -41,7 +41,7 @@ export function EarningsCalculatorBlock({
<input
id={`${id}-slider`}
type="range"
- min={0}
+ min={1}
max={50}
value={value}
onChange={(e) => setValue(Number(e.target.value))}
@@ -57,7 +57,11 @@ export function EarningsCalculatorBlock({
<div className="flex flex-col items-center justify-center border-t border-neutral-200 bg-neutral-100 p-4 font-semibold text-neutral-800/60 sm:p-8">
<span>You can earn</span>
<NumberFlow
- value={Math.floor(revenue * (reward.amount / 100))}
+ value={Math.floor(
+ reward.type === "flat"
+ ? reward.amount / 100
+ : revenue * (reward.amount / 100),
+ )}
className="text-4xl font-medium text-neutral-800"
prefix="$"
/>