feat: remove billing if not stripe

This commit is contained in:
Nevo David 2024-05-06 00:13:40 +07:00
parent ffaf8f9494
commit 580bb6b162
3 changed files with 9 additions and 1 deletions

View File

@ -10,7 +10,8 @@
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@next/next/no-html-link-for-pages": ["error", "apps/frontend/pages"]
"@next/next/no-html-link-for-pages": ["error", "apps/frontend/pages"],
"no-extra-boolean-cast": "off"
}
},
{

View File

@ -12,6 +12,9 @@ const nextConfig = {
// See: https://github.com/gregberge/svgr
svgr: false,
},
env: {
isBillingEnabled: String(!!process.env.STRIPE_PUBLISHABLE_KEY),
}
};
const plugins = [

View File

@ -28,6 +28,7 @@ export const menuItems = [
icon: 'billing',
path: '/billing',
role: ['ADMIN', 'SUPERADMIN'],
requireBilling: true,
},
];
@ -40,6 +41,9 @@ export const TopMenu: FC = () => {
<ul className="gap-5 flex flex-1 items-center text-[18px]">
{menuItems
.filter((f) => {
if (f.requireBilling && process.env.isBillingEnabled === 'false') {
return false;
}
if (f.role) {
return f.role.includes(user?.role!);
}