Skip to content

Commit

Permalink
Restricting Activity tab to superusers for now
Browse files Browse the repository at this point in the history
  • Loading branch information
underbluewaters committed Apr 11, 2024
1 parent 160aeb2 commit 7b609e5
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions packages/client/src/admin/AdminApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { GraphqlQueryCacheContext } from "../offline/GraphqlQueryCache/useGraphq
import LanguageSelector from "../surveys/LanguageSelector";
import TranslateIcon from "@heroicons/react/outline/TranslateIcon";
import { useLocalStorage } from "beautiful-react-hooks";
import useIsSuperuser from "../useIsSuperuser";

const LazyBasicSettings = React.lazy(
/* webpackChunkName: "AdminSettings" */ () => import("./Settings")
Expand Down Expand Up @@ -93,6 +94,8 @@ export default function AdminApp() {
const history = useHistory();
const { t } = useTranslation("admin");

const isSuperuser = useIsSuperuser();

useEffect(() => {
if (
data?.project?.sessionParticipationStatus &&
Expand Down Expand Up @@ -153,27 +156,31 @@ export default function AdminApp() {
),
path: "/admin",
},
{
breadcrumb: t("Activity"),
new: true,
icon: (
<svg
className={iconClassName}
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M16 8v8m-4-5v5m-4-2v2m-2 4h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
/>
</svg>
),
path: "/admin/activity",
},
...(isSuperuser
? [
{
breadcrumb: t("Activity"),
new: true,
icon: (
<svg
className={iconClassName}
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
d="M16 8v8m-4-5v5m-4-2v2m-2 4h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
/>
</svg>
),
path: "/admin/activity",
},
]
: []),
{
breadcrumb: "Users & Groups",
icon: (
Expand Down

0 comments on commit 7b609e5

Please sign in to comment.