diff --git a/package-lock.json b/package-lock.json index c51ab61..56253a7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30708,6 +30708,126 @@ "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.8.29.tgz", "integrity": "sha512-mla2acNCMkWXBD+c+yeUrBUrzOxYMNFdQ6FGfigGGtEVBPJx07BQeJekjt9DmH1FtZek4E9rE1eRR9qQpxACOQ==", "peer": true + }, + "node_modules/@next/swc-darwin-arm64": { + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.3.tgz", + "integrity": "sha512-3pEYo/RaGqPP0YzwnlmPN2puaF2WMLM3apt5jLW2fFdXD9+pqcoTzRk+iZsf8ta7+quAe4Q6Ms0nR0SFGFdS1A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.3.tgz", + "integrity": "sha512-6adp7waE6P1TYFSXpY366xwsOnEXM+y1kgRpjSRVI2CBDOcbRjsJ67Z6EgKIqWIue52d2q/Mx8g9MszARj8IEA==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.3.tgz", + "integrity": "sha512-cuzCE/1G0ZSnTAHJPUT1rPgQx1w5tzSX7POXSLaS7w2nIUJUD+e25QoXD/hMfxbsT9rslEXugWypJMILBj/QsA==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.3.tgz", + "integrity": "sha512-0D4/oMM2Y9Ta3nGuCcQN8jjJjmDPYpHX9OJzqk42NZGJocU2MqhBq5tWkJrUQOQY9N+In9xOdymzapM09GeiZw==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.3.tgz", + "integrity": "sha512-ENPiNnBNDInBLyUU5ii8PMQh+4XLr4pG51tOp6aJ9xqFQ2iRI6IH0Ds2yJkAzNV1CfyagcyzPfROMViS2wOZ9w==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.3.tgz", + "integrity": "sha512-BTAbq0LnCbF5MtoM7I/9UeUu/8ZBY0i8SFjUMCbPDOLv+un67e2JgyN4pmgfXBwy/I+RHu8q+k+MCkDN6P9ViQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.3.tgz", + "integrity": "sha512-AEHIw/dhAMLNFJFJIJIyOFDzrzI5bAjI9J26gbO5xhAKHYTZ9Or04BesFPXiAYXDNdrwTP2dQceYA4dL1geu8A==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-ia32-msvc": { + "version": "14.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.3.tgz", + "integrity": "sha512-vga40n1q6aYb0CLrM+eEmisfKCR45ixQYXuBXxOOmmoV8sYST9k7E3US32FsY+CkkF7NtzdcebiFT4CHuMSyZw==", + "cpu": [ + "ia32" + ], + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } } } } diff --git a/src/__tests__/CreateProdudash.test.tsx b/src/__tests__/CreateProdudash.test.tsx index 92b0b1f..0127c3f 100644 --- a/src/__tests__/CreateProdudash.test.tsx +++ b/src/__tests__/CreateProdudash.test.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { render, screen, waitFor } from '@testing-library/react'; import '@testing-library/jest-dom'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; -import Page from '@/app/dashboard/addproduct/page'; +import Page from '@/app/dashboard/product/create/page'; import request from '@/utils/axios'; import { useRouter } from 'next/navigation'; diff --git a/src/__tests__/ProfileeditDashboard.test.tsx b/src/__tests__/ProfileeditDashboard.test.tsx index 1753d47..5e1790c 100644 --- a/src/__tests__/ProfileeditDashboard.test.tsx +++ b/src/__tests__/ProfileeditDashboard.test.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { render, screen, waitFor } from '@testing-library/react'; import '@testing-library/jest-dom'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; -import Page from '@/app/dashboard/profile_/[id]/page'; +import Page from '@/app/dashboard/profile/[id]/page'; import request from '@/utils/axios'; import { useRouter } from 'next/navigation'; diff --git a/src/__tests__/UpdateReduce.test.tsx b/src/__tests__/UpdateReduce.test.tsx index 17188e6..f02ab51 100644 --- a/src/__tests__/UpdateReduce.test.tsx +++ b/src/__tests__/UpdateReduce.test.tsx @@ -72,7 +72,7 @@ describe('updatePassword slice', () => { const action = { type: updatePassword.rejected.type, - error: 'Failed to update password', + erro: 'Failed to update password', }; const state = reducer(initialState, action); diff --git a/src/__tests__/singleProduct.test.tsx b/src/__tests__/singleProduct.test.tsx index 3b3dbc5..7cf093f 100644 --- a/src/__tests__/singleProduct.test.tsx +++ b/src/__tests__/singleProduct.test.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { render, screen, waitFor } from '@testing-library/react'; import '@testing-library/jest-dom'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; -import Page from '@/app/dashboard/products_/[id]/page'; +import Page from '@/app/dashboard/product/[id]/page'; import request from '@/utils/axios'; import { useRouter } from 'next/navigation'; diff --git a/src/__tests__/updatesDash.test.tsx b/src/__tests__/updatesDash.test.tsx index b5b18e4..2f48759 100644 --- a/src/__tests__/updatesDash.test.tsx +++ b/src/__tests__/updatesDash.test.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { render, screen, waitFor } from '@testing-library/react'; import '@testing-library/jest-dom'; import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; -import Page from '@/app/dashboard/product_/[id]/page'; +import Page from '@/app/dashboard/product/[id]/edit/page'; import request from '@/utils/axios'; import { useRouter } from 'next/navigation'; import { Provider } from 'react-redux'; diff --git a/src/app/dashboard/product_/[id]/page.tsx b/src/app/dashboard/product/[id]/edit/page.tsx similarity index 100% rename from src/app/dashboard/product_/[id]/page.tsx rename to src/app/dashboard/product/[id]/edit/page.tsx diff --git a/src/app/dashboard/products_/[id]/page.tsx b/src/app/dashboard/product/[id]/page.tsx similarity index 100% rename from src/app/dashboard/products_/[id]/page.tsx rename to src/app/dashboard/product/[id]/page.tsx diff --git a/src/app/dashboard/addproduct/page.tsx b/src/app/dashboard/product/create/page.tsx similarity index 100% rename from src/app/dashboard/addproduct/page.tsx rename to src/app/dashboard/product/create/page.tsx diff --git a/src/app/dashboard/profile_/[id]/page.tsx b/src/app/dashboard/profile/[id]/page.tsx similarity index 100% rename from src/app/dashboard/profile_/[id]/page.tsx rename to src/app/dashboard/profile/[id]/page.tsx diff --git a/src/components/DashNavbar.tsx b/src/components/DashNavbar.tsx index 4fa420a..306172f 100644 --- a/src/components/DashNavbar.tsx +++ b/src/components/DashNavbar.tsx @@ -60,7 +60,9 @@ const DashNavbar: React.FC = ({ role }) => {
= ({ role }) => {
handleClick('/')} />

@@ -93,7 +95,7 @@ const DashNavbar: React.FC = ({ role }) => {
  • {React.createElement(FaHome)} = ({ role }) => {
  • {React.createElement(FaUsersGear)} = ({ role }) => {
  • {React.createElement(FaUserShield)} = ({ role }) => {
  • {React.createElement(AiFillProduct)} = ({ role }) => {
  • {React.createElement(BsBorderStyle)} = ({ role }) => {
  • - +
  • {React.createElement(MdCreateNewFolder)} = ({ role }) => {
  • mutate()} - className={`flex bg-primary/80 ${activelink === 'product' ? 'text-yellow-400' : 'text-white'} text-2xl hover:text-yellow-400 duration-200 bg-transparent rounded-md hover:bg-primary p-2 cursor-pointer hover:bg-light-white items-center gap-x-4 bg-light-white`} + className={`flex bg-primary/80 ${activelink === '' ? 'text-yellow-400' : 'text-white'} text-sm hover:text-yellow-400 duration-200 bg-transparent rounded-md hover:bg-primary p-2 cursor-pointer hover:bg-light-white items-center gap-x-4 bg-light-white`} > {React.createElement(MdOutlineLogout)} = ({ role }) => { onClick={handlemenu} className={`${activelink === 'addproduct' ? 'bg-yellow-600 text-white font-bold' : 'text-black'} hover:bg-yellow-400 px-2 hover:text-white font-semibold`} > - Create Product + + Create Product +
  • )}
  • mutate()} className={` hover:bg-yellow-400 px-2 hover:text-white font-semibold`} > diff --git a/src/components/EditProfile.tsx b/src/components/EditProfile.tsx index 161b47d..a97e450 100644 --- a/src/components/EditProfile.tsx +++ b/src/components/EditProfile.tsx @@ -3,26 +3,31 @@ import React, { useEffect, useState, useRef } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { AppDispatch, RootState } from '@/redux/store'; import { getUserProfile, updateUserProfile } from '@/redux/slices/profileSlice'; -import Header from '@/components/Header'; -import Footer from '@/components/Footer'; -import InputBox from '@/components/InputBox'; + import { toast } from 'react-toastify'; import { showToast } from '@/helpers/toast'; import { useForm, SubmitHandler, useWatch } from 'react-hook-form'; -import { zodResolver } from '@hookform/resolvers/zod'; + import updateSchema from '@/validations/userProfileSchema'; import { useRouter } from 'next/navigation'; import type { z } from 'zod'; +import { zodResolver } from '@hookform/resolvers/zod'; + +import InputBox from '@/components/InputBox'; +import UpdatePasswords from './updatepassword'; type FormSchemaType = z.infer; const UserProfileForm: React.FC = () => { const route = useRouter(); + const [showlModal, setShowmodal] = useState(false); const dispatch = useDispatch(); const { user, loading, error } = useSelector( (state: RootState) => state.userProfile, ); - + const handleshow = () => { + setShowmodal(!showlModal); + }; const { register, handleSubmit, @@ -113,7 +118,6 @@ const UserProfileForm: React.FC = () => { ); if (response.payload && response.payload.User) { currentProfile.User = response.payload.User; - console.log('currentProfile', currentProfile); localStorage.setItem('profile', JSON.stringify(currentProfile)); } @@ -267,6 +271,14 @@ const UserProfileForm: React.FC = () => { {watchedValues.phone || 'Contact Number'}
  • +
  • + +
  • @@ -350,10 +362,11 @@ const UserProfileForm: React.FC = () => {

    +
    ); }; diff --git a/src/components/Table.tsx b/src/components/Table.tsx index 995e0e7..37be6ba 100644 --- a/src/components/Table.tsx +++ b/src/components/Table.tsx @@ -133,7 +133,7 @@ const ProductsTable: React.FC = ({ Role }) => { {product.productDiscount} - + @@ -150,7 +150,7 @@ const ProductsTable: React.FC = ({ Role }) => { - + diff --git a/src/components/headerDash.tsx b/src/components/headerDash.tsx index f6d51db..98b42a9 100644 --- a/src/components/headerDash.tsx +++ b/src/components/headerDash.tsx @@ -46,7 +46,7 @@ const HeaderDash: React.FC = ({ pageName }) => {
    diff --git a/src/components/profile/ProfileHeader.tsx b/src/components/profile/ProfileHeader.tsx index 1a07226..5025bf9 100644 --- a/src/components/profile/ProfileHeader.tsx +++ b/src/components/profile/ProfileHeader.tsx @@ -70,7 +70,7 @@ function ProfileHeader() { const router = useRouter(); const handleEditProfile = () => { if (user?.User.Role.name !== 'buyer') { - router.push(`/dashboard/profile_/${user?.User?.id}`); + router.push(`/dashboard/profile/${user?.User?.id}`); } else { router.push('/profile-edit'); } @@ -100,12 +100,6 @@ function ProfileHeader() {
    - = ({ role }) => {
    {role === 'seller' && (
    - + void; + showlModal: boolean; +} + +const UpdatePasswords: React.FC = ({ handleshow, showlModal }) => { + let { submit, erro, loadings, success, handlemoduleButton } = + UpdatePassword(); + const { + register, + handleSubmit, + formState: { errors }, + reset, + } = useForm({ + resolver: zodResolver(Updatepassword), + }); + const onSubmit = (data: FormDataType) => { + const result = submit(data); + // if (result) { + // reset(); + // } + }; + + return ( +
    + {showlModal && ( + +
    +
    + + + +

    {erro}

    +
    +
    + +
    +
    + )} + {success && ( + + )} +
    + ); +}; + +export default UpdatePasswords;