From 1b4edb59f8ba27a8c62bce1691c3fe18392c8b54 Mon Sep 17 00:00:00 2001 From: Anton Akhatov Date: Fri, 29 Dec 2023 23:39:04 +0000 Subject: [PATCH] use sloy-map --- .eslintrc.json | 15 +- README.md | 2 +- build-scripts/prepare-static/constants.mjs | 2 +- build-scripts/prepare-static/index.mjs | 70 +- components/Card/Card.tsx | 53 - .../Card/DesktopCard/DesktopCard.module.css | 16 - components/Card/DesktopCard/DesktopCard.tsx | 27 - components/Card/MobileCard.tsx | 30 - .../ConstructionInfo/ConstructionInfo.tsx | 38 - .../Card/components/Header/Header.module.css | 29 - components/Card/components/Header/Header.tsx | 61 - .../components/Section/Section.module.css | 11 - .../Card/components/Section/Section.tsx | 7 - .../components/Sources/Sources.module.css | 30 - .../Card/components/Sources/Sources.tsx | 21 - components/Card/index.ts | 2 - components/Filters/Filters.module.css | 57 - components/Filters/Filters.tsx | 51 - .../components/Filter/Filter.module.css | 24 - .../Filters/components/Filter/Filter.tsx | 24 - .../components/Toggle/Toggle.module.css | 85 - .../Filters/components/Toggle/Toggle.tsx | 42 - components/Filters/index.ts | 1 - components/LeftSidebar.tsx | 15 - components/RightSidebar.tsx | 14 - constants/colors.ts | 7 - constants/map.ts | 1 - constants/sources.ts | 49 - features/About/AboutProjectContent.tsx | 12 +- .../AboutProjectIcons.module.css | 9 +- .../AboutProjectIcons/AboutProjectIcons.tsx | 39 +- features/About/AboutProjectModal.module.css | 6 + features/About/AboutProjectModal.tsx | 23 +- features/About/AboutProjectProvider.tsx | 32 - features/About/MobileAboutProject.tsx | 22 - features/App.tsx | 96 + features/App/App.tsx | 30 - features/App/Content.config.ts | 47 - features/App/Filters.config.tsx | 68 - features/App/Sidebars.tsx | 62 - features/Buildings/BuildingSource.tsx | 156 - .../CardContent/CardContent.module.css | 14 - .../Buildings/CardContent/CardContent.tsx | 202 - features/Buildings/Filter/HouseBaseFilter.tsx | 29 - features/Buildings/Houses.constants.ts | 43 - features/Buildings/houseBase.ts | 54 +- features/Copyright/Copyright.module.css | 38 - features/Copyright/Copyright.tsx | 25 - .../CustomCardContent}/CardContent.module.css | 0 .../DownloadButton/DownloadButton.module.css | 0 .../DownloadButton/DownloadButton.tsx | 4 +- .../FeedbackButton/FeedbackButton.tsx | 26 + .../HealthProgress/HealthProgress.module.css | 0 .../HealthProgress/HealthProgress.tsx | 26 +- .../CustomCardContent}/Info/Info.module.css | 0 .../CustomCardContent}/Info/Info.tsx | 0 .../CustomCardContent}/Info/Info.types.ts | 0 .../OKNInfo/OKNInfo.module.css | 0 .../OKNInfo/OKNInfo.tsx | 24 +- .../CustomCardContent/OKNInfo/SvgOknIcon.tsx | 2 +- .../Participant/Participant.module.css | 0 .../Participants/Participant/Participant.tsx | 18 +- .../Participants/Participants.module.css | 13 +- .../Participants/Participants.tsx | 108 + .../Participants/Participants.types.ts | 48 + features/CustomCardContent/overrideCard.tsx | 96 + .../FacadeFilter.tsx | 8 +- .../QuarterFilter.tsx | 24 +- .../DTP/CardContent/CardContent.module.css | 14 - features/DTP/CardContent/CardContent.tsx | 120 - .../components/Participants/Participants.tsx | 115 - .../Participants/Participants.types.ts | 12 - features/DTP/DTP.constants.ts | 53 - features/DTP/DtpSource.tsx | 121 - features/DTP/Filter/DTPFilter.module.css | 22 - features/DTP/Filter/DTPFilter.state.ts | 38 - features/DTP/Filter/DTPFilter.tsx | 195 - features/DTP/Filter/DTPFilter.types.ts | 14 - features/DTP/dtp.ts | 106 - features/DTP/dtpParticipantType.ts | 8 - features/DTP/dtpSeverityType.ts | 5 - .../DesignCode/CardContent/CardContent.tsx | 49 - features/DesignCode/DesignCode.constants.ts | 17 - features/DesignCode/DesignCodeSource.tsx | 79 - .../Filter/DesignCodeFilter.module.css | 12 - .../Filter/DesignCodeFilter.state.ts | 17 - .../DesignCode/Filter/DesignCodeFilter.tsx | 57 - .../Filter/DesignCodeFilter.types.ts | 7 - features/DesignCode/designCode.ts | 31 - features/DesignCode/designCodeObject.ts | 28 - .../EditObjectButtonLink.tsx | 18 - features/Facade/CardContent/Facade.module.css | 12 - features/Facade/CardContent/Facade.tsx | 18 - features/Facade/FacadeSource.tsx | 61 - .../Footer/Footer.module.css | 0 {components => features}/Footer/Footer.tsx | 0 features/HouseAge/HouseAgeFilter.tsx | 42 - features/HouseFloor/HouseFloorFilter.tsx | 43 - .../HouseWearTear/HouseWearTearFilter.tsx | 41 - features/Lines/CardContent/CardContent.tsx | 28 - features/Lines/Filter/LinesFilter.module.css | 12 - features/Lines/Filter/LinesFilter.state.ts | 17 - features/Lines/Filter/LinesFilter.tsx | 69 - features/Lines/Filter/LinesFilter.types.ts | 8 - features/Lines/Lines.constants.ts | 16 - features/Lines/LinesSource.tsx | 85 - features/Lines/lineType.ts | 18 - features/Lines/lines.ts | 16 - features/Map/Map.tsx | 62 - features/Map/helpers/colorLuminance.ts | 13 - features/Map/helpers/getFeatureState.ts | 24 - features/Map/helpers/useMapObjectState.ts | 69 - features/Map/providers/MapProvider.tsx | 44 - features/Map/providers/usePopup.ts | 62 - .../OKN/CardContent/CardContent.module.css | 35 - features/OKN/CardContent/CardContent.tsx | 79 - features/OKN/CardContent/index.ts | 1 - features/OKN/Filter/OknFilter.module.css | 12 - features/OKN/Filter/OknFilter.state.ts | 43 - features/OKN/Filter/OknFilter.tsx | 131 - features/OKN/Okn.constants.ts | 30 - features/OKN/OknSource.tsx | 191 - features/OKN/okn.ts | 19 - features/OKN/oknConstants.ts | 11 - features/OKN/oknObject.ts | 42 - features/Privacy/PrivacyPage.tsx | 15 - .../CardContent/CardContent.module.css | 30 - features/Quarter/CardContent/CardContent.tsx | 60 - features/Quarter/QuarterSource.tsx | 73 - features/Quarter/quarter.ts | 11 - features/Quarter/quarterObject.ts | 6 - helpers/isDesktop.tsx | 5 + package.json | 26 +- pages/_document.tsx | 4 +- pages/api/dtp.ts | 10 +- pages/index.tsx | 2 +- pages/privacy.tsx | 15 +- pnpm-lock.yaml | 4885 ++- public/ekb-crime.json | 27315 ++++++++++++++++ public/ekb-facades.json | 32 +- public/ekb-loader.svg | 97 + public/ekb-okn.json | 17710 ++++++++-- ...rter_inspectors.json => ekb-quarters.json} | 0 public/okn-meta.json | 12 - public/okn-static/placemarks.json | 1 - shared/UI/Button/Button.module.css | 43 - shared/UI/Button/Button.tsx | 49 - shared/UI/ButtonLink/ButtonLink.module.css | 32 - shared/UI/ButtonLink/ButtonLink.tsx | 21 - shared/UI/Checkbox/Checkbox.module.css | 90 - shared/UI/Checkbox/Checkbox.svg | 1 - shared/UI/Checkbox/Checkbox.tsx | 34 - shared/UI/Close/Close.module.css | 37 - shared/UI/Close/Close.tsx | 27 - shared/UI/Close/index.ts | 1 - shared/UI/Icons/Auto.tsx | 21 - shared/UI/Icons/Bike.tsx | 21 - shared/UI/Icons/BrokenHeart.tsx | 47 - shared/UI/Icons/Bycicle.tsx | 21 - shared/UI/Icons/Children.tsx | 21 - shared/UI/Icons/Copy.tsx | 34 - shared/UI/Icons/Download.tsx | 20 - shared/UI/Icons/DownloadIcon.tsx | 17 - shared/UI/Icons/Edit.tsx | 26 - shared/UI/Icons/External.tsx | 12 - shared/UI/Icons/Heart.tsx | 35 - shared/UI/Icons/Icons.constants.ts | 30 - shared/UI/Icons/Icons.types.ts | 17 - shared/UI/Icons/Link.tsx | 21 - shared/UI/Icons/Pdf.tsx | 38 - shared/UI/Icons/Pedestrian.tsx | 21 - shared/UI/Icons/PublicTransport.tsx | 21 - shared/UI/Icons/index.tsx | 14 - shared/UI/Label/Label.module.css | 33 - shared/UI/Label/Label.tsx | 66 - shared/UI/Link/Link.module.css | 24 - shared/UI/Link/Link.tsx | 23 - shared/UI/Loader/FilterLoader.tsx | 16 - shared/UI/Loader/Loader.tsx | 6 - shared/UI/Modal/MobileModal.tsx | 23 - shared/UI/RangeHistogram/RangeBaseFilter.tsx | 53 - .../RangeHistogram/RangeHistogram.module.css | 27 - shared/UI/RangeHistogram/RangeHistogram.tsx | 92 - .../RangeHistogram/components/Axis.module.css | 42 - shared/UI/RangeHistogram/components/Axis.tsx | 67 - .../components/BarChart.module.css | 65 - .../UI/RangeHistogram/components/BarChart.tsx | 110 - .../components/Slider.helpers.ts | 32 - .../components/Slider.module.css | 85 - .../UI/RangeHistogram/components/Slider.tsx | 150 - shared/UI/RangeHistogram/index.ts | 3 - shared/UI/RangeHistogram/types.ts | 14 - shared/UI/RangeHistogram/utils/index.ts | 19 - shared/helpers/copy.ts | 8 - shared/helpers/fetchApi.ts | 4 - shared/helpers/getYearNameByValue.ts | 25 - shared/helpers/hash.ts | 8 - shared/helpers/isDesktop.ts | 5 - shared/helpers/round.ts | 5 - shared/helpers/useCopyHref.ts | 25 - shared/helpers/useMatchMedia.ts | 33 - state/config.ts | 1241 + state/features/dataLayers.ts | 36 - state/features/selectors.ts | 5 - state/{index.ts => redux.ts} | 5 +- state/state.ts | 41 - styles/globals.css | 1 - styles/modal.css | 20 - tsconfig.json | 6 +- types/Content.types.ts | 18 - types/Filters.types.ts | 28 - types/ObjectsBase.types.ts | 11 - types/Sources.types.ts | 19 - 213 files changed, 47922 insertions(+), 10333 deletions(-) delete mode 100644 components/Card/Card.tsx delete mode 100644 components/Card/DesktopCard/DesktopCard.module.css delete mode 100644 components/Card/DesktopCard/DesktopCard.tsx delete mode 100644 components/Card/MobileCard.tsx delete mode 100644 components/Card/components/ConstructionInfo/ConstructionInfo.tsx delete mode 100644 components/Card/components/Header/Header.module.css delete mode 100644 components/Card/components/Header/Header.tsx delete mode 100644 components/Card/components/Section/Section.module.css delete mode 100644 components/Card/components/Section/Section.tsx delete mode 100644 components/Card/components/Sources/Sources.module.css delete mode 100644 components/Card/components/Sources/Sources.tsx delete mode 100644 components/Card/index.ts delete mode 100644 components/Filters/Filters.module.css delete mode 100644 components/Filters/Filters.tsx delete mode 100644 components/Filters/components/Filter/Filter.module.css delete mode 100644 components/Filters/components/Filter/Filter.tsx delete mode 100644 components/Filters/components/Toggle/Toggle.module.css delete mode 100644 components/Filters/components/Toggle/Toggle.tsx delete mode 100644 components/Filters/index.ts delete mode 100644 components/LeftSidebar.tsx delete mode 100644 components/RightSidebar.tsx delete mode 100644 constants/colors.ts delete mode 100644 constants/sources.ts delete mode 100644 features/About/AboutProjectProvider.tsx delete mode 100644 features/About/MobileAboutProject.tsx create mode 100644 features/App.tsx delete mode 100644 features/App/App.tsx delete mode 100644 features/App/Content.config.ts delete mode 100644 features/App/Filters.config.tsx delete mode 100644 features/App/Sidebars.tsx delete mode 100644 features/Buildings/BuildingSource.tsx delete mode 100644 features/Buildings/CardContent/CardContent.module.css delete mode 100644 features/Buildings/CardContent/CardContent.tsx delete mode 100644 features/Buildings/Filter/HouseBaseFilter.tsx delete mode 100644 features/Buildings/Houses.constants.ts delete mode 100644 features/Copyright/Copyright.module.css delete mode 100644 features/Copyright/Copyright.tsx rename {styles => features/CustomCardContent}/CardContent.module.css (100%) rename {shared/UI => features/CustomCardContent}/DownloadButton/DownloadButton.module.css (100%) rename {shared/UI => features/CustomCardContent}/DownloadButton/DownloadButton.tsx (84%) create mode 100644 features/CustomCardContent/FeedbackButton/FeedbackButton.tsx rename features/{HouseWearTear => CustomCardContent}/HealthProgress/HealthProgress.module.css (100%) rename features/{HouseWearTear => CustomCardContent}/HealthProgress/HealthProgress.tsx (55%) rename {components/Card/components => features/CustomCardContent}/Info/Info.module.css (100%) rename {components/Card/components => features/CustomCardContent}/Info/Info.tsx (100%) rename {components/Card/components => features/CustomCardContent}/Info/Info.types.ts (100%) rename features/{OKN/CardContent/components => CustomCardContent}/OKNInfo/OKNInfo.module.css (100%) rename features/{OKN/CardContent/components => CustomCardContent}/OKNInfo/OKNInfo.tsx (62%) rename shared/UI/Icons/OKN.tsx => features/CustomCardContent/OKNInfo/SvgOknIcon.tsx (99%) rename features/{DTP/CardContent/components => CustomCardContent}/Participants/Participant/Participant.module.css (100%) rename features/{DTP/CardContent/components => CustomCardContent}/Participants/Participant/Participant.tsx (83%) rename features/{DTP/CardContent/components => CustomCardContent}/Participants/Participants.module.css (81%) create mode 100644 features/CustomCardContent/Participants/Participants.tsx create mode 100644 features/CustomCardContent/Participants/Participants.types.ts create mode 100644 features/CustomCardContent/overrideCard.tsx rename features/{Facade/Filter => CustomFilterContent}/FacadeFilter.tsx (84%) rename features/{Quarter/Filter => CustomFilterContent}/QuarterFilter.tsx (67%) delete mode 100644 features/DTP/CardContent/CardContent.module.css delete mode 100644 features/DTP/CardContent/CardContent.tsx delete mode 100644 features/DTP/CardContent/components/Participants/Participants.tsx delete mode 100644 features/DTP/CardContent/components/Participants/Participants.types.ts delete mode 100644 features/DTP/DTP.constants.ts delete mode 100644 features/DTP/DtpSource.tsx delete mode 100644 features/DTP/Filter/DTPFilter.module.css delete mode 100644 features/DTP/Filter/DTPFilter.state.ts delete mode 100644 features/DTP/Filter/DTPFilter.tsx delete mode 100644 features/DTP/Filter/DTPFilter.types.ts delete mode 100644 features/DTP/dtp.ts delete mode 100644 features/DTP/dtpParticipantType.ts delete mode 100644 features/DTP/dtpSeverityType.ts delete mode 100644 features/DesignCode/CardContent/CardContent.tsx delete mode 100644 features/DesignCode/DesignCode.constants.ts delete mode 100644 features/DesignCode/DesignCodeSource.tsx delete mode 100644 features/DesignCode/Filter/DesignCodeFilter.module.css delete mode 100644 features/DesignCode/Filter/DesignCodeFilter.state.ts delete mode 100644 features/DesignCode/Filter/DesignCodeFilter.tsx delete mode 100644 features/DesignCode/Filter/DesignCodeFilter.types.ts delete mode 100644 features/DesignCode/designCode.ts delete mode 100644 features/DesignCode/designCodeObject.ts delete mode 100644 features/EditObjectButtonLink/EditObjectButtonLink.tsx delete mode 100644 features/Facade/CardContent/Facade.module.css delete mode 100644 features/Facade/CardContent/Facade.tsx delete mode 100644 features/Facade/FacadeSource.tsx rename {components => features}/Footer/Footer.module.css (100%) rename {components => features}/Footer/Footer.tsx (100%) delete mode 100644 features/HouseAge/HouseAgeFilter.tsx delete mode 100644 features/HouseFloor/HouseFloorFilter.tsx delete mode 100644 features/HouseWearTear/HouseWearTearFilter.tsx delete mode 100644 features/Lines/CardContent/CardContent.tsx delete mode 100644 features/Lines/Filter/LinesFilter.module.css delete mode 100644 features/Lines/Filter/LinesFilter.state.ts delete mode 100644 features/Lines/Filter/LinesFilter.tsx delete mode 100644 features/Lines/Filter/LinesFilter.types.ts delete mode 100644 features/Lines/Lines.constants.ts delete mode 100644 features/Lines/LinesSource.tsx delete mode 100644 features/Lines/lineType.ts delete mode 100644 features/Lines/lines.ts delete mode 100644 features/Map/Map.tsx delete mode 100644 features/Map/helpers/colorLuminance.ts delete mode 100644 features/Map/helpers/getFeatureState.ts delete mode 100644 features/Map/helpers/useMapObjectState.ts delete mode 100644 features/Map/providers/MapProvider.tsx delete mode 100644 features/Map/providers/usePopup.ts delete mode 100644 features/OKN/CardContent/CardContent.module.css delete mode 100644 features/OKN/CardContent/CardContent.tsx delete mode 100644 features/OKN/CardContent/index.ts delete mode 100644 features/OKN/Filter/OknFilter.module.css delete mode 100644 features/OKN/Filter/OknFilter.state.ts delete mode 100644 features/OKN/Filter/OknFilter.tsx delete mode 100644 features/OKN/Okn.constants.ts delete mode 100644 features/OKN/OknSource.tsx delete mode 100644 features/OKN/okn.ts delete mode 100644 features/OKN/oknConstants.ts delete mode 100644 features/OKN/oknObject.ts delete mode 100644 features/Privacy/PrivacyPage.tsx delete mode 100644 features/Quarter/CardContent/CardContent.module.css delete mode 100644 features/Quarter/CardContent/CardContent.tsx delete mode 100644 features/Quarter/QuarterSource.tsx delete mode 100644 features/Quarter/quarter.ts delete mode 100644 features/Quarter/quarterObject.ts create mode 100644 helpers/isDesktop.tsx create mode 100644 public/ekb-crime.json create mode 100644 public/ekb-loader.svg rename public/{quarter_inspectors.json => ekb-quarters.json} (100%) delete mode 100644 public/okn-meta.json delete mode 100644 public/okn-static/placemarks.json delete mode 100644 shared/UI/Button/Button.module.css delete mode 100644 shared/UI/Button/Button.tsx delete mode 100644 shared/UI/ButtonLink/ButtonLink.module.css delete mode 100644 shared/UI/ButtonLink/ButtonLink.tsx delete mode 100644 shared/UI/Checkbox/Checkbox.module.css delete mode 100644 shared/UI/Checkbox/Checkbox.svg delete mode 100644 shared/UI/Checkbox/Checkbox.tsx delete mode 100644 shared/UI/Close/Close.module.css delete mode 100644 shared/UI/Close/Close.tsx delete mode 100644 shared/UI/Close/index.ts delete mode 100644 shared/UI/Icons/Auto.tsx delete mode 100644 shared/UI/Icons/Bike.tsx delete mode 100644 shared/UI/Icons/BrokenHeart.tsx delete mode 100644 shared/UI/Icons/Bycicle.tsx delete mode 100644 shared/UI/Icons/Children.tsx delete mode 100644 shared/UI/Icons/Copy.tsx delete mode 100644 shared/UI/Icons/Download.tsx delete mode 100644 shared/UI/Icons/DownloadIcon.tsx delete mode 100644 shared/UI/Icons/Edit.tsx delete mode 100644 shared/UI/Icons/External.tsx delete mode 100644 shared/UI/Icons/Heart.tsx delete mode 100644 shared/UI/Icons/Icons.constants.ts delete mode 100644 shared/UI/Icons/Icons.types.ts delete mode 100644 shared/UI/Icons/Link.tsx delete mode 100644 shared/UI/Icons/Pdf.tsx delete mode 100644 shared/UI/Icons/Pedestrian.tsx delete mode 100644 shared/UI/Icons/PublicTransport.tsx delete mode 100644 shared/UI/Icons/index.tsx delete mode 100644 shared/UI/Label/Label.module.css delete mode 100644 shared/UI/Label/Label.tsx delete mode 100644 shared/UI/Link/Link.module.css delete mode 100644 shared/UI/Link/Link.tsx delete mode 100644 shared/UI/Loader/FilterLoader.tsx delete mode 100644 shared/UI/Loader/Loader.tsx delete mode 100644 shared/UI/Modal/MobileModal.tsx delete mode 100644 shared/UI/RangeHistogram/RangeBaseFilter.tsx delete mode 100644 shared/UI/RangeHistogram/RangeHistogram.module.css delete mode 100644 shared/UI/RangeHistogram/RangeHistogram.tsx delete mode 100644 shared/UI/RangeHistogram/components/Axis.module.css delete mode 100644 shared/UI/RangeHistogram/components/Axis.tsx delete mode 100644 shared/UI/RangeHistogram/components/BarChart.module.css delete mode 100644 shared/UI/RangeHistogram/components/BarChart.tsx delete mode 100644 shared/UI/RangeHistogram/components/Slider.helpers.ts delete mode 100644 shared/UI/RangeHistogram/components/Slider.module.css delete mode 100644 shared/UI/RangeHistogram/components/Slider.tsx delete mode 100644 shared/UI/RangeHistogram/index.ts delete mode 100644 shared/UI/RangeHistogram/types.ts delete mode 100644 shared/UI/RangeHistogram/utils/index.ts delete mode 100644 shared/helpers/copy.ts delete mode 100644 shared/helpers/fetchApi.ts delete mode 100644 shared/helpers/getYearNameByValue.ts delete mode 100644 shared/helpers/hash.ts delete mode 100644 shared/helpers/isDesktop.ts delete mode 100644 shared/helpers/round.ts delete mode 100644 shared/helpers/useCopyHref.ts delete mode 100644 shared/helpers/useMatchMedia.ts create mode 100644 state/config.ts delete mode 100644 state/features/dataLayers.ts delete mode 100644 state/features/selectors.ts rename state/{index.ts => redux.ts} (54%) delete mode 100644 state/state.ts delete mode 100644 styles/modal.css delete mode 100644 types/Content.types.ts delete mode 100644 types/Filters.types.ts delete mode 100644 types/ObjectsBase.types.ts delete mode 100644 types/Sources.types.ts diff --git a/.eslintrc.json b/.eslintrc.json index bf30dcbd..f31a6b16 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -12,15 +12,16 @@ "project": "./tsconfig.json" }, "rules": { + "react-hooks/exhaustive-deps": "error", + "@next/next/no-img-element": "off", // TODO: remove this rule "@typescript-eslint/no-explicit-any": "off", // TODO: remove this rule "@typescript-eslint/ban-ts-comment": "off", - // TODO: remove this rule + "jsx-a11y/click-events-have-key-events": "off", - // TODO: remove this rule "jsx-a11y/no-static-element-interactions": "off", "no-irregular-whitespace": "off", @@ -56,7 +57,15 @@ { "from": "./types", "target": "./shared" }, { "from": "./state", "target": "./components" }, { "from": "./constants", "target": "./components" }, - { "from": "./features", "target": "./components" } + { "from": "./features", "target": "./components" }, + + { "from": "./constants", "target": "./map" }, + { "from": "./state", "target": "./map" }, + { "from": "./styles", "target": "./map" }, + { "from": "./shared", "target": "./map" }, + { "from": "./pages", "target": "./map" }, + { "from": "./features", "target": "./map" }, + { "from": "./components", "target": "./map" } ] } ] diff --git a/README.md b/README.md index 1e7e2ae7..73466144 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ The map contains layers of data about objects in the city so that urbanists can | Traffic collision | ⬇️ [dtp](https://github.com/ekaterinburgdev/map/blob/main/public/ekb-dtp.json) | ⬇️ [dtps](https://github.com/ekaterinburgdev/map/blob/main/public/ekb-dtps.json) | [dtp-stat.ru](https://dtp-stat.ru) | 🔄 | ✅ | | Touristic route (points) | ⬇️ [color-points](https://github.com/ekaterinburgdev/map/blob/main/public/ekb-color-points.json) | | [tourism.ekburg.ru](http://tourism.ekburg.ru) | — | ✅ | | Touristic route (lines) | ⬇️ [color-lines](https://github.com/ekaterinburgdev/map/blob/main/public/ekb-color-lines.json) | | [ekbredline.ru](http://ekbredline.ru) | — | ✅ | -| Quarter inspectors | ⬇️ [quarter_inspectors](https://github.com/ekaterinburgdev/map/blob/main/public/quarter_inspectors.json) | | [екатеринбург.рф](https://екатеринбург.рф/справка/квартальные) | — | ✅ | +| Quarter inspectors | ⬇️ [ekb-quarters](https://github.com/ekaterinburgdev/map/blob/main/public/ekb-quarters.json) | | [екатеринбург.рф](https://екатеринбург.рф/справка/квартальные) | — | ✅ | | Cultural heritage sites (objects) | ⬇️ [okn‑objects](https://github.com/ekaterinburgdev/map/blob/main/public/ekb-okn-objects.json) | ⬇️ [okn](https://github.com/ekaterinburgdev/map/blob/main/public/ekb-okn.json) | [okn.midural.ru](https://okn.midural.ru/karta-obektov-kulturnogo-naslediya-sverdlovskoy-oblasti.html) | — | 🚧 | | Cultural heritage sites (protect zone) | ⬇️ [okn‑protect](https://github.com/ekaterinburgdev/map/blob/main/public/ekb-okn-protect.json) | | [okn.midural.ru](https://okn.midural.ru/karta-obektov-kulturnogo-naslediya-sverdlovskoy-oblasti.html) | — | 🚧 | | Cultural heritage sites (security zone) | ⬇️ [okn‑security](https://github.com/ekaterinburgdev/map/blob/main/public/ekb-okn-security.json) | | [okn.midural.ru](https://okn.midural.ru/karta-obektov-kulturnogo-naslediya-sverdlovskoy-oblasti.html) | — | 🚧 | diff --git a/build-scripts/prepare-static/constants.mjs b/build-scripts/prepare-static/constants.mjs index d8ed5c1b..e20bf064 100644 --- a/build-scripts/prepare-static/constants.mjs +++ b/build-scripts/prepare-static/constants.mjs @@ -6,4 +6,4 @@ export const VERCEL_PUBLIC_IMAGES_PATH = `${VERCEL_PUBLIC_PATH}images/`; export const IMAGES_URLS_PATH = `${VERCEL_OUTPUT_PATH}images/`; -export const PLACEMARKS_CACHE_PATH = `${VERCEL_OUTPUT_PATH}placemarks.json`; \ No newline at end of file +export const PLACEMARKS_CACHE_PATH = `${VERCEL_OUTPUT_PATH}ekb-okn.json`; diff --git a/build-scripts/prepare-static/index.mjs b/build-scripts/prepare-static/index.mjs index 3c977415..125ba980 100644 --- a/build-scripts/prepare-static/index.mjs +++ b/build-scripts/prepare-static/index.mjs @@ -1,13 +1,17 @@ import https from 'node:https'; import fs from 'node:fs'; -import items from '../../public/ekb-okn.json' assert { type: "json" }; +import items from '../../public/ekb-okn.json' assert { type: 'json' }; import { resize, optimize } from './prepareImages.mjs'; -import { IMAGES_URLS_PATH, PLACEMARKS_CACHE_PATH, VERCEL_PUBLIC_IMAGES_PATH } from './constants.mjs'; +import { + IMAGES_URLS_PATH, + PLACEMARKS_CACHE_PATH, + VERCEL_PUBLIC_IMAGES_PATH, +} from './constants.mjs'; -const start = Date.now() +const start = Date.now(); async function init() { - console.log('Prepare images') + console.log('Prepare images'); await clearCachedImages(IMAGES_URLS_PATH); @@ -22,13 +26,13 @@ async function init() { .then(log('Optimize images')) .then(optimize) .catch(console.log); - - console.log('Save metadata') - await saveMetadata(PLACEMARKS_CACHE_PATH, items.features, images) - console.log(`Finish in ${(Date.now() - start) / 1000} seconds`) + console.log('Save metadata'); + await saveMetadata(PLACEMARKS_CACHE_PATH, items.features, images); + + console.log(`Finish in ${(Date.now() - start) / 1000} seconds`); } -init() +init(); async function clearCachedImages(path) { if (fs.existsSync(path)) { @@ -40,13 +44,13 @@ async function clearCachedImages(path) { function getImagesUrls(items) { return items.reduce((all, item) => { - const img = item.properties.img + const img = item.properties.img; if (Boolean(img)) { if (typeof img === 'string') { - return all.concat(img) + return all.concat(img); } - return all.concat(img.url) + return all.concat(img.url); } return all; }, []); @@ -113,7 +117,7 @@ async function saveMetadata(cachPath, items, images) { }, {}); const updatedItems = items.map((item) => { - const img = item.properties.img + const img = item.properties.img; if (Boolean(img)) { let guid = null; @@ -124,26 +128,36 @@ async function saveMetadata(cachPath, items, images) { guid = getGUID(img.url); const image = imagesById[guid]; - if(image) { + if (image) { return { ...item, - preview: { - id: image.id, - m: { - ...image.m, - src: `${VERCEL_PUBLIC_IMAGES_PATH}m_${image.path}`, - }, - s: { - ...image.s, - src: `${VERCEL_PUBLIC_IMAGES_PATH}s_${image.path}`, - }, - } - } + properties: { + ...item.properties, + preview: { + id: image.id, + m: { + ...image.m, + src: `${VERCEL_PUBLIC_IMAGES_PATH}m_${image.path}`, + }, + s: { + ...image.s, + src: `${VERCEL_PUBLIC_IMAGES_PATH}s_${image.path}`, + }, + }, + }, + }; } } return item; }); - fs.writeFileSync(cachPath, JSON.stringify(updatedItems)); -} \ No newline at end of file + fs.writeFileSync( + cachPath, + JSON.stringify({ + type: 'FeatureCollection', + name: 'ek-okn', + features: updatedItems, + }), + ); +} diff --git a/components/Card/Card.tsx b/components/Card/Card.tsx deleted file mode 100644 index c8312a96..00000000 --- a/components/Card/Card.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import React, { useEffect, useMemo, useState } from 'react'; -import styled from 'styled-components'; -import { ContentConfig, MapItemType } from 'types/Content.types'; -import { Loader } from 'shared/UI/Loader/Loader'; - -interface Props { - contentConfig: ContentConfig; - popupId?: string; - popupType: MapItemType | null; -} - -const CardLoaderContainer = styled.div` - position: relative; - height: 600px; -`; - -export function Card({ contentConfig, popupId, popupType }: Props) { - const [popupData, setPopupData] = useState(); - const [loading, setLoading] = useState(false); - - useEffect(() => { - async function fetchData() { - if (!popupId || !popupType) { - return; - } - - setLoading(true); - - const requestFunction = contentConfig[popupType].oneItemRequest; - - const data = await requestFunction(popupId); - - setPopupData(data); - setLoading(false); - } - - fetchData(); - }, [contentConfig, popupId, popupType]); - - const CardContent = useMemo(() => { - setLoading(true); - - return contentConfig[popupType]?.cardContent || (() => null); - }, [contentConfig, popupType]); - - return loading ? ( - - - - ) : ( - - ); -} diff --git a/components/Card/DesktopCard/DesktopCard.module.css b/components/Card/DesktopCard/DesktopCard.module.css deleted file mode 100644 index 54723f98..00000000 --- a/components/Card/DesktopCard/DesktopCard.module.css +++ /dev/null @@ -1,16 +0,0 @@ -.DesktopCard { - position: relative; - background: #1e2841 !important; - border-radius: 10px !important; - max-height: calc(90vh - 2vw) !important; - overflow-y: auto; - overflow-x: hidden; - - @mixin scroll; -} - -.DesktopCard__header { - position: absolute; - right: 0; - top: 0; -} diff --git a/components/Card/DesktopCard/DesktopCard.tsx b/components/Card/DesktopCard/DesktopCard.tsx deleted file mode 100644 index d2751952..00000000 --- a/components/Card/DesktopCard/DesktopCard.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react'; -import { Card } from 'components/Card/Card'; -import { Close } from 'shared/UI/Close'; -import { ContentConfig, MapItemType } from 'types/Content.types'; -import styles from './DesktopCard.module.css'; - -interface Props { - contentConfig: ContentConfig; - popupId?: string; - popupType: MapItemType | null; - closePopup: () => void; -} - -export function DesktopCard({ contentConfig, popupId, popupType, closePopup }: Props) { - if (!popupId) { - return <>; - } - - return ( -
-
- -
- -
- ); -} diff --git a/components/Card/MobileCard.tsx b/components/Card/MobileCard.tsx deleted file mode 100644 index ff2b41a4..00000000 --- a/components/Card/MobileCard.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import Sheet from 'react-modal-sheet'; -import * as React from 'react'; -import { Card } from 'components/Card/Card'; -import { ContentConfig, MapItemType } from 'types/Content.types'; - -interface Props { - contentConfig: ContentConfig; - popupId?: string; - popupType: MapItemType | null; - closePopup: () => void; -} - -export function MobileCard({ contentConfig, popupId, popupType, closePopup }: Props) { - return ( - - - - - - - - - - - ); -} diff --git a/components/Card/components/ConstructionInfo/ConstructionInfo.tsx b/components/Card/components/ConstructionInfo/ConstructionInfo.tsx deleted file mode 100644 index d45cf49e..00000000 --- a/components/Card/components/ConstructionInfo/ConstructionInfo.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import React, { useMemo } from 'react'; -import { getYearNameByValue } from 'shared/helpers/getYearNameByValue'; -import { Info } from 'components/Card/components/Info/Info'; - -const YEAR_RE = /\d{4}/; - -type ConstructionInfoProps = { - date: string; -}; - -export function ConstructionInfo({ date }: ConstructionInfoProps) { - const constructionDateInfo = useMemo(() => { - const result = [ - { - name: 'Когда построили', - text: date, - }, - ]; - - const constructionYearMatch = date.match(YEAR_RE); - - if (constructionYearMatch) { - const constructionYear = Number(constructionYearMatch[0]); - const age = new Date().getFullYear() - Number(constructionYear); - - result.push({ - name: 'Возраст здания', - text: `${String(age)} ${getYearNameByValue(age)}`, - }); - } - - return result; - }, [date]); - - return ( - - ); -} diff --git a/components/Card/components/Header/Header.module.css b/components/Card/components/Header/Header.module.css deleted file mode 100644 index c443ba4c..00000000 --- a/components/Card/components/Header/Header.module.css +++ /dev/null @@ -1,29 +0,0 @@ -.header { - display: flex; - flex-wrap: wrap; - column-gap: 4px; -} - -.header__title { - margin: 12px 0 0; - font-size: 30px; - font-weight: 500; - line-height: 1; -} - -.header__description { - margin: 4px 0 0; - font-size: 14px; - font-weight: 400; - line-height: 20px; -} - -@media screen and (width >= 1150px) { - .header__title { - font-size: 32px; - } - - .header__description { - font-size: 16px; - } -} diff --git a/components/Card/components/Header/Header.tsx b/components/Card/components/Header/Header.tsx deleted file mode 100644 index 45fd8886..00000000 --- a/components/Card/components/Header/Header.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import React, { useMemo } from 'react'; -import { IconType } from 'shared/UI/Icons/Icons.types'; -import { useCopyHref } from 'shared/helpers/useCopyHref'; -import { Label } from 'shared/UI/Label/Label'; -import styles from './Header.module.css'; - -export type HeaderProps = { - coordinates?: [number, number] | number[]; - title?: string; - description?: string; -}; - -const COPY_RESET_TIMEOUT = 2000; - -export function Header({ coordinates, title, description }: HeaderProps) { - const { isCopied: isLinkCopied, onCopy: onCopyLink } = useCopyHref( - window.location.href, - COPY_RESET_TIMEOUT, - ); - - const coordsString = useMemo(() => { - if (!coordinates) { - return null; - } - - const coords = Array.isArray(coordinates[0]) ? coordinates[0] : coordinates; - - return `${coords[0]?.toFixed(6)}, ${coords[1]?.toFixed(6)}`; - }, [coordinates]); - const { isCopied: isCoordsCopied, onCopy: onCopyCoords } = useCopyHref( - coordsString, - COPY_RESET_TIMEOUT, - ); - - return ( - <> -
- {coordsString && ( - - )} - -
-

{title}

- {description &&

{description}

} - - ); -} diff --git a/components/Card/components/Section/Section.module.css b/components/Card/components/Section/Section.module.css deleted file mode 100644 index a47616fe..00000000 --- a/components/Card/components/Section/Section.module.css +++ /dev/null @@ -1,11 +0,0 @@ -.block { - margin-top: 16px; - padding-top: 16px; - border-top: 1px solid rgba(256, 256, 256, 0.16); -} - -.block_inline { - display: flex; - flex-wrap: wrap; - gap: 8px; -} diff --git a/components/Card/components/Section/Section.tsx b/components/Card/components/Section/Section.tsx deleted file mode 100644 index 7c82e9cf..00000000 --- a/components/Card/components/Section/Section.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import React from 'react'; - -import styles from './Section.module.css'; - -export function Section({ children }: React.PropsWithChildren) { - return
{children}
; -} diff --git a/components/Card/components/Sources/Sources.module.css b/components/Card/components/Sources/Sources.module.css deleted file mode 100644 index 0b0938b7..00000000 --- a/components/Card/components/Sources/Sources.module.css +++ /dev/null @@ -1,30 +0,0 @@ -.sources { - display: flex; - gap: 4px; - flex-direction: column; -} - -.sources__title { - font-size: 16px; - line-height: 1.3; - font-weight: 400; - margin: 0; -} - -.sources__list { - margin: 0; - padding: 0; - display: flex; - flex-direction: column; - gap: 8px; -} - -.sources__listItem { - list-style: none; -} - -@media screen and (width >= 1440px) { - .sources__title { - font-size: 16px; - } -} diff --git a/components/Card/components/Sources/Sources.tsx b/components/Card/components/Sources/Sources.tsx deleted file mode 100644 index 074e20c6..00000000 --- a/components/Card/components/Sources/Sources.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import { Link } from 'shared/UI/Link/Link'; -import { SourceInfo } from 'types/Sources.types'; -import styles from './Sources.module.css'; - -export function Sources({ sources }: { sources: SourceInfo[] }) { - return ( -
-

Источники

-
    - {sources.map(({ link, name, data }) => { - return ( -
  • - -
  • - ); - })} -
-
- ); -} diff --git a/components/Card/index.ts b/components/Card/index.ts deleted file mode 100644 index 984b6544..00000000 --- a/components/Card/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { DesktopCard } from './DesktopCard/DesktopCard'; -export { MobileCard } from './MobileCard'; diff --git a/components/Filters/Filters.module.css b/components/Filters/Filters.module.css deleted file mode 100644 index ce4ab076..00000000 --- a/components/Filters/Filters.module.css +++ /dev/null @@ -1,57 +0,0 @@ -.filters__body { - display: flex; - flex-direction: column; - gap: 2px; - padding: 0.5em; - padding-right: 16px; - border-radius: 16px; - background: #1e2841; - font-size: 15px; - line-height: 1.33; - - @mixin scroll; -} - -.filters__item { - background: #141d34; -} - -.filters__item:first-child { - border-top-left-radius: 8px; - border-top-right-radius: 8px; -} - -.filters__item:last-child { - border-bottom-right-radius: 8px; - border-bottom-left-radius: 8px; -} - -.filters__notice { - margin-top: 12px; - margin-bottom: -4px; - padding: 12px 16px; - background: #3a4155; - color: #9c9ea8; - font-size: 14px; - border-radius: 4px; -} - -.filters__notice a { - text-decoration: underline; - - &:hover { - color: white; - } -} - -@media screen and (width >= 1440px) { - .filters__body { - font-size: 16px; - } -} - -@media screen and (width >= 1600px) { - .filters__body { - font-size: 17px; - } -} diff --git a/components/Filters/Filters.tsx b/components/Filters/Filters.tsx deleted file mode 100644 index 39d083ed..00000000 --- a/components/Filters/Filters.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import React from 'react'; -import { FilterConfigItem, FilterType } from 'types/Filters.types'; -import { Toggle } from 'components/Filters/components/Toggle/Toggle'; -import { Filter } from 'components/Filters/components/Filter/Filter'; -import styles from './Filters.module.css'; - -interface Props { - filters: Record; - activeFilter: FilterType; - onToggleClick: (type: FilterType) => void; -} - -export function Filters({ filters, activeFilter, onToggleClick }: Props) { - return ( -
- {(Object.entries(filters) as [FilterType, FilterConfigItem][]).map( - ([type, { component, title, isVerified }], idx) => { - const id = `id:${type}-${idx}`; - const isActive = type === activeFilter; - - return ( -
- - {component && ( - - {isActive ? component : null} - {!isVerified && ( -
- Данные берутся из публичных источников - и содержат неточности.{' '} - - Оставьте фидбек - -  — помогите улучшить карту. -
- )} -
- )} -
- ); - }, - )} -
- ); -} diff --git a/components/Filters/components/Filter/Filter.module.css b/components/Filters/components/Filter/Filter.module.css deleted file mode 100644 index 6c34a9ea..00000000 --- a/components/Filters/components/Filter/Filter.module.css +++ /dev/null @@ -1,24 +0,0 @@ -.filter { - position: relative; - padding: 0 16px; - opacity: 0; - box-sizing: content-box; - visibility: hidden; - max-height: 0; - will-change: padding; - transition: - opacity 0.15s ease, - padding-top 0.2s ease; - &:empty { - display: none; - } -} - -.filter_active { - margin: 0; - padding-top: 16px; - padding-bottom: 16px; - opacity: 1; - visibility: visible; - max-height: 100vh; -} diff --git a/components/Filters/components/Filter/Filter.tsx b/components/Filters/components/Filter/Filter.tsx deleted file mode 100644 index 34585408..00000000 --- a/components/Filters/components/Filter/Filter.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import React, { PropsWithChildren, useRef } from 'react'; -import classNames from 'classnames'; - -import styles from './Filter.module.css'; - -export interface FilterProps extends PropsWithChildren { - isActive: boolean; -} - -export function Filter({ children, isActive }: FilterProps) { - const spoilerRef = useRef(); - - return ( -
- {isActive && children} -
- ); -} diff --git a/components/Filters/components/Toggle/Toggle.module.css b/components/Filters/components/Toggle/Toggle.module.css deleted file mode 100644 index c3189e78..00000000 --- a/components/Filters/components/Toggle/Toggle.module.css +++ /dev/null @@ -1,85 +0,0 @@ -.toggle { - display: flex; - align-items: center; - justify-content: space-between; - gap: 0.75em; - position: relative; - cursor: pointer; - user-select: none; - transition: 0.15s ease; - padding: 0.75em 1em; - - --border-width: 2px; - - &:focus-within { - outline: 2px solid white; - border-radius: 2px; - } - - /* Remove outline on click */ - &:has(:focus:not(:focus-visible)) { - outline: none; - } -} - -@media (hover) { - .toggle:hover { - background: #11192d; - } -} - -.toggle:active { - background: #06112b; -} - -.toggle__control { - position: relative; - height: 24px; - width: 40px; - border-radius: 24px; - box-sizing: border-box; - border: #0f182e var(--border-width) solid; - background-color: #3a4154; - transition: 0.15s ease; - font-size: 9px; - - &:after { - content: ''; - position: absolute; - top: 0; - width: 20px; - height: 20px; - border-radius: 50%; - background-color: rgb(240, 240, 240); - transition: 0.15s ease; - } -} - -.toggle__background { - position: absolute; - opacity: 0; - cursor: pointer; - height: 0; - width: 0; - - &:checked ~ .toggle__control { - background-color: rgba(0, 180, 0, 0.75); - } - - &:checked ~ .toggle__control:after { - transform: translateX(calc(100% - 2 * var(--border-width))); - } - - &:not(:checked) ~ .toggle__control { - background-color: rgba(255, 255, 255, 0.16); - } - - &:not(:checked) ~ .toggle__control:after { - transform: translateX(0); - background: #9b9ea8; - } - - &:hover ~ .toggle__control:after { - background-color: rgb(245, 245, 245); - } -} diff --git a/components/Filters/components/Toggle/Toggle.tsx b/components/Filters/components/Toggle/Toggle.tsx deleted file mode 100644 index 75206c63..00000000 --- a/components/Filters/components/Toggle/Toggle.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import React, { useCallback } from 'react'; - -import { FilterType } from 'types/Filters.types'; - -import styles from './Toggle.module.css'; - -export interface ToggleProps { - id: string; - label: string; - onClick: (type: FilterType) => void; - type: FilterType; - isActive: boolean; -} - -export function Toggle({ id, label, onClick, type, isActive }: ToggleProps) { - const onChange = useCallback(() => { - onClick(type); - }, [type, onClick]); - - return ( - - ); -} diff --git a/components/Filters/index.ts b/components/Filters/index.ts deleted file mode 100644 index 194f6207..00000000 --- a/components/Filters/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { Filters } from './Filters'; diff --git a/components/LeftSidebar.tsx b/components/LeftSidebar.tsx deleted file mode 100644 index 0ed0f9b9..00000000 --- a/components/LeftSidebar.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import styled from 'styled-components'; - -export const LeftSidebar = styled.div` - width: 29%; - min-width: 340px; - max-width: 435px; - position: fixed; - top: 8px; - left: 8px; - z-index: 401; - display: flex; - flex-direction: column; - gap: 8px; - max-height: calc(100vh - 120px); -`; diff --git a/components/RightSidebar.tsx b/components/RightSidebar.tsx deleted file mode 100644 index 82e559bf..00000000 --- a/components/RightSidebar.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import styled from 'styled-components'; - -export const RightSidebar = styled.div` - width: 50%; - max-width: 400px; - position: fixed; - top: 8px; - right: 8px; - z-index: 401; - display: flex; - flex-direction: column; - gap: 8px; - max-height: calc(100vh - 120px); -`; diff --git a/constants/colors.ts b/constants/colors.ts deleted file mode 100644 index 6221a34b..00000000 --- a/constants/colors.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { MapItemType } from 'types/Content.types'; - -export const MARKER_COLOR = { - [MapItemType.DTP]: '#05B506', -}; - -export const DEFAULT_BULDING_COLOR_NORMAL = '#0c1021'; diff --git a/constants/map.ts b/constants/map.ts index 89bb642d..bdeb3b86 100644 --- a/constants/map.ts +++ b/constants/map.ts @@ -1,4 +1,3 @@ export const MIN_ZOOM = 11; export const MAX_ZOOM = 20; -export const BUILDING_LAYER_ID = 'building'; export const CENTER_COORDS: [number, number] = [60.605, 56.838011]; diff --git a/constants/sources.ts b/constants/sources.ts deleted file mode 100644 index 32c45a35..00000000 --- a/constants/sources.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { SourceType, SourcesConfig } from 'types/Sources.types'; - -export const SOURCES_BY_TYPE: SourcesConfig = { - [SourceType.osm]: { - name: 'OpenStreetMap', - link: 'https://www.openstreetmap.org/', - data: null, - }, - [SourceType.okn]: { - name: 'Объекты культурного наследия Свердловской области', - link: 'https://okn.midural.ru/kategorii/obekty-kulturnogo-naslediya-sverdlovskoy-oblasti', - data: null, - }, - [SourceType.howoldthishouse]: { - name: 'Карта возраста домов', - link: 'https://how-old-is-this.house/', - data: 'https://how-old-is-this.house/dataset?p=h-ekb', - }, - [SourceType.domaekb]: { - name: 'Жилые дома Екатеринбурга', - link: 'https://domaekb.ru', - data: null, - }, - [SourceType.mingkh]: { - name: 'МинЖКХ', - link: 'https://mingkh.ru', - data: null, - }, - [SourceType.ekaterinburgdesign]: { - name: 'Дизайн-код Ектеринбурга', - link: 'https://ekaterinburg.design', - data: 'https://ekaterinburg.design', - }, - [SourceType.dtp]: { - name: 'Карта ДТП', - link: 'https://dtp-stat.ru/', - data: 'https://dtp-stat.ru/opendata', - }, - [SourceType.ekb_quarter]: { - name: 'екатеринбург.рф', - link: 'https://екатеринбург.рф/справка/квартальные', - data: null, - }, - [SourceType.design_objects_map]: { - name: 'Карта объектов «Дизайн-кода»', - link: 'https://map.ekaterinburg.design', - data: 'https://map.ekaterinburg.design', - }, -}; diff --git a/features/About/AboutProjectContent.tsx b/features/About/AboutProjectContent.tsx index 69533a9b..3d3325a3 100644 --- a/features/About/AboutProjectContent.tsx +++ b/features/About/AboutProjectContent.tsx @@ -1,6 +1,6 @@ import Image from 'next/image'; import React from 'react'; -import { Button, ButtonSize, ButtonType } from 'shared/UI/Button/Button'; +import { Button, ButtonSize, ButtonType } from 'sloy-ui'; import { TeamGrid } from './Team/TeamGrid'; import styles from './AboutProjectModal.module.css'; import mapService from './map-service.svg'; @@ -167,12 +167,12 @@ export function AboutProjectContent() {

Присоединяйся к нам

); diff --git a/features/About/AboutProjectIcons/AboutProjectIcons.module.css b/features/About/AboutProjectIcons/AboutProjectIcons.module.css index fa5cdc30..0ffa1e07 100644 --- a/features/About/AboutProjectIcons/AboutProjectIcons.module.css +++ b/features/About/AboutProjectIcons/AboutProjectIcons.module.css @@ -4,6 +4,7 @@ right: 8px; z-index: 401; display: flex; + align-items: flex-end; gap: 4px; color: white; transition: 0.15s ease; @@ -14,14 +15,6 @@ height: 100%; } -.aboutProjectIcons__gh:hover { - filter: contrast(0.75); -} - -.aboutProjectIcons__gh:active { - filter: contrast(0.7); -} - @media screen and (width >= 1024px) { .aboutProjectIcons { top: auto; diff --git a/features/About/AboutProjectIcons/AboutProjectIcons.tsx b/features/About/AboutProjectIcons/AboutProjectIcons.tsx index 28fa981c..e2813905 100644 --- a/features/About/AboutProjectIcons/AboutProjectIcons.tsx +++ b/features/About/AboutProjectIcons/AboutProjectIcons.tsx @@ -1,36 +1,37 @@ -import React, { useContext } from 'react'; +import React, { useCallback, useState } from 'react'; import Image from 'next/image'; -import { Button, ButtonSize, ButtonType } from 'shared/UI/Button/Button'; -import { AboutProjectContext } from 'features/About/AboutProjectProvider'; +import { Button, ButtonSize, ButtonType } from 'sloy-ui'; +import { AboutProjectModal } from '../AboutProjectModal'; import styles from './AboutProjectIcons.module.css'; import githubLogo from './github-icon.svg'; export function AboutProjectIcons() { - const { open } = useContext(AboutProjectContext); + const [isOpened, setIsOpened] = useState(false); + + const open = useCallback(() => setIsOpened(true), []); + const close = useCallback(() => setIsOpened(false), []); return (
- github + github + +
); } diff --git a/features/About/AboutProjectModal.module.css b/features/About/AboutProjectModal.module.css index e1118f9e..fd3e71f8 100644 --- a/features/About/AboutProjectModal.module.css +++ b/features/About/AboutProjectModal.module.css @@ -111,3 +111,9 @@ background: rgba(0, 0, 0, 0.6); touch-action: none; } + +.aboutProjectModalClose { + position: absolute; + top: 16px; + right: 16px; +} diff --git a/features/About/AboutProjectModal.tsx b/features/About/AboutProjectModal.tsx index 5f364fad..8abd2ac9 100644 --- a/features/About/AboutProjectModal.tsx +++ b/features/About/AboutProjectModal.tsx @@ -1,11 +1,12 @@ -import React, { useContext, useEffect } from 'react'; +import React, { useEffect } from 'react'; +import { IconType, SheetModal } from 'sloy-ui'; +import { Icon } from 'sloy-ui'; import { AboutProjectContent } from 'features/About/AboutProjectContent'; -import { AboutProjectContext } from 'features/About/AboutProjectProvider'; -import { Close } from 'shared/UI/Close'; +import { useIsDesktop } from 'helpers/isDesktop'; import styles from './AboutProjectModal.module.css'; -export function AboutProjectModal() { - const { close, isOpened } = useContext(AboutProjectContext); +export function AboutProjectModal({ close, isOpened }: { close: VoidFunction; isOpened: boolean }) { + const isDesktop = useIsDesktop(); useEffect(() => { const handleKeyDown = (e) => { @@ -21,10 +22,20 @@ export function AboutProjectModal() { if (!isOpened) return null; + if (!isDesktop) { + return ( + + + + ); + } + return ( <>
- +
+ +
diff --git a/features/About/AboutProjectProvider.tsx b/features/About/AboutProjectProvider.tsx deleted file mode 100644 index a6f6534e..00000000 --- a/features/About/AboutProjectProvider.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import React, { createContext, ReactNode, useMemo, useState } from 'react'; - -export interface IAboutProjectContext { - isOpened: boolean; - open: VoidFunction; - close: VoidFunction; -} - -export const AboutProjectContext = createContext({ - isOpened: false, - open: () => {}, - close: () => {}, -}); - -interface Props { - children: ReactNode; -} - -export function AboutProjectProvider({ children }: Props) { - const [isOpened, setIsOpened] = useState(false); - - const value = useMemo( - (): IAboutProjectContext => ({ - isOpened, - open: () => setIsOpened(true), - close: () => setIsOpened(false), - }), - [isOpened], - ); - - return {children}; -} diff --git a/features/About/MobileAboutProject.tsx b/features/About/MobileAboutProject.tsx deleted file mode 100644 index ee9f669c..00000000 --- a/features/About/MobileAboutProject.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import Sheet from 'react-modal-sheet'; -import * as React from 'react'; -import { useContext } from 'react'; -import { AboutProjectContent } from 'features/About/AboutProjectContent'; -import { AboutProjectContext } from 'features/About/AboutProjectProvider'; - -export function MobileAboutProject() { - const { isOpened, close } = useContext(AboutProjectContext); - - return ( - - - - - - - - - - - ); -} diff --git a/features/App.tsx b/features/App.tsx new file mode 100644 index 00000000..0bfe0984 --- /dev/null +++ b/features/App.tsx @@ -0,0 +1,96 @@ +'use client'; + +import React, { useCallback, useEffect, useState } from 'react'; +import { ThemeProvider } from 'styled-components'; +import { Provider } from 'react-redux'; +import { SloyMap, ILayer, OverrideLayersFn, internalTranslations } from 'sloy-map'; +import { defaultTheme } from 'sloy-ui'; +import { store } from 'state/redux'; +import { AboutProjectIcons } from 'features/About/AboutProjectIcons/AboutProjectIcons'; +import { Footer } from 'features/Footer/Footer'; +import { copyrights, defaultLayers, defaultMapState, defaultSources } from 'state/config'; +import ekbLoader from 'public/ekb-loader.svg'; +import { overrideCard } from './CustomCardContent/overrideCard'; +import { QuarterFilter } from './CustomFilterContent/QuarterFilter'; +import { FacadeFilter } from './CustomFilterContent/FacadeFilter'; +import { getHouseMeta } from './Buildings/houseBase'; + +import 'sloy-map/style.css'; + +function AppMap() { + const [finalSources, setFinalSources] = useState(defaultSources); + const overrideLayers: OverrideLayersFn = useCallback((layer: ILayer) => { + switch (layer.id) { + case 'ekbQuarter': + return ; + case 'ekbFacades': + return ; + default: + return null; + } + }, []); + + useEffect(() => { + getHouseMeta().then((houseMeta) => { + const setProperties = (properties, fields) => + properties.map((p) => { + if (fields[p.id]) { + return { + ...p, + range: p.range.map((item, i) => ({ + ...item, + value: houseMeta[fields[p.id]][i] || 0, + })), + }; + } + + return p; + }); + + setFinalSources( + finalSources.map((s) => { + if (s.id === 'osmBuilding') { + return { + ...s, + properties: setProperties(s.properties, { + 'building:year': 'years', + 'building:levels': 'levels', + 'building:health': 'health', + }), + }; + } + + return s; + }), + ); + }); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + + return ( + + ); +} + +export default function App() { + return ( + + + + +