diff --git a/app/CitizenLogin/page.tsx b/app/CitizenLogin/page.tsx index f7d8040..f8de261 100644 --- a/app/CitizenLogin/page.tsx +++ b/app/CitizenLogin/page.tsx @@ -9,5 +9,11 @@ export default function page() { if (token) { redirect("/RequestStep2"); } - return ; + return ( +
+ + +
+
+ ); } diff --git a/app/components/Landing.tsx b/app/components/Landing.tsx index 6c9276b..acf9a55 100644 --- a/app/components/Landing.tsx +++ b/app/components/Landing.tsx @@ -95,19 +95,6 @@ export default function Landing() { ); })} - {/* {data?.length == 1 && ( - - bg - - )} */} ) : ( <> diff --git a/components/InspectorOperations.tsx b/components/InspectorOperations.tsx index 1959a4c..6732555 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}) +