-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslintcache
1 lines (1 loc) · 14.5 KB
/
.eslintcache
1
[{"/Users/laurenjanicke/aes-finance/src/index.js":"1","/Users/laurenjanicke/aes-finance/src/App.js":"2","/Users/laurenjanicke/aes-finance/src/LogoOverlay.js":"3","/Users/laurenjanicke/aes-finance/src/Omnibox.js":"4","/Users/laurenjanicke/aes-finance/src/Theme.js":"5","/Users/laurenjanicke/aes-finance/src/common.js":"6","/Users/laurenjanicke/aes-finance/src/data-loader.js":"7","/Users/laurenjanicke/aes-finance/src/SettingsPane.js":"8","/Users/laurenjanicke/aes-finance/src/LocationSelector.js":"9"},{"size":168,"mtime":1634941724538,"results":"10","hashOfConfig":"11"},{"size":10677,"mtime":1650396487249,"results":"12","hashOfConfig":"11"},{"size":2074,"mtime":1635625981919,"results":"13","hashOfConfig":"11"},{"size":1945,"mtime":1634941724531,"results":"14","hashOfConfig":"11"},{"size":362,"mtime":1634941724539,"results":"15","hashOfConfig":"11"},{"size":189,"mtime":1634941724565,"results":"16","hashOfConfig":"11"},{"size":1551,"mtime":1634941724533,"results":"17","hashOfConfig":"11"},{"size":4690,"mtime":1650565189500,"results":"18","hashOfConfig":"11"},{"size":2067,"mtime":1634941724566,"results":"19","hashOfConfig":"11"},{"filePath":"20","messages":"21","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"22"},"1jw9qcp",{"filePath":"23","messages":"24","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":"25","usedDeprecatedRules":"22"},{"filePath":"26","messages":"27","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"22"},{"filePath":"28","messages":"29","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"22"},{"filePath":"30","messages":"31","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"22"},{"filePath":"32","messages":"33","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"22"},{"filePath":"34","messages":"35","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"22"},{"filePath":"36","messages":"37","errorCount":0,"warningCount":2,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"38","messages":"39","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"22"},"/Users/laurenjanicke/aes-finance/src/index.js",[],["40","41"],"/Users/laurenjanicke/aes-finance/src/App.js",["42","43"],"import mapboxgl from 'mapbox-gl';\nimport React, { useState, useEffect } from 'react';\nimport { ThemeProvider } from '@material-ui/core/styles';\nimport Hidden from '@material-ui/core/Hidden';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport LogoOverlay from './LogoOverlay';\nimport IconButton from '@material-ui/core/Button';\nimport { Home } from '@material-ui/icons'; \nimport Omnibox from './Omnibox';\nimport SettingsPane from './SettingsPane';\nimport { getAllCategories } from './common';\nimport CONFIG from './config.json';\nimport { fetchMapData } from './data-loader';\nimport { THEME } from './Theme';\nimport insightLogo from './img/insight-white.png';\nimport './App.css';\n\nconst COMPANIES_SOURCE = 'companies';\nconst MAPS = CONFIG['maps'];\nconst POINT_LAYER = 'energy-companies-point-layer';\n// testing if desktop change is key to pages rebuilding\n// = process.env.REACT_APP_MAPBOX_API_TOKEN;\n// mapboxgl.accessToken\n//mapboxgl.accessToken='pk.eyJ1IjoidG90b3JvLWRha2UiLCJhIjoiY2tiNzJuZmQ3MDFudDJxa2N1ZG91YzBzciJ9.5qJpYzti2W7avnuM9rCiKA'\nmapboxgl.accessToken= 'pk.eyJ1IjoiZW5lcmd5c29jaWV0eW1hcHMiLCJhIjoiY2s4dWJwaGNoMDlmczNnbzN3c291eXFkayJ9.0_dLx5Vqpk7h8LOw4Jryng'\nfunction getPopupContent(props) {\n const categoryInfo = ['tax1', 'tax2', 'tax3']\n .map(k => props[k])\n .filter(s => s).join(\" | \");\n return `\n <div class=\"popup\" style = \"color: 626262\">\n <h3 class=\"company-name\">\n <a href=${props['website']} style=\"color: 02346d\" target=\"blank\">${props['company']}</a>\n </h3>\n \n City: <span class=\"city-info\">${props['city']}</span><br />\n\n </div>`;\n}\n\nfunction clearPopups() {\n var popUps = document.getElementsByClassName('mapboxgl-popup');\n // Check if there is already a popup on the map and if so, remove it\n // This prevents multiple popups in the case of overlapping circles\n if (popUps[0]) popUps[0].remove();\n}\n\nfunction displayPopup(map, feature) {\n const coordinates = feature.geometry.coordinates.slice();\n clearPopups();\n new mapboxgl.Popup({})\n .setLngLat(coordinates)\n .setHTML(getPopupContent(feature.properties))\n .setMaxWidth(\"600px\")\n .addTo(map);\n}\n\nfunction populateMapData(map, mapId, mapData) {\n map.setCenter(MAPS[mapId].center);\n map.setZoom(1);\n\n mapData.then(data => {\n map.addSource(COMPANIES_SOURCE, {\n type: 'geojson',\n data: data['geojson'],\n });\n let circleColors =\n data['taxonomy'].map(c => [c.name, c.color]).flat().concat(['#ccc']);\n \n map.addLayer({\n id: POINT_LAYER,\n type: 'circle',\n source: COMPANIES_SOURCE,\n paint: {\n // make circles larger as the user zooms\n 'circle-radius': {\n stops: [[7, 5], [14, 12], [20, 50]]\n },\n 'circle-opacity': 0.85,\n // color circles by primary category\n 'circle-color': ['match', ['get', 'tax1']].concat(circleColors),\n 'circle-stroke-color': '#000',\n 'circle-stroke-width': 0.4,\n }\n });\n\n map.on('mouseenter', POINT_LAYER, (e) => {\n map.getCanvas().style.cursor = 'pointer';\n });\n\n map.on('mouseleave', POINT_LAYER, () => {\n map.getCanvas().style.cursor = '';\n });\n\n map.on('click', POINT_LAYER, e => displayPopup(map, e.features[0]));\n\n map.flyTo({\n center: MAPS[mapId].flyTo,\n zoom: MAPS[mapId].flyToZoom || 8,\n speed: 0.5,\n });\n });\n}\n\nconst getUrlFragment = () => window.location.hash.replace('#', '');\n\nfunction useUrlFragment(fragment, callback) {\n useEffect(() => {\n window.location.hash = '#' + fragment;\n const handleHashChange = () => {\n callback(getUrlFragment());\n }\n window.addEventListener('hashchange', handleHashChange);\n return () => {\n window.removeEventListener('hashchange', handleHashChange);\n }\n });\n}\n\nfunction getInitialMapId() {\n let initialMapId = getUrlFragment();\n if (MAPS.hasOwnProperty(initialMapId)) {\n return initialMapId;\n }\n return CONFIG['defaultMapId'];\n}\n\nconst useStyles = makeStyles((theme) => ({\n root: {\n display: 'flex',\n flexDirection: 'row',\n },\n mainContent: {\n flexGrow: 1,\n position: 'relative',\n },\n mapContainer: {\n height: '100vh',\n top: 0,\n right: 0,\n left: 0,\n bottom: 0,\n backgroundColor: '#333',\n },\n mapOverlay: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n padding: 0,\n pointerEvents: 'none',\n },\n mapOverlayInner: {\n display: 'block',\n position: 'relative',\n height: '100%',\n width: '100%',\n margin: 0,\n padding: 0,\n },\n mainControlOverlay: {\n position: 'absolute',\n top: 0,\n left: 0,\n padding: 0,\n margin: 0,\n pointerEvents: 'auto',\n display: 'flex',\n flexDirection: 'row',\n },\n insightLogoContainer: {\n padding: 8,\n },\n titleAndSearch: {\n padding: '4px 8px',\n },\n mapTitle: {\n color: '#fff',\n padding: '4px 0px',\n marginBottom: 4,\n },\n resetViewButton: {\n position: 'absolute',\n bottom: 73,\n right: 4.5,\n minWidth: 30,\n maxWidth: 30,\n height: 31,\n }\n}));\n\nexport default function App() {\n const classes = useStyles();\n\n const [thisMap, setThisMap] = useState(null);\n const [selectedMapId, setSelectedMapId] = useState(getInitialMapId());\n const [taxonomy, setTaxonomy] = useState([]);\n const [companiesGeojson, setCompaniesGeojson] = useState({});\n const [selectedCategories, setSelectedCategories] = useState(new Set([]));\n const [mobileDrawerOpen, setMobileDrawerOpen] = useState(false);\n\n function handleToggleCategory(e) {\n // called when categories are individually changed\n var s = new Set(selectedCategories);\n if (s.has(e.target.name)) {\n s.delete(e.target.name);\n } else {\n s.add(e.target.name);\n }\n setSelectedCategories(s);\n }\n\n function handleSelectAllCategories(txnomy) {\n // takes argument instead of using taxonomy directly because taxonomy\n // state update can lag behind\n setSelectedCategories(getAllCategories(txnomy));\n }\n\n function handleDeselectAllCategories() {\n setSelectedCategories(new Set());\n }\n\n function handleSelectCompany(e) {\n const selectedCompany = companiesGeojson.features[e.idx];\n displayPopup(thisMap, selectedCompany);\n thisMap.flyTo({\n center: selectedCompany.geometry.coordinates,\n zoom: 14,\n });\n }\n\n function handleSelectMap(mapId) {\n if (mapId !== selectedMapId) {\n clearPopups();\n thisMap.removeLayer(POINT_LAYER);\n thisMap.removeSource(COMPANIES_SOURCE);\n setSelectedMapId(mapId);\n setMobileDrawerOpen(false);\n let mapData = fetchMapData(mapId);\n mapData.then(setUpMap);\n populateMapData(thisMap, mapId, mapData);\n handleSelectAllCategories(taxonomy);\n }\n }\n\n function handleShift() {\n // called when you open the mobile drawer\n if (!mobileDrawerOpen) {\n return classes.mainControlOverlay;\n } else {\n return classes.mainControlOverlayShifted;\n }\n }\n\n function handleReset() {\n // called when reset button is clicked\n thisMap.flyTo({\n center: MAPS[selectedMapId].flyTo,\n zoom: MAPS[selectedMapId].flyToZoom || 8,\n });\n }\n\n function setUpMap(data) {\n setTaxonomy(data['taxonomy']);\n setCompaniesGeojson(data['geojson']);\n // initially select all categories\n handleSelectAllCategories(data['taxonomy']);\n }\n\n function initMap() {\n let map = new mapboxgl.Map({\n container: \"map-container\",\n style: 'mapbox://styles/mapbox/dark-v10',\n attributionControl: false,\n center: MAPS[selectedMapId].center,\n zoom: 1,\n minZoom: 1,\n });\n let mapData = fetchMapData(selectedMapId);\n mapData.then(setUpMap);\n\n map.on('load', () => {\n map.addControl(new mapboxgl.FullscreenControl(), 'bottom-right');\n map.addControl(new mapboxgl.NavigationControl(), 'bottom-right');\n populateMapData(map, selectedMapId, mapData);\n });\n setThisMap(map);\n }\n\n useEffect(() => {\n if (!thisMap) {\n initMap();\n }\n\n if (thisMap) {\n if (thisMap.getLayer(POINT_LAYER)) {\n var filters = [\"any\"];\n // If ANY of the 3 taxonomies for a company are selected, it should be\n // displayed on the map.\n [1, 2, 3].forEach(i => {\n var filter = [\"in\", `tax${i}sanitized`];\n selectedCategories.forEach(category => filter.push(category));\n filters.push(filter);\n });\n thisMap.setFilter(POINT_LAYER, filters);\n }\n }\n });\n\n useUrlFragment(selectedMapId, urlFragment => {\n if (MAPS.hasOwnProperty(urlFragment)) {\n handleSelectMap(urlFragment);\n }\n });\n\n return (\n <ThemeProvider theme={THEME}>\n <div className={classes.root}>\n <SettingsPane\n selectedMapId={selectedMapId}\n mobileDrawerOpen={mobileDrawerOpen}\n selectedCategories={selectedCategories}\n onToggleOpen={setMobileDrawerOpen}\n onSelectMap={handleSelectMap}\n taxonomy={taxonomy}\n onSelectAllCategories={() => handleSelectAllCategories(taxonomy)}\n onDeselectAllCategories={handleDeselectAllCategories}\n onToggleCategory={handleToggleCategory} />\n <main className={classes.mainContent}>\n <div id=\"map-container\" className={classes.mapContainer} />\n <LogoOverlay selectedMapId={selectedMapId} />\n <div className={classes.resetViewButton} >\n <IconButton variant=\"contained\" color=\"white\" className={classes.resetViewButton} aria-label=\"reset view\" onClick={() => { handleReset() }} >\n <Home />\n </IconButton>\n </div>\n <div className={classes.mapOverlay}>\n <div className={classes.mapOverlayInner}>\n <div className={classes.mainControlOverlay}>\n <Hidden smDown implementation=\"css\">\n <div className={classes.insightLogoContainer}>\n <img src={insightLogo} alt=\"aes insight logo\" height=\"80\" />\n </div>\n </Hidden>\n <div className={classes.titleAndSearch}>\n <div className={classes.mapTitle}>\n <Typography variant=\"h1\">{MAPS[selectedMapId].title}</Typography>\n </div>\n <Omnibox\n companies={companiesGeojson.features}\n onSelectCompany={handleSelectCompany}\n onOpenMobileDrawer={() => setMobileDrawerOpen(true)} />\n </div>\n </div>\n <LogoOverlay selectedMapId={selectedMapId} />\n </div>\n </div>\n </main>\n </div>\n </ThemeProvider>\n );\n}\n","/Users/laurenjanicke/aes-finance/src/LogoOverlay.js",[],"/Users/laurenjanicke/aes-finance/src/Omnibox.js",[],"/Users/laurenjanicke/aes-finance/src/Theme.js",[],"/Users/laurenjanicke/aes-finance/src/common.js",[],"/Users/laurenjanicke/aes-finance/src/data-loader.js",[],"/Users/laurenjanicke/aes-finance/src/SettingsPane.js",["44","45"],"/Users/laurenjanicke/aes-finance/src/LocationSelector.js",[],{"ruleId":"46","replacedBy":"47"},{"ruleId":"48","replacedBy":"49"},{"ruleId":"50","severity":1,"message":"51","line":28,"column":9,"nodeType":"52","messageId":"53","endLine":28,"endColumn":21},{"ruleId":"50","severity":1,"message":"54","line":248,"column":12,"nodeType":"52","messageId":"53","endLine":248,"endColumn":23},{"ruleId":"50","severity":1,"message":"55","line":7,"column":8,"nodeType":"52","messageId":"53","endLine":7,"endColumn":15},{"ruleId":"50","severity":1,"message":"56","line":15,"column":8,"nodeType":"52","messageId":"53","endLine":15,"endColumn":24},"no-native-reassign",["57"],"no-negated-in-lhs",["58"],"no-unused-vars","'categoryInfo' is assigned a value but never used.","Identifier","unusedVar","'handleShift' is defined but never used.","'Divider' is defined but never used.","'LocationSelector' is defined but never used.","no-global-assign","no-unsafe-negation"]