File tree 9 files changed +141
-13
lines changed
9 files changed +141
-13
lines changed Original file line number Diff line number Diff line change
1
+ "use client" ;
2
+
3
+ import { ErrorNavigation } from "@components/navigation" ;
4
+
5
+ const Error = ( ) => {
6
+ return (
7
+ < ErrorNavigation
8
+ message = "Oops, an error has occurred."
9
+ redirectTo = "/private/admin/home/chapters"
10
+ redirectMessage = "View all chapters"
11
+ />
12
+ ) ;
13
+ } ;
14
+
15
+ export default Error ;
Original file line number Diff line number Diff line change
1
+ "use client" ;
2
+
3
+ import { ErrorNavigation } from "@components/navigation" ;
4
+
5
+ const Error = ( ) => {
6
+ return (
7
+ < ErrorNavigation
8
+ message = "Oops, an error has occurred."
9
+ redirectTo = "/private/chapter-leader/seniors"
10
+ redirectMessage = "View all seniors"
11
+ />
12
+ ) ;
13
+ } ;
14
+
15
+ export default Error ;
Original file line number Diff line number Diff line change
1
+ "use client" ;
2
+
3
+ import { ErrorNavigation } from "@components/navigation" ;
4
+
5
+ const Error = ( ) => {
6
+ return (
7
+ < ErrorNavigation
8
+ message = "Oops, an error has occurred."
9
+ redirectTo = "/private/chapter-leader/users"
10
+ redirectMessage = "View all users"
11
+ />
12
+ ) ;
13
+ } ;
14
+
15
+ export default Error ;
Original file line number Diff line number Diff line change
1
+ "use client" ;
2
+
3
+ import { ErrorNavigation } from "@components/navigation" ;
4
+
5
+ const Error = ( ) => {
6
+ return (
7
+ < ErrorNavigation
8
+ message = "Oops, an error has occurred."
9
+ redirectMessage = "Back to home"
10
+ />
11
+ ) ;
12
+ } ;
13
+
14
+ export default Error ;
Original file line number Diff line number Diff line change 1
1
import { ISideBar } from "@components/Sidebar" ;
2
2
import { CollapsibleSidebarContainer } from "@components/container" ;
3
3
import { faHome , faUsers , faUser } from "@fortawesome/free-solid-svg-icons" ;
4
- import { UserContext } from "src/context/UserProvider" ;
5
4
6
5
interface IUserLayout {
7
6
children : React . ReactNode ;
Original file line number Diff line number Diff line change
1
+ "use client" ;
2
+
3
+ import { ErrorNavigation } from "@components/navigation" ;
4
+
5
+ const Error = ( ) => {
6
+ return (
7
+ < ErrorNavigation
8
+ message = "Oops, an error has occurred."
9
+ redirectTo = "/private/user/seniors"
10
+ redirectMessage = "View all seniors"
11
+ />
12
+ ) ;
13
+ } ;
14
+
15
+ export default Error ;
Original file line number Diff line number Diff line change @@ -116,21 +116,33 @@ const Sidebar = (props: ISideBar) => {
116
116
< _Sidebar { ...props } />
117
117
</ div >
118
118
< div
119
- className = "mt-6 block lg:hidden"
119
+ className = "block lg:hidden"
120
120
onMouseLeave = { ( ) => setSidebarVisible ( false ) }
121
121
>
122
- < svg
123
- className = "h-8 w-8 text-darkest-tan"
124
- viewBox = "0 0 24 24"
125
- fill = "none"
126
- stroke = "currentColor"
127
- strokeWidth = "1.5"
128
- onClick = { ( ) => setSidebarVisible ( ! sidebarVisible ) }
122
+ < div
123
+ className = "mb-24 block lg:hidden"
124
+ style = { { display : sidebarVisible ? "none" : "block" } }
129
125
>
130
- < line x1 = "4" y1 = "7" x2 = "20" y2 = "7" />
131
- < line x1 = "4" y1 = "12" x2 = "20" y2 = "12" />
132
- < line x1 = "4" y1 = "17" x2 = "20" y2 = "17" />
133
- </ svg >
126
+ < div className = "fixed left-0 top-0 z-50 w-full bg-med-tan px-6 shadow-lg shadow-gray-500" >
127
+ < div className = "flex items-center justify-between" >
128
+ < svg
129
+ className = "h-8 w-8 text-darkest-tan"
130
+ viewBox = "0 0 24 24"
131
+ fill = "none"
132
+ stroke = "currentColor"
133
+ strokeWidth = "1.5"
134
+ onClick = { ( ) => setSidebarVisible ( ! sidebarVisible ) }
135
+ >
136
+ < line x1 = "4" y1 = "7" x2 = "20" y2 = "7" />
137
+ < line x1 = "4" y1 = "12" x2 = "20" y2 = "12" />
138
+ < line x1 = "4" y1 = "17" x2 = "20" y2 = "17" />
139
+ </ svg >
140
+ < Link href = "/public" >
141
+ < Image src = { Logo } alt = "logo" height = { 96 } />
142
+ </ Link >
143
+ </ div >
144
+ </ div >
145
+ </ div >
134
146
{ sidebarVisible && (
135
147
< div className = "fixed left-0 top-0 z-50 h-full w-64 overflow-y-auto drop-shadow-lg lg:overflow-y-hidden" >
136
148
< _Sidebar { ...props } />
Original file line number Diff line number Diff line change
1
+ "use client" ;
2
+
3
+ import { Popup } from "@components/container" ;
4
+ import { UserContext } from "@context/UserProvider" ;
5
+ import { formatUserHomeRoute } from "@utils" ;
6
+ import { useRouter } from "next/navigation" ;
7
+ import React from "react" ;
8
+
9
+ interface ErrorNavigationProps {
10
+ message ?: string ;
11
+ redirectTo ?: string ;
12
+ redirectMessage ?: string ;
13
+ }
14
+
15
+ const ErrorNavigation = ( {
16
+ message,
17
+ redirectTo,
18
+ redirectMessage,
19
+ } : ErrorNavigationProps ) => {
20
+ const router = useRouter ( ) ;
21
+ const userContext = React . useContext ( UserContext ) ;
22
+
23
+ return (
24
+ < Popup >
25
+ < div className = "text-wrap flex h-full w-full flex-col items-center justify-center gap-y-6" >
26
+ < h1 className = "text-lg text-white sm:text-xl" >
27
+ { message ?? "Oops, an error has occurred." }
28
+ </ h1 >
29
+ < button
30
+ className = "mx-1 w-fit rounded bg-white p-3 text-lg text-dark-teal drop-shadow-md"
31
+ onClick = { ( ) =>
32
+ router . replace ( redirectTo ?? formatUserHomeRoute ( userContext . user ) )
33
+ }
34
+ >
35
+ { redirectMessage ?? "Redirect" }
36
+ </ button >
37
+ </ div >
38
+ </ Popup >
39
+ ) ;
40
+ } ;
41
+
42
+ export default ErrorNavigation ;
Original file line number Diff line number Diff line change 1
1
export { default as RootNavigation } from "./RootNavigation" ;
2
+ export { default as ErrorNavigation } from "./ErrorNavigation" ;
You can’t perform that action at this time.
0 commit comments