diff --git a/src/Routers.jsx b/src/Routers.jsx index a19d707..32637e2 100644 --- a/src/Routers.jsx +++ b/src/Routers.jsx @@ -121,7 +121,8 @@ export default function Routers() { } /> } /> } /> - } /> + {/*} />*/} + } /> } /> } /> } /> diff --git a/src/components/AuthPages/VerifyPassword/index.jsx b/src/components/AuthPages/VerifyPassword/index.jsx index 72a209e..f628899 100644 --- a/src/components/AuthPages/VerifyPassword/index.jsx +++ b/src/components/AuthPages/VerifyPassword/index.jsx @@ -156,6 +156,11 @@ const VerifyPassword = () => { We'll send an email to confirm reset + +
+

+ Must include a special, numeric, uppercase and lowercase character +

", props); @@ -42,9 +44,7 @@ export default function Resources(props) { blog: , onsale: , owned: , - created: ( - - ), + created: , hidden: ( -
+ {/*
Add My Item -
+
*/}
diff --git a/src/components/Resources/tabs/CreatedTab.jsx b/src/components/Resources/tabs/CreatedTab.jsx index 0780290..4394e17 100644 --- a/src/components/Resources/tabs/CreatedTab.jsx +++ b/src/components/Resources/tabs/CreatedTab.jsx @@ -18,36 +18,36 @@ export default function CreatedTab({ {/* filer-dropdown */}
-
- - Recently Received - - - - - - -
+ {/*
*/} + {/* */} + {/* Recently Received*/} + {/* */} + {/* */} + {/* */} + {/* */} + {/* */} + {/* */} + {/*
*/}
-
- -
-
- -
+ {/*
*/} + {/* */} + {/*
*/} + {/*
*/} + {/* */} + {/*
*/}
diff --git a/src/components/Resources/tabs/MyUploadedFiles.jsx b/src/components/Resources/tabs/MyUploadedFiles.jsx new file mode 100644 index 0000000..53df8d9 --- /dev/null +++ b/src/components/Resources/tabs/MyUploadedFiles.jsx @@ -0,0 +1,278 @@ +import React, { useState } from "react"; +import dataImage1 from "../../../assets/images/data-table-user-1.png"; +import dataImage2 from "../../../assets/images/data-table-user-2.png"; +import { Link } from "react-router-dom"; +// import dataImage3 from "../../../assets/images/data-table-user-3.png"; +// import dataImage4 from "../../../assets/images/data-table-user-4.png"; +// import SelectBox from "../Helpers/SelectBox"; + +export default function MyUploadedFiles({ className }) { + const filterCategories = ["All Categories", "Explore", "Featured"]; + const [selectedCategory, setCategory] = useState(filterCategories[0]); + return ( + <> +
+ + Add My Item + +
+
+
+
+

+ My Uploads +

+ +
+
+
+ + + {/* table heading */} + {/**/} + {/* */} + {/* */} + {/* */} + + {/* */} + {/**/} + + + + + + + + + + + + + + + +
*/} + {/* All Product*/} + {/* .
+
+
+ data +
+
+

+ Mullican Computer Joy +

+ + Owned by Xoeyam + +
+
+
+
+ + + + + + + + + + + + + 7473 ETH + +
+
+
+ + + + + + + + + + 6392.99$ + +
+
+ +
+
+
+ data +
+
+

+ Mullican Computer Joy +

+ + Owned by Xoeyam + +
+
+
+
+ + + + + + + + + + + + + 7473 ETH + +
+
+
+ + + + + + + + + + 6392.99$ + +
+
+ +
+
+
+ + ); +} diff --git a/src/components/Resources/tabs/index.js b/src/components/Resources/tabs/index.js index 8f6ccf1..0a2baf5 100644 --- a/src/components/Resources/tabs/index.js +++ b/src/components/Resources/tabs/index.js @@ -6,6 +6,7 @@ import OnSaleTab from "./OnSaleTab"; import OwnTab from "./OwnTab"; import BlogTab from "./BlogTab"; import QuestionsTab from "./QuestionsTab"; +import MyUploadedFiles from "./MyUploadedFiles"; export { BlogTab, @@ -16,4 +17,5 @@ export { HiddenProductsTab, OnSaleTab, OwnTab, + MyUploadedFiles, }; \ No newline at end of file diff --git a/src/components/Settings/Tabs/PersonalInfoTab.jsx b/src/components/Settings/Tabs/PersonalInfoTab.jsx index 096f277..2b78e29 100644 --- a/src/components/Settings/Tabs/PersonalInfoTab.jsx +++ b/src/components/Settings/Tabs/PersonalInfoTab.jsx @@ -1,13 +1,11 @@ import React, { useEffect, useState } from "react"; import { useSelector } from "react-redux"; -import { Link, useNavigate } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import usersService from "../../../services/UsersService"; import Icons from "../../Helpers/Icons"; import InputCom from "../../Helpers/Inputs/InputCom"; import LoadingSpinner from "../../Spinners/LoadingSpinner"; -import { toast } from "react-toastify"; - import { Form, Formik } from "formik"; import * as Yup from "yup"; @@ -60,8 +58,6 @@ export default function PersonalInfoTab({ let navigate = useNavigate(); - let [togglePromotion, setTogglePromotion] = useState(false); - const initialValues = { firstname: userDetails?.firstname, lastname: userDetails?.lastname, @@ -69,6 +65,10 @@ export default function PersonalInfoTab({ city: userDetails?.city, email: userDetails?.email, profile: userDetails?.profile_pic, + pref_email: 0, + pref_phone: 0, + accept_promo: false, + online_name: "", }; let [profile, setProfile] = useState({ @@ -90,8 +90,14 @@ export default function PersonalInfoTab({ // there is no profile accommodation on the payload delete values?.profile; + const reqData = { + ...values, + pref_email: Number(values.pref_email?.toString()), + pref_phone: Number(values.pref_phone?.toString()), + }; + apiCall - .updateProfile(values) + .updateProfile(reqData) .then((res) => { // API CALL TO UPDATE USER DETAILS if (res.data.internal_return < 0) { @@ -102,10 +108,14 @@ export default function PersonalInfoTab({ }); return; } - // setRequestState({message: 'Profile update successfully', loading: false, status: true}) - toast.success("Update Successful"); + setRequestState({ + message: "Profile update successfully", + loading: false, + status: true, + }); + // toast.success("Update Successful"); setTimeout(() => { - // navigate("/", { replace: true }); + navigate("/", { replace: true }); window.location.reload(true); }, 1000); }) @@ -148,9 +158,9 @@ export default function PersonalInfoTab({ fieldClass="px-6" label="User Name" type="text" - name="username" - placeholder="" - value={userDetails.username} + name="online_name" + placeholder="Username" + value={userDetails?.username} disable={true} /> @@ -210,6 +220,25 @@ export default function PersonalInfoTab({ )} + {/* Online Name */} +
+ + {props.errors.online_name && + props.touched.online_name && ( +

+ {props.errors.online_name} +

+ )} +
{/* Country */}
@@ -267,13 +296,17 @@ export default function PersonalInfoTab({ Pref. Communication
-
+
Email @@ -283,8 +316,9 @@ export default function PersonalInfoTab({ Phone @@ -296,22 +330,32 @@ export default function PersonalInfoTab({ {/* Allow Promotions */}
-
{/* inputs ends here */} @@ -388,7 +432,6 @@ export default function PersonalInfoTab({ )}
- {/*
e.preventDefault()}> -
-

Put on marketplace

-

- Enter price to allow users instantly purchase your NFT -

+ {/*
*/} + {/*

Put on marketplace

*/} + {/*

*/} + {/* Enter price to allow users instantly purchase your NFT*/} + {/*

*/} + + {/*
*/} + {/* cpt("fixed")}*/} + {/* >*/} + {/* */} + {/*
*/} + {/* */} + {/* */} + {/*
*/} + {/*

*/} + {/* Fixed price*/} + {/*

*/} + {/*
*/} + {/*
*/} + {/* {datas.priceType === "fixed" && (*/} + {/*
*/} + {/* )}*/} + {/*
*/} + {/* cpt("bids")}*/} + {/* >*/} + {/* */} + {/*
*/} + {/* */} + {/* */} + {/*
*/} + {/*

*/} + {/* Open for bids*/} + {/*

*/} + {/*
*/} + {/*
*/} + {/* {datas.priceType === "bids" && (*/} + {/*
*/} + {/* )}*/} + {/*
*/} + {/* cpt("auction")}*/} + {/* >*/} + {/* */} + {/*
*/} + {/* */} + {/* */} + {/*
*/} + {/*

*/} + {/* Timed auction*/} + {/*

*/} + {/*
*/} + {/*
*/} + {/* {datas.priceType === "auction" && (*/} + {/*
*/} + {/* )}*/} + {/* */} + {/* */} + {/**/} + -
-
cpt("fixed")} - > -
-
-
- -
-

- Fixed price -

-
-
- {datas.priceType === "fixed" && ( -
- )} -
-
cpt("bids")} - > -
-
-
- -
-

- Open for bids -

-
-
- {datas.priceType === "bids" && ( -
- )} -
-
cpt("auction")} - > -
-
-
- -
-

- Timed auction -

-
-
- {datas.priceType === "auction" && ( -
- )} -
-
-

Item Name

@@ -161,19 +163,22 @@ export default function ProductUploadField({ />
-
-

Exter link

-
- -
-
+ + + {/*
*/} + {/*

Exter link

*/} + {/*
*/} + {/* */} + {/*
*/} + {/*
*/} +

Description

@@ -188,219 +193,222 @@ export default function ProductUploadField({
-
-

Instant sale price

-
-
- priceHndlr(e)} - placeholder="enter the price for which the item will be instantly sold" - className="input-field placeholder:text-base text-bese px-6 text-dark-gray dark:text-white w-10/12 h-full bg-[#FAFAFA] dark:bg-[#11131F] focus:ring-0 focus:outline-none" - type="number" - /> -
-
-
- - ETH - - - - - - -
-
-
-
-
-

- Service fee : 1.5% -

-

- You will Receive : - .29 ETH $120.56 -

-
-
-
-

Royalties

-
-
- -
-

- Suggested: 10%, 20%, 30% -

-
-
-
-

- Properties - - (Optional) - -

-
-
-
-
- -
-
- -
-
-
-
-
-
-

Choose collection

-
-
- {/* create collection */} -
-
- - - - - - - Crteate - -
-
- {/* saved collection list */} -
-
-
-
- -
-
- - Name 1 - -
-
-
-
-
-
- -
-
- - Name 2 - -
-
-
-
-
-
- -
-
- - Name 3 - -
-
-
-
-
+ {/*
*/} + {/*

Instant sale price

*/} + {/*
*/} + {/*
*/} + {/* priceHndlr(e)}*/} + {/* placeholder="enter the price for which the item will be instantly sold"*/} + {/* className="input-field placeholder:text-base text-bese px-6 text-dark-gray dark:text-white w-10/12 h-full bg-[#FAFAFA] dark:bg-[#11131F] focus:ring-0 focus:outline-none"*/} + {/* type="number"*/} + {/* />*/} + {/*
*/} + {/*
*/} + {/*
*/} + {/* */} + {/* ETH*/} + {/* */} + {/* */} + {/* */} + {/* */} + {/* */} + {/* */} + {/*
*/} + {/*
*/} + {/*
*/} + {/*
*/} + {/*
*/} + {/*

*/} + {/* Service fee : 1.5%*/} + {/*

*/} + {/*

*/} + {/* You will Receive :*/} + {/* .29 ETH $120.56*/} + {/*

*/} + {/*
*/} + {/*
*/} + + {/*
*/} + {/*

Royalties

*/} + {/*
*/} + {/*
*/} + {/* */} + {/*
*/} + {/*

*/} + {/* Suggested: 10%, 20%, 30%*/} + {/*

*/} + {/*
*/} + {/*
*/} + + {/*
*/} + {/*

*/} + {/* Properties*/} + {/* */} + {/* (Optional)*/} + {/* */} + {/*

*/} + {/*
*/} + {/*
*/} + {/*
*/} + {/*
*/} + {/* */} + {/*
*/} + {/*
*/} + {/* */} + {/*
*/} + {/*
*/} + {/*
*/} + {/*
*/} + {/*
*/} + + {/*
*/} + {/*

Choose collection

*/} + {/*
*/} + {/*
*/} + {/* /!* create collection *!/*/} + {/*
*/} + {/*
*/} + {/* */} + {/* */} + {/* */} + {/* */} + {/* */} + {/* */} + {/* Crteate*/} + {/* */} + {/*
*/} + {/*
*/} + {/* /!* saved collection list *!/*/} + {/*
*/} + {/*
*/} + {/*
*/} + {/*
*/} + {/* */} + {/*
*/} + {/*
*/} + {/* */} + {/* Name 1*/} + {/* */} + {/*
*/} + {/*
*/} + {/*
*/} + {/*
*/} + {/*
*/} + {/*
*/} + {/* */} + {/*
*/} + {/*
*/} + {/* */} + {/* Name 2*/} + {/* */} + {/*
*/} + {/*
*/} + {/*
*/} + {/*
*/} + {/*
*/} + {/*
*/} + {/* */} + {/*
*/} + {/*
*/} + {/* */} + {/* Name 3*/} + {/* */} + {/*
*/} + {/*
*/} + {/*
*/} + {/*
*/} + {/*
*/} {/* unlock purchase */} -
-
-
- - - - -
-
-

- Unlock once purchased -

-

- Unlockable content, only revealed by the owner of the item. -

-
-
-
- -
-
+ {/*
*/} + {/*
*/} + {/*
*/} + {/* */} + {/* */} + {/* */} + {/* */} + {/*
*/} + {/*
*/} + {/*

*/} + {/* Unlock once purchased*/} + {/*

*/} + {/*

*/} + {/* Unlockable content, only revealed by the owner of the item.*/} + {/*

*/} + {/*
*/} + {/*
*/} + {/*
*/} + {/* */} + {/*
*/} + {/*
*/} diff --git a/src/components/UploadProduct/index.jsx b/src/components/UploadProduct/index.jsx index 0d51e4e..3d9c3d0 100644 --- a/src/components/UploadProduct/index.jsx +++ b/src/components/UploadProduct/index.jsx @@ -5,8 +5,11 @@ import ModalCom from "../Helpers/ModalCom"; import Layout from "../Partials/Layout"; // import DropFileWidget from "./DropFileWidget"; import ProductUploadField from "./ProductUploadField"; +import LoadingSpinner from "../Spinners/LoadingSpinner"; +import usersService from "../../services/UsersService"; export default function UploadProduct() { + const apiCall = new usersService() // preview modal const [previewProductModal, setPreviewProductModal] = useState(false); // cancelUploadModal @@ -68,10 +71,14 @@ export default function UploadProduct() { }; const fileSelect = useRef(null); const fileRef = useRef(null); - const [selectedFile, setSelectedFile] = useState(""); + const [selectedFile, setSelectedFile] = useState(''); + // const [selectedFile, setSelectedFile] = useState({name: '', size: ''}); const [img, setImg] = useState(null); + const [imgDetails, setImgDetails] = useState('') const changeFile = (e, file) => { if (e) { + setSelectedFile(e.target.files[0].name); + setImgDetails(e?.target?.files[0]) const imgRead = new FileReader(); imgRead.onload = (event) => { setImg(event.target.result); @@ -81,7 +88,8 @@ export default function UploadProduct() { } if (file) { if (file[0].name) { - setSelectedFile(file[0].name); + setSelectedFile(file?.[0].name); + setImgDetails(file?.[0]) const imgRead = new FileReader(); imgRead.onload = (event) => { setImg(event.target.result); @@ -92,6 +100,77 @@ export default function UploadProduct() { } }; + const [requestStatus, setRequestStatus] = useState({loading: false, status: null, message: ''}) + //FUNCTION TO UPLOAD ITEM + const uploadItem = () => { + let errorArr = [] + let uploadInfo = { // SUBMITTED DETAILS FROM USER + img, + itemName, + description + } + //LOOPS THROUGH ITEM DETAILS FOR EMPTINESS + for(let info in uploadInfo){ + if(!uploadInfo[info]){ + errorArr.push(info) + } + } + + // TEST TO SEE IF FIELDS ARE EMPTY + if(errorArr.length){ + let message = '' + // for(let i = 0; i 1 && errorArr.includes('img')){ + message='Please select file to upload & Item name/description cannot be empty' + }else { + message='Item name/description cannot be empty' + } + setRequestStatus({loading: false, status: null, message}) + return setTimeout(()=>{ + setRequestStatus({loading: false, status: false, message: ''}) + },5000) + } + + if(imgDetails.size > 2097152){ // CHECKS IF IMAGE SIZE IS MORE THAN "MB" + setRequestStatus({loading: false, status: null, message: 'Image must be less than 2MB'}) + return setTimeout(()=>{ + setRequestStatus({loading: false, status: false, message: ''}) + },5000) + } + + let reqData = { // PAYLOAD FOR API CALL + file_name: selectedFile, + file_size: imgDetails.size, + file_type: imgDetails.type, + file_data: img, + item_name: itemName, + item_description: description, + msg_type: 'FILE', + // action: 'WRENCHBOARD_RESOURCE_MYFILES', + action: 11307 + } + console.log('TESTING', reqData) + setRequestStatus({loading: true, status: null, message: ''}) + + //API CALL TO UPLOAD COMES HERE + setTimeout(()=>{ + setRequestStatus({loading: false, status: true, message: 'Bad'}) + },3000) + setTimeout(()=>{ + setRequestStatus({loading: false, status: false, message: ''}) + },7000) + } + // drop event function handleDrop(e) { const dt = e.dataTransfer; @@ -167,7 +246,7 @@ export default function UploadProduct() { {/* heading */}

- Create new item + {requestStatus.status == null ? 'Create new item' : 'Upload new item'}

{/** @@ -178,11 +257,11 @@ export default function UploadProduct() { {/* section-heading */}

- Image,Video,Audio or 3D Model + Image,Video,Audio or Documents

- File types suppported: JPG, PNG, GIP, SVG, MP4, MP3, WEBM, - OGG, GLB, GLTF. Max Size : 100 MB + File types supported: JPG, PNG, GIP, SVG, MP4, MP3, WEBM, + OGG, GLB, GLTF

@@ -289,7 +368,8 @@ export default function UploadProduct() {
{/* bottom action */} -
+
+

{requestStatus.message && requestStatus.message}

+ {/* previewUploadProduct(data)}*/} + {/* type="button"*/} + {/* className="sm:w-[126px] h-[46px] w-[100px] flex justify-center items-center border-gradient sm:text-18 text-sm rounded-full text-back"*/} + {/*>*/} + {/* Preview*/} + {/**/} + {requestStatus.loading ? + + : - - Create Now - + Upload + + }