diff --git a/index.html b/index.html
index 2628b5b..d41d835 100644
--- a/index.html
+++ b/index.html
@@ -16,7 +16,7 @@ const craftedMsg = "Crafted with ❤️ by WDI Team for a better web.";
const craftedStyles = 'font-size: 16px; font-family: monospace; background: #000; color: #E5195E; padding: 12px 19px; border: 1.8px dashed; border-right: 0px #000 solid';
const websiteStyles = 'font-size: 16px; font-family: monospace; background: #E5195E; color: #000; padding: 12px 19px; border: 1.8px dashed #000; border-left: 0px #000 solid';
- console.log('%c' + craftedMsg + ' %c' + websiteMsg, craftedStyles, websiteStyles);
+ console.log('%c' + craftedMsg + ' %c' + websiteMsg, craftedStyles, websiteStyles);
diff --git a/src/Components/Banner/AddBanner.jsx b/src/Components/Banner/AddBanner.jsx
index e152450..68499cf 100644
--- a/src/Components/Banner/AddBanner.jsx
+++ b/src/Components/Banner/AddBanner.jsx
@@ -65,8 +65,8 @@ const AddBanner = ({ createApi, navigateLink, title, center }) => {
createApi(formData)
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
+ // // console.log("Mutation response:", response?.data?.statusCode);
+ // // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 200) {
setIsLoading(false);
@@ -94,13 +94,13 @@ const AddBanner = ({ createApi, navigateLink, title, center }) => {
})
.catch((error) => {
// Handle errors
- console.error("Error creating community:", error);
+ // // console.error("Error creating community:", error);
setIsLoading(false);
// Handle error notification if needed
});
} catch (error) {
// Handle errors
- console.error("Error creating community:", error);
+ // // console.error("Error creating community:", error);
setIsLoading(false);
}
};
diff --git a/src/Components/Banner/BannerEdit.jsx b/src/Components/Banner/BannerEdit.jsx
index 2a03ea8..de9a1fd 100644
--- a/src/Components/Banner/BannerEdit.jsx
+++ b/src/Components/Banner/BannerEdit.jsx
@@ -110,13 +110,13 @@ const BannerEdit = ({isLoading, data, updateBanner, navigateTo, refetch, center}
}
// Log the FormData entries
// for (const [key, value] of form.entries()) {
- // console.log(`${key}: ${value}`);
+ // // console.log(`${key}: ${value}`);
// }
const mutationResult = await updateBanner({ id: id, data: form })
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
+ // // console.log("Mutation response:", response?.data?.statusCode);
+ // // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 200) {
setIsLoadingEdit(false);
@@ -131,7 +131,7 @@ const BannerEdit = ({isLoading, data, updateBanner, navigateTo, refetch, center}
}
})
.catch((error) => {
- console.error("Error creating community:", error);
+ // // console.error("Error creating community:", error);
setIsLoadingEdit(false);
// setDeleteIsLoading(false);
// setDeleteAlert(false);
diff --git a/src/Components/Banner/BannerTable.jsx b/src/Components/Banner/BannerTable.jsx
index dfaa308..dacbfcb 100644
--- a/src/Components/Banner/BannerTable.jsx
+++ b/src/Components/Banner/BannerTable.jsx
@@ -86,13 +86,13 @@ const BannerCommunity = ({
}
})
.catch((error) => {
- console.error("Error creating community:", error);
+ // // console.error("Error creating community:", error);
setDeleteIsLoading(false);
setDeleteAlert(false);
});
} catch (error) {
// Handle errors
- console.error("Error deleting community:", error);
+ // // console.error("Error deleting community:", error);
}
};
@@ -115,11 +115,11 @@ const BannerCommunity = ({
}
})
.catch((error) => {
- console.log(error);
+ // // console.log(error);
});
} catch (error) {
// Handle errors
- console.error("Error updating community status:", error);
+ // // console.error("Error updating community status:", error);
}
}
};
diff --git a/src/Components/ChipSelector/ChipSelector.jsx b/src/Components/ChipSelector/ChipSelector.jsx
index 8a1bc8f..d969d75 100644
--- a/src/Components/ChipSelector/ChipSelector.jsx
+++ b/src/Components/ChipSelector/ChipSelector.jsx
@@ -1,8 +1,8 @@
import React, { useState } from "react";
-import { Box, Input, Tag, TagCloseButton, TagLabel } from "@chakra-ui/react";
+import { Box, FormHelperText, Input, Tag, TagCloseButton, TagLabel } from "@chakra-ui/react";
import { TiWarning } from "react-icons/ti";
-const ChipSelector = ({chips, setChips}) => {
+const ChipSelector = ({chips, setChips, type}) => {
const [text, setText] = useState("");
const [validationError, setValidationError] = useState("");
@@ -28,10 +28,11 @@ const ChipSelector = ({chips, setChips}) => {
{
onKeyDown={handlePressEnter}
/>
{validationError && {validationError}}
+
+
+ {type ? "Please select and press enter to add date." : "Please type and press enter to add tags."}
+
+
{
const { data, error, isLoading } = useGetNewsLetterEmailQuery();
- console.log(data);
const handleDownload = () => {
if (Array.isArray(data?.data?.rows)) {
@@ -17,10 +16,10 @@ const Header = ({ link, btnTitle, title }) => {
XLSX.utils.book_append_sheet(workbook, worksheet, "Sheet1");
XLSX.writeFile(workbook, "newsletter_emails.xlsx");
} else {
- console.error(
- "Expected data to be an array but received:",
- data?.data?.rows
- );
+ // // console.error(
+ // "Expected data to be an array but received:",
+ // data?.data?.rows
+ // );
}
};
return (
diff --git a/src/Pages/BlogsAndArticles/AddBlogsAndArticles.jsx b/src/Pages/BlogsAndArticles/AddBlogsAndArticles.jsx
index 7ac0c00..4a6cdff 100644
--- a/src/Pages/BlogsAndArticles/AddBlogsAndArticles.jsx
+++ b/src/Pages/BlogsAndArticles/AddBlogsAndArticles.jsx
@@ -96,8 +96,8 @@ const AddBlogsAndArticles = () => {
createBlog(formData)
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
+ // // console.log("Mutation response:", response?.data?.statusCode);
+ // // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 201) {
setIsLoading(false);
@@ -123,13 +123,13 @@ const AddBlogsAndArticles = () => {
})
.catch((error) => {
// Handle errors
- console.error("Error creating community:", error);
+ // // console.error("Error creating community:", error);
setIsLoading(false);
// Handle error notification if needed
});
} catch (error) {
// Handle errors
- console.error("Error creating community:", error);
+ // // console.error("Error creating community:", error);
}
};
@@ -148,7 +148,6 @@ const AddBlogsAndArticles = () => {
const handleImageChangeLarge = (e) => {
const file = e.target.files[0];
setLargeImageData(file);
- console.log(largeImageData);
if (file) {
const reader = new FileReader();
reader.onloadend = () => {
@@ -360,7 +359,7 @@ const AddBlogsAndArticles = () => {
@@ -434,7 +433,7 @@ const AddBlogsAndArticles = () => {
onChange={setValue}
/>
- Please share proper linked in link here.
+ Please enter your content here. You can format your text using the toolbar above.
@@ -443,6 +442,7 @@ const AddBlogsAndArticles = () => {
Tags
+
@@ -454,10 +454,10 @@ const AddBlogsAndArticles = () => {
placeholder="Category"
className="web-text-medium"
size="sm"
- maxLength={90}
+ maxLength={50}
/>
- Maximum characters must be 100 characters.
+ Maximum characters must be 50 characters.
{errors.category && (
diff --git a/src/Pages/BlogsAndArticles/BlogsAndArticles.jsx b/src/Pages/BlogsAndArticles/BlogsAndArticles.jsx
index ed2109b..510fac2 100644
--- a/src/Pages/BlogsAndArticles/BlogsAndArticles.jsx
+++ b/src/Pages/BlogsAndArticles/BlogsAndArticles.jsx
@@ -77,8 +77,8 @@ const BlogsAndArticles = () => {
await deleteBlog(communityId)
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
+ // // console.log("Mutation response:", response?.data?.statusCode);
+ // // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 201) {
setDeleteIsLoading(false);
@@ -86,13 +86,13 @@ const BlogsAndArticles = () => {
}
})
.catch((error) => {
- console.error("Error creating community:", error);
+ // // console.error("Error creating community:", error);
setDeleteIsLoading(false);
setDeleteAlert(false);
});
} catch (error) {
// Handle errors
- console.error("Error deleting community:", error);
+ // // console.error("Error deleting community:", error);
}
};
@@ -101,7 +101,6 @@ const BlogsAndArticles = () => {
// Trigger the mutation
await updateBlogStatus({ id })
.then((response) => {
- console.log(response?.data);
if (response?.data?.statusCode === 201) {
toast({
render: () => (
@@ -114,11 +113,11 @@ const BlogsAndArticles = () => {
}
})
.catch((error) => {
- console.log(error);
+ // // console.log(error);
});
} catch (error) {
// Handle errors
- console.error("Error updating community status:", error);
+ // // console.error("Error updating community status:", error);
}
};
@@ -288,7 +287,7 @@ const BlogsAndArticles = () => {
onClose={() => setDeleteAlert(false)}
isOpen={deleteAlert}
alertHandler={() => handleDelete(actionId)}
- message={"Are you sure you want to delete video?"}
+ message={"Are you sure you want to delete blogs?"}
isLoading={deleteIsLoading}
/>
>
diff --git a/src/Pages/BlogsAndArticles/EditBlogsAndArticles.jsx b/src/Pages/BlogsAndArticles/EditBlogsAndArticles.jsx
index 899ca5f..939e9dc 100644
--- a/src/Pages/BlogsAndArticles/EditBlogsAndArticles.jsx
+++ b/src/Pages/BlogsAndArticles/EditBlogsAndArticles.jsx
@@ -21,7 +21,7 @@ import {
import { useForm } from "react-hook-form";
import { yupResolver } from "@hookform/resolvers/yup";
import FullscreenLoaders from "../../Components/Loaders/FullscreenLoaders";
-import { addBlogSchema } from "../../Validations/Validations";
+import { addBlogSchema, editBlogSchema } from "../../Validations/Validations";
import fallbackImage from "../../assets/fallBackImage.png";
import fallbackImageLarge from "../../assets/ultp-fallback-img.webp";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
@@ -48,7 +48,6 @@ const EditBlogsAndArticles = () => {
const [smallImageData, setSmallImageData] = useState(null);
const [chips, setChips] = useState();
- console.log(error);
const [valueQuill, setValueQuill] = useState(blog?.content);
@@ -59,7 +58,7 @@ const EditBlogsAndArticles = () => {
formState: { errors },
setValue,
} = useForm({
- resolver: yupResolver(addBlogSchema),
+ resolver: yupResolver(editBlogSchema),
defaultValues: {
author_name: "",
author_designation: "",
@@ -126,11 +125,8 @@ const EditBlogsAndArticles = () => {
updateBlog({ id: id, data: formData })
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response?.error?.status);
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
- console.log(response?.error?.status?.error?.message);
-
+ // // console.log("Mutation response:", response?.data?.statusCode);
+ // // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 201) {
setIsLoading01(false);
toast({
@@ -165,13 +161,13 @@ const EditBlogsAndArticles = () => {
})
.catch((error) => {
// Handle errors
- console.error("Error creating community:", error);
+ // // console.error("Error creating community:", error);
setIsLoading01(false);
// Handle error notification if needed
});
} catch (error) {
// Handle errors
- console.error("Error creating community:", error);
+ // // console.error("Error creating community:", error);
}
};
@@ -190,7 +186,7 @@ const EditBlogsAndArticles = () => {
const handleImageChangeLarge = (e) => {
const file = e.target.files[0];
setLargeImageData(file);
- console.log(largeImageData);
+ // console.log(largeImageData);
if (file) {
const reader = new FileReader();
reader.onloadend = () => {
@@ -242,100 +238,7 @@ const EditBlogsAndArticles = () => {
boxSize="sm"
className="d-flex w-100 p-2 justify-content-center flex-column align-items-center gap-3"
>
- {false ? (
-
- {/*
- Display profile
- */}
- {/* */}
-
-
-
-
-
-
-
- Drop images here
-
-
- or click to upload
-
-
-
-
-
-
-
-
- {errors.content_image_large && (
-
- {" "}
- {errors.content_image_large.message}
-
- )}
-
- Maximum limit of image is 10MB.
-
-
- ) : (
- <>
+
{
)}
- >
- )}
-
+
-
+
);
diff --git a/src/Pages/Events/AddEvents.jsx b/src/Pages/Events/AddEvents.jsx
index f342f4d..3f84475 100644
--- a/src/Pages/Events/AddEvents.jsx
+++ b/src/Pages/Events/AddEvents.jsx
@@ -1,6 +1,7 @@
import { OPACITY_ON_LOAD } from "../../Layout/animations";
import Header from "../../Components/Header";
import {
+ AspectRatio,
Box,
Button,
Divider,
@@ -24,6 +25,7 @@ import Loader01 from "../../Components/Loaders/Loader01";
import { useNavigate } from "react-router-dom";
import { motion } from "framer-motion";
import { useCreateEventsMutation } from "../../Services/api.service";
+import ToastBox from "../../Components/ToastBox";
const AddEvents = () => {
const toast = useToast();
@@ -33,15 +35,32 @@ const AddEvents = () => {
const [largeImageData, setLargeImageData] = useState(null);
const [isLoading, setIsLoading] = useState(false);
+ const [eventDatesInput, setEventsDatesInputs] = useState([]);
+
+
+ // Function to handle adding new date inputs
+ const addDateInput = () => {
+ setEventsDatesInputs([...eventDatesInput, ""]);
+ };
+
+ // Function to handle the change in date inputs
+ const handleDateChange = (index, event) => {
+ const newDates = [...eventDatesInput];
+ newDates[index] = event.target.value;
+ setEventsDatesInputs(newDates);
+ };
+
const {
register,
handleSubmit,
reset,
+ watch,
formState: { errors },
} = useForm({
resolver: yupResolver(addEvents),
});
+
const handleImageChange = (e) => {
const file = e.target.files[0];
setLargeImageData(file);
@@ -55,7 +74,6 @@ const AddEvents = () => {
};
const onSubmit = (data) => {
- console.log(data);
setIsLoading(true);
const formData = new FormData();
formData.append("title", data.title);
@@ -64,21 +82,34 @@ const AddEvents = () => {
formData.append("organizer_name", data.organizer_name);
formData.append("organizer_mobile_number", data.organizer_mobile_number);
formData.append("organizer_email", data.organizer_email);
- formData.append("dates[0]", "2024-05-08T08:19:27.264Z");
+
+ if (eventDatesInput.length === 0 || eventDatesInput[0]==="") {
+ setIsLoading(false);
+ return toast({
+ render: () => (
+
+ ),
+ });
+ } else {
+ eventDatesInput.forEach((date, index) => {
+ formData.append(`dates[${index}]`, date);
+ });
+ }
+
if (data.banner_image[0]) {
formData.append("banner_image", data.banner_image[0]);
}
// for (const [key, value] of formData.entries()) {
- // console.log(`${key}: ${value}`);
+ // // console.log(`${key}: ${value}`);
// }
// Trigger the mutationconst
const res = createEvents(formData)
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
+ // // console.log("Mutation response:", response?.data?.statusCode);
+ // // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 201) {
setIsLoading(false);
@@ -100,12 +131,11 @@ const AddEvents = () => {
})
.catch((error) => {
// Handle errors
- console.error("Error creating community:", error?.message);
+ // // console.error("Error creating community:", error?.message);
setIsLoading(false);
// Handle error notification if needed
});
- console.log(res);
};
return (
@@ -113,285 +143,435 @@ const AddEvents = () => {
{...OPACITY_ON_LOAD}
w={"100%"}
h={"100vh"}
+
className="overflow-auto "
display={"flex"}
flexDirection={"column"}
>
+
+ {/*
+
+
+
+ */}
+
-
-
- Banner info
-
-
- Select the platform for which you need to create this campaign.
-
+
+
+
+ Event Dates
+
+
+
+ {events?.eventDates?.map(({ date }, index) => (
+
+ {formatDate(date)}
+
+ ))}
+
+
+
diff --git a/src/Pages/Faq/AddFaq.jsx b/src/Pages/Faq/AddFaq.jsx
index 7a61cf6..8e2d021 100644
--- a/src/Pages/Faq/AddFaq.jsx
+++ b/src/Pages/Faq/AddFaq.jsx
@@ -41,6 +41,7 @@ const AddFaq = () => {
const {
register,
handleSubmit,
+ watch,
reset,
setValue: setYupFormValue,
formState: { errors },
@@ -52,7 +53,7 @@ const AddFaq = () => {
},
});
- console.log(errors);
+ // console.log(errors);
// const handleImageChange = (e) => {
// const file = e.target.files[0];
// setImageData(file);
@@ -118,13 +119,13 @@ const AddFaq = () => {
})
.catch((error) => {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading(false);
// Handle error notification if needed
});
} catch (error) {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading(false);
}
};
@@ -192,7 +193,19 @@ const AddFaq = () => {
placeholder="Question"
className="web-text-medium"
size="sm"
- />
+ minLength={4}
+ errorBorderColor="crimson"
+ isInvalid={watch()?.question?.length > 50}
+ // maxLength={51}
+ />
+ 50 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If question crosses 50 characters it will cause problem in
+ alignment on website.you have entered {watch()?.question?.length}{" "}
+ characters
+
{errors.question && (
{" "}
diff --git a/src/Pages/Faq/EditFaq.jsx b/src/Pages/Faq/EditFaq.jsx
index d864cfb..d530952 100644
--- a/src/Pages/Faq/EditFaq.jsx
+++ b/src/Pages/Faq/EditFaq.jsx
@@ -5,6 +5,7 @@ import {
Button,
Divider,
FormControl,
+ FormHelperText,
FormLabel,
Input,
useToast,
@@ -32,11 +33,12 @@ const EditFaq = () => {
const [updateFaq] = useUpdateFaqMutation();
const [valueQuill, setValueQuill] = useState(data?.data?.answer);
- console.log(data);
+ // console.log(data);
const {
register,
handleSubmit,
+ watch,
reset,
formState: { errors },
setValue,
@@ -93,7 +95,7 @@ const EditFaq = () => {
}
})
.catch((error) => {
- console.error("Error updating FAQ:", error);
+ // console.error("Error updating FAQ:", error);
setIsLoadingEdit(false);
});
};
@@ -125,7 +127,19 @@ const EditFaq = () => {
placeholder="Question"
className="web-text-medium"
size="sm"
- />
+ minLength={4}
+ errorBorderColor="crimson"
+ isInvalid={watch()?.question?.length > 50}
+ // maxLength={51}
+ />
+ 50 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If question crosses 50 characters it will cause problem in
+ alignment on website.you have entered {watch()?.question?.length}{" "}
+ characters
+
{errors.question && (
{" "}
diff --git a/src/Pages/Faq/Faq.jsx b/src/Pages/Faq/Faq.jsx
index 5d323cc..8566740 100644
--- a/src/Pages/Faq/Faq.jsx
+++ b/src/Pages/Faq/Faq.jsx
@@ -47,7 +47,7 @@ const Faq = () => {
const { data } = useGetFaqQuery();
const faq = data?.data?.rows;
- console.log(faq);
+ // console.log(faq);
const [deleteFaq] = useDeleteFaqMutation();
const [updateFaqStatus] = useUpdateFaqStatusMutation();
@@ -160,8 +160,8 @@ const Faq = () => {
const response = await deleteFaq(communityId);
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
+ // console.log("Mutation response:", response?.data?.statusCode);
+ // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 200) {
toast({
@@ -180,7 +180,7 @@ const Faq = () => {
});
}
} catch (error) {
- console.error("Error deleting community:", error);
+ // console.error("Error deleting community:", error);
toast({
render: () => (
{
try {
await updateFaqStatus({ id })
.then((response) => {
- console.log(response?.data);
+ // console.log(response?.data);
if (response?.data?.statusCode === 201) {
toast({
render: () => (
@@ -215,11 +215,11 @@ const Faq = () => {
}
})
.catch((error) => {
- console.log(error);
+ // console.log(error);
});
} catch (error) {
// Handle errors
- console.error("Error updating community status:", error);
+ // console.error("Error updating community status:", error);
}
};
diff --git a/src/Pages/Faq/ViewFaq.jsx b/src/Pages/Faq/ViewFaq.jsx
index 47cb32c..22a3de5 100644
--- a/src/Pages/Faq/ViewFaq.jsx
+++ b/src/Pages/Faq/ViewFaq.jsx
@@ -19,8 +19,8 @@ const ViewFaq = () => {
const { data, error, isLoading } = useGetFaqByIdQuery(id);
const viewFaq = data?.data;
- // console.log(viewPolicy?.banner_image);
- // console.log(`https://rubix.betadelivery.com/${viewPolicy?.banner_image}`);
+ // // console.log(viewPolicy?.banner_image);
+ // // console.log(`https://rubix.betadelivery.com/${viewPolicy?.banner_image}`);
if (isLoading) {
return ;
diff --git a/src/Pages/NewLetter/NewsLetter.jsx b/src/Pages/NewLetter/NewsLetter.jsx
index 4ea24d0..c1cb817 100644
--- a/src/Pages/NewLetter/NewsLetter.jsx
+++ b/src/Pages/NewLetter/NewsLetter.jsx
@@ -51,9 +51,9 @@ const NewsLetter = () => {
const [deleteIsLoading, setDeleteIsLoading] = useState(false);
const { data } = useGetNewsLetterQuery();
- // console.log(useGetNewsletterQuery);
+ // // console.log(useGetNewsletterQuery);
const email = data?.data?.rows;
- console.log(email);
+ // console.log(email);
const [deleteEmail] = useDeleteEmailMutation();
// const [updateFaqStatus] = useUpdateFaqStatusMutation();
@@ -76,8 +76,8 @@ const NewsLetter = () => {
const response = await deleteEmail(communityId);
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
+ // console.log("Mutation response:", response?.data?.statusCode);
+ // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 200) {
toast({
@@ -96,7 +96,7 @@ const NewsLetter = () => {
});
}
} catch (error) {
- console.error("Error deleting community:", error);
+ // console.error("Error deleting community:", error);
toast({
render: () => (
{
const extractedArray = email?.map((item, index) => {
return {
Title: (
-
{
-
),
"Created At": (
{
const toast = useToast();
@@ -43,21 +44,22 @@ const AddNews = () => {
const [createNews] = useCreateNewsMutation(); // Invoke the hook to get the mutation function
const [isLoading, setIsLoading] = useState(false);
const [selectedImage, setSelectedImage] = useState(fallbackImage);
- const [ imageData, setImageData ] = useState(null)
-
-
-
+ const [imageData, setImageData] = useState(null);
+ const today = new Date().toISOString().split("T")[0];
const {
register,
handleSubmit,
reset,
+ watch,
formState: { errors },
} = useForm({
resolver: yupResolver(addNews),
});
+ const formData = watch()
+
const onSubmit = async (data) => {
const date = new Date(data?.release_date).toUTCString();
try {
@@ -74,14 +76,17 @@ const AddNews = () => {
createNews(formData)
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
+ // // console.log("Mutation response:", response?.data?.statusCode);
+ // // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 200) {
setIsLoading(false);
toast({
render: () => (
-
+
),
});
reset();
@@ -90,20 +95,23 @@ const AddNews = () => {
setIsLoading(false);
toast({
render: () => (
-
+
),
});
}
})
.catch((error) => {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading(false);
// Handle error notification if needed
});
} catch (error) {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading(false);
}
};
@@ -199,7 +207,18 @@ const AddNews = () => {
placeholder="Title"
className="web-text-medium"
size="sm"
+ errorBorderColor="crimson"
+ isInvalid={formData?.title?.length > 50}
+ // maxLength={51}
/>
+ 50 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If description crosses 50 characters it will cause problem in
+ alignment on website.you have entered {formData?.title?.length}{" "}
+ characters
+
{errors.title && (
{errors.title.message}
@@ -209,14 +228,25 @@ const AddNews = () => {
- Description
+ Meta description
- 160}
+ // maxLength={51}
/>
+ 160 ? "red" : "green.500"}
+ className="web-text-small"
+ >
+ If description crosses 160 characters it will cause problem in
+ alignment on website.you have entered {formData?.meta_description?.length}{" "}
+ characters
+
{errors.meta_description && (
{" "}
@@ -234,10 +264,17 @@ const AddNews = () => {
placeholder="Content"
className="web-text-medium"
size="sm"
- maxLength={90}
+ errorBorderColor="crimson"
+ isInvalid={formData?.content?.length > 230}
+ // maxLength={51}
/>
-
- Maximum characters must be 100 characters.
+ 230 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If content crosses 230 characters it will cause problem in
+ alignment on website.you have entered {formData?.content?.length}{" "}
+ characters
{errors.content && (
@@ -257,9 +294,10 @@ const AddNews = () => {
placeholder="Button link"
className="web-text-medium"
size="sm"
+ min={today} // Disable past dates
/>
- Please share proper linked in link here.
+ Please share proper release date here.
{errors.release_date && (
@@ -372,15 +410,13 @@ const AddNews = () => {
}}
type="submit"
size="sm"
- rounded={'sm'}
+ rounded={"sm"}
>
Create
-
-
);
};
diff --git a/src/Pages/News/EditNews.jsx b/src/Pages/News/EditNews.jsx
index 865e542..b5b30b3 100644
--- a/src/Pages/News/EditNews.jsx
+++ b/src/Pages/News/EditNews.jsx
@@ -36,7 +36,7 @@ const EditNews = () => {
const { id } = useParams();
const toast = useToast();
const navigate = useNavigate();
- const { data, error, isLoading } = useGetNewsByIdQuery(id);
+ const { data, error, isLoading, refetch } = useGetNewsByIdQuery(id);
const [isLoadingEdit, setIsLoadingEdit] = useState(false);
const [selectedImage, setSelectedImage] = useState(fallbackImage);
const [largeImageData, setLargeImageData] = useState(null);
@@ -47,6 +47,7 @@ const EditNews = () => {
handleSubmit,
reset,
formState: { errors },
+ watch,
setValue,
} = useForm({
resolver: yupResolver(editNews),
@@ -59,6 +60,10 @@ const EditNews = () => {
},
});
+
+ const formData = watch()
+
+
useEffect(() => {
if (data?.data) {
setSelectedImage(
@@ -72,7 +77,7 @@ const EditNews = () => {
}
}, [data, setValue]);
- console.log(errors);
+ // console.log(errors);
const onSubmit = async (data) => {
setIsLoadingEdit(true);
@@ -95,12 +100,13 @@ const EditNews = () => {
),
});
+ refetch();
navigate("/news");
// setDeleteAlert(false);
}
})
.catch((error) => {
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoadingEdit(false);
// setDeleteIsLoading(false);
// setDeleteAlert(false);
@@ -231,7 +237,18 @@ const EditNews = () => {
name="title"
type="text"
id="title"
+ errorBorderColor="crimson"
+ isInvalid={formData?.title?.length > 50}
+ // maxLength={51}
/>
+ 50 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If title crosses 50 characters it will cause problem in
+ alignment on website.you have entered {formData?.title?.length}{" "}
+ characters
+
{errors.title && (
{errors.title.message}
@@ -241,9 +258,9 @@ const EditNews = () => {
- Description
+ Meta description
- {
name="meta_description"
type="text"
id="meta_description"
+ errorBorderColor="crimson"
+ isInvalid={formData?.meta_description?.length > 160}
+ // maxLength={51}
/>
+ 160 ? "red" : "green.500"}
+ className="web-text-small"
+ >
+ If meta_description crosses 160 characters it will cause problem in
+ alignment on website.you have entered {formData?.meta_description?.length}{" "}
+ characters
+
{errors.meta_description && (
{" "}
@@ -269,10 +297,17 @@ const EditNews = () => {
placeholder="Content"
className="web-text-medium"
size="sm"
- maxLength={90}
+ errorBorderColor="crimson"
+ isInvalid={formData?.content?.length > 230}
+ // maxLength={51}
/>
-
- Maximum characters must be 100 characters.
+ 230 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If content crosses 230 characters it will cause problem in
+ alignment on website.you have entered {formData?.content?.length}{" "}
+ characters
{errors.content && (
diff --git a/src/Pages/News/News.jsx b/src/Pages/News/News.jsx
index ff21244..e20e3b4 100644
--- a/src/Pages/News/News.jsx
+++ b/src/Pages/News/News.jsx
@@ -58,8 +58,8 @@ const News = () => {
await deleteNews(id)
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
+ // // console.log("Mutation response:", response?.data?.statusCode);
+ // // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 200) {
setDeleteIsLoading(false);
@@ -67,13 +67,13 @@ const News = () => {
}
})
.catch((error) => {
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setDeleteIsLoading(false);
setDeleteAlert(false);
});
} catch (error) {
// Handle errors
- console.error("Error deleting community:", error);
+ // console.error("Error deleting community:", error);
}
};
@@ -82,7 +82,7 @@ const News = () => {
// Trigger the mutation
await updateNewsStatus({ id })
.then((response) => {
- console.log(response?.data);
+ // console.log(response?.data);
if (response?.data?.statusCode === 201) {
toast({
render: () => (
@@ -95,11 +95,11 @@ const News = () => {
}
})
.catch((error) => {
- console.log(error);
+ // console.log(error);
});
} catch (error) {
// Handle errors
- console.error("Error updating community status:", error);
+ // console.error("Error updating community status:", error);
}
};
// ====================================================[Table Filter]================================================================
@@ -255,7 +255,7 @@ const News = () => {
onClose={() => setDeleteAlert(false)}
isOpen={deleteAlert}
alertHandler={() => handleDelete(actionId)}
- message={"Are you sure you want to delete video?"}
+ message={"Are you sure you want to delete news?"}
isLoading={deleteIsLoading}
/>
>
diff --git a/src/Pages/News/ViewNews.jsx b/src/Pages/News/ViewNews.jsx
index 6cb67d2..298b972 100644
--- a/src/Pages/News/ViewNews.jsx
+++ b/src/Pages/News/ViewNews.jsx
@@ -30,11 +30,7 @@ const ViewNews = () => {
display={"flex"}
flexDirection={"column"}
>
-
+
@@ -61,7 +57,7 @@ const ViewNews = () => {
{
- news description
+ Meta description
{news?.meta_description}
diff --git a/src/Pages/Partners/AddPartners.jsx b/src/Pages/Partners/AddPartners.jsx
index dd44da6..6a21941 100644
--- a/src/Pages/Partners/AddPartners.jsx
+++ b/src/Pages/Partners/AddPartners.jsx
@@ -9,6 +9,7 @@ import {
Image,
Input,
Stack,
+ Textarea,
useToast,
} from "@chakra-ui/react";
import React, { useState } from "react";
@@ -49,6 +50,7 @@ const AddPartner = () => {
const {
register,
handleSubmit,
+ watch,
reset,
// setValue: setYupFormValue,
formState: { errors },
@@ -61,12 +63,12 @@ const AddPartner = () => {
},
});
- console.log(errors);
+ // console.log(errors);
const handleImageChange = (e) => {
const file = e.target.files[0];
setImageData(file);
// setYupFormValue("banner_image", file);
- console.log(file);
+ // console.log(file);
if (file) {
const reader = new FileReader();
reader.onloadend = () => {
@@ -83,12 +85,12 @@ const AddPartner = () => {
const formData = new FormData();
formData.append("website_link", data?.website_link);
formData.append("description", data?.description);
- console.log(selectedImage);
+ // console.log(selectedImage);
if (data?.banner_image) {
formData.append("banner_image", data?.banner_image[0]);
}
for (let [key, value] of formData.entries()) {
- console.log(key, value);
+ // console.log(key, value);
}
// Trigger the mutation
createPartner(formData)
@@ -131,13 +133,13 @@ const AddPartner = () => {
})
.catch((error) => {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading(false);
// Handle error notification if needed
});
} catch (error) {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading(false);
}
};
@@ -200,12 +202,24 @@ const AddPartner = () => {
Description
-
+ minLength={4}
+ errorBorderColor="crimson"
+ isInvalid={watch()?.description?.length > 50}
+ // maxLength={51}
+ />
+ 50 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If description crosses 50 characters it will cause problem in
+ alignment on website.you have entered {watch()?.description?.length}{" "}
+ characters
+
{errors.description && (
{" "}
diff --git a/src/Pages/Partners/EditPartners.jsx b/src/Pages/Partners/EditPartners.jsx
index 1952613..a898796 100644
--- a/src/Pages/Partners/EditPartners.jsx
+++ b/src/Pages/Partners/EditPartners.jsx
@@ -12,6 +12,7 @@ import {
Input,
Stack,
Text,
+ Textarea,
useToast,
} from "@chakra-ui/react";
import { OPACITY_ON_LOAD } from "../../Layout/animations";
@@ -49,6 +50,7 @@ const EditPartner = () => {
const {
register,
handleSubmit,
+ watch,
reset,
formState: { errors },
setValue,
@@ -62,7 +64,7 @@ const EditPartner = () => {
});
const partnerCard = data?.data;
- // console.log(termContent);
+ // // console.log(termContent);
useEffect(() => {
if (data?.data) {
@@ -89,7 +91,7 @@ const EditPartner = () => {
};
const onSubmit = async (data) => {
- console.log(data);
+ // console.log(data);
setIsLoadingEdit(true);
const form = new FormData();
@@ -101,12 +103,12 @@ const EditPartner = () => {
// Log formData entries
for (let [key, value] of form.entries()) {
- console.log(`${key}: ${value}`);
+ // console.log(`${key}: ${value}`);
}
await updatePartners({ id: id, data: form })
.then((response) => {
- // console.log(response?.error?.data?.error?.message);
+ // // console.log(response?.error?.data?.error?.message);
if (response?.data?.statusCode === 200) {
setIsLoadingEdit(false);
toast({
@@ -128,14 +130,14 @@ const EditPartner = () => {
}
})
.catch((error) => {
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoadingEdit(false);
// setDeleteIsLoading(false);
// setDeleteAlert(false);
});
};
- console.log(errors);
+ // console.log(errors);
if (isLoading) {
return ;
}
@@ -201,12 +203,24 @@ const EditPartner = () => {
Description
-
+ minLength={4}
+ errorBorderColor="crimson"
+ isInvalid={watch()?.description?.length > 230}
+ // maxLength={51}
+ />
+ 230 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If description crosses 230 characters it will cause problem in
+ alignment on website.you have entered {watch()?.description?.length}{" "}
+ characters
+
{errors.description && (
{" "}
diff --git a/src/Pages/Partners/Partner.jsx b/src/Pages/Partners/Partner.jsx
index 4e03afd..ee63638 100644
--- a/src/Pages/Partners/Partner.jsx
+++ b/src/Pages/Partners/Partner.jsx
@@ -53,10 +53,10 @@ const Partner = () => {
const [deletePartners] = useDeletePartnersMutation();
const [updatePartnerStatus] = useUpdatePartnersStatusMutation();
- console.log(partners?.data?.data?.rows);
+ // console.log(partners?.data?.data?.rows);
const filteredData = partners?.data?.data?.rows?.filter((item) => {
- // console.log(item.description);
+ // // console.log(item.description);
// Filter by name (case insensitive)
const name = item.description;
const searchLower = searchTerm.toLowerCase();
@@ -164,8 +164,8 @@ const Partner = () => {
// await deletePartners(communityId)
// .then((response) => {
// // Handle the response here
- // console.log("Mutation response:", response?.data?.statusCode);
- // console.log("Mutation response:", response?.data?.message);
+ // // console.log("Mutation response:", response?.data?.statusCode);
+ // // console.log("Mutation response:", response?.data?.message);
// if (response?.data?.statusCode === 201) {
// setDeleteIsLoading(false);
@@ -181,13 +181,13 @@ const Partner = () => {
// }
// })
// .catch((error) => {
- // console.error("Error creating community:", error);
+ // // console.error("Error creating community:", error);
// setDeleteIsLoading(false);
// setDeleteAlert(false);
// });
// } catch (error) {
// // Handle errors
- // console.log("Error deleting community:", error);
+ // // console.log("Error deleting community:", error);
// }
// };
@@ -209,8 +209,8 @@ const Partner = () => {
const response = await deletePartners(communityId);
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
+ // console.log("Mutation response:", response?.data?.statusCode);
+ // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 200) {
toast({
@@ -229,7 +229,7 @@ const Partner = () => {
});
}
} catch (error) {
- console.error("Error deleting community:", error);
+ // console.error("Error deleting community:", error);
toast({
render: () => (
{
try {
await updatePartnerStatus({ id })
.then((response) => {
- console.log(response?.data);
+ // console.log(response?.data);
if (response?.data?.statusCode === 201) {
toast({
render: () => (
@@ -264,11 +264,11 @@ const Partner = () => {
}
})
.catch((error) => {
- console.log(error);
+ // console.log(error);
});
} catch (error) {
// Handle errors
- console.error("Error updating community status:", error);
+ // console.error("Error updating community status:", error);
}
};
diff --git a/src/Pages/Partners/ViewPartner.jsx b/src/Pages/Partners/ViewPartner.jsx
index ea166a2..8b1fc30 100644
--- a/src/Pages/Partners/ViewPartner.jsx
+++ b/src/Pages/Partners/ViewPartner.jsx
@@ -19,8 +19,8 @@ const ViewPartner = () => {
const { data, error, isLoading } = useGetPartnersByIdQuery(id);
const viewPolicy = data?.data;
- console.log(viewPolicy);
- console.log(`https://rubix.betadelivery.com/${viewPolicy?.company_logo}`);
+ // console.log(viewPolicy);
+ // console.log(`https://rubix.betadelivery.com/${viewPolicy?.company_logo}`);
if (isLoading) {
return ;
diff --git a/src/Pages/Policy/AddPolicy.jsx b/src/Pages/Policy/AddPolicy.jsx
index 9327fd9..03791d4 100644
--- a/src/Pages/Policy/AddPolicy.jsx
+++ b/src/Pages/Policy/AddPolicy.jsx
@@ -45,6 +45,7 @@ const AddPolicy = () => {
const {
register,
handleSubmit,
+ watch,
reset,
setValue: setYupFormValue,
formState: { errors },
@@ -57,7 +58,7 @@ const AddPolicy = () => {
},
});
- console.log(errors);
+ // console.log(errors);
const handleImageChange = (e) => {
const file = e.target.files[0];
setImageData(file);
@@ -82,7 +83,7 @@ const AddPolicy = () => {
formData.append("banner_image", data?.image[0]);
}
// for (let [key, value] of formData.entries()) {
- // console.log(key, value);
+ // // console.log(key, value);
// }
// Trigger the mutation
createPolicy(formData)
@@ -125,13 +126,13 @@ const AddPolicy = () => {
})
.catch((error) => {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading(false);
// Handle error notification if needed
});
} catch (error) {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading(false);
}
};
@@ -199,7 +200,18 @@ const AddPolicy = () => {
placeholder="Title"
className="web-text-medium"
size="sm"
+ minLength={4}
+ errorBorderColor="crimson"
+ isInvalid={watch()?.title?.length > 50}
+ // maxLength={51}
/>
+ 50 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If title crosses 50 characters it will cause problem in alignment
+ on website.you have entered {watch()?.title?.length} characters
+
{errors.title && (
{errors.title.message}
diff --git a/src/Pages/Policy/EditPolicy.jsx b/src/Pages/Policy/EditPolicy.jsx
index ebd6a58..4d3d000 100644
--- a/src/Pages/Policy/EditPolicy.jsx
+++ b/src/Pages/Policy/EditPolicy.jsx
@@ -44,7 +44,7 @@ const EditPolicy = () => {
const [updatePolicy] = useUpdatePolicyMutation();
const [valueQuill, setValueQuill] = useState(data?.data?.content);
- console.log(valueQuill);
+ // console.log(valueQuill);
const {
register,
@@ -62,7 +62,7 @@ const EditPolicy = () => {
});
const policyContent = data?.data;
- // console.log(termContent);
+ // // console.log(termContent);
useEffect(() => {
if (data?.data) {
@@ -89,7 +89,7 @@ const EditPolicy = () => {
};
const onSubmit = async (data) => {
- console.log(data);
+ // console.log(data);
setIsLoadingEdit(true);
const form = new FormData();
@@ -101,12 +101,12 @@ const EditPolicy = () => {
// Log formData entries
for (let [key, value] of form.entries()) {
- console.log(`${key}: ${value}`);
+ // console.log(`${key}: ${value}`);
}
await updatePolicy({ id: id, data: form })
.then((response) => {
- // console.log(response?.error?.data?.error?.message);
+ // // console.log(response?.error?.data?.error?.message);
if (response?.data?.statusCode === 200) {
setIsLoadingEdit(false);
toast({
@@ -128,14 +128,14 @@ const EditPolicy = () => {
}
})
.catch((error) => {
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoadingEdit(false);
// setDeleteIsLoading(false);
// setDeleteAlert(false);
});
};
- console.log(errors);
+ // console.log(errors);
if (isLoading) {
return ;
}
diff --git a/src/Pages/Policy/Policy.jsx b/src/Pages/Policy/Policy.jsx
index f7e6a87..4f76e0d 100644
--- a/src/Pages/Policy/Policy.jsx
+++ b/src/Pages/Policy/Policy.jsx
@@ -161,8 +161,8 @@ const Policy = () => {
await deletePolicy(communityId)
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
+ // // console.log("Mutation response:", response?.data?.statusCode);
+ // // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 201) {
setDeleteIsLoading(false);
@@ -178,13 +178,13 @@ const Policy = () => {
}
})
.catch((error) => {
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setDeleteIsLoading(false);
setDeleteAlert(false);
});
} catch (error) {
// Handle errors
- console.log("Error deleting community:", error);
+ // console.log("Error deleting community:", error);
}
};
@@ -192,7 +192,7 @@ const Policy = () => {
try {
await updatePolicyStatus({ id })
.then((response) => {
- console.log(response?.data);
+ // console.log(response?.data);
if (response?.data?.statusCode === 201) {
toast({
render: () => (
@@ -207,11 +207,11 @@ const Policy = () => {
}
})
.catch((error) => {
- console.log(error);
+ // console.log(error);
});
} catch (error) {
// Handle errors
- console.error("Error updating community status:", error);
+ // console.error("Error updating community status:", error);
}
};
diff --git a/src/Pages/Policy/ViewPolicy.jsx b/src/Pages/Policy/ViewPolicy.jsx
index 6d0c5f4..e73f98e 100644
--- a/src/Pages/Policy/ViewPolicy.jsx
+++ b/src/Pages/Policy/ViewPolicy.jsx
@@ -16,8 +16,8 @@ const ViewPolicy = () => {
const { data, error, isLoading } = useGetPolicyByIdQuery(id);
const viewPolicy = data?.data;
- console.log(viewPolicy?.banner_image);
- console.log(`https://rubix.betadelivery.com/${viewPolicy?.banner_image}`);
+ // console.log(viewPolicy?.banner_image);
+ // console.log(`https://rubix.betadelivery.com/${viewPolicy?.banner_image}`);
if (isLoading) {
return ;
diff --git a/src/Pages/Terms/AddTerms.jsx b/src/Pages/Terms/AddTerms.jsx
index 423095c..ac2e630 100644
--- a/src/Pages/Terms/AddTerms.jsx
+++ b/src/Pages/Terms/AddTerms.jsx
@@ -45,6 +45,7 @@ const AddTerms = () => {
const {
register,
handleSubmit,
+ watch,
reset,
setValue: setYupFormValue,
formState: { errors },
@@ -57,7 +58,7 @@ const AddTerms = () => {
},
});
- console.log(errors);
+ // console.log(errors);
const handleImageChange = (e) => {
const file = e.target.files[0];
setImageData(file);
@@ -82,7 +83,7 @@ const AddTerms = () => {
formData.append("banner_image", data?.image[0]);
}
for (let [key, value] of formData.entries()) {
- console.log(key, value);
+ // console.log(key, value);
}
// Trigger the mutation
createTerms(formData)
@@ -125,13 +126,13 @@ const AddTerms = () => {
})
.catch((error) => {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading(false);
// Handle error notification if needed
});
} catch (error) {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading(false);
}
};
@@ -199,7 +200,18 @@ const AddTerms = () => {
placeholder="Title"
className="web-text-medium"
size="sm"
- />
+ errorBorderColor="crimson"
+ isInvalid={watch()?.title?.length > 50}
+ // maxLength={51}
+ />
+ 50 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If title crosses 50 characters it will cause problem in
+ alignment on website.you have entered {watch()?.title?.length}{" "}
+ characters
+
{errors.title && (
{errors.title.message}
diff --git a/src/Pages/Terms/EditTerms.jsx b/src/Pages/Terms/EditTerms.jsx
index bee336e..0449cb5 100644
--- a/src/Pages/Terms/EditTerms.jsx
+++ b/src/Pages/Terms/EditTerms.jsx
@@ -49,6 +49,7 @@ const EditTerms = () => {
const {
register,
handleSubmit,
+ watch,
reset,
formState: { errors },
setValue,
@@ -61,10 +62,10 @@ const EditTerms = () => {
},
});
- console.log("----------", data?.data?.banner_image);
+ // console.log("----------", data?.data?.banner_image);
const termContent = data?.data;
- // console.log(termContent);
+ // // console.log(termContent);
const [valueQuill, setValueQuill] = useState(termContent?.content);
useEffect(() => {
@@ -92,7 +93,7 @@ const EditTerms = () => {
};
const onSubmit = async (data) => {
- console.log(data);
+ // console.log(data);
setIsLoadingEdit(true);
const form = new FormData();
form.append("title", data?.title);
@@ -103,12 +104,12 @@ const EditTerms = () => {
// Log formData entries
for (let [key, value] of form.entries()) {
- console.log(`${key}: ${value}`);
+ // console.log(`${key}: ${value}`);
}
await updateTerms({ id: id, data: form })
.then((response) => {
- // console.log(response?.error?.data?.error?.message);
+ // // console.log(response?.error?.data?.error?.message);
if (response?.data?.statusCode === 200) {
setIsLoadingEdit(false);
toast({
@@ -130,14 +131,14 @@ const EditTerms = () => {
}
})
.catch((error) => {
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoadingEdit(false);
// setDeleteIsLoading(false);
// setDeleteAlert(false);
});
};
- console.log(errors);
+ // console.log(errors);
if (isLoading) {
return ;
}
@@ -208,7 +209,18 @@ const EditTerms = () => {
placeholder="Title"
className="web-text-medium"
size="sm"
- />
+ errorBorderColor="crimson"
+ isInvalid={watch()?.title?.length > 50}
+ // maxLength={51}
+ />
+ 50 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If title crosses 50 characters it will cause problem in
+ alignment on website.you have entered {watch()?.title?.length}{" "}
+ characters
+
{errors.title && (
{errors.title.message}
diff --git a/src/Pages/Terms/Terms.jsx b/src/Pages/Terms/Terms.jsx
index e9f8f99..d2bc58f 100644
--- a/src/Pages/Terms/Terms.jsx
+++ b/src/Pages/Terms/Terms.jsx
@@ -163,8 +163,8 @@ const Terms = () => {
await deletePolicy(communityId)
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
+ // // console.log("Mutation response:", response?.data?.statusCode);
+ // // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 201) {
setDeleteIsLoading(false);
@@ -180,13 +180,13 @@ const Terms = () => {
}
})
.catch((error) => {
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setDeleteIsLoading(false);
setDeleteAlert(false);
});
} catch (error) {
// Handle errors
- console.log("Error deleting community:", error);
+ // console.log("Error deleting community:", error);
}
};
@@ -194,7 +194,7 @@ const Terms = () => {
try {
await updateTermsStatus({ id })
.then((response) => {
- console.log(response?.data);
+ // console.log(response?.data);
if (response?.data?.statusCode === 201) {
toast({
render: () => (
@@ -209,11 +209,11 @@ const Terms = () => {
}
})
.catch((error) => {
- console.log(error);
+ // console.log(error);
});
} catch (error) {
// Handle errors
- console.error("Error updating community status:", error);
+ // console.error("Error updating community status:", error);
}
};
@@ -241,7 +241,7 @@ const Terms = () => {
onClose={() => setDeleteAlert(false)}
isOpen={deleteAlert}
alertHandler={() => handleDelete(actionId)}
- message={"Are you sure you want to delete Terms?"}
+ message={"Are you sure you want to delete Terms and condition?"}
isLoading={deleteIsLoading}
/>
>
diff --git a/src/Pages/Terms/ViewTerms.jsx b/src/Pages/Terms/ViewTerms.jsx
index d94c6d8..d1d7568 100644
--- a/src/Pages/Terms/ViewTerms.jsx
+++ b/src/Pages/Terms/ViewTerms.jsx
@@ -16,8 +16,8 @@ const ViewTerms = () => {
const { data, error, isLoading } = useGetTermsByIdQuery(id);
const viewTerms = data?.data;
- console.log(viewTerms?.banner_image);
- console.log(`https://rubix.betadelivery.com/${viewTerms?.banner_image}`);
+ // console.log(viewTerms?.banner_image);
+ // console.log(`https://rubix.betadelivery.com/${viewTerms?.banner_image}`);
if (isLoading) {
return ;
diff --git a/src/Pages/Usecase/AddUseCase.jsx b/src/Pages/Usecase/AddUseCase.jsx
index 16d8ef5..7908a0c 100644
--- a/src/Pages/Usecase/AddUseCase.jsx
+++ b/src/Pages/Usecase/AddUseCase.jsx
@@ -63,6 +63,7 @@ const AddUseCase = () => {
const {
register,
handleSubmit,
+ watch,
reset,
setValue: setUseCaseValue,
formState: { errors },
@@ -71,13 +72,13 @@ const AddUseCase = () => {
});
- console.log(errors);
+ // console.log(errors);
const onSubmit = async (data) => {
setIsLoading(true);
setUseCaseValue("content", value);
- console.log(data);
- console.log(data);
+ // console.log(data);
+ // console.log(data);
const formData = new FormData();
@@ -94,7 +95,7 @@ const AddUseCase = () => {
formData.append("icon", data.icon[0]);
}
- console.log(data.attachment);
+ // console.log(data.attachment);
@@ -109,7 +110,7 @@ const AddUseCase = () => {
// Log formData entries
// for (let [key, value] of formData.entries()) {
- // console.log(`${key}: ${value}`);
+ // // console.log(`${key}: ${value}`);
// }
try {
@@ -117,8 +118,8 @@ const AddUseCase = () => {
createUsecase(formData)
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response);
- console.log("Mutation response:", response?.data?.message);
+ // console.log("Mutation response:", response);
+ // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 200) {
setIsLoading(false);
@@ -134,7 +135,7 @@ const AddUseCase = () => {
setIsLoading(false)
navigate("/usecase");
} else if(response?.error?.status === 500){
- console.log(response?.error?.data?.error?.message);
+ // console.log(response?.error?.data?.error?.message);
setIsLoading(false);
toast({
render: () => (
@@ -149,13 +150,13 @@ const AddUseCase = () => {
})
.catch((error) => {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading(false);
// Handle error notification if needed
});
} catch (error) {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading(false);
}
};
@@ -287,8 +288,19 @@ const AddUseCase = () => {
placeholder="Title"
className="web-text-medium"
size="sm"
- maxLength={24}
- />
+ minLength={4}
+ errorBorderColor="crimson"
+ isInvalid={watch()?.title?.length > 50}
+ // maxLength={51}
+ />
+ 50 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If name crosses 50 characters it will cause problem in
+ alignment on website.you have entered {watch()?.title?.length}{" "}
+ characters
+
{errors.title && (
{errors.title.message}
@@ -545,7 +557,7 @@ const AddUseCase = () => {
className="web-text-medium form-control rounded-1"
size="sm"
multiple={true}
- // onChange={(e)=> console.log(e.target.value)}
+ // onChange={(e)=> // console.log(e.target.value)}
/>
You can select multiple documents using
diff --git a/src/Pages/Usecase/EditUseCase.jsx b/src/Pages/Usecase/EditUseCase.jsx
index d1d0291..0132241 100644
--- a/src/Pages/Usecase/EditUseCase.jsx
+++ b/src/Pages/Usecase/EditUseCase.jsx
@@ -59,6 +59,7 @@ const EditUseCase = () => {
const {
register,
handleSubmit,
+ watch,
reset,
formState: { errors },
setValue,
@@ -112,9 +113,9 @@ const EditUseCase = () => {
updateBlog({ id: id, data: formData })
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
- console.log(response);
+ // // console.log("Mutation response:", response?.data?.statusCode);
+ // // console.log("Mutation response:", response?.data?.message);
+ // console.log(response);
if (response?.data?.statusCode === 200) {
setIsLoading01(false);
@@ -142,13 +143,13 @@ const EditUseCase = () => {
})
.catch((error) => {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading01(false);
// Handle error notification if needed
});
} catch (error) {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
}
};
@@ -167,7 +168,7 @@ const EditUseCase = () => {
const handleImageChangeLarge = (e) => {
const file = e.target.files[0];
setLargeImageData(file);
- console.log(largeImageData);
+ // console.log(largeImageData);
if (file) {
const reader = new FileReader();
reader.onloadend = () => {
@@ -290,8 +291,19 @@ const EditUseCase = () => {
placeholder="Title"
className="web-text-medium"
size="sm"
- maxLength={24}
- />
+ minLength={4}
+ errorBorderColor="crimson"
+ isInvalid={watch()?.title?.length > 50}
+ // maxLength={51}
+ />
+ 50 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If title crosses 50 characters it will cause problem in
+ alignment on website.you have entered {watch()?.title?.length}{" "}
+ characters
+
{errors.title && (
{errors.title.message}
@@ -319,9 +331,9 @@ const EditUseCase = () => {
? "red"
: metaDescription.length > 100
? "crimson"
- : ""
+ : "gray.500"
}
- fontWeight={metaDescription.length > 160 ? "bold" : ""}
+
className="web-text-small"
>
If description crosses 160 characters it will cause problem in SEO
@@ -546,7 +558,6 @@ const EditUseCase = () => {
className="web-text-medium form-control rounded-1"
size="sm"
multiple={true}
- onChange={() => console.log(e.target.value)}
/>
You can select multiple documents using{" "}
diff --git a/src/Pages/Usecase/Usecase.jsx b/src/Pages/Usecase/Usecase.jsx
index f7f2b6e..5770a67 100644
--- a/src/Pages/Usecase/Usecase.jsx
+++ b/src/Pages/Usecase/Usecase.jsx
@@ -65,8 +65,8 @@ const Usecase = () => {
await deleteUsecase(id)
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
+ // // console.log("Mutation response:", response?.data?.statusCode);
+ // // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 201) {
setDeleteIsLoading(false);
@@ -74,13 +74,13 @@ const Usecase = () => {
}
})
.catch((error) => {
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setDeleteIsLoading(false);
setDeleteAlert(false);
});
} catch (error) {
// Handle errors
- console.error("Error deleting community:", error);
+ // console.error("Error deleting community:", error);
}
};
@@ -101,11 +101,11 @@ const Usecase = () => {
}
})
.catch((error) => {
- console.log(error);
+ // console.log(error);
});
} catch (error) {
// Handle errors
- console.error("Error updating community status:", error);
+ // console.error("Error updating community status:", error);
}
};
// ====================================================[Table Filter]================================================================
@@ -259,7 +259,7 @@ const Usecase = () => {
onClose={() => setDeleteAlert(false)}
isOpen={deleteAlert}
alertHandler={() => handleDelete(actionId)}
- message={"Are you sure you want to delete video?"}
+ message={"Are you sure you want to delete usecase?"}
isLoading={deleteIsLoading}
/>
>
diff --git a/src/Pages/Videos/AddVideos.jsx b/src/Pages/Videos/AddVideos.jsx
index 8870391..12d0e92 100644
--- a/src/Pages/Videos/AddVideos.jsx
+++ b/src/Pages/Videos/AddVideos.jsx
@@ -25,10 +25,13 @@ const AddVideos = () => {
register,
handleSubmit,
reset,
+ watch,
formState: { errors },
} = useForm({
resolver: yupResolver(addVideos),
});
+
+ const formData = watch();
const handleImageChange = (e) => {
@@ -59,7 +62,7 @@ const AddVideos = () => {
}
for (const [key, value] of formData.entries()) {
- console.log(`${key}: ${value}`);
+ // console.log(`${key}: ${value}`);
}
// Trigger the mutation
createVideos(formData)
@@ -84,16 +87,16 @@ const AddVideos = () => {
})
.catch((error) => {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading(false);
// Handle error notification if needed
});
} catch (error) {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading(false);
}
- console.log(data);
+ // console.log(data);
};
@@ -176,7 +179,18 @@ const AddVideos = () => {
placeholder="Title"
className="web-text-medium"
size="sm"
+ errorBorderColor="crimson"
+ isInvalid={formData?.title?.length > 50}
+ // maxLength={51}
/>
+ 50 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If title crosses 50 characters it will cause problem in
+ alignment on website.you have entered {formData?.title?.length}{" "}
+ characters
+
{errors.title && (
{errors.title.message}
@@ -195,7 +209,18 @@ const AddVideos = () => {
placeholder="Description"
className="web-text-medium"
size="sm"
+ errorBorderColor="crimson"
+ isInvalid={formData?.description?.length > 230}
+ // maxLength={51}
/>
+ 230 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If description crosses 230 characters it will cause problem in
+ alignment on website.you have entered {formData?.description?.length}{" "}
+ characters
+
{errors.description && (
{errors.description.message}
@@ -215,6 +240,9 @@ const AddVideos = () => {
size="sm"
type="text"
/>
+
+ Please enter duration Hrs:Min:Sec format.
+
{errors.duration && (
{errors.duration.message}
@@ -235,7 +263,7 @@ const AddVideos = () => {
maxLength={90}
/>
- Please enter duration Hrs:Min:Sec format.
+ Please enter the embedded youtube Url.
{errors.embeddedCode && (
diff --git a/src/Pages/Videos/EditVideos.jsx b/src/Pages/Videos/EditVideos.jsx
index 8278851..81080a3 100644
--- a/src/Pages/Videos/EditVideos.jsx
+++ b/src/Pages/Videos/EditVideos.jsx
@@ -59,6 +59,8 @@ const EditVideos = () => {
},
});
+ const formData = watch()
+
useEffect(() => {
if (data?.data?.data) {
setSelectedImage(
@@ -97,8 +99,8 @@ const EditVideos = () => {
await updateVideos({ id: id, data: form })
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
+ // // console.log("Mutation response:", response?.data?.statusCode);
+ // // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 201) {
setIsLoadingEdit(false);
@@ -113,7 +115,7 @@ const EditVideos = () => {
}
})
.catch((error) => {
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoadingEdit(false);
// setDeleteIsLoading(false);
// setDeleteAlert(false);
@@ -232,7 +234,18 @@ const EditVideos = () => {
name="title"
type="text"
id="title"
+ errorBorderColor="crimson"
+ isInvalid={formData?.title?.length > 50}
+ // maxLength={51}
/>
+ 50 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If title crosses 50 characters it will cause problem in
+ alignment on website.you have entered {formData?.title?.length}{" "}
+ characters
+
{errors.title && (
{errors.title.message}
@@ -244,7 +257,7 @@ const EditVideos = () => {
Description
- {
name="description"
type="text"
id="description"
+ errorBorderColor="crimson"
+ isInvalid={formData?.description?.length > 230}
+ // maxLength={51}
/>
+ 230 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If description crosses 230 characters it will cause problem in
+ alignment on website.you have entered {formData?.description?.length}{" "}
+ characters
+
{errors.description && (
{" "}
diff --git a/src/Pages/Videos/Videos.jsx b/src/Pages/Videos/Videos.jsx
index 1bfe1cb..aaaeb1c 100644
--- a/src/Pages/Videos/Videos.jsx
+++ b/src/Pages/Videos/Videos.jsx
@@ -101,7 +101,7 @@ const Videos = () => {
),
Duration: (
- {item?.duration} min
+ {item?.duration} sec
),
Active: (
@@ -155,8 +155,8 @@ const Videos = () => {
await deleteVideos(communityId)
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
+ // // console.log("Mutation response:", response?.data?.statusCode);
+ // // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 201) {
setDeleteIsLoading(false);
@@ -172,13 +172,13 @@ const Videos = () => {
}
})
.catch((error) => {
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setDeleteIsLoading(false);
setDeleteAlert(false);
});
} catch (error) {
// Handle errors
- console.log("Error deleting community:", error);
+ // console.log("Error deleting community:", error);
}
};
@@ -203,11 +203,11 @@ const Videos = () => {
}
})
.catch((error) => {
- console.log(error);
+ // console.log(error);
});
} catch (error) {
// Handle errors
- console.error("Error updating community status:", error);
+ // console.error("Error updating community status:", error);
}
};
diff --git a/src/Pages/Videos/ViewVideos.jsx b/src/Pages/Videos/ViewVideos.jsx
index 95fc65a..2ad2b7a 100644
--- a/src/Pages/Videos/ViewVideos.jsx
+++ b/src/Pages/Videos/ViewVideos.jsx
@@ -12,7 +12,7 @@ const ViewVideos = () => {
const navigate = useNavigate();
const { data, error, isLoading } = useGetVideosByIdQuery(id);
const videos = data?.data?.data;
- console.log(videos);
+ // console.log(videos);
if (isLoading) {
return ;
diff --git a/src/Pages/Whitepapers/AddWhitepapers.jsx b/src/Pages/Whitepapers/AddWhitepapers.jsx
index 64d774c..e029feb 100644
--- a/src/Pages/Whitepapers/AddWhitepapers.jsx
+++ b/src/Pages/Whitepapers/AddWhitepapers.jsx
@@ -1,38 +1,48 @@
-import { Box, Button, Divider, FormControl, FormHelperText, FormLabel, Heading, Image, Input, Stack, useToast } from '@chakra-ui/react'
-import React, { useState } from 'react'
-import { OPACITY_ON_LOAD } from '../../Layout/animations'
-import Header from '../../Components/Header'
-import { useNavigate } from 'react-router-dom'
+import {
+ Box,
+ Button,
+ Divider,
+ FormControl,
+ FormHelperText,
+ FormLabel,
+ Heading,
+ Image,
+ Input,
+ Stack,
+ useToast,
+} from "@chakra-ui/react";
+import React, { useState } from "react";
+import { OPACITY_ON_LOAD } from "../../Layout/animations";
+import Header from "../../Components/Header";
+import { useNavigate } from "react-router-dom";
import fallbackImage from "../../assets/ultp-fallback-img.webp";
-import { addWhitePapers } from '../../Validations/Validations'
-import { TiWarning } from 'react-icons/ti'
+import { addWhitePapers } from "../../Validations/Validations";
+import { TiWarning } from "react-icons/ti";
import { yupResolver } from "@hookform/resolvers/yup";
import { useForm } from "react-hook-form";
-import { motion } from 'framer-motion'
-import Loader01 from '../../Components/Loaders/Loader01'
-import { useCreateWhitepaperMutation } from '../../Services/api.service'
-import ToastBox from '../../Components/ToastBox'
+import { motion } from "framer-motion";
+import Loader01 from "../../Components/Loaders/Loader01";
+import { useCreateWhitepaperMutation } from "../../Services/api.service";
+import ToastBox from "../../Components/ToastBox";
const AddWhitepapers = () => {
- const toast = useToast();
- const navigate = useNavigate();
- const [isLoading, setIsLoading] = useState(false);
- const [selectedImage, setSelectedImage] = useState(fallbackImage);
- const [ imageData, setImageData ] = useState(null)
-
+ const toast = useToast();
+ const navigate = useNavigate();
+ const [isLoading, setIsLoading] = useState(false);
+ const [selectedImage, setSelectedImage] = useState(fallbackImage);
+ const [imageData, setImageData] = useState(null);
+
const [createWhitepaper] = useCreateWhitepaperMutation();
- const {
- register,
- handleSubmit,
- reset,
- formState: { errors },
- } = useForm({
- resolver: yupResolver(addWhitePapers),
- });
-
-
-
+ const {
+ register,
+ handleSubmit,
+ reset,
+ watch,
+ formState: { errors },
+ } = useForm({
+ resolver: yupResolver(addWhitePapers),
+ });
const handleImageChange = (e) => {
const file = e.target.files[0];
@@ -66,7 +76,10 @@ const AddWhitepapers = () => {
setIsLoading(false);
toast({
render: () => (
-
+
),
});
reset();
@@ -75,25 +88,27 @@ const AddWhitepapers = () => {
setIsLoading(false);
toast({
render: () => (
-
+
),
});
}
})
.catch((error) => {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading(false);
// Handle error notification if needed
});
} catch (error) {
// Handle errors
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoading(false);
}
};
-
return (
{
display={"flex"}
flexDirection={"column"}
>
-
@@ -121,7 +135,8 @@ const AddWhitepapers = () => {
Whitepaper Banner image
- Below is the whitepaper Banner image that will be whitepaper on the community page.
+ Below is the whitepaper Banner image that will be whitepaper on the
+ community page.
{
onSubmit={handleSubmit(onSubmit)}
className="col-7 pt-4 mb-3 overflow-auto p-4"
>
-
-
Title
@@ -176,7 +189,17 @@ const AddWhitepapers = () => {
placeholder="Title"
className="web-text-medium"
size="sm"
+ errorBorderColor="crimson"
+ isInvalid={watch()?.title?.length > 50}
+ // maxLength={51}
/>
+ 50 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If title crosses 50 characters it will cause problem in alignment
+ on website.you have entered {watch()?.title?.length} characters
+
{errors.title && (
{errors.title.message}
@@ -184,28 +207,24 @@ const AddWhitepapers = () => {
)}
-
-
-
Document
{errors.document && (
- {errors.document.message}
+ {" "}
+ {errors.document.message}
)}
-
-
Banner image
@@ -289,8 +308,7 @@ const AddWhitepapers = () => {
{errors.image && (
- {" "}
- {errors.image.message}
+ {errors.image.message}
)}
@@ -298,9 +316,6 @@ const AddWhitepapers = () => {
-
-
-
-
-
-
+
- )
-}
+ );
+};
-export default AddWhitepapers
\ No newline at end of file
+export default AddWhitepapers;
diff --git a/src/Pages/Whitepapers/EditWhitepaper.jsx b/src/Pages/Whitepapers/EditWhitepaper.jsx
index 8081e16..9dd6dce 100644
--- a/src/Pages/Whitepapers/EditWhitepaper.jsx
+++ b/src/Pages/Whitepapers/EditWhitepaper.jsx
@@ -47,6 +47,7 @@ const EditWhitepaper = () => {
register,
handleSubmit,
reset,
+ watch,
formState: { errors },
setValue,
} = useForm({
@@ -81,7 +82,7 @@ const EditWhitepaper = () => {
};
const onSubmit = async (data) => {
- console.log(data);
+ // console.log(data);
setIsLoadingEdit(true);
const form = new FormData();
form.append("title", data?.title);
@@ -93,7 +94,7 @@ const EditWhitepaper = () => {
}
// Log formData entries
for (let [key, value] of form.entries()) {
- console.log(`${key}: ${value}`);
+ // console.log(`${key}: ${value}`);
}
await updateWhitepaper({ id: id, data: form })
@@ -110,7 +111,7 @@ for (let [key, value] of form.entries()) {
}
})
.catch((error) => {
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setIsLoadingEdit(false);
// setDeleteIsLoading(false);
// setDeleteAlert(false);
@@ -204,7 +205,18 @@ for (let [key, value] of form.entries()) {
placeholder="Title"
className="web-text-medium"
size="sm"
- />
+ errorBorderColor="crimson"
+ isInvalid={watch()?.title?.length > 50}
+ // maxLength={51}
+ />
+ 50 ? "red" : "gray.500"}
+ className="web-text-small"
+ >
+ If title crosses 50 characters it will cause problem in
+ alignment on website.you have entered {watch()?.title?.length}{" "}
+ characters
+
{errors.title && (
{errors.title.message}
diff --git a/src/Pages/Whitepapers/ViewWhitePaper.jsx b/src/Pages/Whitepapers/ViewWhitePaper.jsx
index f51656d..d1e6744 100644
--- a/src/Pages/Whitepapers/ViewWhitePaper.jsx
+++ b/src/Pages/Whitepapers/ViewWhitePaper.jsx
@@ -15,7 +15,7 @@ const ViewWhitePaper = () => {
const navigate = useNavigate();
const { data, error, isLoading } = useGetWhitepaperByIdQuery(id);
const whitepaper = data?.data?.data;
- console.log(whitepaper?.document);
+ // console.log(whitepaper?.document);
if (isLoading) {
return ;
diff --git a/src/Pages/Whitepapers/Whitepapers.jsx b/src/Pages/Whitepapers/Whitepapers.jsx
index 5539a2b..c7ddf0b 100644
--- a/src/Pages/Whitepapers/Whitepapers.jsx
+++ b/src/Pages/Whitepapers/Whitepapers.jsx
@@ -162,8 +162,8 @@ const Whitepapers = () => {
await deleteWhitepaper(communityId)
.then((response) => {
// Handle the response here
- console.log("Mutation response:", response?.data?.statusCode);
- console.log("Mutation response:", response?.data?.message);
+ // // console.log("Mutation response:", response?.data?.statusCode);
+ // // console.log("Mutation response:", response?.data?.message);
if (response?.data?.statusCode === 201) {
setDeleteIsLoading(false);
@@ -179,13 +179,13 @@ const Whitepapers = () => {
}
})
.catch((error) => {
- console.error("Error creating community:", error);
+ // console.error("Error creating community:", error);
setDeleteIsLoading(false);
setDeleteAlert(false);
});
} catch (error) {
// Handle errors
- console.log("Error deleting community:", error);
+ // console.log("Error deleting community:", error);
}
};
@@ -193,7 +193,7 @@ const Whitepapers = () => {
try {
await updateWhitepaperStatus({ id })
.then((response) => {
- console.log(response?.data);
+ // console.log(response?.data);
if (response?.data?.statusCode === 201) {
toast({
render: () => (
@@ -208,11 +208,11 @@ const Whitepapers = () => {
}
})
.catch((error) => {
- console.log(error);
+ // console.log(error);
});
} catch (error) {
// Handle errors
- console.error("Error updating community status:", error);
+ // console.error("Error updating community status:", error);
}
};
@@ -241,7 +241,7 @@ const Whitepapers = () => {
onClose={() => setDeleteAlert(false)}
isOpen={deleteAlert}
alertHandler={() => handleDelete(actionId)}
- message={"Are you sure you want to delete video?"}
+ message={"Are you sure you want to delete whitepaper?"}
isLoading={deleteIsLoading}
/>
>
diff --git a/src/Redux/Store.js b/src/Redux/Store.js
index a73889d..3350ae4 100644
--- a/src/Redux/Store.js
+++ b/src/Redux/Store.js
@@ -15,7 +15,7 @@ const rootReducer = combineReducers({
const encryptor = encryptTransform({
secretKey: "webStore",
onError: function (error) {
- console.log(error);
+ // console.log(error);
},
});
diff --git a/src/Validations/Validations.js b/src/Validations/Validations.js
index f828094..4500474 100644
--- a/src/Validations/Validations.js
+++ b/src/Validations/Validations.js
@@ -9,7 +9,9 @@ export const addCommunitySchema = Yup.object().shape({
member_name: Yup.string().required("Name is required"),
designation: Yup.string().required("Designation is required"),
description: Yup.string().required("Description is required"),
- linkedin: Yup.string().required("Linked In link is required"),
+ linkedin: Yup.string()
+ .url("Invalid LinkedIn URL")
+ .required("Linked In link is required"),
profile_image: Yup.mixed()
.test("required", "You need to provide a file", (files) => {
// return file && file.size <-- u can use this if you don't want to allow empty files to be uploaded;
@@ -46,10 +48,10 @@ export const schemaEdit = Yup.object().shape({
export const addCommunityBannerSchema = Yup.object().shape({
heading: Yup.string().required("Name is required"),
sub_heading: Yup.string().required("Designation is required"),
- CTO_button_title: Yup.string().required("Description is required"),
+ CTO_button_title: Yup.string().required("Description is required"),
CTO_button_link: Yup.string()
- .url("Invalid LinkedIn URL")
- .required("LinkedIn is required"),
+ .url("Invalid LinkedIn URL")
+ .required("LinkedIn is required"),
banner_image: Yup.mixed()
.test("required", "You need to provide a file", (files) => {
// return file && file.size <-- u can use this if you don't want to allow empty files to be uploaded;
@@ -90,70 +92,133 @@ export const addBlogSchema = Yup.object().shape({
meta_description: Yup.string().required("Description is required"),
content: Yup.string(),
summary: Yup.string().required("Summary is required"),
- profile_image:Yup.mixed()
- .test("required", "You need to provide a file", (files) => {
- // return file && file.size <-- u can use this if you don't want to allow empty files to be uploaded;
- if (files) return true;
- return false;
- })
- .test(
- "fileSize",
- " The maximum size of profile picture is 10MB.",
- (files) => {
- //if u want to allow only certain file sizes
- try {
- if (files.length !== 0) {
- return files[0].size <= 10000000;
- }
- return true;
- } catch (error) {
- return false;
- }
- }
- )
- .test("file_formate", "Image file has unsupported format.", (files) => {
- // // console.log(files[0].type)
-
- const SUPPORTED_FORMATS = [
- "image/jpeg",
- "image/jpg",
- "image/png",
- // "image/gif",
- "image/tiff",
- "image/svg+xml",
- ];
- try {
- if (files.length !== 0) {
- return files && SUPPORTED_FORMATS.includes(files[0].type);
- }
- return true;
- } catch (error) {
+ profile_image: Yup.mixed()
+ .test("required", "You need to provide a file", (files) => {
+ // return file && file.size <-- u can use this if you don't want to allow empty files to be uploaded;
+ if (files) return true;
return false;
- }
- })
- .optional(),
- content_image_large:Yup.mixed()
- .test("required", "You need to provide a file", (files) => {
- // return file && file.size <-- u can use this if you don't want to allow empty files to be uploaded;
- if (files) return true;
- return false;
- })
- .test(
- "fileSize",
- " The maximum size of profile picture is 10MB.",
- (files) => {
- //if u want to allow only certain file sizes
+ })
+ .test(
+ "fileSize",
+ " The maximum size of profile picture is 10MB.",
+ (files) => {
+ //if u want to allow only certain file sizes
+ try {
+ if (files.length !== 0) {
+ return files[0].size <= 10000000;
+ }
+ return true;
+ } catch (error) {
+ return false;
+ }
+ }
+ )
+ .test("file_formate", "Image file has unsupported format.", (files) => {
+ // // // console.log(files[0].type)
+
+ const SUPPORTED_FORMATS = [
+ "image/jpeg",
+ "image/jpg",
+ "image/png",
+ // "image/gif",
+ "image/tiff",
+ "image/svg+xml",
+ ];
try {
if (files.length !== 0) {
- return files[0].size <= 10000000;
+ return files && SUPPORTED_FORMATS.includes(files[0].type);
}
return true;
} catch (error) {
return false;
}
- }
- )
- .optional(),
+ })
+ .optional(),
+ content_image_large: Yup.mixed()
+ .test("required", "You need to provide a file", (files) => {
+ // return file && file.size <-- u can use this if you don't want to allow empty files to be uploaded;
+ if (files) return true;
+ return false;
+ })
+ .test(
+ "fileSize",
+ " The maximum size of profile picture is 10MB.",
+ (files) => {
+ //if u want to allow only certain file sizes
+ try {
+ if (files.length !== 0) {
+ return files[0].size <= 10000000;
+ }
+ return true;
+ } catch (error) {
+ return false;
+ }
+ }
+ )
+ .optional(),
+});
+
+export const editBlogSchema = Yup.object().shape({
+ author_name: Yup.string().required("Author is required"),
+ author_designation: Yup.string().required("Author designation is required"),
+ title: Yup.string().required("Title is required"),
+ meta_description: Yup.string().required("Description is required"),
+ content: Yup.string(),
+ summary: Yup.string().required("Summary is required"),
+ profile_image: Yup.mixed()
+ .test(
+ "fileSize",
+ " The maximum size of profile picture is 10MB.",
+ (files) => {
+ //if u want to allow only certain file sizes
+ try {
+ if (files.length !== 0) {
+ return files[0].size <= 10000000;
+ }
+ return true;
+ } catch (error) {
+ return false;
+ }
+ }
+ )
+ .test("file_formate", "Image file has unsupported format.", (files) => {
+ // // // console.log(files[0].type)
+
+ const SUPPORTED_FORMATS = [
+ "image/jpeg",
+ "image/jpg",
+ "image/png",
+ // "image/gif",
+ "image/tiff",
+ "image/svg+xml",
+ ];
+ try {
+ if (files.length !== 0) {
+ return files && SUPPORTED_FORMATS.includes(files[0].type);
+ }
+ return true;
+ } catch (error) {
+ return false;
+ }
+ })
+ .optional(),
+ content_image_large: Yup.mixed()
+ .test(
+ "fileSize",
+ " The maximum size of profile picture is 10MB.",
+ (files) => {
+ //if u want to allow only certain file sizes
+ try {
+ if (files.length !== 0) {
+ return files[0].size <= 10000000;
+ }
+ return true;
+ } catch (error) {
+ return false;
+ }
+ }
+ )
+ .optional(),
});
export const addNews = Yup.object().shape({
@@ -183,7 +248,7 @@ export const addNews = Yup.object().shape({
}
)
// .test("file_formate", "Image file has unsupported format.", (files) => {
- // // // console.log(files[0].type)
+ // // // // console.log(files[0].type)
// const SUPPORTED_FORMATS = [
// "image/jpeg",
@@ -194,7 +259,7 @@ export const addNews = Yup.object().shape({
// ];
// try {
// if (files.length !== 0) {
- //
+ //
// return files && SUPPORTED_FORMATS.includes(files[0].type);
// }
// return true;
@@ -232,7 +297,7 @@ export const editNews = Yup.object().shape({
// }
// )
// .test("file_formate", "Image file has unsupported format.", (files) => {
- // // // console.log(files[0].type)
+ // // // // console.log(files[0].type)
// const SUPPORTED_FORMATS = [
// "image/jpeg",
@@ -243,7 +308,7 @@ export const editNews = Yup.object().shape({
// ];
// try {
// if (files.length !== 0) {
- //
+ //
// return files && SUPPORTED_FORMATS.includes(files[0].type);
// }
// return true;
@@ -288,7 +353,7 @@ export const addEvents = Yup.object().shape({
// }
// )
// .test("file_formate", "Image file has unsupported format.", (files) => {
- // // // console.log(files[0].type)
+ // // // // console.log(files[0].type)
// const SUPPORTED_FORMATS = [
// "image/jpeg",
@@ -299,7 +364,7 @@ export const addEvents = Yup.object().shape({
// ];
// try {
// if (files.length !== 0) {
- //
+ //
// return files && SUPPORTED_FORMATS.includes(files[0].type);
// }
// return true;
@@ -334,7 +399,7 @@ export const addWhitePapers = Yup.object().shape({
}
)
// .test("file_formate", "Image file has unsupported format.", (files) => {
- // // // console.log(files[0].type)
+ // // // // console.log(files[0].type)
// const SUPPORTED_FORMATS = [
// "image/jpeg",
@@ -346,7 +411,7 @@ export const addWhitePapers = Yup.object().shape({
// ];
// try {
// if (files.length !== 0) {
- //
+ //
// return files && SUPPORTED_FORMATS.includes(files[0].type);
// }
// return true;
@@ -378,7 +443,7 @@ export const addWhitePapers = Yup.object().shape({
)
.optional(),
// .test("file_formate", "Image file has unsupported format.", (files) => {
- // // // console.log(files[0].type)
+ // // // // console.log(files[0].type)
// const SUPPORTED_FORMATS = [
// "image/jpeg",
@@ -390,7 +455,7 @@ export const addWhitePapers = Yup.object().shape({
// ];
// try {
// if (files.length !== 0) {
- //
+ //
// return files && SUPPORTED_FORMATS.includes(files[0].type);
// }
// return true;
@@ -409,8 +474,7 @@ export const addWhitePapers = Yup.object().shape({
export const addVideos = Yup.object().shape({
title: Yup.string().required("Name is required"),
- thumbnail: Yup
- .mixed()
+ thumbnail: Yup.mixed()
.required("Thumbnail is required")
.test("required", "You need to provide a file", (files) => {
// return file && file.size <-- u can use this if you don't want to allow empty files to be uploaded;
@@ -437,15 +501,12 @@ export const addVideos = Yup.object().shape({
embeddedCode: Yup.string().required("LinkedIn is required"),
});
-
-
export const addUsecase = Yup.object().shape({
title: Yup.string().required("Name is required"),
meta_description: Yup.string().required("Description is required"),
attachment: Yup.mixed(),
content: Yup.string(),
- banner_image: Yup
- .mixed()
+ banner_image: Yup.mixed()
// .required("Thumbnail is required")
.test("required", "You need to provide a file", (files) => {
// return file && file.size <-- u can use this if you don't want to allow empty files to be uploaded;
@@ -466,9 +527,9 @@ export const addUsecase = Yup.object().shape({
return false;
}
}
- ).optional(),
- icon: Yup
- .mixed()
+ )
+ .optional(),
+ icon: Yup.mixed()
// .required("Icon is required")
.test("required", "You need to provide a file", (files) => {
if (files) return true;
@@ -487,18 +548,16 @@ export const addUsecase = Yup.object().shape({
return false;
}
}
- ).optional(),
-
+ )
+ .optional(),
});
-
export const editUsecase = Yup.object().shape({
title: Yup.string().required("Name is required"),
meta_description: Yup.string().required("Description is required"),
attachment: Yup.mixed(),
content: Yup.string(),
- banner_image: Yup
- .mixed()
+ banner_image: Yup.mixed()
// .required("Thumbnail is required")
.test("required", "You need to provide a file", (files) => {
// return file && file.size <-- u can use this if you don't want to allow empty files to be uploaded;
@@ -519,9 +578,9 @@ export const editUsecase = Yup.object().shape({
return false;
}
}
- ).optional(),
- icon: Yup
- .mixed()
+ )
+ .optional(),
+ icon: Yup.mixed()
// .required("Icon is required")
.test("required", "You need to provide a file", (files) => {
if (files) return true;
@@ -540,11 +599,10 @@ export const editUsecase = Yup.object().shape({
return false;
}
}
- ).optional(),
-
+ )
+ .optional(),
});
-
export const addTerms = Yup.object().shape({
title: Yup.string().required("title is required"),
content: Yup.string(),
@@ -571,7 +629,7 @@ export const addTerms = Yup.object().shape({
// )
.optional(),
// .test("file_formate", "Image file has unsupported format.", (files) => {
- // // // console.log(files[0].type)
+ // // // // console.log(files[0].type)
// const SUPPORTED_FORMATS = [
// "image/jpeg",
@@ -583,7 +641,7 @@ export const addTerms = Yup.object().shape({
// ];
// try {
// if (files.length !== 0) {
- //
+ //
// return files && SUPPORTED_FORMATS.includes(files[0].type);
// }
// return true;
@@ -619,7 +677,7 @@ export const addPolicy = Yup.object().shape({
// )
.optional(),
// .test("file_formate", "Image file has unsupported format.", (files) => {
- // // // console.log(files[0].type)
+ // // // // console.log(files[0].type)
// const SUPPORTED_FORMATS = [
// "image/jpeg",
@@ -631,7 +689,7 @@ export const addPolicy = Yup.object().shape({
// ];
// try {
// if (files.length !== 0) {
- //
+ //
// return files && SUPPORTED_FORMATS.includes(files[0].type);
// }
// return true;
@@ -644,7 +702,8 @@ export const addPolicy = Yup.object().shape({
export const addPartnerCard = Yup.object().shape({
website_link: Yup.string().required("link is required"),
description: Yup.string().required("description is required"),
- banner_image: Yup.mixed().required("logo is required")
+ banner_image: Yup.mixed()
+ .required("logo is required")
// .test("required", "You need to provide a file", (files) => {
// // return file && file.size <-- u can use this if you don't want to allow empty files to be uploaded;
// if (files) return true;
@@ -667,7 +726,7 @@ export const addPartnerCard = Yup.object().shape({
// )
.optional(),
// .test("file_formate", "Image file has unsupported format.", (files) => {
- // // // console.log(files[0].type)
+ // // // // console.log(files[0].type)
// const SUPPORTED_FORMATS = [
// "image/jpeg",
@@ -679,7 +738,7 @@ export const addPartnerCard = Yup.object().shape({
// ];
// try {
// if (files.length !== 0) {
- //
+ //
// return files && SUPPORTED_FORMATS.includes(files[0].type);
// }
// return true;
@@ -715,7 +774,7 @@ export const addFaq = Yup.object().shape({
// )
.optional(),
// .test("file_formate", "Image file has unsupported format.", (files) => {
- // // // console.log(files[0].type)
+ // // // // console.log(files[0].type)
// const SUPPORTED_FORMATS = [
// "image/jpeg",
@@ -727,7 +786,7 @@ export const addFaq = Yup.object().shape({
// ];
// try {
// if (files.length !== 0) {
- //
+ //
// return files && SUPPORTED_FORMATS.includes(files[0].type);
// }
// return true;
@@ -736,4 +795,3 @@ export const addFaq = Yup.object().shape({
// }
// })
});
-