ChandimaPrabath commited on
Commit
fced295
·
1 Parent(s): 3acdbcc

v0.0.3 Debug

Browse files
frontend/app/assets/logo.png ADDED

Git LFS Details

  • SHA256: bd1c29730e788ac649de76cf49aff5ae8f485fb8e2e8ec9bb890f1798ed66dbc
  • Pointer size: 130 Bytes
  • Size of remote file: 57.3 kB
frontend/app/components/NexusAuth.css CHANGED
@@ -8,6 +8,7 @@
8
  background: linear-gradient(145deg, var(--accent), var(--secondary));
9
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2), 0 4px 6px rgba(0, 0, 0, 0.1);
10
  color: var(--foreground);
 
11
  }
12
 
13
  /* Header Styling */
@@ -94,6 +95,7 @@
94
  .nexus-auth-signup-login {
95
  text-align: center;
96
  margin-top: 40px;
 
97
  }
98
 
99
  .nexus-auth-signup-login h1 {
 
8
  background: linear-gradient(145deg, var(--accent), var(--secondary));
9
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.2), 0 4px 6px rgba(0, 0, 0, 0.1);
10
  color: var(--foreground);
11
+ animation: fadeIn .5s ease-in-out, pulse .3s ease-in-out;
12
  }
13
 
14
  /* Header Styling */
 
95
  .nexus-auth-signup-login {
96
  text-align: center;
97
  margin-top: 40px;
98
+ animation: fadeIn .5s ease-in-out, pulse .3s ease-in-out;
99
  }
100
 
101
  .nexus-auth-signup-login h1 {
frontend/app/components/Sidebar.js CHANGED
@@ -1,18 +1,41 @@
1
- 'use client';
2
  import { VERSION } from "@/app/lib/config";
 
3
  import { Bars3Icon, UserCircleIcon, Cog6ToothIcon, QuestionMarkCircleIcon, BoltIcon } from "@heroicons/react/20/solid";
4
  import Link from "next/link";
5
- import { useEffect, useState } from "react";
6
  import Image from "next/image";
7
- import logo from "@/app/assets/logo6.png";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
- export default function Sidebar({ isCollapsed, toggleSidebar }) {
10
  const logoStyle = {
11
- width: isCollapsed ? "60px" : "100px",
12
- height: isCollapsed ? "60px" : "100px",
13
  borderRadius: "50px",
14
  transition: "width 0.3s ease, height 0.3s ease",
15
- marginBottom: "20px",
16
  marginTop: "20px",
17
  };
18
 
@@ -48,6 +71,12 @@ export default function Sidebar({ isCollapsed, toggleSidebar }) {
48
  fontSize: "1em",
49
  };
50
 
 
 
 
 
 
 
51
  const textStyle = {
52
  opacity: isCollapsed ? 0 : 1,
53
  transition: "opacity 0.3s ease",
@@ -78,47 +107,49 @@ export default function Sidebar({ isCollapsed, toggleSidebar }) {
78
  transition: "background-color 0.3s ease, right 0.3s ease",
79
  };
80
 
81
- const [acessLevel, setAcessLevel] = useState(null);
82
-
83
- useEffect(() => {
84
- setAcessLevel(localStorage.getItem('a_l'));
85
- }, []);
86
-
87
  return (
88
- <div style={sidebarStyle}>
89
  <div className="logo-container" style={{ display: "flex", flexDirection: "column", alignItems: "center" }}>
90
  <Image style={logoStyle} src={logo} alt="App Logo" />
91
  <sup style={versionStyle}>{VERSION}</sup>
92
  <button
93
  style={toggleButtonStyle}
94
- onClick={toggleSidebar}
95
  >
96
- <Bars3Icon style={{transform: `rotate(${isCollapsed ? 0 : 90}deg)`, transition: 'transform .3s', width: '20px' }} />
97
  </button>
98
  </div>
99
  <ul className="nav-links" style={{ listStyleType: "none", marginTop: "20px", paddingLeft: "0" }}>
100
  <li>
101
- <Link href="/" style={navLinkStyle}>
102
- <UserCircleIcon style={iconStyle} />
103
- <span style={textStyle}>Profile</span>
 
 
104
  </Link>
105
  </li>
106
  <li>
107
- <Link href={`/su/${acessLevel}`} style={navLinkStyle}>
108
- <BoltIcon style={iconStyle} />
109
- <span style={textStyle}>{acessLevel}</span>
 
 
110
  </Link>
111
  </li>
112
  <li>
113
- <Link href="/settings" style={navLinkStyle}>
114
- <Cog6ToothIcon style={iconStyle} />
115
- <span style={textStyle}>Settings</span>
 
 
116
  </Link>
117
  </li>
118
  <li>
119
- <Link href="/support" style={navLinkStyle}>
120
- <QuestionMarkCircleIcon style={iconStyle} />
121
- <span style={textStyle}>Support</span>
 
 
122
  </Link>
123
  </li>
124
  </ul>
 
1
+ "use client";
2
  import { VERSION } from "@/app/lib/config";
3
+ import { usePathname } from "next/navigation";
4
  import { Bars3Icon, UserCircleIcon, Cog6ToothIcon, QuestionMarkCircleIcon, BoltIcon } from "@heroicons/react/20/solid";
5
  import Link from "next/link";
6
+ import { useEffect, useState, useRef } from "react";
7
  import Image from "next/image";
8
+ import logo from "@/app/assets/logo.png";
9
+
10
+ export default function Sidebar() {
11
+ const pathname = usePathname();
12
+ const [accessLevel, setAccessLevel] = useState(null);
13
+ const [isCollapsed, setIsCollapsed] = useState(true);
14
+ const sidebarRef = useRef(null);
15
+
16
+ const toggleSidebar = () => {
17
+ setIsCollapsed(!isCollapsed);
18
+ };
19
+
20
+ useEffect(() => {
21
+ setAccessLevel(localStorage.getItem("a_l"));
22
+
23
+ const handleClickOutside = (event) => {
24
+ if (sidebarRef.current && !sidebarRef.current.contains(event.target)) {
25
+ setIsCollapsed(true);
26
+ }
27
+ };
28
+
29
+ document.addEventListener("mousedown", handleClickOutside);
30
+ return () => document.removeEventListener("mousedown", handleClickOutside);
31
+ }, []);
32
 
 
33
  const logoStyle = {
34
+ width: isCollapsed ? "60px" : "150px",
35
+ height: isCollapsed ? "60px" : "150px",
36
  borderRadius: "50px",
37
  transition: "width 0.3s ease, height 0.3s ease",
38
+ marginBottom: 0,
39
  marginTop: "20px",
40
  };
41
 
 
71
  fontSize: "1em",
72
  };
73
 
74
+ const activeNavLinkStyle = {
75
+ backgroundColor: "var(--hover-accent)",
76
+ borderRadius: "5px",
77
+ animation: "fadeIn .5s ease-in-out, pulse .5s ease-in-out",
78
+ };
79
+
80
  const textStyle = {
81
  opacity: isCollapsed ? 0 : 1,
82
  transition: "opacity 0.3s ease",
 
107
  transition: "background-color 0.3s ease, right 0.3s ease",
108
  };
109
 
 
 
 
 
 
 
110
  return (
111
+ <div ref={sidebarRef} className="sidebar-container" style={sidebarStyle}>
112
  <div className="logo-container" style={{ display: "flex", flexDirection: "column", alignItems: "center" }}>
113
  <Image style={logoStyle} src={logo} alt="App Logo" />
114
  <sup style={versionStyle}>{VERSION}</sup>
115
  <button
116
  style={toggleButtonStyle}
117
+ onClick={() => toggleSidebar(!isCollapsed)}
118
  >
119
+ <Bars3Icon style={{ transform: `rotate(${isCollapsed ? 0 : 90}deg)`, transition: "transform .3s", width: "20px" }} />
120
  </button>
121
  </div>
122
  <ul className="nav-links" style={{ listStyleType: "none", marginTop: "20px", paddingLeft: "0" }}>
123
  <li>
124
+ <Link href="/" legacyBehavior>
125
+ <a style={{ ...navLinkStyle, ...(pathname === "/" && activeNavLinkStyle) }}>
126
+ <UserCircleIcon style={iconStyle} />
127
+ <span style={textStyle}>Profile</span>
128
+ </a>
129
  </Link>
130
  </li>
131
  <li>
132
+ <Link href={`/su/${accessLevel}`} legacyBehavior>
133
+ <a style={{ ...navLinkStyle, ...(pathname === `/su/${accessLevel}` && activeNavLinkStyle) }}>
134
+ <BoltIcon style={iconStyle} />
135
+ <span style={textStyle}>{accessLevel}</span>
136
+ </a>
137
  </Link>
138
  </li>
139
  <li>
140
+ <Link href="/settings" legacyBehavior>
141
+ <a style={{ ...navLinkStyle, ...(pathname === "/settings" && activeNavLinkStyle) }}>
142
+ <Cog6ToothIcon style={iconStyle} />
143
+ <span style={textStyle}>Settings</span>
144
+ </a>
145
  </Link>
146
  </li>
147
  <li>
148
+ <Link href="/support" legacyBehavior>
149
+ <a style={{ ...navLinkStyle, ...(pathname === "/support" && activeNavLinkStyle) }}>
150
+ <QuestionMarkCircleIcon style={iconStyle} />
151
+ <span style={textStyle}>Support</span>
152
+ </a>
153
  </Link>
154
  </li>
155
  </ul>
frontend/app/globals.css CHANGED
@@ -3,16 +3,24 @@
3
  @tailwind utilities;
4
 
5
  :root {
6
- --background: #15171f; /* Deeper dark background */
7
- --foreground: #E0E0E0; /* Light gray text */
8
- --sidebar-background: #14141b; /* Darker sidebar background */
 
 
 
9
  --primary: #1f202a;
10
- --secondary: #2a2b3b; /* Soft secondary background for content */
 
11
  --accent: #4a557f;
12
- --hover-accent: #5c608a; /* Slightly lighter accent color for hover */
13
- --button-background: #3a3b4c; /* Button background */
14
- --button-hover: #2D2D38; /* Darker button hover */
15
- --shadow-dark: rgba(0, 0, 0, 0.15); /* Shadow for depth */
 
 
 
 
16
  }
17
 
18
  html,
@@ -38,19 +46,23 @@ body {
38
 
39
  @keyframes fadeIn {
40
  from {
41
- opacity: 0;
42
  }
 
43
  to {
44
- opacity: 1;
45
  }
46
  }
47
 
48
  @keyframes pulse {
49
- 0%, 100% {
50
- transform: scale(1);
 
 
51
  }
 
52
  50% {
53
- transform: scale(1.1);
54
  }
55
  }
56
 
@@ -60,8 +72,10 @@ body {
60
  border-radius: 5px;
61
  box-shadow: 0 4px 12px var(--shadow-dark);
62
  text-align: center;
63
- width: 90%; /* Adjust for smaller screens */
64
- max-width: 500px; /* Limit for larger screens */
 
 
65
  margin-bottom: 30px;
66
  transition: all 0.3s ease-in-out;
67
  }
@@ -80,3 +94,7 @@ body {
80
  .logout-button:hover {
81
  background-color: darken(var(--button-background), 10%);
82
  }
 
 
 
 
 
3
  @tailwind utilities;
4
 
5
  :root {
6
+ --background: #15171f;
7
+ /* Deeper dark background */
8
+ --foreground: #E0E0E0;
9
+ /* Light gray text */
10
+ --sidebar-background: #14141b;
11
+ /* Darker sidebar background */
12
  --primary: #1f202a;
13
+ --secondary: #2a2b3b;
14
+ /* Soft secondary background for content */
15
  --accent: #4a557f;
16
+ --hover-accent: #5c608a;
17
+ /* Slightly lighter accent color for hover */
18
+ --button-background: #3a3b4c;
19
+ /* Button background */
20
+ --button-hover: #2D2D38;
21
+ /* Darker button hover */
22
+ --shadow-dark: rgba(0, 0, 0, 0.15);
23
+ /* Shadow for depth */
24
  }
25
 
26
  html,
 
46
 
47
  @keyframes fadeIn {
48
  from {
49
+ opacity: 0;
50
  }
51
+
52
  to {
53
+ opacity: 1;
54
  }
55
  }
56
 
57
  @keyframes pulse {
58
+
59
+ 0%,
60
+ 100% {
61
+ transform: scale(1);
62
  }
63
+
64
  50% {
65
+ transform: scale(1.025);
66
  }
67
  }
68
 
 
72
  border-radius: 5px;
73
  box-shadow: 0 4px 12px var(--shadow-dark);
74
  text-align: center;
75
+ width: 90%;
76
+ /* Adjust for smaller screens */
77
+ max-width: 500px;
78
+ /* Limit for larger screens */
79
  margin-bottom: 30px;
80
  transition: all 0.3s ease-in-out;
81
  }
 
94
  .logout-button:hover {
95
  background-color: darken(var(--button-background), 10%);
96
  }
97
+
98
+ .page-content {
99
+ animation: fadeIn .5s ease-in-out, pulse .3s ease-in-out;
100
+ }
frontend/app/layout.js CHANGED
@@ -9,11 +9,6 @@ import Sidebar from "@/app/components/Sidebar";
9
  import { ToastProvider } from "@/app/lib/ToastContext"; // Update with your file path
10
 
11
  export default function RootLayout({ children }) {
12
- const [isCollapsed, setIsCollapsed] = useState(true);
13
- const toggleSidebar = () => {
14
- setIsCollapsed(!isCollapsed);
15
- };
16
-
17
  const contentStyle = {
18
  padding: "30px",
19
  flexGrow: 1,
@@ -54,7 +49,7 @@ export default function RootLayout({ children }) {
54
 
55
  <NexusAuthWrapper>
56
  <div className="dashboard-container">
57
- <Sidebar isCollapsed={isCollapsed} toggleSidebar={toggleSidebar} />
58
  <div style={contentStyle}>
59
  <header style={headerStyle}>
60
  <h1>Welcome to Nexus Dashboard</h1>
 
9
  import { ToastProvider } from "@/app/lib/ToastContext"; // Update with your file path
10
 
11
  export default function RootLayout({ children }) {
 
 
 
 
 
12
  const contentStyle = {
13
  padding: "30px",
14
  flexGrow: 1,
 
49
 
50
  <NexusAuthWrapper>
51
  <div className="dashboard-container">
52
+ <Sidebar/>
53
  <div style={contentStyle}>
54
  <header style={headerStyle}>
55
  <h1>Welcome to Nexus Dashboard</h1>
frontend/app/lib/config.js CHANGED
@@ -1,5 +1,5 @@
1
  export const API_BASE_URL = "https://hans-r-d-auth-nexus.hf.space/v1/api";
2
  export const DEBUG = true;
3
- export const VERSION = "v0.0.2 Debug";
4
  export const APP_NAME = "Nexus Auth";
5
  export const APP_DESCRIPTION = "A simple authentication service";
 
1
  export const API_BASE_URL = "https://hans-r-d-auth-nexus.hf.space/v1/api";
2
  export const DEBUG = true;
3
+ export const VERSION = "v0.0.3 Debug";
4
  export const APP_NAME = "Nexus Auth";
5
  export const APP_DESCRIPTION = "A simple authentication service";
frontend/app/page.js CHANGED
@@ -36,7 +36,7 @@ export default function Home() {
36
  };
37
 
38
  return (
39
- <>
40
  {username && (
41
  <div className="max-w-sm mx-auto shadow-lg rounded-lg overflow-hidden bg-gray-800 text-white">
42
  <table className="min-w-full divide-y divide-gray-700">
@@ -63,6 +63,6 @@ export default function Home() {
63
  </table>
64
  </div>
65
  )}
66
- </>
67
  );
68
  }
 
36
  };
37
 
38
  return (
39
+ <div className="page-content">
40
  {username && (
41
  <div className="max-w-sm mx-auto shadow-lg rounded-lg overflow-hidden bg-gray-800 text-white">
42
  <table className="min-w-full divide-y divide-gray-700">
 
63
  </table>
64
  </div>
65
  )}
66
+ </div>
67
  );
68
  }
frontend/app/settings/page.js CHANGED
@@ -1,5 +1,7 @@
1
  export default function Settings() {
2
  return (
3
- <></>
 
 
4
  )
5
  };
 
1
  export default function Settings() {
2
  return (
3
+ <div className="page-content flex justify-center items-center">
4
+ <h1>Settings</h1>
5
+ </div>
6
  )
7
  };
frontend/app/su/[access_level]/page.js CHANGED
@@ -84,7 +84,7 @@ export default function SuperUser() {
84
  const { username, userID, accessLevel } = userDetails;
85
 
86
  return (
87
- <div className="max-w-xl mx-auto shadow-lg rounded-lg overflow-hidden bg-gray-800 text-white">
88
  {username ? (
89
  <>
90
  <table className="min-w-full divide-y divide-gray-700">
 
84
  const { username, userID, accessLevel } = userDetails;
85
 
86
  return (
87
+ <div className="page-content max-w-xl mx-auto shadow-lg rounded-lg overflow-hidden bg-gray-800 text-white">
88
  {username ? (
89
  <>
90
  <table className="min-w-full divide-y divide-gray-700">
frontend/app/support/page.js CHANGED
@@ -1,5 +1,7 @@
1
  export default function Support() {
2
  return (
3
- <></>
 
 
4
  )
5
  };
 
1
  export default function Support() {
2
  return (
3
+ <div className="page-content flex justify-center items-center">
4
+ <h1>Support</h1>
5
+ </div>
6
  )
7
  };