Skip to content

Commit

Permalink
Merge pull request #31 from SchoolOfCode/reviews-branch
Browse files Browse the repository at this point in the history
Reviews branch - store info page
  • Loading branch information
ab-stha authored Sep 26, 2024
2 parents 4d9a34d + b19659a commit 6dc1480
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 36 deletions.
Binary file added baggit-app/public/completedstar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added baggit-app/public/emptystar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added baggit-app/public/shield.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion baggit-app/src/app/components/Map/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ export default function MapApp({ markerLocations }) {
position={location.position}
onClick={() => {
setSelectedLocation(location);
setCenter(location.position);
setCenter({
lat: location.position.lat - 0.003,
lng: location.position.lng,
});
}}
icon={{
url: '/marker.png',
Expand Down
147 changes: 112 additions & 35 deletions baggit-app/src/app/storeinfo/page.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,120 @@
import React from 'react';
'use client'

import { useState, React } from 'react';
import styles from './page.module.css';
import Nav from '../components/Navigation/Nav';
import Image from 'next/image';
// import supabase from '@/config/supabaseClient';

const App = () => {

// const [reviews, setReviews] = useState([]);

// // Define a function that fetches data from one row of the reviews table
// async function fetchSingleShopReview(shopLocationId) {
// const { data, error } = await supabase
// .from('storeReviews')
// .select('*')
// .eq('shop_location_id', `${shopLocationId}`)
// if (error) {
// console.log('error on fetchSingleShopReview', error);
// return;
// }

// const formattedReviews = data.map(review => ({
// id: review.id,
// content: review.content,
// rating: review.rating,
// shop: review.shop_location_id,
// author: review.writerName
// }));
// setReviews(formattedReviews);
// console.log(formattedReviews);
// }

// // const ratingsArray = formattedReviews.map(item => item.rating)
// // console.log('array of ratings for this review: ', ratingsArray);

// // function findAverage (arr) {
// // let sumofArr = 0;
// // for (let i = 0; i < arr.length; i++) {
// // sumofArr = sumofArr + arr[i];
// // }
// // return sumofArr/arr.length;
// // }

// // const average = findAverage(ratingsArray);
// // console.log(average);
// // };
// // console.log(average);


// fetchSingleShopReview(2);
// const averageRating = 4;
return (
<>
{/* User Section
<div className={styles.userSection}>
<div className={styles.userInfo}>
<Image src="/baggitLogoRed.svg" alt="LogoBaggIt" width={40} height={40} />
<div>
<h4>John Doe</h4>
<p>Welcome back!</p>
</div>
</div>
</div> */}

<div className={styles.container}>
{/* Location Description */}
<div className={styles.title}>Location Title</div>
<div className={styles.locationDescription}>
<h2>Location description</h2>
<h2>Next</h2>
<div className={styles.details}>
<p><strong>Opening times:</strong> Mon-Sun: 8:00 - 22:00</p>
<p><strong>Features:</strong> Large and small bags allowed</p>
<p>Adress will be show after booking</p>
</div>
</div>

<p>Add review, add star rating also add how many people people have a review for taht star. showhaow far the store is from your location
Adress will be show after booking
Protection up to £5,000


Review section
</p><br></br>

<div className={styles.protection}>
<Image src="/shield.png" alt="protection" width={15} height={15} />
<p>Protection up to £5,000</p>
</div>
<div className={styles.rating}>
<h2>4.0</h2>
<div>
<Image src="/completedstar.png" alt="full star" width={15} height={15} />
<Image src="/completedstar.png" alt="full star" width={15} height={15} />
<Image src="/completedstar.png" alt="full star" width={15} height={15} />
<Image src="/completedstar.png" alt="full star" width={15} height={15} />
<Image src="/emptystar.png" alt="empty star" width={15} height={15} />
<p>3 reviews</p>
</div>
</div>
<div className={styles.smallButtons}>
<button className={styles.buttonsButton} >Top Reviews</button>
<button className={styles.buttonsButton} >Most Recent</button>
</div>
<div>
<h3>Hannah</h3>
<Image src="/completedstar.png" alt="full star" width={15} height={15} />
<Image src="/completedstar.png" alt="full star" width={15} height={15} />
<Image src="/completedstar.png" alt="full star" width={15} height={15} />
<Image src="/completedstar.png" alt="full star" width={15} height={15} />
<Image src="/emptystar.png" alt="empty star" width={15} height={15} />

</div>
<p>&quot;Efficient service, but the storage space was cramped. My bags were safe, though, so no major complaints.&quot;</p>
<div>
<h3>David</h3>
<Image src="/completedstar.png" alt="full star" width={15} height={15} />
<Image src="/completedstar.png" alt="full star" width={15} height={15} />
<Image src="/completedstar.png" alt="full star" width={15} height={15} />
<Image src="/completedstar.png" alt="full star" width={15} height={15} />
<Image src="/completedstar.png" alt="full star" width={15} height={15} />
</div>
<p>&quot;Wonderful app!&quot;</p>
<div>
<h3>Mike</h3>
<Image src="/completedstar.png" alt="full star" width={15} height={15} />
<Image src="/completedstar.png" alt="full star" width={15} height={15} />
<Image src="/completedstar.png" alt="full star" width={15} height={15} />
<Image src="/emptystar.png" alt="full star" width={15} height={15} />
<Image src="/emptystar.png" alt="full star" width={15} height={15} />
</div>
<p>&quot;This shop had great bag security but the shopkeeper was very impolite. I would recommend walking further to a different store.&quot;</p>
{/* About Section */}
<div className={styles.aboutApp}>
<h3>About Bag Storage App</h3>
<p>How it works: Simply choose a location, select a time, and pay securely. Read more about our <a href='/terms'> Terms and Conditions </a> </p><br></br>
</div>
{/* Select Booking Duration */}
<div className={styles.bookingDuration}>
<h3>Select Booking Duration</h3>
Expand All @@ -47,24 +126,22 @@ const App = () => {
</div>
<p className={styles.bookingText}>Choose the time duration for storing your bag</p>
</div>

{/* Buttons for Add Bag, Settings, and Pay Now */}
<div className={styles.buttons}>
<div className={styles.buttonsButton}>Add New Bag</div>
<div className={styles.buttonsButton}>Settings</div>
<div className={styles.buttonsPayNow}>Pay Now</div>
</div>



{/* About Section */}
<div className={styles.aboutApp}>
<h3>About Bag Storage App</h3>
<p>How it works: Simply choose a location, select a time, and pay securely. Read more about our <a href='/terms'> Terms and Conditions </a> </p><br></br>
</div>



{/* User Section
<div className={styles.userSection}>
<div className={styles.userInfo}>
<Image src="/baggitLogoRed.svg" alt="LogoBaggIt" width={40} height={40} />
<div>
<h4>John Doe</h4>
<p>Welcome back!</p>
</div>
</div>
</div> */}
</div>
<Nav />
</>
Expand Down
17 changes: 17 additions & 0 deletions baggit-app/src/app/storeinfo/page.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,21 @@
margin: 0;
font-size: 0.8rem;
color: #555;
}

.protection {
display: flex;
align-items: center;
gap: 5px;
}
.rating {
display: flex;
align-items: center;
gap: 5px;
}
.smallButtons {
display: flex;
align-items: center;
justify-content: center;
gap: 15%;
}

0 comments on commit 6dc1480

Please sign in to comment.