-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from avored/77-react-admin-template
login in react
- Loading branch information
Showing
9 changed files
with
417 additions
and
139 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,98 @@ | ||
import logo from '../assets/logo_only.svg' | ||
function Dashboard() { | ||
return ( | ||
<div className="flex h-screen w-full justify-center items-center"> | ||
<div className="text-indigo-600 text-2xl font-semibold"> | ||
Avored rust content management system | ||
<div | ||
className="relative sm:flex sm:justify-center sm:items-center min-h-screen bg-center bg-gray-100 selection:bg-primary-500 selection:text-white"> | ||
<div className="max-w-7xl mx-auto p-6 lg:p-8"> | ||
<div className="flex justify-center"> | ||
<img src={logo} className="w-20 h-20" alt="Avored Rust Cms"/> | ||
</div> | ||
|
||
<div className="mt-16"> | ||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6 lg:gap-8"> | ||
<a href="/admin/login" | ||
className="scale-100 p-6 bg-white rounded-lg shadow-2xl shadow-gray-500/20 flex focus:outline focus:outline-2 focus:outline-primary-500"> | ||
<div> | ||
<div className="h-16 w-16 bg-primary-50 flex items-center justify-center rounded-full"> | ||
<i className="w-7 h-7 stroke-primary-500" data-feather="framer"></i> | ||
</div> | ||
|
||
<h2 className="mt-6 text-xl font-semibold text-gray-900"> | ||
Administrator | ||
</h2> | ||
|
||
<p className="mt-4 text-gray-500 text-sm leading-relaxed"> | ||
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. | ||
</p> | ||
</div> | ||
<div className="self-center pl-5"> | ||
<i className="w-6 h-6 stroke-primary-500" data-feather="chevrons-right"></i> | ||
</div> | ||
</a> | ||
|
||
<a href="https://github.com/avored/avored-rust-cms" target="_blank" | ||
className="scale-100 p-6 bg-white rounded-lg shadow-2xl flex focus:outline focus:outline-2 focus:outline-primary-500"> | ||
<div> | ||
<div className="h-16 w-16 bg-primary-50 flex items-center justify-center rounded-full"> | ||
<i className="w-7 h-7 stroke-primary-500" data-feather="github"></i> | ||
</div> | ||
|
||
<h2 className="mt-6 text-xl font-semibold text-gray-900"> | ||
Github | ||
</h2> | ||
|
||
<p className="mt-4 text-gray-500 text-sm leading-relaxed"> | ||
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. | ||
</p> | ||
</div> | ||
|
||
<div className="self-center pl-5"> | ||
<i className="w-6 h-6 stroke-primary-500" data-feather="chevrons-right"></i> | ||
</div> | ||
</a> | ||
</div> | ||
</div> | ||
|
||
<div className="flex justify-center mt-16 px-0 sm:items-center sm:justify-between"> | ||
<div className="text-center text-sm text-gray-500 sm:text-left"> | ||
<div className="flex items-center gap-4"> | ||
<a href="https://github.com/sponsors/indpurvesh" | ||
className="group inline-flex items-center hover:text-gray-700 dark:hover:text-white focus:outline focus:outline-2 focus:rounded-sm focus:outline-primary-500"> | ||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" | ||
strokeWidth="1.5" | ||
className="-mt-px mr-1 w-5 h-5 stroke-gray-400 dark:stroke-gray-600 group-hover:stroke-gray-600 dark:group-hover:stroke-gray-400"> | ||
<path strokeLinecap="round" strokeLinejoin="round" | ||
d="M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12z"/> | ||
</svg> | ||
Sponsor | ||
</a> | ||
</div> | ||
</div> | ||
|
||
<div className="ml-4 text-center text-sm text-gray-500 sm:text-right sm:ml-0"> | ||
AvoRed Rust CMS | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default Dashboard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,37 @@ | ||
import {useState} from "react"; | ||
import logo from "../../assets/logo_only.svg"; | ||
import {useNavigate} from "react-router-dom"; | ||
|
||
function Login() { | ||
const [email, setEmail] = useState('[email protected]'); | ||
const [password, setPassword] = useState('admin123'); | ||
const redirect = useNavigate() | ||
const handleSubmit = (async (e) => { | ||
e.preventDefault() | ||
console.log("handle submit") | ||
const response = (await fetch('http://localhost:8080/api/login', { | ||
method: 'post', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
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"); | ||
} | ||
}) | ||
|
||
|
||
return ( | ||
<div | ||
className="min-h-screen bg-slate-100 flex flex-col justify-center py-12 sm:px-6 lg:px-8"> | ||
<div className="flex justify-center"> | ||
<img src={logo} className="w-20 h-20" alt="Avored Rust Cms"/> | ||
</div> | ||
|
||
<div className="sm:mx-auto sm:w-full sm:max-w-md"> | ||
<h2 className="mt-6 text-center text-3xl font-extrabold text-gray-900"> | ||
Sign into your account | ||
|
@@ -13,7 +43,7 @@ function Login() { | |
|
||
<div className="mt-8 sm:mx-auto sm:w-full sm:max-w-md"> | ||
<div className="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10"> | ||
<form className="space-y-5" action="/admin/login" method="POST"> | ||
<form onSubmit={handleSubmit} className="space-y-5" action="/admin/login" method="POST"> | ||
<div> | ||
<label htmlFor="email_address" className="text-sm text-gray-600"> | ||
Email Address | ||
|
@@ -23,6 +53,8 @@ function Login() { | |
type="email" | ||
name="email" | ||
required | ||
value={email} | ||
onChange={e => setEmail(e.target.value)} | ||
autoFocus | ||
className="appearance-none rounded-md ring-1 ring-primary-300 relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-primary-500 sm:text-sm focus:z-10" | ||
placeholder="Email Address" | ||
|
@@ -38,6 +70,8 @@ function Login() { | |
type="password" | ||
name="password" | ||
required | ||
value={password} | ||
onChange={e => setPassword(e.target.value)} | ||
className="appearance-none rounded-md ring-1 ring-primary-300 relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 focus:outline-none focus:ring-primary-500 sm:text-sm focus:z-10" | ||
placeholder="Password" | ||
/> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters