Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

feat: add highlight plan item feature

Marc Seitz6799dfcbcca0
diff --git a/components/billing/upgrade-plan-modal.tsx b/components/billing/upgrade-plan-modal.tsx
index 0b615ef8..25faa19d 100644
--- a/components/billing/upgrade-plan-modal.tsx
+++ b/components/billing/upgrade-plan-modal.tsx
@@ -11,6 +11,10 @@ import { getPriceIdFromPlan } from "@/ee/stripe/functions/get-price-id-from-plan
import { PLANS } from "@/ee/stripe/utils";
import { CheckIcon, Users2Icon } from "lucide-react";
+import { useAnalytics } from "@/lib/analytics";
+import { usePlan } from "@/lib/swr/use-billing";
+import { capitalize, cn } from "@/lib/utils";
+
import { Button } from "@/components/ui/button";
import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog";
import { Switch } from "@/components/ui/switch";
@@ -21,12 +25,9 @@ import {
TooltipTrigger,
} from "@/components/ui/tooltip";
-import { useAnalytics } from "@/lib/analytics";
-import { usePlan } from "@/lib/swr/use-billing";
-import { capitalize, cn } from "@/lib/utils";
-
// Feature rendering component
const FeatureItem = ({ feature }: { feature: Feature }) => {
+ console.log("feature is highlighted", feature.isHighlighted);
const baseClasses = `flex items-center ${feature.isHighlighted ? "bg-orange-50 -mx-6 px-6 py-2 -my-1 font-bold rounded-md dark:bg-orange-900/20" : ""}`;
if (feature.isUsers) {
@@ -103,12 +104,14 @@ export function UpgradePlanModal({
trigger,
open,
setOpen,
+ highlightItem,
children,
}: {
clickedPlan: PlanEnum;
trigger?: string;
open?: boolean;
setOpen?: React.Dispatch<React.SetStateAction<boolean>>;
+ highlightItem?: string[];
children?: React.ReactNode;
}) {
const router = useRouter();
@@ -261,7 +264,12 @@ export function UpgradePlanModal({
<ul className="mb-6 mt-2 space-y-2 text-sm leading-6 text-gray-600 dark:text-muted-foreground">
{planFeatures.features.map((feature, i) => (
<li key={i}>
- <FeatureItem feature={feature} />
+ <FeatureItem
+ feature={{
+ ...feature,
+ isHighlighted: highlightItem?.includes(feature.id),
+ }}
+ />
</li>
))}
</ul>
diff --git a/components/navigation-menu.tsx b/components/navigation-menu.tsx
index 63c17f2f..b904a6ee 100644
--- a/components/navigation-menu.tsx
+++ b/components/navigation-menu.tsx
@@ -94,22 +94,36 @@ const NavItem: React.FC<Props["navigation"][0]> = ({
},
)}
>
- <Link
- href={href}
- className={cn(
- "text-content-subtle hover:bg-background-subtle -mx-3 flex items-center gap-1 rounded-lg px-3 py-2 text-sm font-medium hover:bg-muted hover:text-primary",
- {
- "text-primary": active,
- },
- )}
- >
- {label}
- {tag ? (
- <div className="text-content-subtle rounded border bg-background px-1 py-0.5 font-mono text-xs">
- {tag}
+ {limited ? (
+ <UpgradePlanModal
+ key={label}
+ clickedPlan={PlanEnum.DataRoomsPlus}
+ trigger={label}
+ highlightItem={["qa"]}
+ >
+ <div className="text-content-subtle hover:bg-background-subtle -mx-3 flex items-center gap-1 rounded-lg px-3 py-2 text-sm font-medium hover:bg-muted hover:text-primary">
+ {label}
+ <CrownIcon className="h-4 w-4 text-muted-foreground" />
</div>
- ) : null}
- </Link>
+ </UpgradePlanModal>
+ ) : (
+ <Link
+ href={href}
+ className={cn(
+ "text-content-subtle hover:bg-background-subtle -mx-3 flex items-center gap-1 rounded-lg px-3 py-2 text-sm font-medium hover:bg-muted hover:text-primary",
+ {
+ "text-primary": active,
+ },
+ )}
+ >
+ {label}
+ {tag ? (
+ <div className="text-content-subtle rounded border bg-background px-1 py-0.5 font-mono text-xs">
+ {tag}
+ </div>
+ ) : null}
+ </Link>
+ )}
</li>
);
};