Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚛️ Captain profile #23

Merged
merged 2 commits into from
Dec 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file removed client/public/DELETEME.txt
Empty file.
Binary file added client/public/avatar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 53 additions & 0 deletions client/src/components/captain-profile/CaptainProfile.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { useSelector } from "react-redux";
import Button from "../common/Button";
import PageTitle from "../common/PageTitle";
import "./CaptainProfile.scss";

export default function CaptainProfile() {
const { userInfo } = useSelector((state) => state.auth);

return (
<div className="captain-profile">
<PageTitle title="الصفحة الشخصية" />
<div className="captain-profile__avatar">
<img src="./avatar.png" alt="captain avatar" />
</div>
<h4 className="captain-profile__name">
{userInfo.firstName} {userInfo.middleName} {userInfo.lastName}
</h4>
<h6 className="captain-profile__type">
{
{
general: "قائد / نائب قائد عام",
regular: "قائد",
unit: "قائد وحدة",
}[userInfo.type]
}
</h6>
<div className="captain-profile__info">
<h4>وسائل التواصل</h4>
<div className="captain-profile__info__item">
<h6> رقم التليفون</h6>
<p>{userInfo.phoneNumber}</p>
</div>
<div className="captain-profile__info__item">
<h6>البريد الالكتروني</h6>
<p>{userInfo.email}</p>
</div>
<div className="captain-profile__info__item">
<h6>القطاعات</h6>
<p>
{/* TODO: Handle What will be displayed to General and unit captains */}
{userInfo.rSectorBaseName
? userInfo.rSectorBaseName + " " + userInfo.rSectorSuffixName
: "لا يوجد"}
</p>
</div>
{/* TODO: Add the route for The Button Later */}
<Button className="captain-profile__info__btn Button--medium Button--primary">
تعديل الصفحة الشخصية
</Button>
</div>
</div>
);
}
50 changes: 50 additions & 0 deletions client/src/components/captain-profile/CaptainProfile.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.captain-profile {
&__avatar {
display: flex;
justify-content: center;
margin-block: 1rem;

img {
border-radius: 50%;
}
}

&__name,
&__type {
text-align: center;
margin-bottom: 1rem;
}

&__type {
color: var(--primary-100);
}

&__info {
width: 90vw;
margin-inline: auto;
padding: 20px;
background-color: var(--primary-900);
border-radius: 30px;

h4 {
text-align: center;
margin-bottom: 1rem;
}

&__item {
direction: rtl;
display: flex;
flex-direction: column;
gap: 0.5rem;
margin-bottom: 2rem;

h6 {
color: var(--primary-200);
}
}
&__btn {
margin-inline: auto;
display: block;
}
}
}
3 changes: 1 addition & 2 deletions client/src/components/common/nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ export default function Nav() {
<Link onClick={handleLogout}>
<ArrowLeftOnRectangleIcon className="Nav__icon" />
</Link>
{/* TODO: add route later */}
<Link to="/">
<Link to="/profile">
<UserCircleIcon className="Nav__icon" />
</Link>
{/* TODO: add route later */}
Expand Down
2 changes: 2 additions & 0 deletions client/src/routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import PublicLayout from "./components/layout/PublicLayout";
import TestTypo from "./components/testing/testTypo";
import TestLayout from "./components/testing/testLayout";
import Dashboard from "./components/dashboard/Dashboard";
import CaptainProfile from "./components/captain-profile/CaptainProfile";

function Routes() {
return (
Expand All @@ -28,6 +29,7 @@ function Routes() {
<Route exact path="/signUp" element={<SignUp />} />
<Route exact path="/logIn" element={<LogIn />} />
<Route exact path="/dashboard" element={<Dashboard />} />
<Route exact path="/profile" element={<CaptainProfile />} />
</Route>

{/* Testing Routes */}
Expand Down