Skip to content

Commit

Permalink
Merge pull request #35 from deniodev/dev
Browse files Browse the repository at this point in the history
Submmit Reviews
  • Loading branch information
deniodev authored May 25, 2024
2 parents 3575ebf + 3f2c915 commit 9b1528d
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 26 deletions.
10 changes: 5 additions & 5 deletions client/src/components/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,32 @@ export default function Footer() {
<div className="pb-4 border">
<div className="flex items-center justify-center space-x-4 mb-2 text-3xl mt-4">
<Link
to="https://github.com/deniodev/moz-services"
to="https://github.com/deniodev/get-services"
target="_blank"
className="hover:scale-110 transition-transform duration-500"
>
<BsGithub />
<BsGithub size={20} />
</Link>
<Link
to="/"
target="_blank"
className="hover:scale-110 transition-transform duration-500"
>
<BsFacebook />
<BsFacebook size={20} />
</Link>
<Link
to="/"
target="_blank"
className="hover:scale-110 transition-transform duration-500"
>
<BsInstagram />
<BsInstagram size={20} />
</Link>
<Link
to="/"
target="_blank"
className="hover:scale-110 transition-transform duration-500"
>
<BsYoutube />
<BsYoutube size={20} />
</Link>
</div>

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default function Header() {
return (
<div className="border-b">
<header className="flex h-16 items-center gap-4 bg-background max-w-screen-xl mx-auto p-3">
<nav className="hidden flex-col gap-4 text-lg font-medium md:flex md:flex-row md:items-center md:gap-5 md:text-sm lg:gap-6 ">
<nav className="hidden flex-col gap-4 text-lg font-bold md:flex md:flex-row md:items-center md:gap-5 md:text-sm lg:gap-6 ">
<Link to="/">
<img
src={logoBlack}
Expand Down
2 changes: 0 additions & 2 deletions client/src/pages/About.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
AccordionItem,
AccordionTrigger,
} from '../components/ui/accordion';
import Footer from '../components/Footer';

const About = () => {
const { t } = useTranslation();
Expand Down Expand Up @@ -48,7 +47,6 @@ const About = () => {
</div>
</div>
</div>
<Footer />
</>
);
};
Expand Down
8 changes: 4 additions & 4 deletions client/src/pages/Contact.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ const Contact = () => {

return (
<section>
<div className="p-3 max-w-4xl mx-auto">
<h1 className="text-3xl font-semibold text-center p-2">
<div className="p-3 max-w-screen-xl mx-auto">
<h1 className="scroll-m-20 text-4xl font-bold tracking-tight lg:text-5xl">
{' '}
{t('contact1')}{' '}
</h1>
<p className="text-s leading-loose text-center">{t('contact2')}</p>
<form ref={form} onSubmit={sendEmail} className="space-y-8 ml-5 mr-5">
<p className="leading-7 [&:not(:first-child)]:mt-6">{t('contact2')}</p>
<form ref={form} onSubmit={sendEmail} className="space-y-8 mt-8">
<div>
<Label htmlFor="name" className="ml-1">
{t('name')}
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ const Profile = () => {
src={formData.avatar || currentUser.avatar}
alt="profile"
/>
<AvatarFallback>HS</AvatarFallback>
<AvatarFallback>GS</AvatarFallback>
</Avatar>
<p className="text-sm self-center">
{fileUploadError && (
Expand Down
46 changes: 37 additions & 9 deletions client/src/pages/Service.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,32 @@ const Service = () => {
throw new Error(result.message);
}

setservice((prevService) => {
const newReview = {
rating,
reviewText,
createdAt: new Date().toISOString(),
user: {
avatar: currentUser.avatar,
username: currentUser.username,
},
};

const updatedReviews = [newReview, ...prevService.reviews];
const updatedTotalRating = prevService.totalRating + 1;
const updatedAverageRating = (
(prevService.averageRating * prevService.totalRating + rating) /
updatedTotalRating
).toFixed(1);

return {
...prevService,
reviews: updatedReviews,
totalRating: updatedTotalRating,
averageRating: updatedAverageRating,
};
});

setLoading(false);
toast.success(result.message);
} catch (err) {
Expand Down Expand Up @@ -145,11 +171,13 @@ const Service = () => {
<div className="lg:col-span-2">
<div className="flex flex-col max-w-4xl mx-auto p-3 md:my-7 gap-4">
<div className="flex gap-4 ">
<img
src={service.coverImg}
alt=""
className="max-w-[200px] max-h-[200px] rounded-lg"
/>
<Avatar className="w-[200px] h-[200px] ">
<AvatarImage
src={service.coverImg}
alt="cover image"
className="object-cover"
/>
</Avatar>

<div className="">
<Badge variant="outline">{service.title}</Badge>
Expand Down Expand Up @@ -186,25 +214,25 @@ const Service = () => {
<DrawerContent>
<DrawerFooter className="flex flex-row justify-between">
<Link to={`tel:${service.phone}`} target="_blank">
<Button variant="outline">
<Button variant="outline" title={`${service.phone}`}>
<PhoneCall />
</Button>
</Link>
<Link to={`sms:${service.phone}`} target="_blank">
<Button variant="outline">
<Button variant="outline" title={`${service.phone}`}>
<MessageSquareText />
</Button>
</Link>
<Link
to={`http://wa.me/${service.phone}`}
target="_blank"
>
<Button variant="outline">
<Button variant="outline" title={`${service.phone}`}>
<FaWhatsapp size={25} />
</Button>
</Link>
<DrawerClose>
<Button variant="outline">
<Button variant="outline" title="Exit">
<CircleX />
</Button>
</DrawerClose>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "home-services",
"name": "get-services",
"version": "1.0.0",
"description": "",
"main": "index.js",
Expand All @@ -21,4 +21,4 @@
"mongoose": "^8.3.1",
"nodemon": "^3.1.0"
}
}
}

0 comments on commit 9b1528d

Please sign in to comment.