Skip to content

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

feat(billing): show billing tab to all team members

Marc Seitz0618aab956ff
diff --git a/components/layouts/mobile-more-menu.tsx b/components/layouts/mobile-more-menu.tsx
index 5aee6dc6..bdc150c4 100644
--- a/components/layouts/mobile-more-menu.tsx
+++ b/components/layouts/mobile-more-menu.tsx
@@ -74,12 +74,8 @@ export function MobileMoreMenu({ open, onClose }: MobileMoreMenuProps) {
{ label: "Notifications", href: "/settings/notifications" },
{ label: "Webhooks", href: "/settings/webhooks" },
{ label: "Slack", href: "/settings/slack" },
- ...(isAdmin
- ? [
- { label: "Security", href: "/settings/security" },
- { label: "Billing", href: "/settings/billing" },
- ]
- : []),
+ ...(isAdmin ? [{ label: "Security", href: "/settings/security" }] : []),
+ { label: "Billing", href: "/settings/billing" },
];
return (
diff --git a/components/settings/settings-header.tsx b/components/settings/settings-header.tsx
index e0c8944a..b578681f 100644
--- a/components/settings/settings-header.tsx
+++ b/components/settings/settings-header.tsx
@@ -95,7 +95,6 @@ export function SettingsHeader() {
label: "Billing",
href: `/settings/billing`,
segment: "billing",
- disabled: !isAdmin,
},
]}
/>
diff --git a/components/sidebar/app-sidebar.tsx b/components/sidebar/app-sidebar.tsx
index 902a2490..591537d8 100644
--- a/components/sidebar/app-sidebar.tsx
+++ b/components/sidebar/app-sidebar.tsx
@@ -68,7 +68,7 @@ export function AppSidebarContent() {
// Check feature flags
const { features } = useFeatureFlags();
- // Check if current user is admin (for gating Security & Billing)
+ // Check if current user is admin (for gating Security)
const { isAdmin } = useIsAdmin();
// Fetch datarooms for the current team (simple mode - no filters or extra data)
@@ -207,13 +207,13 @@ export function AppSidebarContent() {
url: "/settings/security",
current: router.pathname.includes("settings/security"),
},
- {
- title: "Billing",
- url: "/settings/billing",
- current: router.pathname.includes("settings/billing"),
- },
]
: []),
+ {
+ title: "Billing",
+ url: "/settings/billing",
+ current: router.pathname.includes("settings/billing"),
+ },
],
},
],
diff --git a/pages/settings/billing.tsx b/pages/settings/billing.tsx
index 2ca10217..9e5a44a9 100644
--- a/pages/settings/billing.tsx
+++ b/pages/settings/billing.tsx
@@ -7,7 +7,6 @@ import { sendGTMEvent } from "@next/third-parties/google";
import { toast } from "sonner";
import { useAnalytics } from "@/lib/analytics";
-import { useIsAdmin } from "@/lib/hooks/use-is-admin";
import { usePlan } from "@/lib/swr/use-billing";
import UpgradePlanContainer from "@/components/billing/upgrade-plan-container";
@@ -24,14 +23,6 @@ export default function Billing() {
const teamId = teamInfo?.currentTeam?.id;
const { plan } = usePlan();
- const { isAdmin, loading: isAdminLoading } = useIsAdmin();
-
- // Redirect non-admin users to general settings
- useEffect(() => {
- if (!isAdminLoading && !isAdmin) {
- router.replace("/settings/general");
- }
- }, [isAdmin, isAdminLoading, router]);
useEffect(() => {
if (router.query.success) {
@@ -58,15 +49,6 @@ export default function Billing() {
}
}, [router.query]);
- // Show nothing while checking admin status
- if (isAdminLoading || !isAdmin) {
- return (
- <AppLayout>
- <div />
- </AppLayout>
- );
- }
-
return (
<>
<GTMComponent />
diff --git a/pages/settings/billing/invoices.tsx b/pages/settings/billing/invoices.tsx
index b7dbbb10..38d3a96e 100644
--- a/pages/settings/billing/invoices.tsx
+++ b/pages/settings/billing/invoices.tsx
@@ -1,10 +1,7 @@
import { useRouter } from "next/router";
-import { useEffect } from "react";
-
import { Download, FileText, Loader2 } from "lucide-react";
-import { useIsAdmin } from "@/lib/hooks/use-is-admin";
import { useInvoices } from "@/lib/swr/use-invoices";
import AppLayout from "@/components/layouts/app";
@@ -23,14 +20,6 @@ import {
export default function Invoices() {
const router = useRouter();
const { invoices, loading, error } = useInvoices();
- const { isAdmin, loading: isAdminLoading } = useIsAdmin();
-
- // Redirect non-admin users to general settings
- useEffect(() => {
- if (!isAdminLoading && !isAdmin) {
- router.replace("/settings/general");
- }
- }, [isAdmin, isAdminLoading, router]);
const formatCurrency = (amount: number, currency: string) => {
return new Intl.NumberFormat("en-US", {
@@ -59,15 +48,6 @@ export default function Invoices() {
}
};
- // Show nothing while checking admin status
- if (isAdminLoading || !isAdmin) {
- return (
- <AppLayout>
- <div />
- </AppLayout>
- );
- }
-
return (
<AppLayout>
<main className="relative mx-2 mb-10 mt-4 space-y-8 overflow-hidden px-1 sm:mx-3 md:mx-5 md:mt-5 lg:mx-7 lg:mt-8 xl:mx-10">