Skip to content

Commit

Permalink
use sloy-map
Browse files Browse the repository at this point in the history
  • Loading branch information
gcor committed Mar 8, 2024
1 parent ec48a3e commit 1b4edb5
Show file tree
Hide file tree
Showing 213 changed files with 47,922 additions and 10,333 deletions.
15 changes: 12 additions & 3 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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" }
]
}
]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) || 🚧 |
Expand Down
2 changes: 1 addition & 1 deletion build-scripts/prepare-static/constants.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
export const PLACEMARKS_CACHE_PATH = `${VERCEL_OUTPUT_PATH}ekb-okn.json`;
70 changes: 42 additions & 28 deletions build-scripts/prepare-static/index.mjs
Original file line number Diff line number Diff line change
@@ -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);

Expand All @@ -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)) {
Expand All @@ -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;
}, []);
Expand Down Expand Up @@ -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;
Expand All @@ -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));
}
fs.writeFileSync(
cachPath,
JSON.stringify({
type: 'FeatureCollection',
name: 'ek-okn',
features: updatedItems,
}),
);
}
53 changes: 0 additions & 53 deletions components/Card/Card.tsx

This file was deleted.

16 changes: 0 additions & 16 deletions components/Card/DesktopCard/DesktopCard.module.css

This file was deleted.

27 changes: 0 additions & 27 deletions components/Card/DesktopCard/DesktopCard.tsx

This file was deleted.

30 changes: 0 additions & 30 deletions components/Card/MobileCard.tsx

This file was deleted.

38 changes: 0 additions & 38 deletions components/Card/components/ConstructionInfo/ConstructionInfo.tsx

This file was deleted.

29 changes: 0 additions & 29 deletions components/Card/components/Header/Header.module.css

This file was deleted.

Loading

1 comment on commit 1b4edb5

@ekbdev
Copy link

@ekbdev ekbdev commented on 1b4edb5 Mar 8, 2024

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-7vr9x02iz-ekbdev.vercel.app
https://ekbdev-map-refactor3.vercel.app

Built with commit 1b4edb5.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.