From a50685ec695d6b50f28c2e6774962b59d4f9ecc0 Mon Sep 17 00:00:00 2001 From: Alireza Hassani Date: Tue, 11 Aug 2026 15:23:56 +0330 Subject: [PATCH] Gate Finance behind a super-admin business module. Add finance to the modules picker and hide sidebar, home tile, and customer invoice actions when it is disabled. Co-authored-by: Cursor --- apps/business/src/components/Sidebar.tsx | 1 + apps/business/src/pages/CustomersPage.tsx | 26 ++++++++++++------- apps/business/src/pages/HomePage.tsx | 1 + apps/business/src/utils/businessModules.ts | 1 + apps/super-admin/src/utils/businessModules.ts | 2 ++ docs/PROJECT_CONTEXT.md | 2 +- 6 files changed, 22 insertions(+), 11 deletions(-) diff --git a/apps/business/src/components/Sidebar.tsx b/apps/business/src/components/Sidebar.tsx index d09e1bb..a944cf8 100644 --- a/apps/business/src/components/Sidebar.tsx +++ b/apps/business/src/components/Sidebar.tsx @@ -142,6 +142,7 @@ export function Sidebar() { icon: Wallet, labelKey: 'nav.finance', basePath: '/finance', + moduleId: 'finance', children: [ { labelKey: 'nav.finance.overview', to: '/finance' }, { labelKey: 'nav.finance.invoices', to: '/invoices' }, diff --git a/apps/business/src/pages/CustomersPage.tsx b/apps/business/src/pages/CustomersPage.tsx index 901ec11..bbbceca 100644 --- a/apps/business/src/pages/CustomersPage.tsx +++ b/apps/business/src/pages/CustomersPage.tsx @@ -12,6 +12,7 @@ import { Pagination } from '../components/Pagination' import { ToggleSwitch } from '../components/ToggleSwitch' import { Tooltip } from '../components/Tooltip' import { useAuth } from '../context/AuthContext' +import { useTenantBranding } from '../context/TenantBrandingContext' import { useToast } from '../context/ToastContext' import { useT } from '../i18n/useT' import type { BusinessMessageKey } from '../i18n/messages' @@ -26,6 +27,7 @@ import { type CustomerAccessFilter, type CustomersListResponse, } from '../services/customerService' +import { hasBusinessModule } from '../utils/businessModules' import { formatIrtPrice } from '../utils/irtPrice' import { textLocaleAttrs } from '../utils/textLocale' import filterStyles from '../components/ListFiltersPanel.module.css' @@ -74,7 +76,9 @@ export function CustomersPage() { const navigate = useNavigate() const { locale } = useLocale() const { user: authUser } = useAuth() + const { enabledModules } = useTenantBranding() const { showToast } = useToast() + const financeEnabled = hasBusinessModule(enabledModules, 'finance') const [data, setData] = useState(null) const [loading, setLoading] = useState(false) const [error, setError] = useState('') @@ -537,16 +541,18 @@ export function CustomersPage() { - - - + {financeEnabled ? ( + + + + ) : null}