Skip to content

Commit

Permalink
#5 farmer profile page added
Browse files Browse the repository at this point in the history
  • Loading branch information
Ktn-mariam committed Nov 16, 2023
1 parent 92c42fd commit a444106
Show file tree
Hide file tree
Showing 6 changed files with 227 additions and 28 deletions.
Binary file added client/public/mazaara-farm.webp
Binary file not shown.
77 changes: 77 additions & 0 deletions client/src/components/CommentSection.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import React from 'react'
import Pagination from '@mui/material/Pagination'
import AccountCircleIcon from '@mui/icons-material/AccountCircle'
import Rating from '@mui/material/Rating'

const CommentSection = () => {
return (
<div>
<h1 className="text-xl font-bold mb-4">Reviews</h1>
<div className="flex flex-col gap-10">
<div>
<div className="flex items-center gap-1">
<AccountCircleIcon fontSize="medium" />
<h1>Mariam Khatoon</h1>
</div>
<div className="flex items-center mt-0.5 gap-2">
<Rating defaultValue={3.5} precision={0.5} size="small" readOnly />
<h3 className="pt-0.5 text-sm">3.5 out of 5</h3>
<h1 className="text-gray-500 text-sm pt-0.5 ">
Reviewed on Nov 15, 2023
</h1>
</div>
<div className="mt-2">
<h1 className="font-bold">Fresh and tasty</h1>
<h1 className="text-sm">
good as described. doubt the weight as very few
</h1>
</div>
</div>
<div>
<div className="flex items-center gap-1">
<AccountCircleIcon fontSize="medium" />
<h1>Mariam Khatoon</h1>
</div>
<div className="flex items-center mt-0.5 gap-2">
<Rating defaultValue={3.5} precision={0.5} size="small" readOnly />
<h3 className="pt-0.5 text-sm">3.5 out of 5</h3>
<h1 className="text-gray-500 text-sm pt-0.5 ">
Reviewed on Nov 15, 2023
</h1>
</div>
<div className="mt-2">
<h1 className="font-bold">Fresh and tasty</h1>
<h1 className="text-sm">
good as described. doubt the weight as very few organges arrived
</h1>
</div>
</div>
<div>
<div className="flex items-center gap-1">
<AccountCircleIcon fontSize="medium" />
<h1>Mariam Khatoon</h1>
</div>
<div className="flex items-center mt-0.5 gap-2">
<Rating defaultValue={3.5} precision={0.5} size="small" readOnly />
<h3 className="pt-0.5 text-sm">3.5 out of 5</h3>
<h1 className="text-gray-500 text-sm pt-0.5 ">
Reviewed on Nov 15, 2023
</h1>
</div>
<div className="mt-2">
<h1 className="font-bold">Fresh and tasty</h1>
<h1 className="text-sm">
good as described. doubt the weight as very few organges arrived
fjhjef fekjfk dkjdfshkl dfjnjf kjdfsjkl
</h1>
</div>
</div>
<div className="mt-3">
<Pagination count={4} />
</div>
</div>
</div>
)
}

export default CommentSection
27 changes: 27 additions & 0 deletions client/src/components/LocationMap.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react'
import { MapContainer, Marker, Popup, TileLayer } from 'react-leaflet'

const LocationMap = () => {
return (
<div className="h-80">
<MapContainer
style={{ height: '100%', width: '100%' }}
center={[25.261, 55.315]}
zoom={13}
scrollWheelZoom={false}
>
<TileLayer
attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
url="https://{s}.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png"
/>
<Marker position={[25.261, 55.315]}>
<Popup>
A pretty CSS3 popup. <br /> Easily customizable.
</Popup>
</Marker>
</MapContainer>
</div>
)
}

export default LocationMap
68 changes: 42 additions & 26 deletions client/src/components/ProductCard.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,54 @@
import React from 'react'
import StarBorderOutlinedIcon from '@mui/icons-material/StarBorderOutlined'
import StarOutlinedIcon from '@mui/icons-material/StarOutlined'
import StarHalfOutlinedIcon from '@mui/icons-material/StarHalfOutlined'
import EditIcon from '@mui/icons-material/Edit'
import DeleteIcon from '@mui/icons-material/Delete'
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff'
import Rating from '@mui/material/Rating'

function ProductCard() {
interface ProductCardProps {
height: number
editable: boolean
}

const ProductCard: React.FC<ProductCardProps> = ({ height, editable }) => {
return (
<div className="m-1">
<div className="mx-1">
<div className="py-5 flex flex-col items-center rounded-md font-noto hover:cursor-pointer">
{/* 4:5 ratio */}
<img className="h-48 mb-3" src="/apple.png" alt="" />
<div
className={`h-40 mb-3 md:h-${height} md:w-${height-8} flex items-center justify-center overflow-hidden`}
>
<img className="object-cover w-full h-full" src="/apple.png" alt="" />
</div>
<div>
<h4 className="truncate w-36">Apples, Silicon Oasiskm frkn</h4>
<h4 className={`truncate w-${height-8}`}>
Apples, Silicon Oasiskm frkn
</h4>
<h6 className="text-xs">Mariam Khatoon</h6>
<div className="flex">
<p className="text-xs py-0.5 pr-1">AED</p>
<p>
<span className="font-bold">35.50</span>/kg
</p>
</div>
<div className="flex items-center">
<StarOutlinedIcon style={{ fontSize: '15px', color: '#ffc300' }} />
<StarOutlinedIcon style={{ fontSize: '15px', color: '#ffc300' }} />
<StarHalfOutlinedIcon
style={{ fontSize: '15px', color: '#ffc300' }}
/>
<StarBorderOutlinedIcon
style={{ fontSize: '15px', color: '#ffc300' }}
/>
<StarBorderOutlinedIcon
style={{ fontSize: '15px', color: '#ffc300' }}
/>
<p className="text-xs pl-1">5</p>
<div className="flex gap-3 justify-between items-end">
<div>
<div className="flex">
<p className="text-xs py-0.5 pr-1">AED</p>
<p>
<span className="font-bold">35.50</span>/kg
</p>
</div>
<Rating
defaultValue={3.5}
precision={0.5}
size="small"
readOnly
/>
</div>
{editable && (
<div className="float-right flex gap-1.5">
<EditIcon fontSize="small" />
<DeleteIcon fontSize="small" />
<VisibilityOffIcon fontSize="small" />
</div>
)}
</div>
</div>
<div></div>
</div>
</div>
)
Expand Down
79 changes: 79 additions & 0 deletions client/src/pages/FarmerProfile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import React from 'react'
import RatingStats from '../components/RatingStats'
import ProductSlider from '../components/ProductSlider'
import CommentSection from '../components/CommentSection'
import LocationMap from '../components/LocationMap'
import LocationOnIcon from '@mui/icons-material/LocationOn'
import PhonelinkRingIcon from '@mui/icons-material/PhonelinkRing'
import ArrowBackIcon from '@mui/icons-material/ArrowBack'
import EditIcon from '@mui/icons-material/Edit'

const FarmerProfile = () => {
return (
<div className="md:px-36 px-14 pt-10 mb-32 font-noto">
<div className="flex items-center gap-2 mb-5 ml-10 hover:cursor-pointer">
<ArrowBackIcon />
<h3 className="text-xl">Back</h3>
</div>
<div className="flex">
<div className="grid grid-cols-3 gap-10">
<div className="col-span-1 px-10 py-10 border border-1 border-zinc-300 rounded-2xl mb-10">
<div className="w-74 h-64 flex items-center justify-center overflow-hidden">
<img
className="object-cover w-full h-full"
src="/mazaara-farm.webp"
alt=""
/>
</div>
<div className="flex items-center gap-3 justify-between">
<h1 className="text-2xl font-bold pt-3">Mariam Khatoon</h1>
<div className="hover:cursor-pointer">
<EditIcon fontSize="small" />
</div>
</div>
<div>
Family farmer. Apples, berries, litchis. Quality, sustainable
practices.
</div>
<div className="flex items-center gap-3 pt-7 text-sm">
<PhonelinkRingIcon />
+971 50 243 0978
</div>
<div className="flex items-center gap-3 mt-3 text-sm">
<LocationOnIcon />
Flat 503, Sapphire Building, Silicon Oasis, Dubai, United Arab
Emirates
</div>
<div className="pt-10">
<RatingStats />
</div>
</div>
<div className="ml-10 col-span-2">
<div className="mt-7">
<ProductSlider
noOfSlides={3}
height={64}
heading={'Products sold by Mariam'}
editable={true}
/>
</div>
<div className="mt-5">
<h1 className=" font-noto font-bold text-xl mb-5">
Location on Map
</h1>
<div className="h-96">
<LocationMap />
</div>
</div>
<div>
<CommentSection />
</div>
</div>
</div>
<div className="h-96"></div>
</div>
</div>
)
}

export default FarmerProfile
4 changes: 2 additions & 2 deletions client/src/pages/ProductCategoryPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ProductCategoryPage = () => {
'Cherimoya',
]
return (
<div>
<div className="mb-20">
<StoreNavbar />
<div className="md:px-36 px-14 flex">
<div className="w-40 md:w-64 py-14 font-workSans">
Expand Down Expand Up @@ -79,7 +79,7 @@ const ProductCategoryPage = () => {
<div className="pl-14 font-workSans">
<h1 className="text-xl font-bold">Results</h1>
</div>
<div className="grid grid-cols-1 justify-center sm:grid-cols-2 md:grid-cols-3 pl-10 gap-x-4 gap-y-4">
<div className="grid grid-cols-1 justify-center sm:grid-cols-2 md:grid-cols-3 pl-10 gap-x-4 gap-y-1">
<Product />
<Product />
<Product />
Expand Down

0 comments on commit a444106

Please sign in to comment.