From 7d30b1fd27ca2de279d0561b0156bac728f75d52 Mon Sep 17 00:00:00 2001 From: amir-kedis Date: Sun, 24 Dec 2023 10:20:14 +0200 Subject: [PATCH 1/9] =?UTF-8?q?=F0=9F=A7=B9=20chore:=20add=20dashboard=20p?= =?UTF-8?q?age=20boilerplate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/dashboard/Dashboard.jsx | 5 +++++ client/src/components/dashboard/Dashboard.scss | 0 client/src/components/login/logIn.jsx | 3 +-- client/src/components/signup/signUp.jsx | 3 +-- client/src/routes.jsx | 2 ++ 5 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 client/src/components/dashboard/Dashboard.jsx create mode 100644 client/src/components/dashboard/Dashboard.scss diff --git a/client/src/components/dashboard/Dashboard.jsx b/client/src/components/dashboard/Dashboard.jsx new file mode 100644 index 00000000..70ad4525 --- /dev/null +++ b/client/src/components/dashboard/Dashboard.jsx @@ -0,0 +1,5 @@ +import "./Dashboard.scss"; + +export default function Dashboard() { + return
Dashboard
; +} diff --git a/client/src/components/dashboard/Dashboard.scss b/client/src/components/dashboard/Dashboard.scss new file mode 100644 index 00000000..e69de29b diff --git a/client/src/components/login/logIn.jsx b/client/src/components/login/logIn.jsx index 4b98d8ff..13a589e7 100644 --- a/client/src/components/login/logIn.jsx +++ b/client/src/components/login/logIn.jsx @@ -21,8 +21,7 @@ export default function LogIn() { useEffect(() => { if (userInfo) { - /* TODO: Add later the home page not the landing page */ - navigate("/"); + navigate("/dashboard"); } }, [navigate, userInfo]); diff --git a/client/src/components/signup/signUp.jsx b/client/src/components/signup/signUp.jsx index 5df44a01..8871f206 100644 --- a/client/src/components/signup/signUp.jsx +++ b/client/src/components/signup/signUp.jsx @@ -27,8 +27,7 @@ export default function SignUp() { useEffect(() => { if (userInfo) { - /* TODO: Add later the home page not the landing page */ - navigate("/"); + navigate("/dashboard"); } }, [navigate, userInfo]); diff --git a/client/src/routes.jsx b/client/src/routes.jsx index 4c876f00..f5116faa 100644 --- a/client/src/routes.jsx +++ b/client/src/routes.jsx @@ -17,6 +17,7 @@ import PublicLayout from "./components/layout/PublicLayout"; // Import Testing Routes here import TestTypo from "./components/testing/testTypo"; import TestLayout from "./components/testing/testLayout"; +import Dashboard from "./components/dashboard/Dashboard"; function Routes() { return ( @@ -26,6 +27,7 @@ function Routes() { } /> } /> } /> + } /> {/* Testing Routes */} From 812c5d58822e88125cfceb982b51cb9b4ffda472 Mon Sep 17 00:00:00 2001 From: amir-kedis Date: Sun, 24 Dec 2023 10:41:26 +0200 Subject: [PATCH 2/9] =?UTF-8?q?=F0=9F=92=85=20feat:=20style=20PageTitile?= =?UTF-8?q?=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/styles/components/PageTitle.scss | 24 +++++++++++++++++++ client/src/components/common/PageTitle.jsx | 19 ++++++++++----- 2 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 client/src/assets/styles/components/PageTitle.scss diff --git a/client/src/assets/styles/components/PageTitle.scss b/client/src/assets/styles/components/PageTitle.scss new file mode 100644 index 00000000..abc7b8e7 --- /dev/null +++ b/client/src/assets/styles/components/PageTitle.scss @@ -0,0 +1,24 @@ +.pageTitle { + text-align: center; + position: relative; + padding-block: 2rem; + + &::before { + content: ""; + position: absolute; + width: 100%; + height: 100%; + background: var(--Primary-200, #2b0547); + border-radius: 50%; + top: 0; + left: 0; + filter: blur(70px); + z-index: -1; + } + + h1 { + font-size: 39.81px; + font-weight: 700; + line-height: 54px; + } +} diff --git a/client/src/components/common/PageTitle.jsx b/client/src/components/common/PageTitle.jsx index 3bc8069e..fcbfe4ab 100644 --- a/client/src/components/common/PageTitle.jsx +++ b/client/src/components/common/PageTitle.jsx @@ -1,9 +1,16 @@ -import React from 'react' +import PropTypes from "prop-types"; +import "../../assets/styles/components/PageTitle.scss"; -const PageTitle = ({title}) => { +const PageTitle = ({ title }) => { return ( -

{title}

- ) -} +
+

{title}

+
+ ); +}; -export default PageTitle \ No newline at end of file +PageTitle.propTypes = { + title: PropTypes.string.isRequired, +}; + +export default PageTitle; From 43ad800ff0a4e2e11d6bc6a93d80c110e951d44f Mon Sep 17 00:00:00 2001 From: amir-kedis Date: Sun, 24 Dec 2023 10:48:36 +0200 Subject: [PATCH 3/9] =?UTF-8?q?=E2=9A=9B=EF=B8=8F=20feat:=20add=20to=20das?= =?UTF-8?q?hboard=20Page=20title?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/dashboard/Dashboard.jsx | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/client/src/components/dashboard/Dashboard.jsx b/client/src/components/dashboard/Dashboard.jsx index 70ad4525..cb5f1e5c 100644 --- a/client/src/components/dashboard/Dashboard.jsx +++ b/client/src/components/dashboard/Dashboard.jsx @@ -1,5 +1,24 @@ +import PageTitle from "../common/PageTitle"; import "./Dashboard.scss"; +import { useSelector } from "react-redux"; +import { useEffect } from "react"; +import { useNavigate } from "react-router-dom"; export default function Dashboard() { - return
Dashboard
; + const { userInfo } = useSelector((state) => state.auth); + const navigate = useNavigate(); + + useEffect(() => { + if (!userInfo) { + navigate("/logIn"); + } + }, [navigate, userInfo]); + + const titleMsg = `مرحباً يا كاتبن ${userInfo?.firstName} ${userInfo?.middleName}`; + + return ( +
+ +
+ ); } From 795ec1b4124e816febb4e14ff03ee8fafab237aa Mon Sep 17 00:00:00 2001 From: amir-kedis Date: Sun, 24 Dec 2023 10:55:54 +0200 Subject: [PATCH 4/9] =?UTF-8?q?=E2=9C=A8=20feat:=20add=20dynamic=20header?= =?UTF-8?q?=20content?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/common/nav.jsx | 20 +++++++++++++++---- client/src/components/layout/PublicLayout.jsx | 2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/client/src/components/common/nav.jsx b/client/src/components/common/nav.jsx index 901b78ad..b5b665af 100644 --- a/client/src/components/common/nav.jsx +++ b/client/src/components/common/nav.jsx @@ -1,5 +1,7 @@ import { Link } from "react-router-dom"; import PropTypes from "prop-types"; +import { useSelector } from "react-redux"; +import { useEffect, useState } from "react"; // icons import { UserCircleIcon } from "@heroicons/react/24/outline"; @@ -9,8 +11,18 @@ import logo from "../../assets/images/logo.svg"; // styles import "../../assets/styles/components/Nav.scss"; -export default function Nav(props) { - const { showIcons } = props; +export default function Nav() { + const [show, setShow] = useState(false); + + const { userInfo } = useSelector((state) => state.auth); + + useEffect(() => { + if (userInfo) { + setShow(true); + } else { + setShow(false); + } + }, [userInfo]); return (