diff --git a/components/doctor/detailDoctor/cards/comments/chart/index.js b/components/doctor/detailDoctor/cards/comments/chart/index.js
index 8702ed1..2310a73 100644
--- a/components/doctor/detailDoctor/cards/comments/chart/index.js
+++ b/components/doctor/detailDoctor/cards/comments/chart/index.js
@@ -55,7 +55,7 @@ function Chart({ comments, doctor }) {
{Object.values(doctor?.average_rate?.averages).map((item, idx) => (
-
+
))}
diff --git a/components/doctors/search/AutoComplete.js b/components/doctors/search/AutoComplete.js
index 4127521..83c5eac 100644
--- a/components/doctors/search/AutoComplete.js
+++ b/components/doctors/search/AutoComplete.js
@@ -5,22 +5,20 @@ function AutoComplete({
data,
noneBg,
clearText,
- inputValue, // مقدار کنترلشده از والد (اختیاری)
+ inputValue,
placeholder,
- handleSearch, // تابعی که باید با مقدار جستجو صدا زده بشه
- setInputValue, // اختیاری: اگه والد دوست داره همونوقت مقدار رو بگیره
+ handleSearch,
+ setInputValue,
setSelectedOption,
- debounce = 500, // قابل تنظیم
+ debounce = 500,
}) {
const typingTimeoutRef = useRef(null);
const [localInput, setLocalInput] = useState(inputValue || "");
- // همگامسازی وقتی والد مقدار کنترلشده رو تغییر میده (مثلاً بعد از انتخاب گزینه)
useEffect(() => {
setLocalInput(inputValue || "");
}, [inputValue]);
- // پاککردن تایمر هنگام unmount
useEffect(() => {
return () => {
if (typingTimeoutRef.current) clearTimeout(typingTimeoutRef.current);
@@ -28,13 +26,10 @@ function AutoComplete({
}, []);
const onInputChange = (_, newInputValue) => {
- // نمایش آنی تایپ کاربر
setLocalInput(newInputValue);
- // اختیاری: اگر والد خواست همونجا مقدار رو بگیره
if (setInputValue) setInputValue(newInputValue);
- // پاک کردن تایمر قبلی و ست کردن تایمر جدید برای debounce
if (typingTimeoutRef.current) clearTimeout(typingTimeoutRef.current);
typingTimeoutRef.current = setTimeout(() => {
handleSearch(newInputValue);
@@ -42,7 +37,6 @@ function AutoComplete({
};
const onChange = (_, newValue) => {
- // انتخاب از لیست — مقدار رو فوراً پردازش کن
if (typingTimeoutRef.current) {
clearTimeout(typingTimeoutRef.current);
typingTimeoutRef.current = null;
@@ -55,7 +49,7 @@ function AutoComplete({
: "";
setLocalInput(val);
setSelectedOption && setSelectedOption(newValue);
- handleSearch(val); // اجرای فوری روی انتخاب
+ handleSearch(val);
if (setInputValue) setInputValue(val);
};
@@ -67,7 +61,7 @@ function AutoComplete({
typeof option === "string" ? option : option.name
}
disableClearable
- inputValue={localInput} // ← نمایش آنی از local state
+ inputValue={localInput}
className="!w-full"
onInputChange={onInputChange}
onChange={onChange}
diff --git a/components/doctors/search/SearchField.js b/components/doctors/search/SearchField.js
index a6f4fc7..ee5b433 100644
--- a/components/doctors/search/SearchField.js
+++ b/components/doctors/search/SearchField.js
@@ -3,7 +3,7 @@ import { useRouter } from "next/navigation";
import specialties from "@/data/specialties.json";
import AutoComplete from "./AutoComplete";
-function SearchField({ filter, setFilter, updateData, setDataInURL }) {
+function SearchField({ filter, setFilter, setDataInURL }) {
const router = useRouter();
const clearText = () => {
@@ -17,7 +17,6 @@ function SearchField({ filter, setFilter, updateData, setDataInURL }) {
},
};
setFilter(newFilter);
- // setDataInURL(newFilter);
};
const handleSearch = (e) => {
@@ -34,7 +33,6 @@ function SearchField({ filter, setFilter, updateData, setDataInURL }) {
dataUrl.specialty = findName.name;
newFilter.category = itemParent;
newFilter.specialty = findName;
- // updateData("name", e);
} else {
dataUrl.specialty = findName.name;
newFilter.category = findName;
@@ -50,8 +48,6 @@ function SearchField({ filter, setFilter, updateData, setDataInURL }) {
router.push(`?${searchParams.toString()}`);
newFilter.name = e;
setFilter(newFilter);
- // const newFilter = { ...filter, [name]: e };
- // setFilter(newFilter);
} else {
let newFilter = filter;
@@ -65,7 +61,6 @@ function SearchField({ filter, setFilter, updateData, setDataInURL }) {
router.push(`?${searchParams.toString()}`);
}
newFilter.name = e;
- // updateData("name", e);
setFilter(newFilter);
setDataInURL(newFilter);
}
@@ -78,7 +73,6 @@ function SearchField({ filter, setFilter, updateData, setDataInURL }) {
clearText={clearText}
inputValue={filter.name}
handleSearch={handleSearch}
- // handleSearch={(e) => updateData("name", e)}
placeholder="جستجوی نام پزشک، تخصص، بیماری ..."
/>
diff --git a/components/doctors/search/index.js b/components/doctors/search/index.js
index eef89cc..f414c0c 100644
--- a/components/doctors/search/index.js
+++ b/components/doctors/search/index.js
@@ -39,7 +39,6 @@ function SearchBar({ filter, sendReq, setFilter, updateData, setDataInURL }) {