change key field to specialty, filter list doctors with name, remove loading state from doctors page, save state id in url

This commit is contained in:
Ehsan
2025-09-07 10:22:53 +03:30
parent dc40129034
commit 10d4c39a4d
11 changed files with 142 additions and 59 deletions
+7 -3
View File
@@ -13,9 +13,12 @@ import specialties from "@/data/specialties.json";
function DoctorsPage({ params, matchedCity, matchedState, list }) {
const fieldId = params.field;
const [loading, setLoading] = useState(true);
const [doctors, setDoctors] = useState(list);
const [open, setOpen] = useState(false);
const [fields, setFields] = useState({
search: "",
stars: null,
});
const [selected, setSelected] = useState({
province: matchedState?.name || params?.province,
city: matchedCity?.name || params?.city,
@@ -60,8 +63,9 @@ function DoctorsPage({ params, matchedCity, matchedState, list }) {
<div className="flex flex-col lg:flex-row items-start lg:items-center justify-center gap-[24px] lg:gap-[32px] w-full">
<SearchBar
data={data}
params={params}
fields={fields}
setData={setData}
setFields={setFields}
setDoctors={setDoctors}
matchedCity={matchedCity}
matchedState={matchedState}
@@ -71,7 +75,7 @@ function DoctorsPage({ params, matchedCity, matchedState, list }) {
<SortList data={data} setData={setData} />
</div>
</div>
<ListDoctors loading={loading} list={doctors} />
<ListDoctors list={doctors} />
</div>
);
}