diff --git a/src/components/markers/s2cell.js b/src/components/markers/s2cell.js deleted file mode 100644 index bb8395ad2..000000000 --- a/src/components/markers/s2cell.js +++ /dev/null @@ -1,13 +0,0 @@ -export default function s2cellMarker(cellUpdated) { - const ago = new Date().getTime() - cellUpdated * 1000 - const value = ago <= 150000 ? 0 : Math.min((ago - 150000) / 750000, 1) - const hue = ((1 - value) * 120).toString(10) - - return { - fillColor: ['hsl(', hue, ',100%,50%)'].join(''), - color: 'black', - opacity: 0.75, - fillOpacity: 0.5, - weight: 0.5, - } -} diff --git a/src/components/markers/scanCell.js b/src/components/markers/scanCell.js new file mode 100644 index 000000000..97456d0d7 --- /dev/null +++ b/src/components/markers/scanCell.js @@ -0,0 +1,12 @@ +export default function scanCellMarker(ago) { + const value = ago <= 1050 ? 0 : Math.min((ago - 1050) / 750, 1) + const hue = ((1 - value) * 120).toString(10) + + return { + fillColor: ['hsl(', hue, ',100%, 50%)'].join(''), + color: 'black', + opacity: 0.75, + fillOpacity: 0.5, + weight: 0.5, + } +} diff --git a/src/components/popups/S2cell.jsx b/src/components/popups/ScanCell.jsx similarity index 95% rename from src/components/popups/S2cell.jsx rename to src/components/popups/ScanCell.jsx index 8510753cd..b9bc5e0e2 100644 --- a/src/components/popups/S2cell.jsx +++ b/src/components/popups/ScanCell.jsx @@ -4,7 +4,7 @@ import { Trans, useTranslation } from 'react-i18next' import Utility from '@services/Utility' -export default function S2CellPopup({ cell, ts }) { +export default function ScanCellPopup({ cell, ts }) { const { t } = useTranslation() const { id, updated } = cell const lastUpdated = new Date(updated * 1000) diff --git a/src/components/tiles/ScanCell.jsx b/src/components/tiles/ScanCell.jsx index c21c1e624..d9ec4bed5 100644 --- a/src/components/tiles/ScanCell.jsx +++ b/src/components/tiles/ScanCell.jsx @@ -1,12 +1,12 @@ import React, { memo } from 'react' import { Polygon, Popup } from 'react-leaflet' -import PopupContent from '../popups/S2cell' -import marker from '../markers/s2cell' +import PopupContent from '../popups/ScanCell' +import marker from '../markers/scanCell' -const S2cellTile = ({ item, config, zoom, ts }) => +const ScanCellTile = ({ item, config, zoom, ts }) => zoom >= config.scanCellsZoom && ( - + @@ -18,4 +18,4 @@ const areEqual = (prev, next) => prev.item.updated === next.item.updated && prev.zoom === next.zoom -export default memo(S2cellTile, areEqual) +export default memo(ScanCellTile, areEqual)