Sidebar generation page
This commit is contained in:
@@ -28,6 +28,7 @@ import { checkAccess, getTypesOfUser } from "@/utils/permissions";
|
|||||||
import usePermissions from "@/hooks/usePermissions";
|
import usePermissions from "@/hooks/usePermissions";
|
||||||
import { EntityWithRoles } from "@/interfaces/entity";
|
import { EntityWithRoles } from "@/interfaces/entity";
|
||||||
import { useAllowedEntitiesSomePermissions } from "@/hooks/useEntityPermissions";
|
import { useAllowedEntitiesSomePermissions } from "@/hooks/useEntityPermissions";
|
||||||
|
import { useMemo } from "react";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
path: string;
|
path: string;
|
||||||
@@ -87,6 +88,8 @@ export default function Sidebar({
|
|||||||
}: Props) {
|
}: Props) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
const isAdmin = useMemo(() => ['developer', 'admin'].includes(user?.type), [user?.type])
|
||||||
|
|
||||||
const [isMinimized, toggleMinimize] = usePreferencesStore((state) => [state.isSidebarMinimized, state.toggleSidebarMinimized]);
|
const [isMinimized, toggleMinimize] = usePreferencesStore((state) => [state.isSidebarMinimized, state.toggleSidebarMinimized]);
|
||||||
|
|
||||||
const { totalAssignedTickets } = useTicketsListener(user.id);
|
const { totalAssignedTickets } = useTicketsListener(user.id);
|
||||||
@@ -166,7 +169,7 @@ export default function Sidebar({
|
|||||||
badge={totalAssignedTickets}
|
badge={totalAssignedTickets}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{entitiesAllowGeneration.length > 0 && (
|
{(entitiesAllowGeneration.length > 0 || isAdmin) && (
|
||||||
<Nav
|
<Nav
|
||||||
disabled={disableNavigation}
|
disabled={disableNavigation}
|
||||||
Icon={BsCloudFill}
|
Icon={BsCloudFill}
|
||||||
|
|||||||
Reference in New Issue
Block a user