Skip to content

Commit

Permalink
Merge pull request #107 from ekaterinburgdev/change-tiles-server
Browse files Browse the repository at this point in the history
use new tile server + add house meta
  • Loading branch information
gcor authored Sep 26, 2023
2 parents bf0cd17 + 2ac4a2e commit 0466a97
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
1 change: 0 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
},
"rules": {
"indent": ["error", 4, { "SwitchCase": 1 }],
"no-console": ["error", { "allow": ["error"] }],
"no-param-reassign": ["error", { "props": false }],
"no-plusplus": "off",
"implicit-arrow-linebreak": "off",
Expand Down
17 changes: 16 additions & 1 deletion components/Layers/Houses/houseBase.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
import { HistogramDataWithoutValues } from 'components/UI/RangeHistogram';
import houseMeta from '../../../public/houses-meta.json';
import { HouseSourceType } from './Houses.constants';

type Meta = Record<string, number | null>;

let cache: Meta = null;
async function getHouseMeta(): Promise<Meta> {
return fetch('https://map-backend.netlify.app/house-meta.json')
.then((res) => res.json())
.then((data) => ({
years: data.years.map((item) => item.count || null),
levels: data.levels.map((item) => item.count || null),
health: data.health.map((item) => item.count || null),
}));
}

export const houseBase = {
async getFilterValues(_: HistogramDataWithoutValues, filterName: HouseSourceType) {
const houseMeta = cache || (await getHouseMeta());
cache = houseMeta;

switch (filterName) {
case HouseSourceType.Year:
return Promise.resolve(houseMeta.years);
Expand Down
2 changes: 1 addition & 1 deletion components/Map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function Map() {
maxZoom={20}
// hash
style={{ width: '100vw', height: '100vh', color: 'black' }}
mapStyle="https://cartography-zeta.vercel.app/style.json"
mapStyle="https://map-backend.netlify.app/style.json"
// @ts-ignore
mapLib={maplibregl}
antialias
Expand Down
1 change: 0 additions & 1 deletion public/house-meta.json

This file was deleted.

1 change: 0 additions & 1 deletion public/houses-meta.json

This file was deleted.

0 comments on commit 0466a97

Please sign in to comment.