From 967a9d9c3e1acc76912547f003b01f30baa5f18b Mon Sep 17 00:00:00 2001 From: Son-OfAnton Date: Sat, 2 Sep 2023 23:35:52 +0300 Subject: [PATCH] feat(AAiT.web.g1): Added toast and glass navbar --- aait/web/group-1/app/layout.tsx | 2 +- aait/web/group-1/app/profile/account/page.tsx | 5 ++- aait/web/group-1/components/layout/NavBar.tsx | 40 ++++++++++++++----- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/aait/web/group-1/app/layout.tsx b/aait/web/group-1/app/layout.tsx index a323fe906..951509eda 100644 --- a/aait/web/group-1/app/layout.tsx +++ b/aait/web/group-1/app/layout.tsx @@ -3,7 +3,7 @@ import type { Metadata } from "next"; import { Poppins } from "next/font/google"; import { NavBar } from "@/components/layout/NavBar"; -import { ToastContainer } from 'react-toastify' +import { ToastContainer } from "react-toastify"; import 'react-toastify/dist/ReactToastify.css' const inter = Poppins({ diff --git a/aait/web/group-1/app/profile/account/page.tsx b/aait/web/group-1/app/profile/account/page.tsx index d351bf4fe..3613d9d8b 100644 --- a/aait/web/group-1/app/profile/account/page.tsx +++ b/aait/web/group-1/app/profile/account/page.tsx @@ -3,7 +3,7 @@ import React, { useState } from 'react'; import Image from 'next/image'; import { useChangePasswordMutation } from '@/store/features/user/userApi'; - +import { toast } from 'react-toastify'; export default function Page() { const [changePassword] = useChangePasswordMutation() @@ -13,10 +13,11 @@ export default function Page() { const handleSaveChanges = () => { if(newPassword !== confirmPass) { - window.alert("Password don't match") + toast.error('Passwords are not matching') return } changePassword({"oldPassword": oldPassword, "newPassword": newPassword}) + toast.success("Password changed successfuly") } diff --git a/aait/web/group-1/components/layout/NavBar.tsx b/aait/web/group-1/components/layout/NavBar.tsx index 10ec976fb..089d579f2 100644 --- a/aait/web/group-1/components/layout/NavBar.tsx +++ b/aait/web/group-1/components/layout/NavBar.tsx @@ -15,6 +15,8 @@ interface NavItems { export const NavBar = () => { const router = useRouter() const [isMenuToggled, setIsMenuToggled] = useState(false); + const userData = localStorage.getItem('user'); + const currUser = userData ? JSON.parse(userData) : null; const navItems: NavItems[] = [ { @@ -61,13 +63,19 @@ export const NavBar = () => { {/* login signup section */}
- Login - + Login + +
+ User Avatar +
+ +
@@ -80,17 +88,27 @@ export const NavBar = () => {
{/* Navigation section */} {isMenuToggled && ( -
+
+ +
+ User Avatar +
+ {navItems.map((nav: NavItems) => ( ))} - - + Login
)}