From 6dbac5bd7fab037a37646b5fd37af1bfab52c519 Mon Sep 17 00:00:00 2001 From: JamesNg Date: Tue, 7 Oct 2025 23:08:43 -0400 Subject: [PATCH 1/2] use React context hook to replace useState for search queries --- VRMS | 1 + client/src/App.jsx | 69 ++-- .../components/user-admin/UserManagement.jsx | 15 +- .../user-admin/UserPermissionSearch.jsx | 18 +- client/src/context/searchContext.jsx | 23 ++ client/src/pages/UserPermissionSearch.jsx | 314 ------------------ 6 files changed, 76 insertions(+), 364 deletions(-) create mode 160000 VRMS create mode 100644 client/src/context/searchContext.jsx delete mode 100644 client/src/pages/UserPermissionSearch.jsx diff --git a/VRMS b/VRMS new file mode 160000 index 00000000..7042af0f --- /dev/null +++ b/VRMS @@ -0,0 +1 @@ +Subproject commit 7042af0f43f0b034977c7f64c613e9d8b7199edb diff --git a/client/src/App.jsx b/client/src/App.jsx index 5be55b97..d8325df3 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -1,7 +1,5 @@ -import React from 'react'; import { AuthProvider } from './context/authContext'; import { Route, Redirect, Switch } from 'react-router-dom'; - import Home from './pages/Home'; import Navbar from './components/Navbar'; import Footer from './components/Footer'; @@ -26,13 +24,9 @@ import addProject from './components/manageProjects/addProject'; import HealthCheck from './pages/HealthCheck'; import SecretPassword from './pages/SecretPassword'; import UserWelcome from './pages/UserWelcome'; -// Added User Permission Search component -import UserPermissionSearch from './pages/UserPermissionSearch'; import UserPermission from './pages/UserPermission'; - import { Box, ThemeProvider } from '@mui/material'; import theme from './theme'; - import './App.scss'; /* @@ -44,6 +38,7 @@ import './App.scss'; Return if user is logged in */ import withAuth from './hooks/withAuth'; +import { SearchTextProvider } from './context/searchContext'; const routes = [ { path: '/', name: 'home', Component: Home }, @@ -93,47 +88,49 @@ const App = () => { return ( - + - - - {routes.map(({ path, Component }) => ( - - ))} - - + + + + {routes.map(({ path, Component }) => ( + + ))} + + + +