This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react'; | |
import PropTypes from 'prop-types'; | |
import * as mockReviews from '../mockReviews.json'; | |
const TOTAL_MOCK_REVIEWS = 100; | |
const randomProductIndex = () => { | |
return Math.floor(Math.random() * Math.floor(TOTAL_MOCK_REVIEWS - 1)); | |
}; | |
const useRandomProduct = () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"id": 1, | |
"product_name": "Cheese - Pied De Vents", | |
"product_price": "Dong", | |
"product_description": "Pellentesque at nulla. Suspendisse potenti. Cras in purus eu magna vulputate luctus.", | |
"avg_product_review": 2.39, | |
"in_stock": true, | |
"product_image": "http://dummyimage.com/150x150.png/5fa2dd/ffffff" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sampleFeature = { | |
type: "Feature", | |
properties: { | |
Notes: | |
"The closest entrance is on Seaman Avenue at Isham Street, and you'll find the run just behind the flag pole. You can reach Inwood Hill Park by Subway via the A train to 207th St, or the 1 train to 207th St, and walk west.", | |
boro: "Manhattan", | |
name: "Inwood Hill Park Dog Run: Homer's Run", | |
Url: "http://www.inwoof.com/", | |
state: "NY", | |
address: "Seaman Avenue & Isham Street", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// set curser to pointer on icon mousehover | |
map.on("mousemove", function (e) { | |
var iconsUnderMouse = map.queryRenderedFeatures(e.point, { | |
layers: ["nycparks-ad16j1"] | |
}); | |
map.getCanvas().style.cursor = iconsUnderMouse.length ? "pointer" : ""; | |
}); | |
// select icon if clicked on | |
map.on("click", function (e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flyToRun(currentFeature) { | |
map.flyTo({ | |
center: currentFeature.geometry.coordinates, | |
speed: 0.8, | |
curve: 1, | |
zoom: 16 | |
}); | |
} | |
function flyToBoro(view) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var map = new mapboxgl.Map({ | |
container: "map", | |
style: "mapbox://styles/bubbasdad/cj8krq0rm57zw2sor4hhor04o", | |
maxZoom: 18, | |
minZoom: 9, | |
center: [-73.996, 40.71], | |
zoom: 9.76, | |
buffer: 256, | |
scrollZoom: true, | |
"source-layer": "nycparks-ad16j1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prepNavPanel() { | |
var boroIDs = ["mh", "bk", "qs", "xb", "si", "all"]; | |
boroIDs.forEach(function (boroID) { | |
let buttonEl = document.getElementById(boroID); | |
let id = buttonEl.id; | |
buttonEl.onclick = | |
id !== "all" | |
? function (e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flyToBoro(view) { | |
map.flyTo({ | |
center: view.coordinates, | |
speed: 0.65, | |
curve: 1.3, | |
zoom: view.zoom | |
}); | |
} | |
var boroView = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "Feature", | |
"properties": { | |
"name": "Brooklyn Bridge Dog Run", | |
"address": "385 Plymouth St", | |
"boro": "Brooklyn", | |
"state": "NY", | |
"DogRuns_Type": "Off-Leash", | |
"Notes": "Located under the Manhattan Bridge. Go Figure.", | |
"Prop_ID": "BB999", |
NewerOlder