import Typography from "@/shared/ui/components/Typography/Typography"; import "./MapSection.scss"; import Paragraph from "@/shared/ui/components/Paragraph/Paragraph"; import MapSearch from "./MapSearch/MapSearch"; import dynamic from "next/dynamic"; import { apiInstance } from "@/shared/config/apiConfig"; import { IReport } from "@/shared/types/report-type"; import Switch from "./Switch/Switch"; import { ROAD_TYPES, ROAD_TYPES_COLORS, } from "@/shared/variables/road-types"; const DynamicMap = dynamic(() => import("./HomeMap/HomeMap"), { ssr: false, }); interface IMapSectionProps { searchParams: { ["тип-дороги"]: string; ["поиск-на-карте"]: string; ["поиск-рейтинг"]: string; ["страница-рейтинга"]: string; }; } const MapSection: React.FC = async ({ searchParams, }: IMapSectionProps) => { const getReports = async (categories: string) => { const res = await apiInstance( `/report/?category=${categories}` ); return res.data; }; const data = (await getReports(searchParams["тип-дороги"] || "1,2,3,4,5,6")) || []; const setCategories = (category: string) => { if (searchParams["тип-дороги"] === undefined) { const categories = ["1", "2", "3", "4", "5", "6"]; return categories.filter((cat) => cat !== category).join(","); } const categories = Array.from(searchParams["тип-дороги"]).filter( (part) => part !== "," ); if (categories.includes(category)) return categories.filter((cat) => cat !== category).join(","); categories.push(category); return categories.join(","); }; return (
Карта дорог Будьте в курсе последних новостей о дорожном движении, строительствах и мероприятиях!
    {[1, 2, 3].map((sw) => (
  • {ROAD_TYPES[sw]}

  • ))}
    {[4, 5, 6].map((sw) => (
  • {ROAD_TYPES[sw]}

  • ))}
); }; export default MapSection;