(
@@ -34,6 +36,12 @@ type OptionsPageProps = {
/** A page for rendering an array of {@link OptionData} */
const OptionsPage = ({ options, title, fieldsetLegend }: OptionsPageProps) => {
const location = useLocation();
+ const { data: userObj } = useGetUser();
+
+ if (userObj && isStateUser(userObj.user) === false) {
+ return ;
+ }
+
return (
diff --git a/react-app/src/main.tsx b/react-app/src/main.tsx
index 4e37464f1..8cb6356fa 100644
--- a/react-app/src/main.tsx
+++ b/react-app/src/main.tsx
@@ -2,11 +2,11 @@ import React from "react";
import ReactDOM from "react-dom/client";
import { RouterProvider } from "react-router-dom";
import "@fontsource/open-sans";
-import "./index.css"; // this one second
+import "./index.css";
import { queryClient, router } from "./router";
import { QueryClientProvider } from "@tanstack/react-query";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
-import { UserContextProvider, TimeoutModal } from "@/components";
+import { TimeoutModal } from "@/components";
import config from "@/config";
import { asyncWithLDProvider } from "launchdarkly-react-client-sdk";
@@ -31,12 +31,10 @@ const initializeLaunchDarkly = async () => {
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
-
-
-
-
-
-
+
+
+
+
,
diff --git a/react-app/testing/setup.ts b/react-app/testing/setup.ts
index af2d9db3b..1992144bb 100644
--- a/react-app/testing/setup.ts
+++ b/react-app/testing/setup.ts
@@ -1,6 +1,6 @@
import { expect, afterEach, beforeAll, afterAll, vi } from "vitest";
import { cleanup } from "@testing-library/react";
-import matchers from "@testing-library/jest-dom/matchers";
+import * as matchers from "@testing-library/jest-dom/matchers";
global.ResizeObserver = vi.fn().mockImplementation(() => ({
observe: vi.fn(),
@@ -66,6 +66,14 @@ beforeAll(() => {
return idsThatExist.includes(id);
}),
+ useGetUser: () => ({
+ data: {
+ user: {
+ "custom:cms-roles":
+ "onemac-micro-statesubmitter,onemac-micro-super",
+ },
+ },
+ }),
}));
vi.mock("@/utils/user", () => ({
isAuthorizedState: vi.fn(async (id: string) => {
@@ -74,8 +82,6 @@ beforeAll(() => {
return validStates.includes(id.substring(0, 2));
}),
}));
- // mock the api calls that the frontend uses here
- // vi.mock("@/api/stuff")
}
});