Skip to content

Commit

Permalink
Add download button, fix copyright
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigoriiPrudnikov committed Nov 19, 2023
1 parent a77cc3d commit 715e8fe
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 29 deletions.
13 changes: 7 additions & 6 deletions components/Layers/Filters.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,37 @@ export const FILTERS_CONFIG: FilterConfig = {
[FilterType.HouseAge]: {
title: 'Возраст домов',
component: <HouseAgeFilter />,
source: SOURCES_BY_TYPE.howoldthishouse,
source: [SOURCES_BY_TYPE.howoldthishouse],
isVerified: false,
},
[FilterType.HouseFloor]: {
title: 'Этажность домов',
component: <HouseFloorFilter />,
source: SOURCES_BY_TYPE.howoldthishouse,
source: [SOURCES_BY_TYPE.mingkh, SOURCES_BY_TYPE.howoldthishouse],
isVerified: false,
},
[FilterType.HouseWearTear]: {
title: 'Степень износа домов',
component: <HouseWearTearFilter />,
source: SOURCES_BY_TYPE.howoldthishouse,
source: [SOURCES_BY_TYPE.mingkh, SOURCES_BY_TYPE.howoldthishouse],
isVerified: false,
},
[FilterType.OKN]: {
title: 'Объекты культурного наследия',
component: <OknFilter />,
source: SOURCES_BY_TYPE.okn,
source: [SOURCES_BY_TYPE.okn],
isVerified: false,
},
[FilterType.DesignCode]: {
title: '«Дизайн-код Екатеринбурга»',
component: <DesignCodeFilter />,
source: SOURCES_BY_TYPE.ekaterinburgdesign,
source: [SOURCES_BY_TYPE.ekaterinburgdesign],
isVerified: true,
},
[FilterType.DTP]: {
title: 'ДТП',
component: <DTPFilter />,
source: SOURCES_BY_TYPE.dtp,
source: [SOURCES_BY_TYPE.dtp],
isVerified: true,
},
[FilterType.Line]: {
Expand All @@ -55,6 +55,7 @@ export const FILTERS_CONFIG: FilterConfig = {
[FilterType.Quarter]: {
title: 'Квартальные',
component: <QuarterFilter />,
source: [SOURCES_BY_TYPE.ekb_quarter],
isVerified: true,
},
[FilterType.HouseFacades]: {
Expand Down
25 changes: 15 additions & 10 deletions components/Layers/Houses/CardContent/CardContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ import { HouseObject } from 'components/Layers/Houses/houseBase';
import { MapContext } from 'components/Map/providers/MapProvider';
import { usePopup } from 'components/Map/providers/usePopup';
import { ConstructionInfo } from 'components/UI/Card/components/ConstructionInfo/ConstructionInfo';
import DownloadButton from 'components/UI/Card/components/DownloadButton/DownloadButton';
import { Header } from 'components/UI/Card/components/Header/Header';
import { Info } from 'components/UI/Card/components/Info/Info';
import { Label } from 'components/UI/Card/components/Label/Label';
import { Section } from 'components/UI/Card/components/Section/Section';
import { Sources } from 'components/UI/Card/components/Sources/Sources';
import { EditObjectButtonLink } from 'components/UI/EditObjectButtonLink/EditObjectButtonLink';
import { FilterLoader } from 'components/UI/Filters/components/Loader/FilterLoader';
import { Link } from 'components/UI/Card/components/Link/Link';
import { getLatLngFromHash } from 'helpers/hash';
import HealthProgress from '../HealthProgress/HealthProgress';
import facades from '../../../../public/ekb-facades.json';
import HealthProgress from '../HealthProgress/HealthProgress';
import styles from './CardContent.module.css';

export function HousesCardContent() {
Expand Down Expand Up @@ -125,21 +125,20 @@ export function HousesCardContent() {
});
}

const facade = facades[placemark?.attributes?.osmId];
if (facade) {
result.push({
name: 'Фасад',
text: <Link href={facade.link} text="Скачать макет" />,
});
}
// const facade = facades[placemark?.attributes?.osmId];
// if (facade) {
// result.push({
// name: 'Фасад',
// text: <DownloadButton type="primary" facade={facade} />,
// });
// }

return result;
}, [
placemark?.attributes?.Management_company,
placemark?.attributes?.WearAndTear,
placemark?.attributes?.Series,
placemark?.attributes?.Floors,
placemark?.attributes?.osmId,
isEmergency,
]);

Expand Down Expand Up @@ -178,6 +177,12 @@ export function HousesCardContent() {
<ConstructionInfo date={String(placemark?.attributes.Year)} />
</Section>
)}

{facades[placemark?.attributes?.osmId] && (
<Section>
<DownloadButton type="primary" facade={facades[placemark?.attributes?.osmId]} />
</Section>
)}
<Section>
<Sources sources={['howoldthishouse', 'mingkh', 'domaekb']} />
</Section>
Expand Down
2 changes: 1 addition & 1 deletion components/Layers/Quarter/CardContent/CardContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function QuarterCardContent({ placemark }: QuarterCardContentProps) {
</Section>

<Section>
<Sources sources={['ekb']} />
<Sources sources={['ekb_quarter']} />
</Section>
<Section>
<div className={sectionStyles.block_inline}>
Expand Down
1 change: 0 additions & 1 deletion components/Map/layers/BuildingSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { MapItemType } from 'types/map-item';
import facades from '../../../public/ekb-facades-design-code.json';
import useMapObjectState from '../providers/useMapObjectState';
import { usePopup } from '../providers/usePopup';
// import { map } from 'lodash'

const BUILDING_LAYER_ID = 'building';

Expand Down
17 changes: 9 additions & 8 deletions components/UI/Copyright/Copyright.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ export function Copyright() {
<a href="https://www.openstreetmap.org/" target="_blank" rel="noreferrer">
OpenStreetMap
</a>
{copyright && (
<>
{' · '}
<a href={copyright.link} target="_blank" rel="noreferrer">
{new URL(copyright.link).host}
</a>
</>
)}
{copyright &&
copyright.map((elem) => (
<>
{' · '}
<a href={elem.link} target="_blank" rel="noreferrer">
{elem.name}
</a>
</>
))}
</div>
);
}
4 changes: 2 additions & 2 deletions constants/sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ export const SOURCES_BY_TYPE = {
},
ekaterinburgdesign: {
name: 'Дизайн-код Ектеринбурга',
link: 'https://ekaterinburg.design',
link: 'https://map.ekaterinburg.design',
data: 'https://map.ekaterinburg.design/api/map',
},
dtp: {
name: 'Карта ДТП',
link: 'https://dtp-stat.ru/',
data: 'https://dtp-stat.ru/opendata',
},
ekb: {
ekb_quarter: {
name: 'екатеринбург.рф',
link: 'https://екатеринбург.рф/справка/квартальные',
data: null,
Expand Down
2 changes: 1 addition & 1 deletion types/Filters.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export enum FilterType {
export interface FilterConfigItem {
title: string;
component: ReactNode;
source?: Source;
source?: Source[];
isVerified: boolean;
}

Expand Down

1 comment on commit 715e8fe

@ekbdev
Copy link

@ekbdev ekbdev commented on 715e8fe Nov 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for map ready!

✅ Preview
https://map-7smvf9pc0-ekbdev.vercel.app
https://ekbdev-map-facades.vercel.app

Built with commit 715e8fe.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.