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.

Discount banner

Tim Wilson8802a3419987
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/discount/group-discount.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/discount/group-discount.tsx
index f2c1c55698..30ad2f708f 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/discount/group-discount.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/discount/group-discount.tsx
@@ -4,16 +4,23 @@ import useGroup from "@/lib/swr/use-group";
import type { DiscountProps } from "@/lib/types";
import { useDiscountSheet } from "@/ui/partners/add-edit-discount-sheet";
import { ProgramRewardDescription } from "@/ui/partners/program-reward-description";
-import { Button, Discount } from "@dub/ui";
+import { X } from "@/ui/shared/icons";
+import {
+ Button,
+ buttonVariants,
+ Discount,
+ Grid,
+ useLocalStorage,
+} from "@dub/ui";
import { cn } from "@dub/utils";
+import { motion } from "framer-motion";
import { BadgePercent } from "lucide-react";
-import Link from "next/link";
export const GroupDiscount = () => {
const { group, loading } = useGroup();
return (
- <div className="flex flex-col gap-6">
+ <div>
<Banner />
{loading ? (
@@ -85,25 +92,77 @@ const DiscountSkeleton = () => {
};
const Banner = () => {
+ const [dismissedBanner, setDismissedBanner] = useLocalStorage<boolean>(
+ "program-discount-banner-dismissed",
+ false,
+ );
+
return (
- <div className="flex flex-col gap-6 rounded-xl bg-neutral-100 p-5">
- <Discount className="size-6" />
- <div>
- <h2 className="text-base font-semibold leading-6 text-neutral-900">
- Referral discounts
- </h2>
- <p className="text-base font-normal leading-6 text-neutral-500">
- Discounts offered to customers when referred by all partners in this
- group
- </p>
+ <motion.div
+ animate={
+ dismissedBanner
+ ? { opacity: 0, height: 0 }
+ : { opacity: 1, height: "auto" }
+ }
+ initial={false}
+ className="overflow-hidden"
+ {...(dismissedBanner && { inert: "" })}
+ >
+ <div className="pb-6">
+ <div className="relative isolate overflow-hidden rounded-xl bg-neutral-100">
+ <div
+ className="pointer-events-none absolute inset-0 [mask-image:linear-gradient(90deg,transparent,black)]"
+ aria-hidden
+ >
+ <div className="absolute right-0 top-0 h-full w-[600px]">
+ <Grid
+ cellSize={60}
+ patternOffset={[1, -30]}
+ className="text-neutral-200"
+ />
+ </div>
+ <div className="absolute -inset-16 opacity-15 blur-[50px] [transform:translateZ(0)]">
+ <div
+ className="absolute right-0 top-0 h-full w-[350px] -scale-y-100 rounded-l-full saturate-150"
+ style={{
+ backgroundImage: `conic-gradient(from -66deg, #855AFC -32deg, #FF0000 63deg, #EAB308 158deg, #5CFF80 240deg, #855AFC 328deg, #FF0000 423deg)`,
+ }}
+ />
+ </div>
+ </div>
+ <div className="relative flex flex-col gap-4 p-5">
+ <Discount className="size-6" />
+ <div>
+ <h2 className="text-content-emphasis text-base font-semibold">
+ Referral discounts
+ </h2>
+ <p className="text-content-subtle text-base font-normal leading-6">
+ Discounts offered to customers when referred by partners in this
+ group
+ </p>
+ </div>
+ <a
+ href="https://dub.co/help/article/dual-sided-incentives"
+ target="_blank"
+ rel="noopener noreferrer"
+ className={cn(
+ buttonVariants({ variant: "secondary" }),
+ "flex h-8 w-fit items-center rounded-lg border bg-white px-3 text-sm",
+ )}
+ >
+ Learn more
+ </a>
+ </div>
+
+ <button
+ type="button"
+ className="text-content-emphasis absolute right-4 top-4 flex size-7 items-center justify-center rounded-lg transition-colors duration-150 hover:bg-black/5 active:bg-black/10"
+ onClick={() => setDismissedBanner(true)}
+ >
+ <X className="size-4" />
+ </button>
+ </div>
</div>
- <Link href="/">
- <Button
- text="Learn more"
- variant="secondary"
- className="h-8 w-fit rounded-lg bg-white"
- />
- </Link>
- </div>
+ </motion.div>
);
};
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/rewards/group-rewards.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/rewards/group-rewards.tsx
index eca5b76900..7eb4a24c47 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/rewards/group-rewards.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/groups/[groupSlug]/rewards/group-rewards.tsx
@@ -228,7 +228,9 @@ const Banner = () => {
? { opacity: 0, height: 0 }
: { opacity: 1, height: "auto" }
}
+ initial={false}
className="overflow-hidden"
+ {...(dismissedBanner && { inert: "" })}
>
<div className="pb-6">
<div className="relative isolate overflow-hidden rounded-xl bg-neutral-100">