feat: affiliate

This commit is contained in:
Nevo David 2024-12-05 21:23:33 +07:00
parent 65e3bf0852
commit f5a5170c7f
1 changed files with 30 additions and 22 deletions

View File

@ -8,16 +8,16 @@ import { useUser } from '@gitroom/frontend/components/layout/user.context';
import { useVariables } from '@gitroom/react/helpers/variable.context';
export const useMenuItems = () => {
const {isGeneral} = useVariables();
const { isGeneral } = useVariables();
return [
...(!isGeneral
? [
{
name: 'Analytics',
icon: 'analytics',
path: '/analytics',
},
]
{
name: 'Analytics',
icon: 'analytics',
path: '/analytics',
},
]
: []),
{
name: isGeneral ? 'Calendar' : 'Launches',
@ -26,22 +26,22 @@ export const useMenuItems = () => {
},
...(isGeneral
? [
{
name: 'Analytics',
icon: 'analytics',
path: '/analytics',
},
]
{
name: 'Analytics',
icon: 'analytics',
path: '/analytics',
},
]
: []),
...(!isGeneral
? [
{
name: 'Settings',
icon: 'settings',
path: '/settings',
role: ['ADMIN', 'SUPERADMIN'],
},
]
{
name: 'Settings',
icon: 'settings',
path: '/settings',
role: ['ADMIN', 'SUPERADMIN'],
},
]
: []),
{
name: 'Marketplace',
@ -60,13 +60,20 @@ export const useMenuItems = () => {
role: ['ADMIN', 'SUPERADMIN'],
requireBilling: true,
},
{
name: 'Affiliate',
icon: 'affiliate',
path: 'https://affiliate.postiz.com',
role: ['ADMIN', 'SUPERADMIN', 'USER'],
requireBilling: true,
},
];
}
};
export const TopMenu: FC = () => {
const path = usePathname();
const user = useUser();
const {billingEnabled} = useVariables();
const { billingEnabled } = useVariables();
const menuItems = useMenuItems();
return (
@ -86,6 +93,7 @@ export const TopMenu: FC = () => {
<li key={item.name}>
<Link
prefetch={true}
target={item.path.indexOf('http') > -1 ? '_blank' : '_self'}
href={item.path}
className={clsx(
'flex gap-2 items-center box px-[6px] md:px-[24px] py-[8px]',