Files
flxn-app/src/features/core/hooks/use-links.ts
2025-10-16 15:39:46 -05:00

40 lines
900 B
TypeScript

import { HouseIcon, RankingIcon, ShieldIcon, TrophyIcon, UserCircleIcon } from "@phosphor-icons/react";
import { useMemo } from "react";
export const useLinks = (userId: string | undefined, roles: string[]) =>
useMemo(() => {
const links = [
{
label: 'Home',
href: '/',
Icon: HouseIcon
},
{
label: 'Statistics',
href: '/stats',
Icon: RankingIcon
},
{
label: 'Tournaments',
href: '/tournaments',
Icon: TrophyIcon,
exclude: ['/admin/tournaments']
},
{
label: 'Profile',
href: `/profile/${userId}`,
Icon: UserCircleIcon,
include: ['/settings']
}
]
if (roles.includes('Admin')) {
links.push({
label: 'Admin',
href: '/admin',
Icon: ShieldIcon
})
}
return links;
}, [userId, roles]);