Skip to content

Commit

Permalink
fix(single product page): fix getting data from firebase issue
Browse files Browse the repository at this point in the history
fix #31
  • Loading branch information
KatiaGhezali committed Nov 18, 2023
1 parent cb09992 commit 1ca9cd5
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 49 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 44 additions & 47 deletions src/components/ProductDetails/ProductDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ const ProductDetails = ({ productId }) => {

<div className='flex mb-2'>
<p className='mr-20'>
<span className='font-bold'>Condition:</span>
<span className='font-bold'>Condition: </span>
{productData.condition}
</p>

<p className=''>
<span className='font-bold'>Category:</span>
<span className='font-bold'>Category: </span>
{productData.category}
</p>
</div>
Expand All @@ -154,56 +154,53 @@ const ProductDetails = ({ productId }) => {

{/* User Info */}
<div className='mt-2'>
{userData && user ? (
<div className='flex items-center mt-4 bg-gradient-to-r from-[#585785] to-[#FF8A57] rounded-l-full shadow-xl p-4'>
<div className='rounded-full overflow-hidden'>
<Image
src={userData.photo}
width={40}
height={40}
className='object-cover w-full h-full'
alt='user picture'
/>
</div>
<div className='ml-4 flex-1'>
<div className='flex flex-col'>
<h2 className='text-xl font-bold text-white'>
{userData.name} {userData.username}
</h2>
<div className='flex items-center'>
<p className='text-lg text-white mr-2'>
{userData.email}
{/* {userData && user ? ( */}
<div className='flex items-center mt-4 bg-gradient-to-r from-[#585785] to-[#FF8A57] rounded-l-full shadow-xl p-4'>
<div className='rounded-full overflow-hidden'>
<Image
src={userData?.photo}
width={65}
height={65}
className='object-cover w-full h-full'
alt='user picture'
/>
</div>
<div className='ml-4 flex-1'>
<div className='flex flex-col'>
<h2 className='text-xl font-bold text-white'>
{userData?.name} {userData?.username}
</h2>
<div className='flex items-center'>
<p className='text-lg text-white mr-2'>
{userData?.email}
</p>
<div
className='text-center text-white ml-auto'
style={{ marginLeft: "35%" }}
>
<p className='text-4xl font-bold'>
{productData?.price}$
</p>
<div
className='text-center text-white ml-auto'
style={{ marginLeft: "35%" }}
>
<p className='text-4xl font-bold'>
{productData.price}$
</p>
</div>
</div>
<p className='text-lg text-white'>
{productData.location.city},{" "}
{productData.location.country}
</p>
</div>
<p className='text-lg text-white'>
{productData.location?.city},{" "}
{productData.location?.country}
</p>
</div>
</div>
) : (
<div className='flex items-center justify-center mt-4 text-center'>
<p className='text-[#32314D] font-bold'>
Please log in to get in touch with the owner
of this product.{" "}
<Link
href='/login'
className='text-[#7874F2]'
>
Log in
</Link>
</p>
</div>
)}
</div>
{/* ) : ( */}
<div className='flex items-center justify-center mt-4 text-center'>
<p className='text-[#32314D] font-bold'>
Please log in to get in touch with the owner of
this product.{" "}
<Link href='/login' className='text-[#7874F2]'>
Log in
</Link>
</p>
</div>
{/* )} */}
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/singleproduct/[productId].jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function SingleProduct() {
{productId && (
<div className='hidden lg:block'>
{/* This will be visible on screens larger than or equal to lg (large) */}
<MapComponent productId={productId} />
{/* <MapComponent productId={productId} /> */}
</div>
)}
</div>
Expand Down

0 comments on commit 1ca9cd5

Please sign in to comment.