mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-02-23 18:14:19 -08:00
review fixes, and fix for automated build
This commit is contained in:
parent
97eba04f53
commit
cb1ecb1614
8 changed files with 38 additions and 34 deletions
2
.github/workflows/build_deploy.yml
vendored
2
.github/workflows/build_deploy.yml
vendored
|
@ -39,6 +39,8 @@ jobs:
|
||||||
echo "DESTINATION_FOLDER=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
|
echo "DESTINATION_FOLDER=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
|
||||||
- name: Install
|
- name: Install
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build --if-present
|
run: npm run build --if-present
|
||||||
- name: Get directory contents
|
- name: Get directory contents
|
||||||
|
|
|
@ -48,7 +48,7 @@ const MapPopup = ({map, selectedFeature, position}: IMapPopupProps) => {
|
||||||
}, [position]);
|
}, [position]);
|
||||||
|
|
||||||
const getCategorization = (percentile: number) => {
|
const getCategorization = (percentile: number) => {
|
||||||
let categorization = '';
|
let categorization;
|
||||||
if (percentile >= 0.75 ) {
|
if (percentile >= 0.75 ) {
|
||||||
categorization = 'Prioritized';
|
categorization = 'Prioritized';
|
||||||
} else if (0.60 <= percentile && percentile < 0.75) {
|
} else if (0.60 <= percentile && percentile < 0.75) {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
font-family: monospace;
|
font-family: monospace;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 300;
|
top: 300px;
|
||||||
left: 0;
|
left: 0;
|
||||||
margin: 12px;
|
margin: 12px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
/* eslint-disable no-unused-vars */
|
/* eslint-disable no-unused-vars */
|
||||||
import React, {useRef, useEffect, useState} from 'react';
|
import React, {useRef, useEffect, useState} from 'react';
|
||||||
import {Map, NavigationControl, Popup, MapLayerMouseEvent, Coordinate} from 'mapbox-gl';
|
import {Map, NavigationControl} from 'mapbox-gl';
|
||||||
import * as styles from './mapboxMap.module.scss';
|
import * as styles from './mapboxMap.module.scss';
|
||||||
import mapStyle from '../data/mapStyle';
|
import mapStyle from '../data/mapStyle';
|
||||||
import ZoomWarning from './zoomWarning';
|
import ZoomWarning from './zoomWarning';
|
||||||
|
|
||||||
const MapboxMap = () => {
|
const MapboxMap = () => {
|
||||||
const mapContainer = React.useRef<HTMLDivElement>(null);
|
const mapContainer = React.useRef<HTMLDivElement>(null);
|
||||||
const map = useRef<Map>() as React.MutableRefObject<Map>; ;
|
const map = useRef<Map>() as React.MutableRefObject<Map>;
|
||||||
const [lng, setLng] = useState(-86.502136);
|
const [lng, setLng] = useState(-86.502136);
|
||||||
const [lat, setLat] = useState(32.4687126);
|
const [lat, setLat] = useState(32.4687126);
|
||||||
const [zoom, setZoom] = useState(3);
|
const [zoom, setZoom] = useState(3);
|
||||||
|
|
|
@ -13,9 +13,12 @@ import ZoomWarning from './zoomWarning';
|
||||||
import MapPopup from './mapPopup';
|
import MapPopup from './mapPopup';
|
||||||
import * as styles from './openlayersMap.module.scss';
|
import * as styles from './openlayersMap.module.scss';
|
||||||
|
|
||||||
|
const DEFAULT_ZOOM = 4;
|
||||||
|
const DEFAULT_US_CENTER = [-86.502136, 32.4687126];
|
||||||
|
|
||||||
interface IMapWrapperProps {
|
interface IMapWrapperProps {
|
||||||
features: Feature<Geometry>[],
|
features: Feature<Geometry>[],
|
||||||
};
|
}
|
||||||
|
|
||||||
// The below adapted from
|
// The below adapted from
|
||||||
// https://taylor.callsen.me/using-openlayers-with-react-functional-components/
|
// https://taylor.callsen.me/using-openlayers-with-react-functional-components/
|
||||||
|
@ -38,7 +41,7 @@ const MapWrapper = ({features}: IMapWrapperProps) => {
|
||||||
|
|
||||||
useEffect( () => {
|
useEffect( () => {
|
||||||
const view = new View({
|
const view = new View({
|
||||||
center: fromLonLat([-86.502136, 32.4687126]),
|
center: fromLonLat(DEFAULT_US_CENTER),
|
||||||
zoom: 4,
|
zoom: 4,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -52,7 +55,7 @@ const MapWrapper = ({features}: IMapWrapperProps) => {
|
||||||
view: view,
|
view: view,
|
||||||
controls: [],
|
controls: [],
|
||||||
});
|
});
|
||||||
const currentZoom = Math.floor(initialMap.getView().getZoom()!);
|
const currentZoom = Math.floor(initialMap.getView().getZoom() || DEFAULT_ZOOM);
|
||||||
|
|
||||||
initialMap.on('moveend', handleMoveEnd);
|
initialMap.on('moveend', handleMoveEnd);
|
||||||
initialMap.on('click', handleMapClick);
|
initialMap.on('click', handleMapClick);
|
||||||
|
@ -82,7 +85,7 @@ const MapWrapper = ({features}: IMapWrapperProps) => {
|
||||||
}
|
}
|
||||||
}, [features]);
|
}, [features]);
|
||||||
|
|
||||||
const handleMapClick = (event: { pixel: any; }) => {
|
const handleMapClick = (event: { pixel: any }) => {
|
||||||
const clickedCoord = mapRef.current.getCoordinateFromPixel(event.pixel);
|
const clickedCoord = mapRef.current.getCoordinateFromPixel(event.pixel);
|
||||||
|
|
||||||
mapRef.current.forEachFeatureAtPixel(event.pixel, (feature) => {
|
mapRef.current.forEachFeatureAtPixel(event.pixel, (feature) => {
|
||||||
|
@ -94,7 +97,7 @@ const MapWrapper = ({features}: IMapWrapperProps) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleMoveEnd = () => {
|
const handleMoveEnd = () => {
|
||||||
const newZoom = Math.floor(mapRef.current.getView().getZoom()!);
|
const newZoom = Math.floor(mapRef.current.getView().getZoom() || DEFAULT_ZOOM);
|
||||||
if (currentZoom != newZoom) {
|
if (currentZoom != newZoom) {
|
||||||
setCurrentZoom(newZoom);
|
setCurrentZoom(newZoom);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,12 +7,11 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
position:absolute;
|
position: absolute;
|
||||||
top:50%;
|
top: 50%;
|
||||||
left:20%;
|
left: 20%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.zoomWarning > img {
|
.zoomWarning > img {
|
||||||
filter: invert(100%);
|
filter: invert(100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ declare namespace ZoomWarningModuleScssNamespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare const ZoomWarningModuleScssModule: ZoomWarningModuleScssNamespace.IZoomWarningModuleScss & {
|
declare const ZoomWarningModuleScssModule: ZoomWarningModuleScssNamespace.IZoomWarningModuleScss & {
|
||||||
/** WARNING: Only available when `css-loader` is used without `style-loader` or `mini-css-extract-plugin` */
|
/** WARNING: Only available when `css-loader` is used without `style-loader` or `mini-css-extract-plugin` */
|
||||||
locals: ZoomWarningModuleScssNamespace.IZoomWarningModuleScss;
|
locals: ZoomWarningModuleScssNamespace.IZoomWarningModuleScss;
|
||||||
};
|
};
|
||||||
|
|
||||||
export = ZoomWarningModuleScssModule;
|
export = ZoomWarningModuleScssModule;
|
||||||
|
|
|
@ -14,7 +14,7 @@ function hexToHSLA(hex:string, alpha:number) {
|
||||||
* @param {number} medRamp : the medium value this can assume
|
* @param {number} medRamp : the medium value this can assume
|
||||||
* @param {number} maxRamp : the maximum value this can assume
|
* @param {number} maxRamp : the maximum value this can assume
|
||||||
* @param {boolean} high : whether this is a "high" or "low" layer
|
* @param {boolean} high : whether this is a "high" or "low" layer
|
||||||
* @return {FillLayerDetails} a mapboxgl fill layer
|
* @return {FillPaint} a mapboxgl fill layer
|
||||||
**/
|
**/
|
||||||
function makePaint({
|
function makePaint({
|
||||||
field,
|
field,
|
||||||
|
@ -92,13 +92,13 @@ const mapStyle : Style = {
|
||||||
'geo': {
|
'geo': {
|
||||||
'type': 'raster',
|
'type': 'raster',
|
||||||
'tiles': [
|
'tiles': [
|
||||||
'http://mt0.google.com/vt/lyrs=p&hl=en&x={x}&y={y}&z={z}',
|
'https://mt0.google.com/vt/lyrs=p&hl=en&x={x}&y={y}&z={z}',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'custom': {
|
'custom': {
|
||||||
'type': 'vector',
|
'type': 'vector',
|
||||||
'tiles': [
|
'tiles': [
|
||||||
'http://usds-geoplatform-justice40-website.s3-website-us-east-1.amazonaws.com/0624_demo/{z}/{x}/{y}.pbf',
|
'https://d2zjid6n5ja2pt.cloudfront.net/0624_demo/{z}/{x}/{y}.pbf',
|
||||||
// For local development, use:
|
// For local development, use:
|
||||||
// 'http://localhost:8080/data/tl_2010_bg_with_data/{z}/{x}/{y}.pbf',
|
// 'http://localhost:8080/data/tl_2010_bg_with_data/{z}/{x}/{y}.pbf',
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Reference in a new issue