diff --git a/app/components/Landing.tsx b/app/components/Landing.tsx index 5b914a1..6c9276b 100644 --- a/app/components/Landing.tsx +++ b/app/components/Landing.tsx @@ -47,7 +47,7 @@ export default function Landing() { queryFn: () => getSliders(), refetchOnWindowFocus: false, }); - + const { data: NewsData, isLoading: NewsIsLoading, @@ -70,7 +70,8 @@ export default function Landing() { delay: 2500, disableOnInteraction: false, }} - loop={false} + // autoplay={ data?.length > 1 ? { delay: 2500, disableOnInteraction: false } : false } + loop={false} pagination={{ clickable: true, }} @@ -94,7 +95,7 @@ export default function Landing() { ); })} - {data?.length == 1 && ( + {/* {data?.length == 1 && ( bg - )} + )} */} ) : ( <> diff --git a/components/RequestStep2.tsx b/components/RequestStep2.tsx index 88c3c92..bae022d 100644 --- a/components/RequestStep2.tsx +++ b/components/RequestStep2.tsx @@ -193,6 +193,14 @@ export default function RequestStep2() { setCharCount(form.watch("description").length); }, [form.watch("description")]); + function handleDescriptionChange(event: React.ChangeEvent) { + const newCharCount = event.target.value.length; + // Update charCount only when the user types or removes characters + if (newCharCount <= 1024) { + setCharCount(newCharCount); + } + } + function onSubmit(data: z.infer) { console.log(data); const formData = new FormData(); @@ -353,6 +361,16 @@ export default function RequestStep2() { placeholder=" توضیحات خود را بنویسید" className="mb-3 resize-none" {...field} + onChange={(e) => { + const currentValue = e.target.value; + if (currentValue.length <= 1024) { + field.onChange(e); + handleDescriptionChange(e); + } else { + // Truncate the value to the allowed limit + field.onChange(currentValue.substring(0, 1024)); + } + }} />