Skip to content

Commit

Permalink
fix: scan cells
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Mar 14, 2024
1 parent 5b78be4 commit b6b45ca
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/features/scanCell/ScanCellPopup.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
import * as React from 'react'
import Typography from '@mui/material/Typography'
import { Trans, useTranslation } from 'react-i18next'
import { useTranslation } from 'react-i18next'

import { ErrorBoundary } from '@components/ErrorBoundary'
import { getTimeUntil } from '@utils/getTimeUntil'
Expand All @@ -27,7 +27,7 @@ export function ScanCellPopup({ id, updated }) {
return (
<ErrorBoundary noRefresh variant="h5">
<Typography variant="h6" align="center">
<Trans i18nKey="s2_cell_level">{{ level: 15 }}</Trans>
{t('s2_cell_level', { level: 15 })}
</Typography>
<Typography variant="subtitle2" align="center">
{timer.str.replace('days', t('days')).replace('day', t('day'))}
Expand Down
5 changes: 4 additions & 1 deletion src/features/scanCell/ScanCellTile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import { scanCellMarker } from './scanCellMarker'
* @returns
*/
const BaseScanCellTile = (scanCell) => (
<Polygon positions={scanCell.polygon} {...scanCellMarker(scanCell.updated)}>
<Polygon
positions={scanCell.polygon}
{...scanCellMarker(Date.now() / 1000 - scanCell.updated)}
>
<Popup position={[scanCell.center_lat, scanCell.center_lon]}>
<ScanCellPopup {...scanCell} />
</Popup>
Expand Down
3 changes: 1 addition & 2 deletions src/features/scanCell/scanCellMarker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
export 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(''),
fillColor: `hsl(${hue}, 100%, 50%)`,
color: 'black',
opacity: 0.75,
fillOpacity: 0.5,
Expand Down

0 comments on commit b6b45ca

Please sign in to comment.