diff options
author | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-07-25 22:54:55 +0530 |
---|---|---|
committer | Biswakalyan Bhuyan <biswa@surgot.in> | 2024-07-25 22:54:55 +0530 |
commit | 680f38b1c48c4cc5c4b34b285f68fe48217d0ab9 (patch) | |
tree | 6cb3bdbf246636625b34fec022bf6619d24f8c01 /src/pages | |
parent | 458a8c849da82adf045a40919a4a9e3aa06e1c06 (diff) | |
download | admin-panel-680f38b1c48c4cc5c4b34b285f68fe48217d0ab9.tar.gz admin-panel-680f38b1c48c4cc5c4b34b285f68fe48217d0ab9.tar.bz2 admin-panel-680f38b1c48c4cc5c4b34b285f68fe48217d0ab9.zip |
setting up login
Diffstat (limited to 'src/pages')
-rw-r--r-- | src/pages/Dashboard.jsx | 14 | ||||
-rw-r--r-- | src/pages/Login.jsx | 24 | ||||
-rw-r--r-- | src/pages/ManageAds.jsx | 35 | ||||
-rw-r--r-- | src/pages/Register.jsx | 21 |
4 files changed, 94 insertions, 0 deletions
diff --git a/src/pages/Dashboard.jsx b/src/pages/Dashboard.jsx new file mode 100644 index 0000000..ce3472e --- /dev/null +++ b/src/pages/Dashboard.jsx @@ -0,0 +1,14 @@ +import React from 'react'; +import Navbar from '../components/Navbar'; + +const Dashboard = () => { + return ( + <div> + <Navbar /> + <h1>Dashboard</h1> + {/* Add dashboard content here */} + </div> + ); +}; + +export default Dashboard; diff --git a/src/pages/Login.jsx b/src/pages/Login.jsx new file mode 100644 index 0000000..89e0c8b --- /dev/null +++ b/src/pages/Login.jsx @@ -0,0 +1,24 @@ +import React from 'react'; +import { useNavigate } from 'react-router-dom'; + +const Login = () => { + const navigate = useNavigate(); + + const handleLogin = () => { + // Handle login logic here + navigate('/dashboard'); + }; + + return ( + <div> + <h1>Login</h1> + <form onSubmit={handleLogin}> + <input type="text" placeholder="Username" /> + <input type="password" placeholder="Password" /> + <button type="submit">Login</button> + </form> + </div> + ); +}; + +export default Login; diff --git a/src/pages/ManageAds.jsx b/src/pages/ManageAds.jsx new file mode 100644 index 0000000..834a898 --- /dev/null +++ b/src/pages/ManageAds.jsx @@ -0,0 +1,35 @@ +import React, { useState, useEffect } from 'react'; +import AdCard from '../components/AdCard'; +import AdForm from '../components/AdForm'; +import { fetchAds, addAd } from '../utils/api'; + +const ManageAds = () => { + const [ads, setAds] = useState([]); + + useEffect(() => { + const getAds = async () => { + const adsData = await fetchAds(); + setAds(adsData); + }; + getAds(); + }, []); + + const handleAddAd = async (ad) => { + await addAd(ad); + setAds([...ads, ad]); + }; + + return ( + <div> + <h1>Manage Ads</h1> + <AdForm onAddAd={handleAddAd} /> + <div> + {ads.map((ad) => ( + <AdCard key={ad.id} ad={ad} /> + ))} + </div> + </div> + ); +}; + +export default ManageAds; diff --git a/src/pages/Register.jsx b/src/pages/Register.jsx new file mode 100644 index 0000000..84c0bf2 --- /dev/null +++ b/src/pages/Register.jsx @@ -0,0 +1,21 @@ +import React from 'react'; + +const Register = () => { + const handleRegister = (e) => { + e.preventDefault(); + // Handle registration logic here + }; + + return ( + <div> + <h1>Register</h1> + <form onSubmit={handleRegister}> + <input type="text" placeholder="Username" /> + <input type="password" placeholder="Password" /> + <button type="submit">Register</button> + </form> + </div> + ); +}; + +export default Register; |