Skip to content

Commit

Permalink
fix: fav icon func fix, sw fix for problematic cache, add review font…
Browse files Browse the repository at this point in the history
…-size adjustment
  • Loading branch information
et41 committed Jul 10, 2018
1 parent 7fb4b97 commit a9ff47b
Show file tree
Hide file tree
Showing 20 changed files with 296 additions and 79 deletions.
29 changes: 20 additions & 9 deletions .tmp/localDiskDb.db
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"Sunday": "12:00 pm - 4:00 pm, 5:30 pm - 11:00 pm"
},
"createdAt": 1504095563444,
"updatedAt": "2018-07-08T12:59:59.458Z",
"updatedAt": "2018-07-10T11:14:50.913Z",
"id": 1,
"is_favorite": false
},
Expand All @@ -45,7 +45,7 @@
"Sunday": "12:00 pm - 3:00 pm, 5:00 pm - 11:00 pm"
},
"createdAt": 1504095568414,
"updatedAt": "2018-07-08T13:00:19.076Z",
"updatedAt": "2018-07-10T11:14:18.207Z",
"is_favorite": false,
"id": 2
},
Expand All @@ -69,8 +69,9 @@
"Sunday": "11:30 am - 2:00 am"
},
"createdAt": 1504095571434,
"updatedAt": 1504095571434,
"id": 3
"updatedAt": "2018-07-10T11:44:46.394Z",
"id": 3,
"is_favorite": true
},
{
"name": "Katz's Delicatessen",
Expand All @@ -92,7 +93,7 @@
"Sunday": "Sat - 10:30 pm"
},
"createdAt": 1504095567091,
"updatedAt": 1504095567091,
"updatedAt": "2018-07-10T11:13:35.479Z",
"is_favorite": false,
"id": 4
},
Expand All @@ -116,7 +117,7 @@
"Sunday": "10:00 am - 12:00 am"
},
"createdAt": 1504095567071,
"updatedAt": 1504095567071,
"updatedAt": "2018-07-08T20:11:07.674Z",
"is_favorite": false,
"id": 5
},
Expand Down Expand Up @@ -188,7 +189,7 @@
"Sunday": "10:00 am - 3:00 pm, 5:30 pm - 11:00 pm"
},
"createdAt": 1504095567091,
"updatedAt": 1504095567091,
"updatedAt": "2018-07-08T20:02:53.459Z",
"is_favorite": false,
"id": 8
},
Expand Down Expand Up @@ -235,7 +236,7 @@
"Sunday": "11:00 am - 12:00 am"
},
"createdAt": 1504095567183,
"updatedAt": 1504095567183,
"updatedAt": "2018-07-08T21:03:24.801Z",
"is_favorite": false,
"id": 10
}
Expand Down Expand Up @@ -628,6 +629,16 @@
"rating": "4",
"comments": "One of the tastiest and most unique ramen places I've been to in NYC, but also the priciest. I think overall its worth the try. Not an everyday casual ramen shop though.",
"id": 83
},
{
"restaurant_id": "6",
"name": "eren",
"date": 1531223102986,
"createdAt": 1531223102986,
"updatedAt": 1531223102986,
"rating": "4",
"comments": "nice bbq",
"id": 84
}
]
},
Expand Down Expand Up @@ -683,7 +694,7 @@
"id": 10
},
"reviews": {
"id": 83
"id": 84
}
}
}
20 changes: 12 additions & 8 deletions src/css/main-aux.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,28 @@
#restaurants-list p {
font-size: 11pt;
}
#restaurants-list p:last-child {
/*#restaurants-list p:last-child {
margin: 50px;
}
}*/

#restaurants-list li span {
font-size: 30px;
font-size: 30px;
color: #cd9292;
/* padding: 0 0 0 50vw; */
margin-top: 15px;
margin-top: 20px;
float: right;
}
/*#restaurants-list li span p {
font-size: 22px;
color: #cd9292;
float: left;
margin: 0 10px 0 0;
}*/

#restaurants-list li .checked {
font-size: 30px;
color: #c22c2c;
/* padding: 0 0 0 50vw; */
margin-top: 15px;
float: right;
}

#restaurants-list li a {
color: #fff;
background: #7d4f00;
Expand Down
2 changes: 2 additions & 0 deletions src/css/restaurant.css
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ button {
padding:0;
}
#addReview {
font-size: 13px;

box-shadow: 3px 3px 10px #888888;
background: none;
background-color: #333;
Expand Down
2 changes: 1 addition & 1 deletion src/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
#maincontent {
background-color: #f3f3f3;
width: 100%;
}</style><link rel="manifest" href="/manifest.json"><link rel="stylesheet" src="//normalize-css.googlecode.com/svn/trunk/normalize.css"><link rel="stylesheet" href="sass/main.css"><link rel="stylesheet" href="sass/main-aux.css" onload="if(media!='all')media='all'"><title>Restaurant Reviews</title></head><body><header><nav><h1><a href="/">Restaurant Reviews</a></h1></nav></header><main id="maincontent"><section id="map-container"><button id="collapsible" class="collapsible">Show Restaurants On Map</button><div id="map" role="application" aria-label="Map of Restaurants"></div></section><section><div id="filter" class="filter-options" tabindex="0"><h2>Filter Results</h2><select id="neighborhoods-select" aria-label="Neighborhoods" name="neighborhoods" onchange="updateSelectedRestaurants()" alt="select your neighborhood"><option value="all">All Neighborhoods</option></select> <select id="cuisines-select" aria-label="Cousines" name="cuisines" onchange="updateSelectedRestaurants()" alt="select your cuisine"><option value="all">All Cuisines</option></select></div><ul id="restaurants-list"></ul></section></main><script type="application/javascript" src="js/idb.js"></script><script type="application/javascript" src="js/uglify.js"></script><script async defer="defer" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDfPSCK0MsJDi53Kc_ZWHEE2sGS9n3RynM&libraries=places"></script><footer id="footer">Copyright (c) 2017 <a href="/"><strong>Restaurant Reviews</strong></a> All Rights Reserved.</footer></body></html>
}</style><link rel="manifest" href="/manifest.json"><link rel="stylesheet" src="//normalize-css.googlecode.com/svn/trunk/normalize.css"><link rel="stylesheet" href="sass/main.css"><link rel="stylesheet" href="sass/main-aux.css" onload="if(media!='all')media='all'"><title>Restaurant Reviews</title></head><body><header><nav><h1><a href="/">Restaurant Reviews</a></h1></nav></header><main id="maincontent"><section id="map-container"><button id="collapsible" class="collapsible">Show Restaurants On Map</button><div id="map" role="application" aria-label="Map of Restaurants"></div></section><section><div id="filter" class="filter-options" tabindex="0"><h2>Filter Results</h2><select id="neighborhoods-select" aria-label="Neighborhoods" name="neighborhoods" onchange="updateSelectedRestaurants()" alt="select your neighborhood"><option value="all">All Neighborhoods</option></select> <select id="cuisines-select" aria-label="Cousines" name="cuisines" onchange="updateSelectedRestaurants()" alt="select your cuisine"><option value="all">All Cuisines</option></select></div><ul id="restaurants-list"></ul></section></main><script type="application/javascript" src="js/idb.js"></script><script type="application/javascript" src="js/dbhelper.js"></script><script type="application/javascript" src="js/main.js"></script><script type="application/javascript" src="js/intersection.js"></script><script type="application/javascript" src="js/mainRestaurants.js"></script><script type="application/javascript" src="js/uglify.js"></script><script async defer="defer" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDfPSCK0MsJDi53Kc_ZWHEE2sGS9n3RynM&libraries=places"></script><footer id="footer">Copyright (c) 2017 <a href="/"><strong>Restaurant Reviews</strong></a> All Rights Reserved.</footer></body></html>
19 changes: 19 additions & 0 deletions src/dist/js/dbhelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,25 @@ class DBHelper {
});
}

static controlFav(id ) {
return fetch(`http://localhost:1337/restaurants/${id}/`,
{

method: 'GET',
headers:{
'Content-Type': 'application/json'
}

}).then(res => {
console.log('response status:', res);
return res.json();

}).then(response => {
console.log('response status:', response.is_favorite);
return response.is_favorite;
});
}

/**
* Fetch restaurants by a cuisine type with proper error handling.
*/
Expand Down
20 changes: 6 additions & 14 deletions src/dist/js/intersection.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@

console.log('intersection.js');
let idIntersectingElement;
var io = new IntersectionObserver(entries => {
console.log('iointersect');
let idIntersectingElement;
var io = new IntersectionObserver(entries => {
console.log('iointersect');

entries.forEach(entry => {
entries.forEach(entry => {
if(entry.isIntersecting) {
//console.log('intersecting',entry.target.id,entry);
let idStr = entry.target.childNodes[0].id;
let idNumber = idStr.replace( /^\D+/g, '');
idNumber = Number(idNumber);
idIntersectingElement = idNumber;
console.log('load image from intersect:',res.restaurants[idNumber-1])
loadImage(res.restaurants[idNumber-1],idStr);
io.unobserve(entry.target);
}
});
});
});


addIntersection = () => {
//console.log('addIntersection');
let el2 = document.querySelectorAll('#restaurants-list li');
//console.log('el2:',el2);
el2.forEach(e => {
io.observe(e);
});
}
22 changes: 3 additions & 19 deletions src/dist/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,10 @@ document.addEventListener('DOMContentLoaded', (event) => {
fetchNeighborhoods();
fetchCuisines();

// activateMap();
});

window.addEventListener('load', () => {

addIntersection();

});

/*activateMap = () => {
let mapId = document.getElementById('map');
mapId.style.position = 'relative';
mapId.style.left = 0;
}
*/

/**
* Fetch all neighborhoods and set their HTML.
*/
Expand Down Expand Up @@ -66,7 +55,7 @@ initMap = () => {
lng: -73.987501
};
self.map = new google.maps.Map(document.getElementById('map'), {
zoom: 11,
zoom: 12,
center: loc,
scrollwheel: false
});
Expand Down Expand Up @@ -151,11 +140,6 @@ elementCollapsable.addEventListener('click', () => {
initMap();
});

console.log('map.js');
/*document.addEventListener('DOMContentLoaded', () => {
initMap();
});*/


/**
* Add markers for current restaurants to the map.
Expand Down Expand Up @@ -199,4 +183,4 @@ fillRestaurantsHTML = (restaurants = self.restaurants) => {
ul.append(createRestaurantHTML(restaurant));
});
addMarkersToMap();
}
}
Loading

0 comments on commit a9ff47b

Please sign in to comment.