From 328e90a5c29f0b4a62b5b213495d195ef376a774 Mon Sep 17 00:00:00 2001 From: regalijan Date: Thu, 19 Oct 2023 16:49:57 -0400 Subject: [PATCH] Make mod button dependent on permissions --- components/Navigation.tsx | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/components/Navigation.tsx b/components/Navigation.tsx index e598e66..babd852 100644 --- a/components/Navigation.tsx +++ b/components/Navigation.tsx @@ -47,6 +47,27 @@ export default function (props: { let data = { ...props }; const { isOpen, onClose, onOpen } = useDisclosure(); + function hasMod(): boolean { + const { permissions } = props; + + if (typeof permissions === "undefined") return false; + + return Boolean( + [ + 1 << 0, + 1 << 2, + 1 << 4, + 1 << 5, + 1 << 6, + 1 << 7, + 1 << 8, + 1 << 9, + 1 << 10, + 1 << 11, + ].find((int) => permissions & int) + ); + } + return ( <> @@ -113,7 +134,12 @@ export default function (props: { - @@ -167,7 +193,9 @@ export default function (props: { About Us Our Team Support - Moderation + + Moderation +