-
Notifications
You must be signed in to change notification settings - Fork 440
Implement Patent Application Dashboards, Multi-Step Forms, and Status Tracking #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: patent-management-v2
Are you sure you want to change the base?
Changes from all commits
dcae196
04f5143
7da1430
cda4833
713be1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,88 +1,163 @@ | ||
| import { createTheme, MantineProvider } from "@mantine/core"; | ||
| import { MantineProvider, createTheme } from "@mantine/core"; | ||
| import { Suspense, lazy } from "react"; | ||
| import { useSelector } from "react-redux"; | ||
| import "@mantine/core/styles.css"; | ||
| import "@mantine/notifications/styles.css"; | ||
| import { Route, Routes, Navigate, useLocation } from "react-router-dom"; | ||
| import { | ||
| Route, | ||
| Routes, | ||
| Navigate, | ||
| useLocation, | ||
| useParams, | ||
| } from "react-router-dom"; | ||
| import { Notifications } from "@mantine/notifications"; | ||
| import { host } from "./routes/globalRoutes"; | ||
| import { Layout } from "./components/layout"; | ||
| import Dashboard from "./Modules/Dashboard/dashboardNotifications"; | ||
| import Profile from "./Modules/Dashboard/StudentProfile/profilePage"; | ||
| import LoginPage from "./pages/login"; | ||
| import ForgotPassword from "./pages/forgotPassword"; | ||
| import AcademicPage from "./Modules/Academic/index"; | ||
| import ValidateAuth from "./helper/validateauth"; | ||
| import FacultyProfessionalProfile from "./Modules/facultyProfessionalProfile/facultyProfessionalProfile"; | ||
| import InactivityHandler from "./helper/inactivityhandler"; | ||
| import Examination from "./Modules/Examination/examination"; | ||
| import Database from "./Modules/Database/database"; | ||
| import ProgrammeCurriculumRoutes from "./Modules/Program_curriculum/programmCurriculum"; | ||
| import NotFoundPage from "./components/NotFoundPage"; | ||
| import PatentRoutes from "./Modules/Patent/routes/PatentRoutes"; | ||
|
|
||
| // Working module imports | ||
| const Dashboard = lazy( | ||
| () => import("./Modules/Dashboard/dashboardNotifications"), | ||
| ); | ||
| const Profile = lazy( | ||
| () => import("./Modules/Dashboard/StudentProfile/profilePage"), | ||
| ); | ||
| const LoginPage = lazy(() => import("./pages/login")); | ||
| const ForgotPassword = lazy(() => import("./pages/forgotPassword")); | ||
| const AcademicPage = lazy(() => import("./Modules/Academic/index")); | ||
| const ValidateAuth = lazy(() => import("./helper/validateauth")); | ||
| const MessPage = lazy(() => import("./Modules/Mess/messContent")); | ||
| const FacultyProfessionalProfile = lazy( | ||
| () => | ||
| import("./Modules/facultyProfessionalProfile/facultyProfessionalProfile"), | ||
| ); | ||
| const InactivityHandler = lazy(() => import("./helper/inactivityhandler.js")); | ||
| const Examination = lazy(() => import("./Modules/Examination/examination")); | ||
| const ProgrammeCurriculumRoutes = lazy( | ||
| () => import("./Modules/Program_curriculum/programmCurriculum"), | ||
| ); | ||
|
|
||
| const theme = createTheme({ | ||
| breakpoints: { | ||
| xxs: "300px", | ||
| xs: "375px", | ||
| sm: "768px", | ||
| md: "992px", | ||
| lg: "1200px", | ||
| xl: "1408px", | ||
| }, | ||
| breakpoints: { xs: "30em", sm: "48em", md: "64em", lg: "74em", xl: "90em" }, | ||
| }); | ||
|
|
||
| function ProfileRouteWithUsername() { | ||
| const { username } = useParams(); | ||
| return <Profile connectionRoute={`${host}/dep/api/profile/${username}/`} />; | ||
| } | ||
|
|
||
| export default function App() { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Custom breakpoints removed — may break existing components. The previous breakpoints ( |
||
| const location = useLocation(); | ||
| const role = useSelector((state) => state.user.role); | ||
|
|
||
| return ( | ||
| <MantineProvider theme={theme}> | ||
| <Notifications position="top-center" autoClose={2000} limit={1} /> | ||
| {location.pathname !== "/accounts/login" && <ValidateAuth />} | ||
|
|
||
| {![ | ||
| "/accounts/login", | ||
| "/reset-password", | ||
| ].includes(location.pathname) && <ValidateAuth />} | ||
| {location.pathname !== "/accounts/login" && <InactivityHandler />} | ||
|
|
||
| <Routes> | ||
| <Route path="/" element={<Navigate to="/accounts/login" replace />} /> | ||
|
|
||
| <Route | ||
| path="/dashboard" | ||
| element={ | ||
| <Layout> | ||
| <Dashboard /> | ||
| <Suspense fallback={<div>Loading .... </div>}> | ||
| <Dashboard /> | ||
| </Suspense> | ||
| </Layout> | ||
| } | ||
| /> | ||
|
|
||
| <Route | ||
| path="/academics" | ||
| element={ | ||
| <Layout> | ||
| <AcademicPage /> | ||
| <Suspense fallback={<div>Loading .... </div>}> | ||
| <AcademicPage /> | ||
| </Suspense> | ||
| </Layout> | ||
| } | ||
| /> | ||
|
|
||
| <Route | ||
| path="/programme_curriculum/*" | ||
| element={ | ||
| <Layout> | ||
| <Suspense fallback={<div>Loading .... </div>}> | ||
| <ProgrammeCurriculumRoutes /> | ||
| </Suspense> | ||
| </Layout> | ||
| } | ||
| /> | ||
|
|
||
| <Route | ||
| path="/examination/*" | ||
| element={ | ||
| <Layout> | ||
| <Suspense fallback={<div>Loading .... </div>}> | ||
| <Examination /> | ||
| </Suspense> | ||
| </Layout> | ||
| } | ||
| /> | ||
|
|
||
| <Route | ||
| path="/mess" | ||
| element={ | ||
| <Layout> | ||
| <Suspense fallback={<div>Loading .... </div>}> | ||
| <MessPage /> | ||
| </Suspense> | ||
| </Layout> | ||
| } | ||
| /> | ||
|
|
||
| <Route | ||
| path="/profile" | ||
| element={ | ||
| <Layout> | ||
| <Profile /> | ||
| <Suspense fallback={<div>Loading .... </div>}> | ||
| <Profile /> | ||
| </Suspense> | ||
| </Layout> | ||
| } | ||
| /> | ||
|
|
||
| <Route | ||
| path="/facultyprofessionalprofile/*" | ||
| path="/profile/:username" | ||
| element={ | ||
| <Layout> | ||
| <FacultyProfessionalProfile /> | ||
| <Suspense fallback={<div>Loading .... </div>}> | ||
| <ProfileRouteWithUsername /> | ||
| </Suspense> | ||
| </Layout> | ||
| } | ||
| /> | ||
|
|
||
| <Route | ||
| path="/programme_curriculum/*" | ||
| path="/facultyprofessionalprofile/*" | ||
| element={ | ||
| <div> | ||
| <ProgrammeCurriculumRoutes /> | ||
| </div> | ||
| <Layout> | ||
| <Suspense fallback={<div>Loading .... </div>}> | ||
| <FacultyProfessionalProfile /> | ||
| </Suspense> | ||
| </Layout> | ||
| } | ||
| /> | ||
|
|
||
| <Route path="/patent/*" element={<PatentRoutes />} /> | ||
|
|
||
| <Route path="/accounts/login" element={<LoginPage />} /> | ||
| <Route path="/reset-password" element={<ForgotPassword />} /> | ||
| <Route path="/examination/*" element={<Examination />} /> | ||
| <Route path="/database/*" element={<Database />} /> | ||
| <Route path="*" element={<NotFoundPage />} /> | ||
|
|
||
| {/* Catch-all route for modules not yet implemented */} | ||
| <Route path="*" element={<Navigate to="/dashboard" replace />} /> | ||
| </Routes> | ||
| </MantineProvider> | ||
| ); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ValidateAuthandInactivityHandlerare lazy-loaded but rendered without a<Suspense>boundary. They are imported withlazy()but used directly outside of<Routes>with no<Suspense fallback={...}>wrapper. If their chunks haven't loaded yet, React will throw an error at runtime. Wrap them: