diff --git a/package-lock.json b/package-lock.json index 35fc2c88..ef18e506 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,8 @@ "axios": "^1.5.1", "easymde": "^2.18.0", "feather-icons": "^4.29.0", + "feather-icons-react": "^0.6.2", + "lodash": "^4.17.21", "tailwindcss": "^3.3.3" }, "devDependencies": { @@ -1126,6 +1128,14 @@ "core-js": "^3.1.3" } }, + "node_modules/feather-icons-react": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/feather-icons-react/-/feather-icons-react-0.6.2.tgz", + "integrity": "sha512-G677Y5nc3HzP1f5NNb5LJuZwKrI58BK4+/9O8Bl4naF9JixC+YL4trVom1F2ajnilq/EbU8JETPTNqvCzwH1qA==", + "peerDependencies": { + "react": ">= 16.8.4" + } + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -1446,6 +1456,12 @@ "jiti": "bin/jiti.js" } }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "peer": true + }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -1504,8 +1520,19 @@ "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "peer": true, + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } }, "node_modules/marked": { "version": "4.3.0", @@ -1939,6 +1966,18 @@ "safe-buffer": "^5.1.0" } }, + "node_modules/react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", @@ -3543,6 +3582,12 @@ "core-js": "^3.1.3" } }, + "feather-icons-react": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/feather-icons-react/-/feather-icons-react-0.6.2.tgz", + "integrity": "sha512-G677Y5nc3HzP1f5NNb5LJuZwKrI58BK4+/9O8Bl4naF9JixC+YL4trVom1F2ajnilq/EbU8JETPTNqvCzwH1qA==", + "requires": {} + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -3766,6 +3811,12 @@ "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.19.3.tgz", "integrity": "sha512-5eEbBDQT/jF1xg6l36P+mWGGoH9Spuy0PCdSr2dtWRDGC6ph/w9ZCL4lmESW8f8F7MwT3XKescfP0wnZWAKL9w==" }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "peer": true + }, "json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -3812,8 +3863,16 @@ "lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "peer": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } }, "marked": { "version": "4.3.0", @@ -4081,6 +4140,15 @@ "safe-buffer": "^5.1.0" } }, + "react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "peer": true, + "requires": { + "loose-envify": "^1.1.0" + } + }, "read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", diff --git a/package.json b/package.json index a0971caf..a6415698 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,8 @@ "axios": "^1.5.1", "easymde": "^2.18.0", "feather-icons": "^4.29.0", + "feather-icons-react": "^0.6.2", + "lodash": "^4.17.21", "tailwindcss": "^3.3.3" } } diff --git a/react-admin/src/App.js b/react-admin/src/App.js index 311e7bbb..7ff7cf7e 100644 --- a/react-admin/src/App.js +++ b/react-admin/src/App.js @@ -2,12 +2,14 @@ import './App.css'; import {BrowserRouter, Navigate, Route, Routes} from 'react-router-dom'; import Dashboard from './pages/Dashboard' import Login from './pages/auth/Login' +import Home from "./pages/Home"; function App() { return ( - } /> + {/*} />*/} + } /> } /> } /> diff --git a/react-admin/src/pages/Dashboard.jsx b/react-admin/src/pages/Dashboard.jsx index 7d228b9b..ad6e1a74 100644 --- a/react-admin/src/pages/Dashboard.jsx +++ b/react-admin/src/pages/Dashboard.jsx @@ -1,97 +1,135 @@ import logo from '../assets/logo_only.svg' +import FeatherIcon from 'feather-icons-react' + function Dashboard() { return ( -
-
-
- Avored Rust Cms -
+
+
+ +
+ +
+ +
+ AvoRed + Rust CMS +
+
+
+
+
+
-
- AvoRed Rust CMS +
+
+ Dashboard content goes here +
+ +
-
) } diff --git a/react-admin/src/pages/Home.jsx b/react-admin/src/pages/Home.jsx new file mode 100644 index 00000000..7d228b9b --- /dev/null +++ b/react-admin/src/pages/Home.jsx @@ -0,0 +1,98 @@ +import logo from '../assets/logo_only.svg' +function Dashboard() { + return ( +
+
+
+ Avored Rust Cms +
+ +
+
+ +
+
+ +
+ +

+ Administrator +

+ +

+ An app administrator plays a pivotal role in ensuring + the smooth operation of the avored cms. + They are responsible for managing user access, + content updates and overseeing updates. The administrator acts as the + gatekeeper, safeguarding the app's content and user + experience while facilitating its growth and improvement. + In essence, they are the backbone of a well-maintained + and secure avored rust cms ecosystem. +

+
+
+ +
+
+ + +
+
+ +
+ +

+ Github +

+ +

+ GitHub Star: When you "star" a GitHub repository, it signifies your + interest in that project. Starring a repository + also sends a signal to the repository owner that you + appreciate their work or find it valuable. + + Community Help: The GitHub community is known for its collaborative nature. + Developers frequently help each other by contributing to + open-source projects, reporting issues, suggesting improvements, + and even submitting pull requests to fix bugs or add + features. This collective effort is essential for + the growth and success of open-source projects hosted on GitHub. +

+
+ +
+ +
+
+
+
+ +
+ + +
+ AvoRed Rust CMS +
+
+
+
+ ) +} + +export default Dashboard \ No newline at end of file diff --git a/react-admin/src/pages/auth/Login.jsx b/react-admin/src/pages/auth/Login.jsx index 330145b9..0b9a5f98 100644 --- a/react-admin/src/pages/auth/Login.jsx +++ b/react-admin/src/pages/auth/Login.jsx @@ -1,14 +1,25 @@ -import {useState} from "react"; +import {useEffect, useState} from "react"; import logo from "../../assets/logo_only.svg"; import {useNavigate} from "react-router-dom"; +import {isEmpty} from "lodash"; function Login() { const [email, setEmail] = useState('admin@admin.com'); const [password, setPassword] = useState('admin123'); const redirect = useNavigate() + + const [token, setToken] = useState(''); + + useEffect(()=>{ + /* to do make sure it execute once only..*/ + const token = localStorage.getItem("AUTH_TOKEN"); + if (!isEmpty(token)) { + return redirect("/admin"); + } + },[]); + const handleSubmit = (async (e) => { e.preventDefault() - console.log("handle submit") const response = (await fetch('http://localhost:8080/api/login', { method: 'post', headers: { @@ -17,7 +28,6 @@ function Login() { body: JSON.stringify({email: email, password: password}) })) const login_response = await response.json() - console.log(login_response) if (login_response.status) { localStorage.setItem("AUTH_TOKEN", login_response.data) return redirect("/admin");