diff --git a/src/App.css b/src/App.css index 74b5e05..e247a5f 100644 --- a/src/App.css +++ b/src/App.css @@ -36,3 +36,4 @@ transform: rotate(360deg); } } + diff --git a/src/App.js b/src/App.js index dc42127..421cfd1 100644 --- a/src/App.js +++ b/src/App.js @@ -2,8 +2,8 @@ import { HomePage, PostForm, NotFoundPage } from "./pages/index"; import { Routes, Route } from "react-router-dom"; import { PostProvider } from "./context/postContext"; import { Toaster } from "react-hot-toast"; -import Signup from "./components/Signup"; -import Login from "./components/Login"; +import Signup from "./components/signup/Signup"; +import Login from "./components/Login/Login"; import RequiresAuth from "./components/RequiresAuth"; import { HomePageUser } from "./pages/HomePageUser"; import Navbar from "./components/Navbar/Navbar"; @@ -14,6 +14,7 @@ function App() { const isLoginPage = location.pathname === "/login"; return ( +
} /> } /> - } /> + } /> } /> {/* Private routes */} }> - } /> + } /> } /> } /> diff --git a/src/Images/background.jpg b/src/Images/background.jpg new file mode 100644 index 0000000..7658555 Binary files /dev/null and b/src/Images/background.jpg differ diff --git a/src/Images/logoimg.jpg b/src/Images/logoimg.jpg new file mode 100644 index 0000000..ef4439c Binary files /dev/null and b/src/Images/logoimg.jpg differ diff --git a/src/Images/postimg.jpg b/src/Images/postimg.jpg new file mode 100644 index 0000000..f518409 Binary files /dev/null and b/src/Images/postimg.jpg differ diff --git a/src/components/Login/index.jsx b/src/components/Login/Login.jsx similarity index 90% rename from src/components/Login/index.jsx rename to src/components/Login/Login.jsx index e587366..9ba4e2d 100644 --- a/src/components/Login/index.jsx +++ b/src/components/Login/Login.jsx @@ -1,7 +1,8 @@ import { useState } from "react"; import useAuth from "../../hooks/useAuth"; import axios from "axios"; - +import { useLocation, useNavigate } from "react-router-dom"; +import backgroundImage from '../../Images/logoimg.jpg' const Signin = () => { const [data, setData] = useState({ email: "", @@ -10,7 +11,9 @@ const Signin = () => { const [error, setError] = useState(""); const { setAuth } = useAuth(); - + const location = useLocation(); + const navigate = useNavigate(); + const from = location.state?.from?.pathname || "/"; @@ -26,9 +29,10 @@ const Signin = () => { const roles = res?.roles; const token = res?.token; setAuth({ roles, token }); - + console.log(roles); - window.location= "/homeuser" + + navigate(from, { replace: true }); } catch (error) { if ( error.response && @@ -44,11 +48,8 @@ const Signin = () => {
+ style={{ backgroundImage: `url('${backgroundImage}')` }} + >

TechTalk News

@@ -130,7 +131,7 @@ const Signin = () => { )}
diff --git a/src/components/PostCard.jsx b/src/components/PostCard.jsx index 477e245..e6df9a5 100644 --- a/src/components/PostCard.jsx +++ b/src/components/PostCard.jsx @@ -2,6 +2,8 @@ import toast from "react-hot-toast"; import { usePosts } from "../context/postContext"; import { useNavigate } from "react-router-dom"; import moment from "moment"; +import logoImg from "../Images/postimg.jpg" + export function insertMedia(filePath) { var extension = filePath.split(".").pop().toLowerCase(); @@ -74,7 +76,7 @@ export function PostCard({ post }) {
img Logo
@@ -89,16 +91,18 @@ export function PostCard({ post }) {
{" "} {" "}
diff --git a/src/components/PostCardUser.jsx b/src/components/PostCardUser.jsx index f5fcc8c..994c0cb 100644 --- a/src/components/PostCardUser.jsx +++ b/src/components/PostCardUser.jsx @@ -1,5 +1,7 @@ import moment from "moment"; import { insertMedia } from "./PostCard"; +import logoImg from "../Images/postimg.jpg" + export function PostCardUser({ post }) { const normalDate = moment(post.createdAt).format("DD/MM/YYYY"); return ( @@ -8,7 +10,7 @@ export function PostCardUser({ post }) {
logo
@@ -24,7 +26,7 @@ export function PostCardUser({ post }) {
diff --git a/src/components/signup/index.jsx b/src/components/signup/Signup.jsx similarity index 100% rename from src/components/signup/index.jsx rename to src/components/signup/Signup.jsx diff --git a/src/pages/Contact.js b/src/pages/Contact.js index 0d308d0..8514d62 100644 --- a/src/pages/Contact.js +++ b/src/pages/Contact.js @@ -48,7 +48,7 @@ const ContactForm = () => { return (
-

Contact us

+

Contact us

Email us at help@techtalk12.com or message us here:

@@ -106,7 +106,7 @@ const ContactForm = () => {
diff --git a/src/pages/NotFoundPage.js b/src/pages/NotFoundPage.js index 36e61ed..4969238 100644 --- a/src/pages/NotFoundPage.js +++ b/src/pages/NotFoundPage.js @@ -10,7 +10,7 @@ export function NotFoundPage() {