diff --git a/.eslintrc.json b/.eslintrc.json index 2a634d3b..9f3ea61f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -57,6 +57,9 @@ { "from": "./state", "target": "./components" }, { "from": "./constants", "target": "./components" }, { "from": "./features", "target": "./components" } + + // { "from": "./features", "target": "./map" }, + // { "from": "./components", "target": "./map" } ] } ] diff --git a/components/Card/Card.tsx b/components/Card/Card.tsx deleted file mode 100644 index cdbdbe84..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 { AnimatedLogo } from 'ekb'; -import { ContentConfig, MapItemType } from 'types/Content.types'; - -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.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 52ea9413..00000000 --- a/components/Card/MobileCard.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { SheetModal } from 'ekb'; -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 d63477e6..00000000 --- a/components/Card/components/Header/Header.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import React, { useMemo } from 'react'; -import { Button, ButtonSize, ButtonType } from 'ekb'; -import { Icon } from 'shared/UI/Icons'; -import { IconType } from 'shared/UI/Icons/Icons.types'; -import { useCopyHref } from 'shared/helpers/useCopyHref'; -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/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.tsx b/components/Filters/Filters.tsx deleted file mode 100644 index 854f1374..00000000 --- a/components/Filters/Filters.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import React from 'react'; -import styled from 'styled-components'; -import { Accordion, AccordionItem, Link, LinkSize } from 'ekb'; -import { FilterConfigItem, FilterType } from 'types/Filters.types'; - -interface Props { - filters: Record; - activeFilter: FilterType; - onToggleClick: (type: FilterType) => void; -} - -const Notice = styled.div` - margin-top: 12px; - padding: 12px 16px; - background: #3a4155; - color: #9c9ea8; - font-size: 14px; - border-radius: 4px; -`; - -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; - const toggle = () => onToggleClick(type); - - return ( - - {component && ( - <> - {isActive ? component : null} - {!isVerified && ( - - Данные берутся из публичных источников - и содержат неточности.{' '} - - Оставьте фидбек - -  — помогите улучшить карту. - - )} - - )} - - ); - }, - )} - - ); -} 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/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/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/App/App.tsx b/features/App.tsx similarity index 76% rename from features/App/App.tsx rename to features/App.tsx index 663fe805..a23011fe 100644 --- a/features/App/App.tsx +++ b/features/App.tsx @@ -5,11 +5,10 @@ import { store } from 'state'; import { AboutProjectIcons } from 'features/About/AboutProjectIcons/AboutProjectIcons'; import { AboutProjectProvider } from 'features/About/AboutProjectProvider'; import { Copyright } from 'features/Copyright/Copyright'; -import { MapContextProvider } from 'features/Map/providers/MapProvider'; +import { MapContextProvider } from 'map/state/MapProvider'; import { Footer } from 'components/Footer/Footer'; -import { Map } from 'features/Map/Map'; -import { FILTERS_CONFIG } from './Filters.config'; -import { Sidebars } from './Sidebars'; +import { Map } from 'map/Map'; +import { Sidebars } from 'map/components/Sidebars'; export default function App() { return ( @@ -19,7 +18,7 @@ export default function App() { - +