Skip to content

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

show subscription modal on lower plans

Ashish Viradiya63337a82e982
diff --git a/components/Sidebar.tsx b/components/Sidebar.tsx
index 6d0bfa8b..9137ce8e 100644
--- a/components/Sidebar.tsx
+++ b/components/Sidebar.tsx
@@ -23,7 +23,7 @@ import useLimits from "@/lib/swr/use-limits";
import { cn, nFormatter } from "@/lib/utils";
import ProBanner from "./billing/pro-banner";
-import { UpgradePlanModal } from "./billing/upgrade-plan-modal";
+import { PlanEnum, UpgradePlanModal } from "./billing/upgrade-plan-modal";
import ProfileMenu from "./profile-menu";
import SiderbarFolders from "./sidebar-folders";
import { AddTeamModal } from "./teams/add-team-modal";
@@ -241,7 +241,7 @@ export const SidebarComponent = ({ className }: { className?: string }) => {
return (
<UpgradePlanModal
key={item.name}
- clickedPlan={"Business"}
+ clickedPlan={PlanEnum.Business}
trigger={"sidebar_datarooms"}
>
<div className="group flex w-full items-center gap-x-2 rounded-md px-3 py-2 text-sm leading-6 text-muted-foreground hover:bg-transparent">
@@ -262,7 +262,7 @@ export const SidebarComponent = ({ className }: { className?: string }) => {
return (
<UpgradePlanModal
key={item.name}
- clickedPlan={"Pro"}
+ clickedPlan={PlanEnum.Pro}
trigger={"sidebar_visitors"}
>
<div className="group flex w-full items-center gap-x-2 rounded-md px-3 py-2 text-sm leading-6 text-muted-foreground hover:bg-transparent">
diff --git a/components/billing/pro-banner.tsx b/components/billing/pro-banner.tsx
index c6c8b715..4e781fce 100644
--- a/components/billing/pro-banner.tsx
+++ b/components/billing/pro-banner.tsx
@@ -6,7 +6,7 @@ import { usePlausible } from "next-plausible";
import X from "@/components/shared/icons/x";
import { Button } from "@/components/ui/button";
-import { UpgradePlanModal } from "./upgrade-plan-modal";
+import { PlanEnum, UpgradePlanModal } from "./upgrade-plan-modal";
export default function ProBanner({
setShowProBanner,
@@ -40,7 +40,10 @@ export default function ProBanner({
Join to unlock custom branding, domains, team members, and data rooms.
</p>
<div className="flex">
- <UpgradePlanModal clickedPlan={"Business"} trigger={"pro_banner"}>
+ <UpgradePlanModal
+ clickedPlan={PlanEnum.Business}
+ trigger={"pro_banner"}
+ >
<Button
type="button"
className="grow"
diff --git a/components/billing/upgrade-plan-modal.tsx b/components/billing/upgrade-plan-modal.tsx
index fea30f51..9678cf45 100644
--- a/components/billing/upgrade-plan-modal.tsx
+++ b/components/billing/upgrade-plan-modal.tsx
@@ -17,6 +17,11 @@ import { PLANS } from "@/lib/stripe/utils";
import { usePlan } from "@/lib/swr/use-billing";
import { capitalize } from "@/lib/utils";
+export enum PlanEnum {
+ Pro = "Pro",
+ Business = "Business",
+ DataRooms = "Data Rooms",
+}
export function UpgradePlanModal({
clickedPlan,
trigger,
@@ -24,7 +29,7 @@ export function UpgradePlanModal({
setOpen,
children,
}: {
- clickedPlan: "Pro" | "Business" | "Data Rooms";
+ clickedPlan: PlanEnum;
trigger?: string;
open?: boolean;
setOpen?: React.Dispatch<React.SetStateAction<boolean>>;
diff --git a/components/datarooms/add-dataroom-modal.tsx b/components/datarooms/add-dataroom-modal.tsx
index e579228b..965e074d 100644
--- a/components/datarooms/add-dataroom-modal.tsx
+++ b/components/datarooms/add-dataroom-modal.tsx
@@ -22,7 +22,7 @@ import { Label } from "@/components/ui/label";
import { useAnalytics } from "@/lib/analytics";
import { usePlan } from "@/lib/swr/use-billing";
-import { UpgradePlanModal } from "../billing/upgrade-plan-modal";
+import { PlanEnum, UpgradePlanModal } from "../billing/upgrade-plan-modal";
export function AddDataroomModal({
children,
@@ -94,7 +94,7 @@ export function AddDataroomModal({
if (children) {
return (
<UpgradePlanModal
- clickedPlan="Data Rooms"
+ clickedPlan={PlanEnum.DataRooms}
trigger={"add_dataroom_overview"}
>
{children}
diff --git a/components/datarooms/dataroom-trial-modal.tsx b/components/datarooms/dataroom-trial-modal.tsx
index 34bba372..c5bcf020 100644
--- a/components/datarooms/dataroom-trial-modal.tsx
+++ b/components/datarooms/dataroom-trial-modal.tsx
@@ -22,7 +22,7 @@ import { Label } from "@/components/ui/label";
import { useAnalytics } from "@/lib/analytics";
-import { UpgradePlanModal } from "../billing/upgrade-plan-modal";
+import { PlanEnum, UpgradePlanModal } from "../billing/upgrade-plan-modal";
import { PhoneInput } from "../ui/phone-input";
import {
Select,
@@ -236,7 +236,7 @@ export function DataroomTrialModal({
<div className="text-xs text-muted-foreground">
After the trial, upgrade to{" "}
- <UpgradePlanModal clickedPlan="Business">
+ <UpgradePlanModal clickedPlan={PlanEnum.Business}>
<button className="underline">Papermark Business</button>
</UpgradePlanModal>{" "}
to continue using data rooms.
diff --git a/components/datarooms/settings/duplicate-dataroom.tsx b/components/datarooms/settings/duplicate-dataroom.tsx
index 2b22aaf9..acd9285e 100644
--- a/components/datarooms/settings/duplicate-dataroom.tsx
+++ b/components/datarooms/settings/duplicate-dataroom.tsx
@@ -4,7 +4,10 @@ import { useLimits } from "@/ee/limits/swr-handler";
import { toast } from "sonner";
import { mutate } from "swr";
-import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
+import {
+ PlanEnum,
+ UpgradePlanModal,
+} from "@/components/billing/upgrade-plan-modal";
import { Button } from "@/components/ui/button";
import {
Card,
@@ -121,7 +124,7 @@ export default function DuplicateDataroom({
</Card>
{planModalOpen ? (
<UpgradePlanModal
- clickedPlan="Data Rooms"
+ clickedPlan={PlanEnum.DataRooms}
trigger="datarooms"
open={planModalOpen}
setOpen={setPlanModalOpen}
diff --git a/components/documents/add-document-modal.tsx b/components/documents/add-document-modal.tsx
index 76f1e786..176efba4 100644
--- a/components/documents/add-document-modal.tsx
+++ b/components/documents/add-document-modal.tsx
@@ -33,7 +33,7 @@ import { usePlan } from "@/lib/swr/use-billing";
import useLimits from "@/lib/swr/use-limits";
import { getSupportedContentType } from "@/lib/utils/get-content-type";
-import { UpgradePlanModal } from "../billing/upgrade-plan-modal";
+import { PlanEnum, UpgradePlanModal } from "../billing/upgrade-plan-modal";
export function AddDocumentModal({
newVersion,
@@ -409,7 +409,7 @@ export function AddDocumentModal({
if (newVersion) {
return (
<UpgradePlanModal
- clickedPlan="Pro"
+ clickedPlan={PlanEnum.Pro}
trigger={"limit_upload_document_version"}
>
{children}
@@ -417,7 +417,10 @@ export function AddDocumentModal({
);
}
return (
- <UpgradePlanModal clickedPlan="Pro" trigger={"limit_upload_documents"}>
+ <UpgradePlanModal
+ clickedPlan={PlanEnum.Pro}
+ trigger={"limit_upload_documents"}
+ >
<Button>Upgrade to Add Documents</Button>
</UpgradePlanModal>
);
diff --git a/components/documents/document-card.tsx b/components/documents/document-card.tsx
index c5c42568..7590f8aa 100644
--- a/components/documents/document-card.tsx
+++ b/components/documents/document-card.tsx
@@ -33,7 +33,7 @@ import { cn, nFormatter, timeAgo } from "@/lib/utils";
import { fileIcon } from "@/lib/utils/get-file-icon";
import { useCopyToClipboard } from "@/lib/utils/use-copy-to-clipboard";
-import { UpgradePlanModal } from "../billing/upgrade-plan-modal";
+import { PlanEnum, UpgradePlanModal } from "../billing/upgrade-plan-modal";
import { DataroomTrialModal } from "../datarooms/dataroom-trial-modal";
import { AddToDataroomModal } from "./add-document-to-dataroom-modal";
import { MoveToFolderModal } from "./move-folder-modal";
@@ -343,7 +343,7 @@ export default function DocumentsCard({
) : null}
{planModalOpen ? (
<UpgradePlanModal
- clickedPlan="Data Rooms"
+ clickedPlan={PlanEnum.DataRooms}
trigger="datarooms"
open={planModalOpen}
setOpen={setPlanModalOpen}
diff --git a/components/documents/document-header.tsx b/components/documents/document-header.tsx
index f4451cc8..e95d696e 100644
--- a/components/documents/document-header.tsx
+++ b/components/documents/document-header.tsx
@@ -44,7 +44,7 @@ import { cn } from "@/lib/utils";
import { fileIcon } from "@/lib/utils/get-file-icon";
import PlanBadge from "../billing/plan-badge";
-import { UpgradePlanModal } from "../billing/upgrade-plan-modal";
+import { PlanEnum, UpgradePlanModal } from "../billing/upgrade-plan-modal";
import AdvancedSheet from "../shared/icons/advanced-sheet";
import PortraitLandscape from "../shared/icons/portrait-landscape";
import { Alert, AlertClose, AlertDescription, AlertTitle } from "../ui/alert";
@@ -845,7 +845,7 @@ export default function DocumentHeader({
{planModalOpen ? (
<UpgradePlanModal
- clickedPlan="Pro"
+ clickedPlan={PlanEnum.Pro}
trigger={planModalTrigger}
open={planModalOpen}
setOpen={setPlanModalOpen}
diff --git a/components/domains/add-domain-modal.tsx b/components/domains/add-domain-modal.tsx
index 82895086..f499d4ce 100644
--- a/components/domains/add-domain-modal.tsx
+++ b/components/domains/add-domain-modal.tsx
@@ -20,7 +20,7 @@ import { useAnalytics } from "@/lib/analytics";
import { usePlan } from "@/lib/swr/use-billing";
import useLimits from "@/lib/swr/use-limits";
-import { UpgradePlanModal } from "../billing/upgrade-plan-modal";
+import { PlanEnum, UpgradePlanModal } from "../billing/upgrade-plan-modal";
export function AddDomainModal({
open,
@@ -107,7 +107,11 @@ export function AddDomainModal({
if (children) {
return (
<UpgradePlanModal
- clickedPlan={linkType === "DATAROOM_LINK" ? "Data Rooms" : "Business"}
+ clickedPlan={
+ linkType === "DATAROOM_LINK"
+ ? PlanEnum.DataRooms
+ : PlanEnum.Business
+ }
trigger={"add_domain_overview"}
>
<Button>Upgrade to Add Domain</Button>
@@ -116,7 +120,11 @@ export function AddDomainModal({
} else {
return (
<UpgradePlanModal
- clickedPlan={linkType === "DATAROOM_LINK" ? "Data Rooms" : "Business"}
+ clickedPlan={
+ linkType === "DATAROOM_LINK"
+ ? PlanEnum.DataRooms
+ : PlanEnum.Business
+ }
open={open}
setOpen={setOpen}
trigger={"add_domain_link_sheet"}
diff --git a/components/folders/add-folder-modal.tsx b/components/folders/add-folder-modal.tsx
index 7da9981e..42df3e8e 100644
--- a/components/folders/add-folder-modal.tsx
+++ b/components/folders/add-folder-modal.tsx
@@ -23,7 +23,7 @@ import { Label } from "@/components/ui/label";
import { useAnalytics } from "@/lib/analytics";
import { usePlan } from "@/lib/swr/use-billing";
-import { UpgradePlanModal } from "../billing/upgrade-plan-modal";
+import { PlanEnum, UpgradePlanModal } from "../billing/upgrade-plan-modal";
export function AddFolderModal({
// open,
@@ -110,7 +110,10 @@ export function AddFolderModal({
if (plan === "free" && (!isDataroom || !trial)) {
if (children) {
return (
- <UpgradePlanModal clickedPlan="Pro" trigger={"add_folder_button"}>
+ <UpgradePlanModal
+ clickedPlan={PlanEnum.Pro}
+ trigger={"add_folder_button"}
+ >
{children}
</UpgradePlanModal>
);
diff --git a/components/layouts/trial-banner.tsx b/components/layouts/trial-banner.tsx
index f1616580..04cfe702 100644
--- a/components/layouts/trial-banner.tsx
+++ b/components/layouts/trial-banner.tsx
@@ -3,7 +3,10 @@ import { Dispatch, SetStateAction, useEffect, useState } from "react";
import Cookies from "js-cookie";
import { usePlausible } from "next-plausible";
-import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
+import {
+ PlanEnum,
+ UpgradePlanModal,
+} from "@/components/billing/upgrade-plan-modal";
import X from "@/components/shared/icons/x";
import { usePlan } from "@/lib/swr/use-billing";
@@ -69,7 +72,7 @@ function TrialBannerComponent({
You are on a data room trial, you have access to advanced link
permissions and data room.{" "}
<UpgradePlanModal
- clickedPlan={"Data Rooms"}
+ clickedPlan={PlanEnum.DataRooms}
trigger={"trial_navbar"}
>
<span
diff --git a/components/links/link-sheet/index.tsx b/components/links/link-sheet/index.tsx
index 243ceaf9..8e45ef04 100644
--- a/components/links/link-sheet/index.tsx
+++ b/components/links/link-sheet/index.tsx
@@ -8,7 +8,10 @@ import { RefreshCwIcon } from "lucide-react";
import { toast } from "sonner";
import { mutate } from "swr";
-import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
+import {
+ PlanEnum,
+ UpgradePlanModal,
+} from "@/components/billing/upgrade-plan-modal";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
@@ -319,7 +322,7 @@ export default function LinkSheet({
</TabsTrigger>
) : (
<UpgradePlanModal
- clickedPlan="Data Rooms"
+ clickedPlan={PlanEnum.DataRooms}
trigger="add_group_link"
>
<div className="inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all">
diff --git a/components/links/link-sheet/link-options.tsx b/components/links/link-sheet/link-options.tsx
index 4110ef59..048e61b1 100644
--- a/components/links/link-sheet/link-options.tsx
+++ b/components/links/link-sheet/link-options.tsx
@@ -2,7 +2,10 @@ import { useState } from "react";
import { LinkAudienceType, LinkType } from "@prisma/client";
-import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
+import {
+ PlanEnum,
+ UpgradePlanModal,
+} from "@/components/billing/upgrade-plan-modal";
import { DEFAULT_LINK_TYPE } from "@/components/links/link-sheet";
import AllowDownloadSection from "@/components/links/link-sheet/allow-download-section";
import AllowListSection from "@/components/links/link-sheet/allow-list-section";
@@ -57,9 +60,7 @@ export const LinkOptions = ({
const [openUpgradeModal, setOpenUpgradeModal] = useState<boolean>(false);
const [trigger, setTrigger] = useState<string>("");
- const [upgradePlan, setUpgradePlan] = useState<
- "Pro" | "Business" | "Data Rooms"
- >("Business");
+ const [upgradePlan, setUpgradePlan] = useState<PlanEnum>(PlanEnum.Business);
const handleUpgradeStateChange = ({
state,
@@ -69,7 +70,7 @@ export const LinkOptions = ({
setOpenUpgradeModal(state);
setTrigger(trigger);
if (plan) {
- setUpgradePlan(plan);
+ setUpgradePlan(plan as PlanEnum);
}
};
diff --git a/components/links/links-table.tsx b/components/links/links-table.tsx
index 5e6f40ed..974d68bf 100644
--- a/components/links/links-table.tsx
+++ b/components/links/links-table.tsx
@@ -17,7 +17,10 @@ import {
import { toast } from "sonner";
import useSWR, { mutate } from "swr";
-import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
+import {
+ PlanEnum,
+ UpgradePlanModal,
+} from "@/components/billing/upgrade-plan-modal";
import { Button } from "@/components/ui/button";
import {
Collapsible,
@@ -206,7 +209,7 @@ export default function LinksTable({
const AddLinkButton = () => {
if (!canAddLinks) {
return (
- <UpgradePlanModal clickedPlan="Pro" trigger={"limit_add_link"}>
+ <UpgradePlanModal clickedPlan={PlanEnum.Pro} trigger={"limit_add_link"}>
<Button>Upgrade to Create Link</Button>
</UpgradePlanModal>
);
diff --git a/components/sidebar/app-sidebar.tsx b/components/sidebar/app-sidebar.tsx
index fb2fa33d..49ccc11f 100644
--- a/components/sidebar/app-sidebar.tsx
+++ b/components/sidebar/app-sidebar.tsx
@@ -10,12 +10,10 @@ import { TeamContextType, initialState, useTeam } from "@/context/team-context";
import Cookies from "js-cookie";
import {
BrushIcon,
- ChartNoAxesColumn,
- ChartNoAxesColumnIcon,
+ CircleUserRound,
CogIcon,
ContactIcon,
FolderIcon,
- HouseIcon,
Loader,
ServerIcon,
} from "lucide-react";
@@ -37,6 +35,7 @@ import useLimits from "@/lib/swr/use-limits";
import { nFormatter } from "@/lib/utils";
import ProBanner from "../billing/pro-banner";
+import { PlanEnum } from "../billing/upgrade-plan-modal";
import { Progress } from "../ui/progress";
export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
@@ -45,6 +44,7 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
const { currentTeam, teams, setCurrentTeam, isLoading }: TeamContextType =
useTeam() || initialState;
const { plan: userPlan, trial: userTrial } = usePlan();
+ const isTrial = !!userTrial;
const { limits } = useLimits();
const linksLimit = limits?.links;
const documentsLimit = limits?.documents;
@@ -79,12 +79,21 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
url: "/datarooms",
icon: ServerIcon,
current: router.pathname.includes("datarooms"),
+ disabled:
+ userPlan === "business" || userPlan === "datarooms" || isTrial
+ ? false
+ : true,
+ trigger: "sidebar_datarooms",
+ plan: PlanEnum.Business,
},
{
title: "Visitors",
url: "/visitors",
icon: ContactIcon,
current: router.pathname.includes("visitors"),
+ disabled: userPlan === "free" && !isTrial ? true : false,
+ trigger: "sidebar_visitors",
+ plan: PlanEnum.Pro,
},
{
title: "Branding",
@@ -126,6 +135,29 @@ export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
},
],
},
+ {
+ title: "Account",
+ url: "/account/general",
+ icon: CircleUserRound,
+ isActive:
+ router.pathname.includes("account") &&
+ !router.pathname.includes("branding") &&
+ !router.pathname.includes("datarooms") &&
+ !router.pathname.includes("documents") &&
+ !router.pathname.includes("settings"),
+ items: [
+ {
+ title: "General",
+ url: "/account/general",
+ current: router.pathname.includes("account/general"),
+ },
+ {
+ title: "Security",
+ url: "/account/security",
+ current: router.pathname.includes("account/security"),
+ },
+ ],
+ },
],
};
diff --git a/components/sidebar/nav-main.tsx b/components/sidebar/nav-main.tsx
index 2e083e50..a4cab2b9 100644
--- a/components/sidebar/nav-main.tsx
+++ b/components/sidebar/nav-main.tsx
@@ -23,22 +23,25 @@ import {
import { cn } from "@/lib/utils";
-export function NavMain({
- items,
-}: {
- items: {
+import { PlanEnum, UpgradePlanModal } from "../billing/upgrade-plan-modal";
+
+export interface NavItem {
+ title: string;
+ url: string;
+ icon: LucideIcon;
+ current?: boolean;
+ isActive?: boolean;
+ disabled?: boolean;
+ plan?: PlanEnum;
+ trigger?: string;
+ items?: {
title: string;
url: string;
- icon: LucideIcon;
current?: boolean;
- isActive?: boolean;
- items?: {
- title: string;
- url: string;
- current?: boolean;
- }[];
}[];
-}) {
+}
+
+export function NavMain({ items }: { items: NavItem[] }) {
return (
<SidebarGroup>
<SidebarMenu className="space-y-0.5 text-foreground">
@@ -50,11 +53,24 @@ export function NavMain({
"rounded-md bg-gray-200 font-semibold dark:bg-secondary",
)}
>
- <SidebarMenuButton asChild tooltip={item.title}>
- <Link href={item.url} className="p-2">
- <item.icon />
- <span>{item.title}</span>
- </Link>
+ <SidebarMenuButton asChild={!item.disabled} tooltip={item.title}>
+ {item.disabled ? (
+ <UpgradePlanModal
+ key={item.title}
+ clickedPlan={item.plan as PlanEnum}
+ trigger={item.trigger}
+ >
+ <div className="flex w-full flex-row items-center gap-2">
+ <item.icon className="h-4 w-4" />
+ <span id={item.plan}>{item.title}</span>
+ </div>
+ </UpgradePlanModal>
+ ) : (
+ <Link href={item.url} className="p-2">
+ <item.icon />
+ <span>{item.title}</span>
+ </Link>
+ )}
</SidebarMenuButton>
{item.items?.length ? (
<>
diff --git a/components/ui/sidebar.tsx b/components/ui/sidebar.tsx
index a72ea6cc..edc0399e 100644
--- a/components/ui/sidebar.tsx
+++ b/components/ui/sidebar.tsx
@@ -159,7 +159,7 @@ const SidebarProvider = React.forwardRef<
} as React.CSSProperties
}
className={cn(
- "group/sidebar-wrapper has-[[data-variant=inset]]:bg-sidebar flex min-h-svh w-full",
+ "group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",
className,
)}
ref={ref}
@@ -201,7 +201,7 @@ const Sidebar = React.forwardRef<
return (
<div
className={cn(
- "bg-sidebar text-sidebar-foreground flex h-full w-[--sidebar-width] flex-col",
+ "flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",
className,
)}
ref={ref}
@@ -218,7 +218,7 @@ const Sidebar = React.forwardRef<
<SheetContent
data-sidebar="sidebar"
data-mobile="true"
- className="bg-sidebar text-sidebar-foreground w-[--sidebar-width] p-0 [&>button]:hidden"
+ className="w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
style={
{
"--sidebar-width": SIDEBAR_WIDTH_MOBILE,
@@ -235,7 +235,7 @@ const Sidebar = React.forwardRef<
return (
<div
ref={ref}
- className="text-sidebar-foreground group peer hidden md:block"
+ className="group peer hidden text-sidebar-foreground md:block"
data-state={state}
data-collapsible={state === "collapsed" ? collapsible : ""}
data-variant={variant}
@@ -269,7 +269,7 @@ const Sidebar = React.forwardRef<
<div
data-sidebar="sidebar"
className={cn(
- "bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow",
+ "flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",
sidebarClassName,
)}
>
@@ -323,10 +323,10 @@ const SidebarRail = React.forwardRef<
onClick={toggleSidebar}
title="Toggle Sidebar"
className={cn(
- "hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex",
+ "absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex",
"[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize",
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
- "group-data-[collapsible=offcanvas]:hover:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
+ "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar",
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
className,
@@ -364,7 +364,7 @@ const SidebarInput = React.forwardRef<
ref={ref}
data-sidebar="input"
className={cn(
- "focus-visible:ring-sidebar-ring h-8 w-full bg-background shadow-none focus-visible:ring-2",
+ "h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",
className,
)}
{...props}
@@ -411,7 +411,7 @@ const SidebarSeparator = React.forwardRef<
<Separator
ref={ref}
data-sidebar="separator"
- className={cn("bg-sidebar-border mx-2 w-auto", className)}
+ className={cn("mx-2 w-auto bg-sidebar-border", className)}
{...props}
/>
);
@@ -462,7 +462,7 @@ const SidebarGroupLabel = React.forwardRef<
ref={ref}
data-sidebar="group-label"
className={cn(
- "text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-none transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
+ "flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
className,
)}
@@ -483,7 +483,7 @@ const SidebarGroupAction = React.forwardRef<
ref={ref}
data-sidebar="group-action"
className={cn(
- "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-none transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
+ "absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
// Increases the hit area of the button on mobile.
"after:absolute after:-inset-2 after:md:hidden",
"group-data-[collapsible=icon]:hidden",
@@ -629,7 +629,7 @@ const SidebarMenuAction = React.forwardRef<
ref={ref}
data-sidebar="menu-action"
className={cn(
- "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-none transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
+ "absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0",
// Increases the hit area of the button on mobile.
"after:absolute after:-inset-2 after:md:hidden",
"peer-data-[size=sm]/menu-button:top-1",
@@ -637,7 +637,7 @@ const SidebarMenuAction = React.forwardRef<
"peer-data-[size=lg]/menu-button:top-2.5",
"group-data-[collapsible=icon]:hidden",
showOnHover &&
- "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
+ "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",
className,
)}
{...props}
@@ -654,7 +654,7 @@ const SidebarMenuBadge = React.forwardRef<
ref={ref}
data-sidebar="menu-badge"
className={cn(
- "text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums",
+ "pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground",
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
"peer-data-[size=sm]/menu-button:top-1",
"peer-data-[size=default]/menu-button:top-1.5",
@@ -713,7 +713,7 @@ const SidebarMenuSub = React.forwardRef<
ref={ref}
data-sidebar="menu-sub"
className={cn(
- "border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5",
+ "mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5",
"group-data-[collapsible=icon]:hidden",
className,
)}
@@ -745,7 +745,7 @@ const SidebarMenuSubButton = React.forwardRef<
data-size={size}
data-active={isActive}
className={cn(
- "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
+ "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
size === "sm" && "text-xs",
size === "md" && "text-sm",
diff --git a/components/visitors/visitor-useragent-placeholder.tsx b/components/visitors/visitor-useragent-placeholder.tsx
index 5f5d6c35..40eec2c3 100644
--- a/components/visitors/visitor-useragent-placeholder.tsx
+++ b/components/visitors/visitor-useragent-placeholder.tsx
@@ -1,6 +1,9 @@
import { CrownIcon } from "lucide-react";
-import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
+import {
+ PlanEnum,
+ UpgradePlanModal,
+} from "@/components/billing/upgrade-plan-modal";
import { Button } from "@/components/ui/button";
import UAIcon from "@/components/user-agent-icon";
@@ -36,7 +39,10 @@ export default function VisitorUserAgentPlaceholder() {
</div>
</div>
<div className="absolute left-8 top-3">
- <UpgradePlanModal clickedPlan="Pro" trigger="visitor-table-user-agent">
+ <UpgradePlanModal
+ clickedPlan={PlanEnum.Pro}
+ trigger="visitor-table-user-agent"
+ >
<Button
variant="outline"
size="sm"
diff --git a/components/visitors/visitors-table.tsx b/components/visitors/visitors-table.tsx
index dadc6610..40cca651 100644
--- a/components/visitors/visitors-table.tsx
+++ b/components/visitors/visitors-table.tsx
@@ -41,7 +41,7 @@ import { usePlan } from "@/lib/swr/use-billing";
import { useDocumentVisits } from "@/lib/swr/use-document";
import { durationFormat, timeAgo } from "@/lib/utils";
-import { UpgradePlanModal } from "../billing/upgrade-plan-modal";
+import { PlanEnum, UpgradePlanModal } from "../billing/upgrade-plan-modal";
import { Button } from "../ui/button";
import {
DropdownMenu,
@@ -479,7 +479,7 @@ export default function VisitorsTable({
Some older visits may not be shown because your document
has more than 20 views.{" "}
</span>
- <UpgradePlanModal clickedPlan="Pro" trigger="">
+ <UpgradePlanModal clickedPlan={PlanEnum.Pro} trigger="">
<button className="underline hover:text-gray-800">
Upgrade to see full history
</button>
diff --git a/components/welcome/dataroom-trial.tsx b/components/welcome/dataroom-trial.tsx
index 3938ef71..3bd8a8bb 100644
--- a/components/welcome/dataroom-trial.tsx
+++ b/components/welcome/dataroom-trial.tsx
@@ -22,7 +22,7 @@ import {
import { useAnalytics } from "@/lib/analytics";
import { STAGGER_CHILD_VARIANTS } from "@/lib/constants";
-import { UpgradePlanModal } from "../billing/upgrade-plan-modal";
+import { PlanEnum, UpgradePlanModal } from "../billing/upgrade-plan-modal";
import { Input } from "../ui/input";
export default function DataroomTrial() {
@@ -240,12 +240,12 @@ export default function DataroomTrial() {
<div className="text-xs text-muted-foreground">
{/* Data rooms are available on our{" "}
- <UpgradePlanModal clickedPlan="Business">
+ <UpgradePlanModal clickedPlan={PlanEnum.Business}>
<button className="underline">Business</button>
</UpgradePlanModal>{" "}
plan. <br /> */}
No credit card is required. After the trial, upgrade to{" "}
- <UpgradePlanModal clickedPlan="Business">
+ <UpgradePlanModal clickedPlan={PlanEnum.Business}>
<button className="underline">
Papermark Business or Data Rooms
</button>
diff --git a/pages/branding.tsx b/pages/branding.tsx
index 9d2f6231..1db92d7c 100644
--- a/pages/branding.tsx
+++ b/pages/branding.tsx
@@ -8,7 +8,10 @@ import { HexColorInput, HexColorPicker } from "react-colorful";
import { toast } from "sonner";
import { mutate } from "swr";
-import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
+import {
+ PlanEnum,
+ UpgradePlanModal,
+} from "@/components/billing/upgrade-plan-modal";
import AppLayout from "@/components/layouts/app";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardFooter } from "@/components/ui/card";
@@ -353,7 +356,7 @@ export default function Branding() {
<CardFooter className="border-t p-6">
{plan === "free" ? (
<UpgradePlanModal
- clickedPlan="Pro"
+ clickedPlan={PlanEnum.Pro}
trigger={"branding_page"}
>
<Button>Upgrade to Save Branding</Button>
diff --git a/pages/datarooms/[id]/groups/index.tsx b/pages/datarooms/[id]/groups/index.tsx
index 5257522c..0641d136 100644
--- a/pages/datarooms/[id]/groups/index.tsx
+++ b/pages/datarooms/[id]/groups/index.tsx
@@ -4,7 +4,10 @@ import { useState } from "react";
import { CircleHelpIcon, InfoIcon, UsersIcon } from "lucide-react";
-import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
+import {
+ PlanEnum,
+ UpgradePlanModal,
+} from "@/components/billing/upgrade-plan-modal";
import { DataroomHeader } from "@/components/datarooms/dataroom-header";
import { DataroomNavigation } from "@/components/datarooms/dataroom-navigation";
import { AddGroupModal } from "@/components/datarooms/groups/add-group-modal";
@@ -35,7 +38,10 @@ export default function DataroomGroupPage() {
return <Button onClick={() => setModalOpen(true)}>Create group</Button>;
}
return (
- <UpgradePlanModal clickedPlan="Data Rooms" trigger="create_group_button">
+ <UpgradePlanModal
+ clickedPlan={PlanEnum.DataRooms}
+ trigger="create_group_button"
+ >
<Button>Upgrade to create group</Button>
</UpgradePlanModal>
);
diff --git a/pages/datarooms/[id]/permissions/index.tsx b/pages/datarooms/[id]/permissions/index.tsx
index b0e9b63d..5defdcf9 100644
--- a/pages/datarooms/[id]/permissions/index.tsx
+++ b/pages/datarooms/[id]/permissions/index.tsx
@@ -4,7 +4,10 @@ import { useState } from "react";
import { CircleHelpIcon, UsersIcon } from "lucide-react";
-import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
+import {
+ PlanEnum,
+ UpgradePlanModal,
+} from "@/components/billing/upgrade-plan-modal";
import { DataroomHeader } from "@/components/datarooms/dataroom-header";
import { DataroomNavigation } from "@/components/datarooms/dataroom-navigation";
import { AddGroupModal } from "@/components/datarooms/groups/add-group-modal";
@@ -40,7 +43,10 @@ export default function DataroomAnalyticsPage() {
return <Button onClick={() => setModalOpen(true)}>Create group</Button>;
}
return (
- <UpgradePlanModal clickedPlan="Data Rooms" trigger="create_group_button">
+ <UpgradePlanModal
+ clickedPlan={PlanEnum.DataRooms}
+ trigger="create_group_button"
+ >
<Button>Upgrade to create group</Button>
</UpgradePlanModal>
);
diff --git a/pages/datarooms/index.tsx b/pages/datarooms/index.tsx
index a3edfa3d..e99c389a 100644
--- a/pages/datarooms/index.tsx
+++ b/pages/datarooms/index.tsx
@@ -5,7 +5,10 @@ import { useEffect } from "react";
import { PlusIcon } from "lucide-react";
-import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
+import {
+ PlanEnum,
+ UpgradePlanModal,
+} from "@/components/billing/upgrade-plan-modal";
import { AddDataroomModal } from "@/components/datarooms/add-dataroom-modal";
import { DataroomTrialModal } from "@/components/datarooms/dataroom-trial-modal";
import { EmptyDataroom } from "@/components/datarooms/empty-dataroom";
@@ -60,7 +63,10 @@ export default function DataroomsPage() {
</div>
<div className="flex items-center gap-x-1">
{isBusiness && !canCreateUnlimitedDatarooms ? (
- <UpgradePlanModal clickedPlan="Data Rooms" trigger="datarooms">
+ <UpgradePlanModal
+ clickedPlan={PlanEnum.DataRooms}
+ trigger="datarooms"
+ >
<Button
className="group flex flex-1 items-center justify-start gap-x-3 px-3 text-left"
title="Upgrade to Add Data Room"
@@ -76,7 +82,10 @@ export default function DataroomsPage() {
{daysLeft(new Date(datarooms[0].createdAt), 7)} days left
</span>
</div>
- <UpgradePlanModal clickedPlan="Data Rooms" trigger="datarooms">
+ <UpgradePlanModal
+ clickedPlan={PlanEnum.DataRooms}
+ trigger="datarooms"
+ >
<Button
className="group flex flex-1 items-center justify-start gap-x-3 px-3 text-left"
title="Upgrade to Add Data Room"
diff --git a/pages/documents/[id]/index.tsx b/pages/documents/[id]/index.tsx
index ae7d0424..91142b9b 100644
--- a/pages/documents/[id]/index.tsx
+++ b/pages/documents/[id]/index.tsx
@@ -4,7 +4,10 @@ import { useState } from "react";
import { useTeam } from "@/context/team-context";
-import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
+import {
+ PlanEnum,
+ UpgradePlanModal,
+} from "@/components/billing/upgrade-plan-modal";
import DocumentHeader from "@/components/documents/document-header";
import { StatsComponent } from "@/components/documents/stats";
import VideoAnalytics from "@/components/documents/video-analytics";
@@ -44,7 +47,7 @@ export default function DocumentPage() {
const AddLinkButton = () => {
if (!canAddLinks) {
return (
- <UpgradePlanModal clickedPlan="Pro" trigger={"limit_add_link"}>
+ <UpgradePlanModal clickedPlan={PlanEnum.Pro} trigger={"limit_add_link"}>
<Button className="flex h-8 whitespace-nowrap text-xs lg:h-9 lg:text-sm">
Upgrade to Create Link
</Button>
diff --git a/pages/settings/billing.tsx b/pages/settings/billing.tsx
index 599076ae..326cb231 100644
--- a/pages/settings/billing.tsx
+++ b/pages/settings/billing.tsx
@@ -7,7 +7,10 @@ import { useTeam } from "@/context/team-context";
import { CheckIcon } from "lucide-react";
import { toast } from "sonner";
-import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
+import {
+ PlanEnum,
+ UpgradePlanModal,
+} from "@/components/billing/upgrade-plan-modal";
import AppLayout from "@/components/layouts/app";
import { SettingsHeader } from "@/components/settings/settings-header";
import { Badge } from "@/components/ui/badge";
@@ -355,9 +358,7 @@ export default function Billing() {
</Button>
) : (
<UpgradePlanModal
- clickedPlan={
- tier.name as "Pro" | "Business" | "Data Rooms"
- }
+ clickedPlan={tier.name as PlanEnum}
trigger={"billing_page"}
>
<Button
diff --git a/pages/settings/people.tsx b/pages/settings/people.tsx
index bc04cf7f..c74091bf 100644
--- a/pages/settings/people.tsx
+++ b/pages/settings/people.tsx
@@ -8,7 +8,10 @@ import { useSession } from "next-auth/react";
import { toast } from "sonner";
import { mutate } from "swr";
-import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
+import {
+ PlanEnum,
+ UpgradePlanModal,
+} from "@/components/billing/upgrade-plan-modal";
import AppLayout from "@/components/layouts/app";
import { SettingsHeader } from "@/components/settings/settings-header";
import Folder from "@/components/shared/icons/folder";
@@ -234,7 +237,7 @@ export default function Billing() {
</AddTeamMembers>
) : (
<UpgradePlanModal
- clickedPlan={"Pro"}
+ clickedPlan={PlanEnum.Pro}
trigger={"invite_team_members"}
>
<Button className="whitespace-nowrap px-1 text-xs sm:px-4 sm:text-sm">
diff --git a/pages/settings/presets.tsx b/pages/settings/presets.tsx
index d5551e57..82d5689c 100644
--- a/pages/settings/presets.tsx
+++ b/pages/settings/presets.tsx
@@ -11,7 +11,10 @@ import { toast } from "sonner";
import { mutate } from "swr";
import useSWRImmutable from "swr/immutable";
-import { UpgradePlanModal } from "@/components/billing/upgrade-plan-modal";
+import {
+ PlanEnum,
+ UpgradePlanModal,
+} from "@/components/billing/upgrade-plan-modal";
import AppLayout from "@/components/layouts/app";
import Preview from "@/components/settings/og-preview";
import { SettingsHeader } from "@/components/settings/settings-header";
@@ -533,7 +536,7 @@ export default function Presets() {
<div className="flex justify-end">
{plan === "free" ? (
<UpgradePlanModal
- clickedPlan="Pro"
+ clickedPlan={PlanEnum.Pro}
trigger={"branding_page"}
>
<Button>Upgrade to Save Preset</Button>