diff --git a/app/components/Landing.tsx b/app/components/Landing.tsx
index 7ebb015..381a3c2 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,19 +95,6 @@ export default function Landing() {
);
})}
- {data?.length == 1 && (
-
-
-
- )}
>
) : (
<>
diff --git a/components/InspectorOperations.tsx b/components/InspectorOperations.tsx
index 00e6c7b..bfba09a 100644
--- a/components/InspectorOperations.tsx
+++ b/components/InspectorOperations.tsx
@@ -33,7 +33,7 @@ import { useMutation, useQuery } from "@tanstack/react-query";
import { OperateByInspector } from "@/utils/inspectorApi";
import { toast } from "sonner";
import { postComplaintsDetails } from "@/utils/citizenApi";
-import { useState } from "react";
+import { useEffect, useState } from "react";
import { DialogTrigger } from "./ui/dialog";
import AttachmentsDialog from "./AttachmentsDialog";
import { Eye, Upload } from "lucide-react";
@@ -52,6 +52,7 @@ export default function InspectorOperations({
password?: string;
}) {
const [first, setfirst] = useState([]);
+ const [charCount, setCharCount] = useState(0);
// Queries
const { data, isLoading, refetch } = useQuery({
@@ -118,6 +119,19 @@ export default function InspectorOperations({
},
});
+ // Add the useEffect hook to monitor changes in the description field
+ useEffect(() => {
+ setCharCount(form.watch("text")?.length);
+ }, [form.watch("text")]);
+
+ function handleTextChange(event: React.ChangeEvent) {
+ const newCharCount = event.target.value.length;
+ // Update charCount only when the user types or removes characters
+ if (newCharCount <= data?.maxTextLength) {
+ setCharCount(newCharCount);
+ }
+ }
+
//Functions
function onSubmit(data: z.infer) {
const formData = new FormData();
@@ -162,12 +176,26 @@ export default function InspectorOperations({
name="text"
render={({ field, fieldState: { error } }) => (
- متن
+
+ متن({charCount}/{data?.maxTextLength})
+
{!error ? (
diff --git a/components/RequestStep2.tsx b/components/RequestStep2.tsx
index 5b22829..00158e0 100644
--- a/components/RequestStep2.tsx
+++ b/components/RequestStep2.tsx
@@ -202,6 +202,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 <= optionsData?.maxTextLength) {
+ setCharCount(newCharCount);
+ }
+ }
+
function onSubmit(data: z.infer) {
console.log(data);
const formData = new FormData();