feat: implement root domain handling for nobat724.com to prevent city filtering

This commit is contained in:
hamed
2026-07-02 21:53:45 +03:30
parent e6b55c6bad
commit 79f7df2e4d
9 changed files with 196 additions and 24 deletions
+5 -4
View File
@@ -11,18 +11,19 @@ import { useSearchParams } from "next/navigation";
// Data
import states from "@/data/state.json";
import cities from "@/data/city.json";
import { isRootCity } from "@/lib/rootCity";
function ClinicsPage({ clinics, matchedCity, matchedState }) {
const searchParams = useSearchParams();
const [page, setPage] = useState(clinics?.meta?.currentPage || 1);
const [filteredClinics, setFilteredClinics] = useState(clinics?.data);
const selectedState = searchParams.get("state") || matchedState?.name;
const isRoot = isRootCity(matchedCity);
const selectedState =
searchParams.get("state") || (!isRoot ? matchedState?.name : undefined);
const selectedCity =
searchParams.get("city") ||
(matchedCity?.name && matchedCity?.id !== "600"
? matchedCity?.name
: false);
(matchedCity?.name && !isRoot ? matchedCity?.name : false);
const [selected, setSelected] = useState({
province:
+5 -4
View File
@@ -7,6 +7,7 @@ import Head from "./head";
import specialties from "@/data/specialties.json";
import states from "@/data/state.json";
import cities from "@/data/city.json";
import { isRootCity } from "@/lib/rootCity";
function DoctorsPage({ matchedCity, matchedState, list }) {
const searchParams = useSearchParams();
@@ -19,12 +20,12 @@ function DoctorsPage({ matchedCity, matchedState, list }) {
const isParent =
findItem("name", fieldName) && findItem("name", fieldName).parent_id;
const selectedState = searchParams.get("state") || matchedState?.name;
const isRoot = isRootCity(matchedCity);
const selectedState =
searchParams.get("state") || (!isRoot ? matchedState?.name : undefined);
const selectedCity =
searchParams.get("city") ||
(matchedCity?.name && matchedCity?.id !== "600"
? matchedCity?.name
: false);
(matchedCity?.name && !isRoot ? matchedCity?.name : false);
const valCategory = isParent
? findItem("id", isParent)