Skip to content

Commit

Permalink
Add log out (#606)
Browse files Browse the repository at this point in the history
* Update login form with additional links and error messaging

* completed login page

* update site config

* remove enrolcourse

* remove courseInfo

* rmoved courseinfo

* remove unused file

* remove more unused files

* save

* save

* save

* removed all premature course files

* save

* run prettier

* remove comment forms

* add useEffect

* save

* save

* save

* add logout functionality

* add attribute

* run prettier
  • Loading branch information
jeromehardaway authored Jun 9, 2024
1 parent d22454d commit 818068a
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 22 deletions.
5 changes: 1 addition & 4 deletions src/components/modals/enroll-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ const EnrollModal = ({ show, onClose }: TProps) => {
{!isLoggedIn && (
<p>
Please,{" "}
<Anchor
className="tw-text-primary"
path="/login-register"
>
<Anchor className="tw-text-primary" path="/login">
log in
</Anchor>{" "}
to get access to free lesson
Expand Down
44 changes: 28 additions & 16 deletions src/containers/profile/bio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,52 @@ const ProfileBio = () => {
<figure className="tw-col-span-full md:tw-col-span-6 xl:tw-col-span-5">
<img
className="tw-w-full"
src="/images/profile/profile.jpeg"
src="https://res.cloudinary.com/vetswhocode/image/upload/v1683429329/jerome-headshot-bw-3900.jpg"
alt="profile"
width={470}
height={470}
/>
</figure>
<div className="tw-col-span-full md:tw-col-[7/-1]">
<h2 className="tw-mb-0 tw-leading-[1.42]">
Maggie Strickland
Jerome Hardaway
</h2>
<h3 className="tw-font-normal tw-text-body tw-text-h6 tw-leading-relaxed tw-mb-0">
/Advanced Educator
Executive Director
</h3>
<p className="tw-mb-0 tw-mt-3.8">
Maggie is a brilliant educator, whose life was spent for
computer science and love of nature. Being a female, she
encountered a lot of obstacles and was forbidden to work
in this field by her family. With a true spirit and
talented gift, she was able to succeed and set an
example for others.
With over 10 years of software engineering experience,
Jerome is a leader in developing and delivering AI
products that enhance the user experience and empower
millions of customers worldwide. He currently works as a
Senior Software Engineer at Microsoft, where he applies
his skills in Python, Javascript, and user-centered
design to create innovative solutions and technologies
for various platforms and domains.
</p>

<p className="tw-mb-0 tw-mt-3.8">
Jerome is also passionate about teaching and mentoring
diverse and underrepresented communities in the tech
industry. He is the Founder and Executive Director of
Vets Who Code, a nonprofit organization that teaches
veterans and military spouses how to code for free and
helps them find fulfilling careers in the tech sector.
Jerome shares his knowledge and expertise with learners
and peers through courses on LinkedIn Learning and
FrontEnd Masters, as well as through his recognition as
a LinkedIn Top Voice, a GitHub Star, and a Twilio
Champion. Jerome's mission is to make the tech industry
more accessible, diverse, and innovative, and he is
always looking for new ways to achieve this goal.
</p>
<h4 className="tw-text-h5 tw-mt-9 tw-mb-2.5">Contact</h4>
<div className="contact-info-text">
<span className="phone">
Phone number:{" "}
<strong className="tw-text-heading">
(+88) - 1990 - 8668
</strong>{" "}
</span>
<br />
<span className="email">
Email:{" "}
<strong className="tw-text-heading">
maggiestrickland.instructor@gmail.com
jerome@vetswhocode.io
</strong>
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Login = () => {

useEffect(() => {
if (isLoggedIn) {
void router.push("/dashboard"); // Redirect to dashboard if already logged in
void router.push("/profile"); // Redirect to dashboard if already logged in
}
}, [isLoggedIn, router]);

Expand Down
17 changes: 16 additions & 1 deletion src/pages/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type PageProps = NextPage & {

const Profile: PageProps = () => {
const mounted = useMount();
const { isLoggedIn } = useUser();
const { isLoggedIn, logout } = useUser();
const router = useRouter();

useEffect(() => {
Expand All @@ -33,6 +33,12 @@ const Profile: PageProps = () => {
</div>
);
}

const handleLogout = () => {
logout();
void router.push("/login-register");
};

return (
<>
<SEO title="Profile" />
Expand All @@ -42,6 +48,15 @@ const Profile: PageProps = () => {
showTitle={false}
/>
<ProfileBio />
<div className="tw-mt-4 tw-flex tw-justify-center">
<button
onClick={handleLogout}
type="button"
className="tw-bg-red-500 tw-text-white tw-px-4 tw-py-2 tw-rounded"
>
Logout
</button>
</div>
</>
);
};
Expand Down

0 comments on commit 818068a

Please sign in to comment.