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.

Earnings calculator defaults + misc. changes

Tim Wilsonc8fddb86a8c2
diff --git a/apps/web/lib/zod/schemas/program-lander.ts b/apps/web/lib/zod/schemas/program-lander.ts
index c0bee6bf31..f843006cd9 100644
--- a/apps/web/lib/zod/schemas/program-lander.ts
+++ b/apps/web/lib/zod/schemas/program-lander.ts
@@ -1,6 +1,7 @@
import { z } from "zod";
const programLanderBlockTitleSchema = z.string().optional();
+const programLanderBlockDescriptionSchema = z.string().optional();
export const programLanderBlockCommonSchema = z.object({
id: z.string(),
@@ -63,6 +64,7 @@ export const programLanderEarningsCalculatorBlockSchema =
type: z.literal("earnings-calculator"),
data: z.object({
title: programLanderBlockTitleSchema,
+ description: programLanderBlockDescriptionSchema,
productPrice: z.number(),
}),
});
diff --git a/apps/web/ui/partners/design/modals/accordion-block-modal.tsx b/apps/web/ui/partners/design/modals/accordion-block-modal.tsx
index 7f0c5ee434..18d4298500 100644
--- a/apps/web/ui/partners/design/modals/accordion-block-modal.tsx
+++ b/apps/web/ui/partners/design/modals/accordion-block-modal.tsx
@@ -104,121 +104,123 @@ function AccordionBlockModalInner({
</div>
</div>
- <div
- ref={scrollRef}
- onScroll={updateScrollProgress}
- className="scrollbar-hide relative -my-2 max-h-[calc(100vh-300px)] overflow-y-auto py-2"
- >
- <EditList
- values={fields.map(({ id }) => id)}
- onAdd={() => {
- const id = uuid();
+ <div className="relative -my-2">
+ <div
+ ref={scrollRef}
+ onScroll={updateScrollProgress}
+ className="scrollbar-hide relative max-h-[calc(100vh-300px)] overflow-y-auto py-2"
+ >
+ <EditList
+ values={fields.map(({ id }) => id)}
+ onAdd={() => {
+ const id = uuid();
- setValue(
- "items",
- [
- ...fields,
- {
- id,
- title: `Item ${fields.length + 1}`,
- content: "",
- },
- ],
- { shouldDirty: true },
- );
+ setValue(
+ "items",
+ [
+ ...fields,
+ {
+ id,
+ title: `Item ${fields.length + 1}`,
+ content: "",
+ },
+ ],
+ { shouldDirty: true },
+ );
- return id;
- }}
- onReorder={(updated) =>
- setValue(
- "items",
- updated.map((id) => fields.find((f) => f.id === id)!),
- { shouldDirty: true },
- )
- }
- >
- {fields.map((field, index) => {
- const fieldErrors = errors.items?.[index];
+ return id;
+ }}
+ onReorder={(updated) =>
+ setValue(
+ "items",
+ updated.map((id) => fields.find((f) => f.id === id)!),
+ { shouldDirty: true },
+ )
+ }
+ >
+ {fields.map((field, index) => {
+ const fieldErrors = errors.items?.[index];
- return (
- <EditListItem
- key={field.id}
- value={field.id}
- title={
- <span className="flex items-center gap-2">
- {field.title || "Item"}
- {(fieldErrors?.title || fieldErrors?.content) && (
- <CircleWarning className="size-3.5 text-red-600" />
- )}
- </span>
- }
- onRemove={
- fields.length > 1
- ? () =>
- setValue(
- "items",
- fields.filter(({ id }) => id !== field.id),
- { shouldDirty: true },
- )
- : undefined
- }
- >
- <div className="flex flex-col gap-6">
- {/* Title */}
- <div>
- <label
- htmlFor={`${id}-${field.id}-title`}
- className="flex items-center gap-2 text-sm font-medium text-neutral-700"
- >
- Title
- </label>
- <div className="mt-2 rounded-md shadow-sm">
- <input
- id={`${id}-${field.id}-title`}
- type="text"
- placeholder="Title"
- 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",
- fieldErrors?.title &&
- "border-red-600 focus:border-red-500 focus:ring-red-600",
- )}
- {...register(`items.${index}.title`, {
- required: "Title is required",
- })}
- />
+ return (
+ <EditListItem
+ key={field.id}
+ value={field.id}
+ title={
+ <span className="flex items-center gap-2">
+ {field.title || "Item"}
+ {(fieldErrors?.title || fieldErrors?.content) && (
+ <CircleWarning className="size-3.5 text-red-600" />
+ )}
+ </span>
+ }
+ onRemove={
+ fields.length > 1
+ ? () =>
+ setValue(
+ "items",
+ fields.filter(({ id }) => id !== field.id),
+ { shouldDirty: true },
+ )
+ : undefined
+ }
+ >
+ <div className="flex flex-col gap-6">
+ {/* Title */}
+ <div>
+ <label
+ htmlFor={`${id}-${field.id}-title`}
+ className="flex items-center gap-2 text-sm font-medium text-neutral-700"
+ >
+ Title
+ </label>
+ <div className="mt-2 rounded-md shadow-sm">
+ <input
+ id={`${id}-${field.id}-title`}
+ type="text"
+ placeholder="Title"
+ 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",
+ fieldErrors?.title &&
+ "border-red-600 focus:border-red-500 focus:ring-red-600",
+ )}
+ {...register(`items.${index}.title`, {
+ required: "Title is required",
+ })}
+ />
+ </div>
</div>
- </div>
- {/* Content */}
- <div>
- <label
- htmlFor={`${id}-${field.id}-content`}
- className="flex items-center gap-2 text-sm font-medium text-neutral-700"
- >
- Content
- </label>
- <div className="mt-2 rounded-md shadow-sm">
- <textarea
- id={`${id}-${field.id}-content`}
- rows={3}
- maxLength={1000}
- placeholder="Start typing"
- className={cn(
- "block max-h-32 min-h-16 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",
- fieldErrors?.content &&
- "border-red-600 focus:border-red-500 focus:ring-red-600",
- )}
- {...register(`items.${index}.content`, {
- required: "Content is required",
- })}
- />
+ {/* Content */}
+ <div>
+ <label
+ htmlFor={`${id}-${field.id}-content`}
+ className="flex items-center gap-2 text-sm font-medium text-neutral-700"
+ >
+ Content
+ </label>
+ <div className="mt-2 rounded-md shadow-sm">
+ <textarea
+ id={`${id}-${field.id}-content`}
+ rows={3}
+ maxLength={1000}
+ placeholder="Start typing"
+ className={cn(
+ "block max-h-32 min-h-16 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",
+ fieldErrors?.content &&
+ "border-red-600 focus:border-red-500 focus:ring-red-600",
+ )}
+ {...register(`items.${index}.content`, {
+ required: "Content is required",
+ })}
+ />
+ </div>
</div>
</div>
- </div>
- </EditListItem>
- );
- })}
- </EditList>
+ </EditListItem>
+ );
+ })}
+ </EditList>
+ </div>
{/* Bottom scroll fade */}
<div
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 775b45f9cc..1e5968afe5 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
@@ -3,10 +3,10 @@
import useProgram from "@/lib/swr/use-program";
import useWorkspace from "@/lib/swr/use-workspace";
import { programLanderEarningsCalculatorBlockSchema } from "@/lib/zod/schemas/program-lander";
-import { Button, Modal, useMediaQuery } from "@dub/ui";
+import { Button, Modal, useMediaQuery, useScrollProgress } from "@dub/ui";
import { cn } from "@dub/utils";
import Link from "next/link";
-import { Dispatch, SetStateAction, useId } from "react";
+import { Dispatch, SetStateAction, useId, useRef } from "react";
import { Control, useForm, useWatch } from "react-hook-form";
import { z } from "zod";
import { EarningsCalculatorBlock } from "../../lander-blocks/earnings-calculator-block";
@@ -60,6 +60,9 @@ function EarningsCalculatorBlockModalInner({
},
});
+ const scrollRef = useRef<HTMLDivElement>(null);
+ const { scrollProgress, updateScrollProgress } = useScrollProgress(scrollRef);
+
return (
<>
<div className="p-4 pt-3">
@@ -67,7 +70,7 @@ function EarningsCalculatorBlockModalInner({
{defaultValues ? "Edit" : "Add"} earnings calculator
</h3>
<form
- className="mt-4 flex flex-col gap-6"
+ className="mt-4"
onSubmit={(e) => {
e.stopPropagation();
handleSubmit(async (data) => {
@@ -79,77 +82,112 @@ function EarningsCalculatorBlockModalInner({
})(e);
}}
>
- {/* Title */}
- <div>
- <label
- htmlFor={`${id}-title`}
- className="flex items-center gap-2 text-sm font-medium text-neutral-700"
+ <div className="relative">
+ <div
+ ref={scrollRef}
+ onScroll={updateScrollProgress}
+ className="scrollbar-hide relative -m-2 max-h-[calc(100vh-160px)] overflow-y-auto p-2"
>
- Section heading
- </label>
- <div className="mt-2 rounded-md shadow-sm">
- <input
- id={`${id}-title`}
- type="text"
- placeholder="Earnings calculator"
- autoFocus={!isMobile}
- className="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"
- {...register("title")}
- />
- </div>
- </div>
+ <div className="flex flex-col gap-5">
+ {/* Title */}
+ <div>
+ <label
+ htmlFor={`${id}-title`}
+ className="flex items-center gap-2 text-sm font-medium text-neutral-700"
+ >
+ Section heading
+ </label>
+ <div className="mt-2 rounded-md shadow-sm">
+ <input
+ id={`${id}-title`}
+ type="text"
+ placeholder="Earnings calculator"
+ autoFocus={!isMobile}
+ className="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"
+ {...register("title")}
+ />
+ </div>
+ </div>
- {/* Product price */}
- <div>
- <label
- htmlFor={`${id}-price`}
- className="flex items-center gap-2 text-sm font-medium text-neutral-700"
- >
- Average product price
- </label>
- <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 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", {
- required: true,
- valueAsNumber: true,
- min: 0,
- max: MAX_PRODUCT_PRICE,
- })}
- />
- </div>
- </div>
+ {/* Description */}
+ <div>
+ <label
+ htmlFor={`${id}-description`}
+ className="flex items-center gap-2 text-sm font-medium text-neutral-700"
+ >
+ Section description
+ </label>
+ <div className="mt-2 rounded-md shadow-sm">
+ <textarea
+ id={`${id}-description`}
+ placeholder="See how much you could earn"
+ rows={2}
+ className="block max-h-32 min-h-12 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"
+ {...register("description")}
+ />
+ </div>
+ </div>
- <div className="flex flex-col gap-2.5">
- <div>
- <span className="text-content-emphasis text-sm font-medium">
- Preview
- </span>
- <p className="text-xs text-neutral-500">
- This is calculated using your{" "}
- <Link
- href={`/${workspaceSlug}/programs/${program!.id}/settings/rewards`}
- target="_blank"
- >
- default program reward
- </Link>
- </p>
+ {/* Product price */}
+ <div>
+ <label
+ htmlFor={`${id}-price`}
+ className="flex items-center gap-2 text-sm font-medium text-neutral-700"
+ >
+ Average product price
+ </label>
+ <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 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", {
+ required: true,
+ valueAsNumber: true,
+ min: 0,
+ max: MAX_PRODUCT_PRICE,
+ })}
+ />
+ </div>
+ </div>
+
+ <div className="flex flex-col gap-2.5">
+ <div>
+ <span className="text-content-emphasis text-sm font-medium">
+ Preview
+ </span>
+ <p className="text-xs text-neutral-500">
+ This is calculated using your{" "}
+ <Link
+ href={`/${workspaceSlug}/programs/${program!.id}/settings/rewards`}
+ target="_blank"
+ className="underline hover:text-neutral-600"
+ >
+ default program reward
+ </Link>
+ </p>
+ </div>
+ <Preview control={control} />
+ </div>
+ </div>
</div>
- <Preview control={control} />
- </div>
- <div className="flex items-center justify-end gap-2">
+ {/* Bottom scroll fade */}
+ <div
+ className="pointer-events-none absolute bottom-0 left-0 hidden h-16 w-full bg-gradient-to-t from-white sm:block"
+ style={{ opacity: 1 - Math.pow(scrollProgress, 2) }}
+ />
+ </div>
+ <div className="mt-6 flex items-center justify-end gap-2">
<Button
onClick={() => setShowModal(false)}
variant="secondary"
@@ -182,24 +220,19 @@ function Preview({
});
const productPrice = useWatch({ control, name: "productPrice" });
- console.log(productPrice);
-
return (
- <div className="-mt-4">
- <EarningsCalculatorBlock
- block={{
- id: "",
- type: "earnings-calculator",
- data: {
- productPrice:
- Math.min(Math.max(productPrice || 0, 0), MAX_PRODUCT_PRICE) * 100,
- },
- }}
- reward={program?.rewards?.find(
- (r) => r.id === program?.defaultRewardId,
- )}
- brandColor={brandColor ?? undefined}
- />
- </div>
+ <EarningsCalculatorBlock
+ block={{
+ id: "",
+ type: "earnings-calculator",
+ data: {
+ productPrice:
+ Math.min(Math.max(productPrice || 0, 0), MAX_PRODUCT_PRICE) * 100,
+ },
+ }}
+ showTitleAndDescription={false}
+ reward={program?.rewards?.find((r) => r.id === program?.defaultRewardId)}
+ brandColor={brandColor ?? undefined}
+ />
);
}
diff --git a/apps/web/ui/partners/design/modals/files-block-modal.tsx b/apps/web/ui/partners/design/modals/files-block-modal.tsx
index cafcec6f18..9ef08611f8 100644
--- a/apps/web/ui/partners/design/modals/files-block-modal.tsx
+++ b/apps/web/ui/partners/design/modals/files-block-modal.tsx
@@ -106,141 +106,143 @@ function FilesBlockModalInner({
</div>
</div>
- <div
- ref={scrollRef}
- onScroll={updateScrollProgress}
- className="scrollbar-hide relative -my-2 max-h-[calc(100vh-300px)] overflow-y-auto py-2"
- >
- <EditList
- values={fields.map(({ id }) => id)}
- onAdd={() => {
- const id = uuid();
+ <div className="relative -my-2">
+ <div
+ ref={scrollRef}
+ onScroll={updateScrollProgress}
+ className="scrollbar-hide relative max-h-[calc(100vh-300px)] overflow-y-auto py-2"
+ >
+ <EditList
+ values={fields.map(({ id }) => id)}
+ onAdd={() => {
+ const id = uuid();
- setValue(
- "items",
- [
- ...fields,
- {
- id,
- name: `File ${fields.length + 1}`,
- description: "",
- url: "",
- },
- ],
- { shouldDirty: true },
- );
+ setValue(
+ "items",
+ [
+ ...fields,
+ {
+ id,
+ name: `File ${fields.length + 1}`,
+ description: "",
+ url: "",
+ },
+ ],
+ { shouldDirty: true },
+ );
- return id;
- }}
- onReorder={(updated) =>
- setValue(
- "items",
- updated.map((id) => fields.find((f) => f.id === id)!),
- { shouldDirty: true },
- )
- }
- >
- {fields.map((field, index) => {
- const fieldErrors = errors.items?.[index];
+ return id;
+ }}
+ onReorder={(updated) =>
+ setValue(
+ "items",
+ updated.map((id) => fields.find((f) => f.id === id)!),
+ { shouldDirty: true },
+ )
+ }
+ >
+ {fields.map((field, index) => {
+ const fieldErrors = errors.items?.[index];
- return (
- <EditListItem
- key={field.id}
- value={field.id}
- title={
- <span className="flex items-center gap-2">
- {field.name || "File"}
- {(fieldErrors?.url || fieldErrors?.name) && (
- <CircleWarning className="size-3.5 text-red-600" />
- )}
- </span>
- }
- onRemove={
- fields.length > 1
- ? () =>
- setValue(
- "items",
- fields.filter(({ id }) => id !== field.id),
- { shouldDirty: true },
- )
- : undefined
- }
- >
- <div className="flex flex-col gap-6">
- {/* Name */}
- <div>
- <label
- htmlFor={`${id}-${field.id}-name`}
- className="flex items-center gap-2 text-sm font-medium text-neutral-700"
- >
- Display name
- </label>
- <div className="mt-2 rounded-md shadow-sm">
- <input
- id={`${id}-${field.id}-name`}
- type="text"
- placeholder="Brand assets"
- 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",
- fieldErrors?.name &&
- "border-red-600 focus:border-red-500 focus:ring-red-600",
- )}
- {...register(`items.${index}.name`, {
- required: "Display name is required",
- })}
- />
+ return (
+ <EditListItem
+ key={field.id}
+ value={field.id}
+ title={
+ <span className="flex items-center gap-2">
+ {field.name || "File"}
+ {(fieldErrors?.url || fieldErrors?.name) && (
+ <CircleWarning className="size-3.5 text-red-600" />
+ )}
+ </span>
+ }
+ onRemove={
+ fields.length > 1
+ ? () =>
+ setValue(
+ "items",
+ fields.filter(({ id }) => id !== field.id),
+ { shouldDirty: true },
+ )
+ : undefined
+ }
+ >
+ <div className="flex flex-col gap-6">
+ {/* Name */}
+ <div>
+ <label
+ htmlFor={`${id}-${field.id}-name`}
+ className="flex items-center gap-2 text-sm font-medium text-neutral-700"
+ >
+ Display name
+ </label>
+ <div className="mt-2 rounded-md shadow-sm">
+ <input
+ id={`${id}-${field.id}-name`}
+ type="text"
+ placeholder="Brand assets"
+ 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",
+ fieldErrors?.name &&
+ "border-red-600 focus:border-red-500 focus:ring-red-600",
+ )}
+ {...register(`items.${index}.name`, {
+ required: "Display name is required",
+ })}
+ />
+ </div>
</div>
- </div>
- {/* URL */}
- <div>
- <label
- htmlFor={`${id}-${field.id}-url`}
- className="flex items-center gap-2 text-sm font-medium text-neutral-700"
- >
- File URL
- </label>
- <div className="mt-2 rounded-md shadow-sm">
- <input
- id={`${id}-${field.id}-url`}
- type="text"
- placeholder="https://example.com/file.pdf"
- 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",
- fieldErrors?.url &&
- "border-red-600 focus:border-red-500 focus:ring-red-600",
- )}
- {...register(`items.${index}.url`, {
- required: "File URL is required",
- })}
- />
+ {/* URL */}
+ <div>
+ <label
+ htmlFor={`${id}-${field.id}-url`}
+ className="flex items-center gap-2 text-sm font-medium text-neutral-700"
+ >
+ File URL
+ </label>
+ <div className="mt-2 rounded-md shadow-sm">
+ <input
+ id={`${id}-${field.id}-url`}
+ type="text"
+ placeholder="https://example.com/file.pdf"
+ 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",
+ fieldErrors?.url &&
+ "border-red-600 focus:border-red-500 focus:ring-red-600",
+ )}
+ {...register(`items.${index}.url`, {
+ required: "File URL is required",
+ })}
+ />
+ </div>
</div>
- </div>
- {/* Description */}
- <div>
- <label
- htmlFor={`${id}-${field.id}-description`}
- className="flex items-center gap-2 text-sm font-medium text-neutral-700"
- >
- Description
- </label>
- <div className="mt-2 rounded-md shadow-sm">
- <textarea
- id={`${id}-${field.id}-description`}
- rows={2}
- maxLength={240}
- placeholder="More information about the file"
- className="block max-h-32 min-h-10 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"
- {...register(`items.${index}.description`)}
- />
+ {/* Description */}
+ <div>
+ <label
+ htmlFor={`${id}-${field.id}-description`}
+ className="flex items-center gap-2 text-sm font-medium text-neutral-700"
+ >
+ Description
+ </label>
+ <div className="mt-2 rounded-md shadow-sm">
+ <textarea
+ id={`${id}-${field.id}-description`}
+ rows={2}
+ maxLength={240}
+ placeholder="More information about the file"
+ className="block max-h-32 min-h-10 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"
+ {...register(`items.${index}.description`)}
+ />
+ </div>
</div>
</div>
- </div>
- </EditListItem>
- );
- })}
- </EditList>
+ </EditListItem>
+ );
+ })}
+ </EditList>
+ </div>
{/* Bottom scroll fade */}
<div
diff --git a/apps/web/ui/partners/lander-blocks/AccordionBlock.tsx b/apps/web/ui/partners/lander-blocks/AccordionBlock.tsx
index d8086eb218..c18d9f3c19 100644
--- a/apps/web/ui/partners/lander-blocks/AccordionBlock.tsx
+++ b/apps/web/ui/partners/lander-blocks/AccordionBlock.tsx
@@ -15,9 +15,9 @@ export function AccordionBlock({
block: z.infer<typeof programLanderAccordionBlockSchema>;
}) {
return (
- <div>
+ <div className="space-y-5">
<BlockTitle title={block.data.title} />
- <div className="mt-5 border-y border-slate-200">
+ <div className="border-y border-slate-200">
<Accordion type="multiple">
{block.data.items.map((item, idx) => (
<AccordionItem key={idx} value={idx.toString()}>
diff --git a/apps/web/ui/partners/lander-blocks/BlockDescription.tsx b/apps/web/ui/partners/lander-blocks/BlockDescription.tsx
new file mode 100644
index 0000000000..43a638ef11
--- /dev/null
+++ b/apps/web/ui/partners/lander-blocks/BlockDescription.tsx
@@ -0,0 +1,5 @@
+export function BlockDescription({ description }: { description?: string }) {
+ return description ? (
+ <p className="text-base text-neutral-500">{description}</p>
+ ) : null;
+}
diff --git a/apps/web/ui/partners/lander-blocks/FilesBlock.tsx b/apps/web/ui/partners/lander-blocks/FilesBlock.tsx
index 8b64a2a5e5..34dd87cdee 100644
--- a/apps/web/ui/partners/lander-blocks/FilesBlock.tsx
+++ b/apps/web/ui/partners/lander-blocks/FilesBlock.tsx
@@ -11,9 +11,9 @@ export function FilesBlock({
logo: string | null;
}) {
return (
- <div>
+ <div className="space-y-5">
<BlockTitle title={block.data.title} />
- <div className="mt-5 grid grid-cols-1 gap-3">
+ <div className="grid grid-cols-1 gap-3">
{block.data.items.map((file, idx) => (
<a
key={idx}
diff --git a/apps/web/ui/partners/lander-blocks/TextBlock.tsx b/apps/web/ui/partners/lander-blocks/TextBlock.tsx
index dac2c69d52..b50e50d142 100644
--- a/apps/web/ui/partners/lander-blocks/TextBlock.tsx
+++ b/apps/web/ui/partners/lander-blocks/TextBlock.tsx
@@ -9,9 +9,9 @@ export function TextBlock({
block: z.infer<typeof programLanderTextBlockSchema>;
}) {
return (
- <div>
+ <div className="space-y-5">
<BlockTitle title={block.data.title} />
- <BlockMarkdown className="mt-5">{block.data.content}</BlockMarkdown>
+ <BlockMarkdown>{block.data.content}</BlockMarkdown>
</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 9a12c5ba29..0ffecef237 100644
--- a/apps/web/ui/partners/lander-blocks/earnings-calculator-block.tsx
+++ b/apps/web/ui/partners/lander-blocks/earnings-calculator-block.tsx
@@ -7,26 +7,39 @@ import NumberFlow from "@number-flow/react";
import { useId, useState } from "react";
import { z } from "zod";
import { formatRewardDescription } from "../format-reward-description";
+import { BlockDescription } from "./BlockDescription";
import { BlockTitle } from "./BlockTitle";
export function EarningsCalculatorBlock({
block,
brandColor,
reward,
+ showTitleAndDescription = true,
}: {
block: z.infer<typeof programLanderEarningsCalculatorBlockSchema>;
brandColor?: string;
reward?: Pick<RewardProps, "event" | "type" | "amount" | "maxDuration">;
+ showTitleAndDescription?: boolean;
}) {
const id = useId();
const [value, setValue] = useState(10);
- const revenue = value * (block.data.productPrice / 100);
+ const revenue = value * ((block.data.productPrice || 30_00) / 100);
return reward && reward.event === "sale" ? (
- <div>
- <BlockTitle title={block.data.title} />
- <div className="mt-5 overflow-hidden rounded-lg border border-neutral-200 bg-white">
+ <div className="space-y-5">
+ {showTitleAndDescription && (
+ <div className="space-y-2">
+ <BlockTitle title={block.data.title || "Earnings calculator"} />
+ <BlockDescription
+ description={
+ block.data.description || "See how much you could earn"
+ }
+ />
+ </div>
+ )}
+
+ <div className="overflow-hidden rounded-lg border border-neutral-200 bg-white">
<div className="p-4 sm:p-8">
<label
htmlFor={`${id}-slider`}