diff --git a/src/app/private/admin/home/error.tsx b/src/app/private/admin/home/error.tsx new file mode 100644 index 00000000..7b33c19d --- /dev/null +++ b/src/app/private/admin/home/error.tsx @@ -0,0 +1,15 @@ +"use client"; + +import { ErrorNavigation } from "@components/navigation"; + +const Error = () => { + return ( + + ); +}; + +export default Error; diff --git a/src/app/private/chapter-leader/seniors/error.tsx b/src/app/private/chapter-leader/seniors/error.tsx new file mode 100644 index 00000000..08bd3dd2 --- /dev/null +++ b/src/app/private/chapter-leader/seniors/error.tsx @@ -0,0 +1,15 @@ +"use client"; + +import { ErrorNavigation } from "@components/navigation"; + +const Error = () => { + return ( + + ); +}; + +export default Error; diff --git a/src/app/private/chapter-leader/users/error.tsx b/src/app/private/chapter-leader/users/error.tsx new file mode 100644 index 00000000..9de45007 --- /dev/null +++ b/src/app/private/chapter-leader/users/error.tsx @@ -0,0 +1,15 @@ +"use client"; + +import { ErrorNavigation } from "@components/navigation"; + +const Error = () => { + return ( + + ); +}; + +export default Error; diff --git a/src/app/private/error.tsx b/src/app/private/error.tsx new file mode 100644 index 00000000..df60e822 --- /dev/null +++ b/src/app/private/error.tsx @@ -0,0 +1,14 @@ +"use client"; + +import { ErrorNavigation } from "@components/navigation"; + +const Error = () => { + return ( + + ); +}; + +export default Error; diff --git a/src/app/private/user/layout.tsx b/src/app/private/user/layout.tsx index 2fcaa795..2db88220 100644 --- a/src/app/private/user/layout.tsx +++ b/src/app/private/user/layout.tsx @@ -1,7 +1,6 @@ import { ISideBar } from "@components/Sidebar"; import { CollapsibleSidebarContainer } from "@components/container"; import { faHome, faUsers, faUser } from "@fortawesome/free-solid-svg-icons"; -import { UserContext } from "src/context/UserProvider"; interface IUserLayout { children: React.ReactNode; diff --git a/src/app/private/user/seniors/error.tsx b/src/app/private/user/seniors/error.tsx new file mode 100644 index 00000000..3d317059 --- /dev/null +++ b/src/app/private/user/seniors/error.tsx @@ -0,0 +1,15 @@ +"use client"; + +import { ErrorNavigation } from "@components/navigation"; + +const Error = () => { + return ( + + ); +}; + +export default Error; diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index 4e0c45ae..fd66ec4d 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -116,21 +116,33 @@ const Sidebar = (props: ISideBar) => { <_Sidebar {...props} />
setSidebarVisible(false)} > - setSidebarVisible(!sidebarVisible)} +
- - - - +
+
+ setSidebarVisible(!sidebarVisible)} + > + + + + + + logo + +
+
+
{sidebarVisible && (
<_Sidebar {...props} /> diff --git a/src/components/navigation/ErrorNavigation.tsx b/src/components/navigation/ErrorNavigation.tsx new file mode 100644 index 00000000..069d0c2d --- /dev/null +++ b/src/components/navigation/ErrorNavigation.tsx @@ -0,0 +1,42 @@ +"use client"; + +import { Popup } from "@components/container"; +import { UserContext } from "@context/UserProvider"; +import { formatUserHomeRoute } from "@utils"; +import { useRouter } from "next/navigation"; +import React from "react"; + +interface ErrorNavigationProps { + message?: string; + redirectTo?: string; + redirectMessage?: string; +} + +const ErrorNavigation = ({ + message, + redirectTo, + redirectMessage, +}: ErrorNavigationProps) => { + const router = useRouter(); + const userContext = React.useContext(UserContext); + + return ( + +
+

+ {message ?? "Oops, an error has occurred."} +

+ +
+
+ ); +}; + +export default ErrorNavigation; diff --git a/src/components/navigation/index.tsx b/src/components/navigation/index.tsx index d29a066b..2b5f9bdc 100644 --- a/src/components/navigation/index.tsx +++ b/src/components/navigation/index.tsx @@ -1 +1,2 @@ export { default as RootNavigation } from "./RootNavigation"; +export { default as ErrorNavigation } from "./ErrorNavigation";