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.

Custom reward tooltip descriptions (#3144)

Tim Wilsonbf6c8c4c6095
diff --git a/apps/web/lib/actions/partners/create-reward.ts b/apps/web/lib/actions/partners/create-reward.ts
index b839cd8acc..b2abf4d36f 100644
--- a/apps/web/lib/actions/partners/create-reward.ts
+++ b/apps/web/lib/actions/partners/create-reward.ts
@@ -27,6 +27,7 @@ export const createRewardAction = authActionClient
amountInPercentage,
maxDuration,
description,
+ tooltipDescription,
modifiers,
groupId,
} = parsedInput;
@@ -64,6 +65,7 @@ export const createRewardAction = authActionClient
type,
maxDuration,
description: description || null,
+ tooltipDescription: tooltipDescription || null,
modifiers: modifiers || Prisma.DbNull,
...(type === "flat"
? {
diff --git a/apps/web/lib/actions/partners/update-reward.ts b/apps/web/lib/actions/partners/update-reward.ts
index 0b1472de43..c1128f9952 100644
--- a/apps/web/lib/actions/partners/update-reward.ts
+++ b/apps/web/lib/actions/partners/update-reward.ts
@@ -23,6 +23,7 @@ export const updateRewardAction = authActionClient
amountInPercentage,
maxDuration,
description,
+ tooltipDescription,
modifiers,
rewardId,
} = parsedInput;
@@ -55,6 +56,7 @@ export const updateRewardAction = authActionClient
type,
maxDuration,
description: description || null,
+ tooltipDescription: tooltipDescription || null,
modifiers: modifiers === null ? Prisma.DbNull : modifiers,
...(type === "flat"
? {
diff --git a/apps/web/lib/zod/schemas/rewards.ts b/apps/web/lib/zod/schemas/rewards.ts
index 2a9fdb857e..af9acf9f76 100644
--- a/apps/web/lib/zod/schemas/rewards.ts
+++ b/apps/web/lib/zod/schemas/rewards.ts
@@ -167,6 +167,7 @@ export const RewardSchema = z.object({
id: z.string(),
event: z.nativeEnum(EventType),
description: z.string().nullish(),
+ tooltipDescription: z.string().nullish(),
type: z.nativeEnum(RewardStructure),
amountInCents: z.number().int().nullable().optional(),
amountInPercentage: decimalToNumber,
@@ -174,6 +175,9 @@ export const RewardSchema = z.object({
modifiers: z.any().nullish(), // TODO: Fix this
});
+export const REWARD_DESCRIPTION_MAX_LENGTH = 100;
+export const REWARD_TOOLTIP_DESCRIPTION_MAX_LENGTH = 2000;
+
export const createOrUpdateRewardSchema = z.object({
workspaceId: z.string(),
event: z.nativeEnum(EventType),
@@ -182,7 +186,11 @@ export const createOrUpdateRewardSchema = z.object({
amountInPercentage: PERCENTAGE_REWARD_AMOUNT_SCHEMA.optional(),
maxDuration: maxDurationSchema,
modifiers: rewardConditionsArraySchema.nullish(),
- description: z.string().max(100).nullish(),
+ description: z.string().max(REWARD_DESCRIPTION_MAX_LENGTH).nullish(),
+ tooltipDescription: z
+ .string()
+ .max(REWARD_TOOLTIP_DESCRIPTION_MAX_LENGTH)
+ .nullish(),
groupId: z.string(),
});
diff --git a/apps/web/ui/partners/program-reward-description.tsx b/apps/web/ui/partners/program-reward-description.tsx
index ef475bc7e7..4b2956b4e5 100644
--- a/apps/web/ui/partners/program-reward-description.tsx
+++ b/apps/web/ui/partners/program-reward-description.tsx
@@ -11,7 +11,17 @@ export function ProgramRewardDescription({
periodClassName,
showModifiersTooltip = true,
}: {
- reward?: Omit<RewardProps, "id"> | null;
+ reward?: Pick<
+ RewardProps,
+ | "description"
+ | "event"
+ | "maxDuration"
+ | "modifiers"
+ | "tooltipDescription"
+ | "type"
+ | "amountInCents"
+ | "amountInPercentage"
+ > | null;
discount?: DiscountProps | null;
amountClassName?: string;
periodClassName?: string;
@@ -19,8 +29,9 @@ export function ProgramRewardDescription({
}) {
return (
<>
- {reward
- ? reward.description || (
+ {reward ? (
+ <>
+ {reward.description || (
<>
Earn{" "}
<strong
@@ -52,16 +63,20 @@ export function ProgramRewardDescription({
</strong>
</>
) : null}
- {/* Modifiers */}
- {showModifiersTooltip && !!reward.modifiers?.length && (
- <>
- {" "}
- <ProgramRewardModifiersTooltip reward={reward} />
- </>
- )}
</>
- )
- : null}
+ )}
+
+ {/* Modifiers */}
+ {showModifiersTooltip &&
+ (!!reward.modifiers?.length ||
+ Boolean(reward.tooltipDescription)) && (
+ <>
+ {" "}
+ <ProgramRewardModifiersTooltip reward={reward} />
+ </>
+ )}
+ </>
+ ) : null}
{discount ? (
<>
diff --git a/apps/web/ui/partners/program-reward-list.tsx b/apps/web/ui/partners/program-reward-list.tsx
index 093e6d7046..9619e4f5ac 100644
--- a/apps/web/ui/partners/program-reward-list.tsx
+++ b/apps/web/ui/partners/program-reward-list.tsx
@@ -67,14 +67,18 @@ export function ProgramRewardList({
</strong>
</>
) : null}
- {showModifiersTooltip && !!reward.modifiers?.length && (
- <>
- {" "}
- <ProgramRewardModifiersTooltip reward={reward} />
- </>
- )}
</>
)}
+
+ {/* Modifiers */}
+ {showModifiersTooltip &&
+ (!!reward.modifiers?.length ||
+ Boolean(reward.tooltipDescription)) && (
+ <>
+ {" "}
+ <ProgramRewardModifiersTooltip reward={reward} />
+ </>
+ )}
</Item>
))}
diff --git a/apps/web/ui/partners/program-reward-modifiers-tooltip.tsx b/apps/web/ui/partners/program-reward-modifiers-tooltip.tsx
index b4e21f2a61..24c336c757 100644
--- a/apps/web/ui/partners/program-reward-modifiers-tooltip.tsx
+++ b/apps/web/ui/partners/program-reward-modifiers-tooltip.tsx
@@ -32,12 +32,17 @@ type ProgramRewardModifiersTooltipProps = {
export function ProgramRewardModifiersTooltip({
reward,
}: ProgramRewardModifiersTooltipProps) {
- if (!reward?.modifiers?.length) return null;
+ if (!reward?.modifiers?.length && !reward?.tooltipDescription) return null;
return (
<div className="inline-block align-text-top">
<InfoTooltip
- content={<ProgramRewardModifiersTooltipContent reward={reward} />}
+ content={
+ reward.tooltipDescription || (
+ <ProgramRewardModifiersTooltipContent reward={reward} />
+ )
+ }
+ contentClassName={reward.tooltipDescription ? "text-left" : undefined}
/>
</div>
);
diff --git a/apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx b/apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx
index e8122f5a92..628cc930d3 100644
--- a/apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx
+++ b/apps/web/ui/partners/rewards/add-edit-reward-sheet.tsx
@@ -15,6 +15,8 @@ import { RECURRING_MAX_DURATIONS } from "@/lib/zod/schemas/misc";
import {
createOrUpdateRewardSchema,
ENTITY_ATTRIBUTE_TYPES,
+ REWARD_DESCRIPTION_MAX_LENGTH,
+ REWARD_TOOLTIP_DESCRIPTION_MAX_LENGTH,
rewardConditionsArraySchema,
rewardConditionSchema,
rewardConditionsSchema,
@@ -53,9 +55,11 @@ import {
InlineBadgePopoverContext,
InlineBadgePopoverInput,
InlineBadgePopoverMenu,
+ InlineBadgePopoverRichTextArea,
} from "../../shared/inline-badge-popover";
import { RewardDiscountPartnersCard } from "../groups/reward-discount-partners-card";
import { RewardIconSquare } from "./reward-icon-square";
+import { RewardPreviewCard } from "./reward-preview-card";
import { REWARD_TYPES, RewardsLogic } from "./rewards-logic";
interface RewardSheetProps {
@@ -80,6 +84,63 @@ type FormData = z.infer<typeof formSchema>;
export const useAddEditRewardForm = () => useFormContext<FormData>();
+export const getRewardPayload = ({ data }: { data: FormData }) => {
+ let modifiers: RewardConditionsArray | null = null;
+
+ if (data.modifiers?.length) {
+ modifiers = rewardConditionsArraySchema.parse(
+ data.modifiers.map((m) => {
+ const type = m.type === undefined ? data.type : m.type;
+ const maxDuration =
+ m.maxDuration === undefined ? data.maxDuration : m.maxDuration;
+
+ return {
+ ...m,
+ conditions: m.conditions.map((c) => ({
+ ...c,
+ value:
+ c.entity &&
+ c.attribute &&
+ ENTITY_ATTRIBUTE_TYPES[c.entity]?.[c.attribute] === "currency"
+ ? c.value === "" ||
+ c.value == null ||
+ Number.isNaN(Number(c.value))
+ ? c.value
+ : Math.round(Number(c.value) * 100)
+ : c.value,
+ })),
+ amountInCents:
+ type === "flat" && m.amountInCents !== undefined
+ ? Math.round(m.amountInCents * 100)
+ : undefined,
+ amountInPercentage:
+ type === "percentage" ? m.amountInPercentage : undefined,
+ maxDuration: maxDuration === Infinity ? null : maxDuration,
+ };
+ }),
+ );
+ }
+
+ const amount =
+ data.type === "flat"
+ ? {
+ amountInCents: Math.round((data.amountInCents ?? 0) * 100),
+ amountInPercentage: undefined,
+ }
+ : {
+ amountInCents: undefined,
+ amountInPercentage: data.amountInPercentage,
+ };
+
+ return {
+ ...data,
+ ...amount,
+ maxDuration:
+ Infinity === Number(data.maxDuration) ? null : data.maxDuration,
+ modifiers,
+ };
+};
+
function RewardSheetContent({
setIsOpen,
event,
@@ -118,6 +179,7 @@ function RewardSheetContent({
? defaultValuesSource.amountInPercentage
: undefined,
description: defaultValuesSource?.description ?? null,
+ tooltipDescription: defaultValuesSource?.tooltipDescription ?? null,
modifiers: defaultValuesSource?.modifiers?.map((m) => {
const maxDuration =
m.maxDuration === undefined
@@ -156,6 +218,7 @@ function RewardSheetContent({
type,
maxDuration,
description,
+ tooltipDescription,
modifiers,
] = watch([
"event",
@@ -164,6 +227,7 @@ function RewardSheetContent({
"type",
"maxDuration",
"description",
+ "tooltipDescription",
"modifiers",
]);
@@ -233,70 +297,24 @@ function RewardSheetContent({
return;
}
- let modifiers: RewardConditionsArray | null = null;
-
- if (data.modifiers?.length) {
- try {
- modifiers = rewardConditionsArraySchema.parse(
- data.modifiers.map((m) => {
- const type = m.type === undefined ? data.type : m.type;
- const maxDuration =
- m.maxDuration === undefined ? data.maxDuration : m.maxDuration;
-
- return {
- ...m,
- conditions: m.conditions.map((c) => ({
- ...c,
- value:
- c.entity &&
- c.attribute &&
- ENTITY_ATTRIBUTE_TYPES[c.entity]?.[c.attribute] === "currency"
- ? c.value === "" ||
- c.value == null ||
- Number.isNaN(Number(c.value))
- ? c.value
- : Math.round(Number(c.value) * 100)
- : c.value,
- })),
- amountInCents:
- type === "flat" && m.amountInCents !== undefined
- ? Math.round(m.amountInCents * 100)
- : undefined,
- amountInPercentage:
- type === "percentage" ? m.amountInPercentage : undefined,
- maxDuration: maxDuration === Infinity ? null : maxDuration,
- };
- }),
- );
- } catch (error) {
- console.log("parse error", error);
- setError("root.logic", { message: "Invalid reward condition" });
- toast.error(
- "Invalid reward condition. Please fix the errors and try again.",
- );
- return;
- }
- }
+ let payload: ReturnType<typeof getRewardPayload> | null = null;
+
+ try {
+ payload = {
+ ...getRewardPayload({
+ data,
+ }),
+ workspaceId,
+ };
+ } catch (error) {
+ console.log("parse error", error);
+ setError("root.logic", { message: "Invalid reward condition" });
+ toast.error(
+ "Invalid reward condition. Please fix the errors and try again.",
+ );
- const amount =
- type === "flat"
- ? {
- amountInCents: Math.round((data.amountInCents ?? 0) * 100),
- amountInPercentage: undefined,
- }
- : {
- amountInCents: undefined,
- amountInPercentage: data.amountInPercentage,
- };
-
- const payload = {
- ...data,
- ...amount,
- workspaceId,
- maxDuration:
- Infinity === Number(data.maxDuration) ? null : data.maxDuration,
- modifiers,
- };
+ return;
+ }
if (!reward) {
await createReward({
@@ -466,7 +484,7 @@ function RewardSheetContent({
<div className="pt-2.5">
<div className="border-border-subtle flex min-w-0 items-center gap-2.5 border-t px-2.5 pt-2.5">
<RewardIconSquare icon={Gift} />
- <span className="grow leading-relaxed">
+ <span className="min-w-0 grow leading-relaxed">
Shown as{" "}
<InlineBadgePopover
text={description || "Reward description"}
@@ -484,7 +502,25 @@ function RewardSheetContent({
)
}
className="sm:w-80"
- maxLength={100}
+ maxLength={REWARD_DESCRIPTION_MAX_LENGTH}
+ />
+ </InlineBadgePopover>
+ with the tooltip{" "}
+ <InlineBadgePopover
+ text={tooltipDescription || "Reward tooltip"}
+ showOptional={!tooltipDescription}
+ buttonClassName="min-w-0 max-w-full"
+ contentClassName="truncate"
+ >
+ <InlineBadgePopoverRichTextArea
+ value={tooltipDescription ?? ""}
+ onChange={(value) =>
+ setValue("tooltipDescription", value, {
+ shouldDirty: true,
+ })
+ }
+ className="sm:w-80"
+ maxLength={REWARD_TOOLTIP_DESCRIPTION_MAX_LENGTH}
/>
</InlineBadgePopover>
</span>
@@ -509,8 +545,14 @@ function RewardSheetContent({
/>
<VerticalLine />
-
- {group && <RewardDiscountPartnersCard groupId={group.id} />}
+ <RewardPreviewCard />
+
+ {group && (
+ <>
+ <VerticalLine />
+ <RewardDiscountPartnersCard groupId={group.id} />
+ </>
+ )}
</div>
<div className="flex items-center justify-between border-t border-neutral-200 p-5">
diff --git a/apps/web/ui/partners/rewards/reward-preview-card.tsx b/apps/web/ui/partners/rewards/reward-preview-card.tsx
new file mode 100644
index 0000000000..8eea65fef0
--- /dev/null
+++ b/apps/web/ui/partners/rewards/reward-preview-card.tsx
@@ -0,0 +1,182 @@
+import { EnrolledPartnerProps } from "@/lib/types";
+import { Button, Table, useTable } from "@dub/ui";
+import { cn, nFormatter, OG_AVATAR_URL, pluralize } from "@dub/utils";
+import Link from "next/link";
+import { useParams } from "next/navigation";
+import { useWatch } from "react-hook-form";
+import { REWARD_EVENTS } from "../constants";
+import { ProgramRewardDescription } from "../program-reward-description";
+import {
+ getRewardPayload,
+ useAddEditRewardForm,
+} from "./add-edit-reward-sheet";
+
+export function RewardPreviewCard() {
+ const { control } = useAddEditRewardForm();
+
+ const data = useWatch({ control });
+
+ let reward: ReturnType<typeof getRewardPayload> | null = null;
+ try {
+ reward = getRewardPayload({ data: data as any });
+ } catch (error) {
+ return null;
+ }
+
+ const Icon = REWARD_EVENTS[reward.event].icon;
+
+ return (
+ <div className="border-border-subtle bg-bg-muted rounded-xl border shadow-sm">
+ <div className="px-4 py-2.5">
+ <span className="text-content-emphasis flex items-center gap-2.5 text-sm font-semibold">
+ Reward preview
+ </span>
+ </div>
+
+ <div className="border-border-subtle bg-bg-default -mx-px rounded-xl border-x border-t p-4">
+ <div className="text-content-default flex items-center gap-2">
+ <Icon className="size-4 shrink-0" />
+ <span className="text-sm font-normal">
+ <ProgramRewardDescription reward={reward} />
+ </span>
+ </div>
+ </div>
+ </div>
+ );
+}
+
+function PartnersCompactTable({
+ partners,
+ partnersCount,
+ groupId,
+}: {
+ partners?: EnrolledPartnerProps[];
+ partnersCount: number;
+ groupId: string;
+}) {
+ const { slug } = useParams<{ slug: string }>();
+
+ const { table, ...tableProps } = useTable({
+ data: partners || [],
+ columns: [
+ {
+ header: "Partner",
+ cell: ({ row }) => (
+ <div className="flex items-center gap-2">
+ <img
+ src={row.original.image || `${OG_AVATAR_URL}${row.original.name}`}
+ alt={row.original.name}
+ className="size-6 shrink-0 rounded-full"
+ />
+ <span className="truncate text-sm text-neutral-700">
+ {row.original.name}
+ </span>
+ </div>
+ ),
+ size: 180,
+ minSize: 180,
+ maxSize: 180,
+ },
+ {
+ header: "Email",
+ cell: ({ row }) => (
+ <div className="truncate text-sm text-neutral-600">
+ {row.original.email}
+ </div>
+ ),
+ size: 160,
+ minSize: 160,
+ maxSize: 160,
+ },
+ ],
+ thClassName: "border-l-0",
+ tdClassName: (columnId: string) =>
+ cn("border-l-0", columnId !== "menu" && "max-w-0 truncate"),
+ resourceName: (p: boolean) => `partner${p ? "s" : ""}`,
+ rowCount: partners?.length || 0,
+ });
+
+ return (
+ <div className="relative">
+ {partners?.length ? (
+ <>
+ <Table
+ {...tableProps}
+ table={table}
+ containerClassName="border"
+ scrollWrapperClassName="overflow-x-hidden"
+ />
+ {partnersCount > 10 && (
+ <div className="mt-2 flex justify-end">
+ <Link
+ href={`/${slug}/program/partners?groupId=${groupId}`}
+ target="_blank"
+ >
+ <Button
+ type="button"
+ variant="secondary"
+ className="h-7 w-fit rounded-lg px-2.5"
+ text="View all"
+ />
+ </Link>
+ </div>
+ )}
+ </>
+ ) : (
+ <div className="text-content-muted flex h-24 items-center justify-center text-sm">
+ No partners found.
+ </div>
+ )}
+ </div>
+ );
+}
+
+function PartnerPreviewOrCount({
+ previewPartners,
+ partnersCount,
+ isExpanded,
+}: {
+ previewPartners: EnrolledPartnerProps[];
+ partnersCount: number;
+ isExpanded: boolean;
+}) {
+ const showAvatars = !isExpanded && partnersCount > 0;
+
+ return (
+ <span className="relative">
+ <span
+ className={cn(
+ "transition-[transform,opacity] duration-200",
+ showAvatars && "pointer-events-none -translate-y-0.5 opacity-0",
+ )}
+ >
+ <strong className="font-semibold">
+ {nFormatter(partnersCount, { full: true })}
+ </strong>{" "}
+ {partnersCount && pluralize("partner", partnersCount)}
+ </span>
+
+ <span
+ className={cn(
+ "absolute left-2 top-1/2 inline-flex min-w-full -translate-y-1/2 items-center align-text-top transition-[transform,opacity] duration-200",
+ !showAvatars && "pointer-events-none translate-y-0.5 opacity-0",
+ )}
+ >
+ {previewPartners.map(({ id, name, image }) => (
+ <img
+ key={id}
+ src={image || `${OG_AVATAR_URL}${name}`}
+ alt={`${name} avatar`}
+ title={name}
+ className="-ml-1.5 size-[1.125rem] shrink-0 rounded-full border border-white"
+ />
+ ))}
+ {partnersCount > 3 && (
+ <span className="text-content-subtle ml-1 text-xs">
+ +{nFormatter(partnersCount - 3, { full: true })}
+ </span>
+ )}
+ </span>
+ </span>
+ );
+}
diff --git a/apps/web/ui/shared/inline-badge-popover.tsx b/apps/web/ui/shared/inline-badge-popover.tsx
index 4129ee1387..3a1cd2ba54 100644
--- a/apps/web/ui/shared/inline-badge-popover.tsx
+++ b/apps/web/ui/shared/inline-badge-popover.tsx
@@ -3,11 +3,15 @@ import {
AnimatedSizeContainer,
Button,
Check2,
+ MarkdownIcon,
Plus,
Popover,
+ RichTextArea,
+ RichTextProvider,
+ RichTextToolbar,
useScrollProgress,
} from "@dub/ui";
-import { cn } from "@dub/utils";
+import { cn, nFormatter } from "@dub/utils";
import { Command } from "cmdk";
import {
createContext,
@@ -34,14 +38,18 @@ export const InlineBadgePopoverContext = createContext<{
export function InlineBadgePopover({
text,
invalid,
+ showOptional,
disabled,
children,
buttonClassName,
+ contentClassName,
}: PropsWithChildren<{
text: ReactNode;
invalid?: boolean;
+ showOptional?: boolean;
disabled?: boolean;
buttonClassName?: string;
+ contentClassName?: string;
}>) {
const [isOpen, setIsOpen] = useState(false);
@@ -69,11 +77,13 @@ export function InlineBadgePopover({
"inline-block rounded px-1.5 text-left text-sm font-semibold transition-colors",
invalid
? "bg-orange-50 text-orange-500 hover:bg-orange-100 data-[state=open]:bg-orange-100"
- : "bg-blue-50 text-blue-700 hover:bg-blue-100 data-[state=open]:bg-blue-100",
+ : showOptional
+ ? "bg-neutral-100 text-neutral-500 hover:bg-neutral-200 data-[state=open]:bg-neutral-200"
+ : "bg-blue-50 text-blue-700 hover:bg-blue-100 data-[state=open]:bg-blue-100",
buttonClassName,
)}
>
- <span>{text}</span>
+ <span className={contentClassName}>{text}</span>
</button>
</Popover>
);
@@ -302,3 +312,71 @@ export const InlineBadgePopoverInputs = ({
</div>
);
};
+
+export const InlineBadgePopoverRichTextArea = ({
+ value,
+ onChange,
+ maxLength,
+ className,
+}: {
+ value: string;
+ onChange: (value: string) => void;
+ maxLength: number;
+ className?: string;
+}) => {
+ const { setIsOpen } = useContext(InlineBadgePopoverContext);
+
+ return (
+ <div>
+ <div
+ className={cn(
+ "w-full rounded-md border border-neutral-300 shadow-sm focus-within:border-neutral-500 focus-within:ring-1 focus-within:ring-neutral-500 sm:w-32",
+ className,
+ )}
+ >
+ <div>
+ <RichTextProvider
+ features={["bold", "italic", "links"]}
+ style="condensed"
+ markdown
+ placeholder="Reward tooltip"
+ editorClassName="block max-h-24 w-full resize-none border-none overflow-auto scrollbar-hide p-3 text-base sm:text-sm"
+ initialValue={value}
+ onChange={(editor) => onChange((editor as any).getMarkdown())}
+ autoFocus
+ editorProps={{
+ handleDOMEvents: {
+ keydown: (_, e) => {
+ if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
+ e.preventDefault();
+ e.stopPropagation();
+ setIsOpen(false);
+ return false;
+ }
+ },
+ },
+ }}
+ >
+ <RichTextArea />
+
+ <div className="flex items-center justify-between gap-4 px-1 pb-1">
+ <RichTextToolbar />
+ </div>
+ </RichTextProvider>
+ </div>
+ </div>
+ <div className="mt-1 flex items-center justify-between px-1">
+ {maxLength ? (
+ <div className="text-content-subtle mt-1 text-xs">
+ {nFormatter(value?.toString().length || 0, { full: true })}/
+ {nFormatter(maxLength, { full: true })} characters
+ </div>
+ ) : (
+ <div />
+ )}
+
+ <MarkdownIcon className="text-content-default size-4" />
+ </div>
+ </div>
+ );
+};
diff --git a/packages/prisma/schema/reward.prisma b/packages/prisma/schema/reward.prisma
index 363d315824..b6c0c4feca 100644
--- a/packages/prisma/schema/reward.prisma
+++ b/packages/prisma/schema/reward.prisma
@@ -13,6 +13,7 @@ model Reward {
id String @id @default(cuid())
programId String
description String?
+ tooltipDescription String? @db.Text
event EventType
type RewardStructure @default(percentage)
amountInCents Int?
diff --git a/packages/ui/src/tooltip.tsx b/packages/ui/src/tooltip.tsx
index 14d3317a97..f8db48555f 100644
--- a/packages/ui/src/tooltip.tsx
+++ b/packages/ui/src/tooltip.tsx
@@ -8,6 +8,7 @@ import { ReactNode, useState } from "react";
import ReactMarkdown from "react-markdown";
import { Badge } from "./badge";
import { Button, ButtonProps, buttonVariants } from "./button";
+import { PROSE_STYLES } from "./rich-text-area";
export function TooltipProvider({ children }: { children: ReactNode }) {
return (
@@ -29,6 +30,7 @@ const TooltipMarkdown = ({
className={cn(
"prose prose-sm prose-neutral max-w-xs text-pretty px-4 py-2 text-center leading-snug transition-all",
"prose-a:cursor-alias prose-a:underline prose-a:decoration-dotted prose-a:underline-offset-2",
+ PROSE_STYLES.condensed,
className,
)}
components={{