From 90aecc8184a06559c9053379c0a4ce23cd73ba57 Mon Sep 17 00:00:00 2001 From: Priscilla Date: Wed, 21 Aug 2024 22:55:53 +0200 Subject: [PATCH] temporarily disabled components to handle scraped data --- src/Components/RestaurantDetails.jsx | 43 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/Components/RestaurantDetails.jsx b/src/Components/RestaurantDetails.jsx index 04ca025..48cd46f 100644 --- a/src/Components/RestaurantDetails.jsx +++ b/src/Components/RestaurantDetails.jsx @@ -23,26 +23,27 @@ function RestaurantDetails() { const restaurantRef = firestoreDoc(db, 'restaurants', restaurantID); const restaurantDoc = await getDoc(restaurantRef); const restaurantData = restaurantDoc.exists() ? restaurantDoc.data() : {}; - const environmentImage = await getDownloadURL(ref(storage, restaurantData.interior)) + // const environmentImage = await getDownloadURL(ref(storage, restaurantData.interior)) - const reviewsRef = collection(db, 'restaurants', restaurantID, 'reviews'); - const reviewSnap = await getDocs(reviewsRef); - const reviewsData = reviewSnap.docs.map(doc => doc.data()); + // const reviewsRef = collection(db, 'restaurants', restaurantID, 'reviews'); + // const reviewSnap = await getDocs(reviewsRef); + // const reviewsData = reviewSnap.docs.map(doc => doc.data()); - const menuItemRef = collection(db, 'restaurants', restaurantID, 'menu-items') - const menuItemSnap = await getDocs(menuItemRef) - const menuItemData = menuItemSnap.docs.map(doc => doc.data()) + // const menuItemRef = collection(db, 'restaurants', restaurantID, 'menu-items') + // const menuItemSnap = await getDocs(menuItemRef) + // const menuItemData = menuItemSnap.docs.map(doc => doc.data()) - const reviewsCount = await getCountFromServer(reviewsRef) - const reviewsAverage = await getAggregateFromServer(reviewsRef, {averageRating: average("rating")}) + // const reviewsCount = await getCountFromServer(reviewsRef) + // const reviewsAverage = await getAggregateFromServer(reviewsRef, {averageRating: average("rating")}) - setThisRestaurant({...restaurantData, - interiorUrl: environmentImage, - reviews: reviewsData, - menuItems: menuItemData, - counts: reviewsCount.data().count, - ratings: reviewsAverage.data().averageRating}); + setThisRestaurant({...restaurantData + // interiorUrl: environmentImage, + // reviews: reviewsData, + // menuItems: menuItemData, + // counts: reviewsCount.data().count, + // ratings: reviewsAverage.data().averageRating + }); } catch (err) { console.error(err); } finally { @@ -66,21 +67,21 @@ function RestaurantDetails() { return (
- Restaurant + Restaurant

{thisRestaurant.name}

{thisRestaurant.address}

{thisRestaurant.cuisine}

-
+ {/*
{thisRestaurant.counts} Reviews
-
+
*/}

Featured Dishes

- + {/* */}
- - + {/* */} + {/* */}
) }