Skip to content

Commit

Permalink
🎉✨ Final push for AVM Ayurvedic 🌿🚀 - Project completed & hosted succe…
Browse files Browse the repository at this point in the history
…ssfully! 🎯🏁
  • Loading branch information
sinanptm committed Oct 13, 2024
1 parent a886f0a commit dd44a9c
Show file tree
Hide file tree
Showing 297 changed files with 8,829 additions and 8,766 deletions.
38 changes: 19 additions & 19 deletions client/app/(landing-pages)/about/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@ import WhyChooseUs from "@/components/page-components/landing/about/WhyChooseUs"
import { memo } from "react";

export const metadata: Metadata = {
title: "About Us",
description:
"Learn about our commitment to holistic health through Ayurveda. Discover our story, meet our team, and understand our mission to enhance your well-being through ancient healing practices.",
keywords: ["Ayurveda", "Holistic Health", "About Us", "Our Team", "Our Mission", "Ayurvedic Center"],
title: "About Us",
description:
"Learn about our commitment to holistic health through Ayurveda. Discover our story, meet our team, and understand our mission to enhance your well-being through ancient healing practices.",
keywords: ["Ayurveda", "Holistic Health", "About Us", "Our Team", "Our Mission", "Ayurvedic Center"],
};

const AboutPage= () => {
return (
<div className="min-h-screen bg-background py-8">
<div className="container mx-auto px-4">
<h1 className="mb-8 text-4xl font-bold text-center">About AVM Ayurveda</h1>
<HeroSection />
<OurStory />
<MissionAndValues />
<WhyChooseUs />
<LocationMap />
<BookingSection />
const AboutPage = () => {
return (
<div className="min-h-screen bg-background py-8">
<div className="container mx-auto px-4">
<h1 className="mb-8 text-4xl font-bold text-center">About AVM Ayurveda</h1>
<HeroSection />
<OurStory />
<MissionAndValues />
<WhyChooseUs />
<LocationMap />
<BookingSection />
</div>
</div>
</div>
);
}
);
};

export default memo(AboutPage)
export default memo(AboutPage);
10 changes: 6 additions & 4 deletions client/app/(landing-pages)/clinicians/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ export const metadata: Metadata = {

const Page = async () => {
const apiUrl = process.env.NEXT_PUBLIC_API_URL;
const response = await fetch(`${apiUrl && apiUrl.trim() ? apiUrl : "https://api.avm-ayurvedic.online/api"}/doctors`, {
next: { revalidate: 60 }
});
const response = await fetch(
`${apiUrl && apiUrl.trim() ? apiUrl : "https://api.avm-ayurvedic.online/api"}/doctors`,
{
next: { revalidate: 60 },
}
);

const data = await response.json();


return (
<section className="py-12 bg-gradient-to-b from-primary/10 to-background">
<div className="container mx-auto px-4">
Expand Down
3 changes: 1 addition & 2 deletions client/app/(landing-pages)/services/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Featured from "@/components/page-components/landing/services/Featured";
import Services from "@/components/page-components/landing/services/Services";
import WhyOurService from "@/components/page-components/landing/services/WhyOurService";
import Spinner from "@/components/skeletons/Spinner";
import Spinner from "@/components/skeletons/Spinner";
import { Metadata } from "next";
import dynamic from "next/dynamic";
import { memo } from "react";
Expand All @@ -10,7 +10,6 @@ const FeaturesList = dynamic(() => import("@/components/page-components/landing/
loading: () => <Spinner className="w-10 h-10 justify-center items-center" size="md" />,
});


export const metadata: Metadata = {
title: "Services",
description: "Learn about our ayurvedic outpatient and inpatient consulting services",
Expand Down
159 changes: 96 additions & 63 deletions client/app/(patient)/appointments/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
'use client'
"use client";

import { useState } from "react"
import { useParams, notFound } from "next/navigation"
import { format } from "date-fns"
import Image from "next/image"
import { AlertCircle, Calendar, Clock, FileText, Pill } from "lucide-react"
import { useGetAppointmentDetailsPatient, useUpdateAppointmentStatusAndNotesPatient } from "@/lib/hooks/appointment/useAppointmentPatient"
import { useAuth } from "@/lib/hooks/useAuth"
import { AppointmentStatus } from "@/types/enum"
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
import { Textarea } from "@/components/ui/textarea"
import { toast } from "@/components/ui/use-toast"
import { Badge } from "@/components/ui/badge"
import { Separator } from "@/components/ui/separator"
import ConfirmCancelAppointmentModelPatient from "@/components/models/appointment/ConfirmCancelAppointmentPatient"
import { ButtonV2 } from "@/components/button/ButtonV2"
import dynamic from "next/dynamic"
import { useState } from "react";
import { useParams, notFound } from "next/navigation";
import { format } from "date-fns";
import Image from "next/image";
import { AlertCircle, Calendar, Clock, FileText, Pill } from "lucide-react";
import {
useGetAppointmentDetailsPatient,
useUpdateAppointmentStatusAndNotesPatient,
} from "@/lib/hooks/appointment/useAppointmentPatient";
import { useAuth } from "@/lib/hooks/useAuth";
import { AppointmentStatus } from "@/types/enum";
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
import { Textarea } from "@/components/ui/textarea";
import { toast } from "@/components/ui/use-toast";
import { Badge } from "@/components/ui/badge";
import { Separator } from "@/components/ui/separator";
import ConfirmCancelAppointmentModelPatient from "@/components/models/appointment/ConfirmCancelAppointmentPatient";
import { ButtonV2 } from "@/components/button/ButtonV2";
import dynamic from "next/dynamic";

const DownloadPrescriptionButton = dynamic(() => import("@/components/button/DownloadPrescriptionButton"), { ssr: false });
const DownloadPrescriptionButton = dynamic(() => import("@/components/button/DownloadPrescriptionButton"), {
ssr: false,
});

export default function AppointmentDetailsPage() {
const id = useParams().id as string
const [isEditingNote, setIsEditingNote] = useState(false)
const [isCancelModelOpen, setCancelModelOpen] = useState(false)
const { data: appointment, refetch } = useGetAppointmentDetailsPatient(id)
const { mutate: update } = useUpdateAppointmentStatusAndNotesPatient()
const [newNote, setNewNote] = useState("")
const { patientToken } = useAuth()

const id = useParams().id as string;
const [isEditingNote, setIsEditingNote] = useState(false);
const [isCancelModelOpen, setCancelModelOpen] = useState(false);
const { data: appointment, refetch } = useGetAppointmentDetailsPatient(id);
const { mutate: update } = useUpdateAppointmentStatusAndNotesPatient();
const [newNote, setNewNote] = useState("");
const { patientToken } = useAuth();

const handleUpdateNote = async () => {
if (newNote.trim()) {
Expand All @@ -38,27 +42,27 @@ export default function AppointmentDetailsPage() {
toast({
title: "Note Updated",
description: "Your note has been successfully updated.",
})
setIsEditingNote(false)
refetch()
});
setIsEditingNote(false);
refetch();
},
onError: () => {
toast({
title: "Error",
description: "Failed to update the note. Please try again.",
variant: "destructive",
})
});
},
}
)
);
} else {
toast({
title: "Invalid Input",
description: "Note cannot be empty. Please enter some text.",
variant: "destructive",
})
});
}
}
};

const handleCancelAppointment = async () => {
update(
Expand All @@ -67,42 +71,43 @@ export default function AppointmentDetailsPage() {
onSuccess: () => {
toast({
title: "Appointment Cancelled",
description: "Your appointment has been successfully cancelled. Refund will be getting to your account in 10 working days 💸.",
})
refetch()
setCancelModelOpen(false)
description:
"Your appointment has been successfully cancelled. Refund will be getting to your account in 10 working days 💸.",
});
refetch();
setCancelModelOpen(false);
},
onError: () => {
toast({
title: "Error",
description: "Failed to cancel the appointment. Please try again.",
variant: "destructive",
})
});
},
}
)
}
);
};

const isCancellable = () => {
if (!appointment?.slot?.startTime || !appointment?.appointmentDate) return false
if (!appointment?.slot?.startTime || !appointment?.appointmentDate) return false;

const appointmentDate = new Date(appointment.appointmentDate)
const [hours, minutes] = appointment.slot.startTime.split(":")
const isPM = appointment.slot.startTime.includes("PM")
const appointmentDate = new Date(appointment.appointmentDate);
const [hours, minutes] = appointment.slot.startTime.split(":");
const isPM = appointment.slot.startTime.includes("PM");

appointmentDate.setHours(isPM ? parseInt(hours) + 12 : parseInt(hours), parseInt(minutes.split(" ")[0]))
appointmentDate.setHours(isPM ? parseInt(hours) + 12 : parseInt(hours), parseInt(minutes.split(" ")[0]));

const currentTime = new Date()
const threeHoursBefore = new Date(appointmentDate.getTime() - 3 * 60 * 60 * 1000)
return currentTime < threeHoursBefore
}
const currentTime = new Date();
const threeHoursBefore = new Date(appointmentDate.getTime() - 3 * 60 * 60 * 1000);
return currentTime < threeHoursBefore;
};

if (!patientToken) {
notFound()
notFound();
}

if (!appointment) {
return <div className="text-center mt-8">Loading appointment details...</div>
return <div className="text-center mt-8">Loading appointment details...</div>;
}

return (
Expand All @@ -121,26 +126,46 @@ export default function AppointmentDetailsPage() {
<CardContent className="space-y-4">
<div className="grid gap-4 sm:grid-cols-2">
<div className="flex items-center space-x-2">
<Image src={'/assets/icons/calendar.svg'} alt="Calendar" width={24} height={24} className="text-muted-foreground" />
<Image
src={"/assets/icons/calendar.svg"}
alt="Calendar"
width={24}
height={24}
className="text-muted-foreground"
/>
<span className="text-sm">{format(new Date(appointment.appointmentDate!), "PPPP")}</span>
</div>
<div className="flex items-center space-x-2">
<Clock className="w-6 h-6 text-muted-foreground" />
<span className="text-sm">{appointment.slot?.startTime} - {appointment.slot?.endTime}</span>
<span className="text-sm">
{appointment.slot?.startTime} - {appointment.slot?.endTime}
</span>
</div>
<div className="flex items-center space-x-2">
{appointment.appointmentType === "video-consulting" ? (
<Image src={'/assets/icons/utils/video.svg'} alt="Video" width={24} height={24} className="text-muted-foreground" />
<Image
src={"/assets/icons/utils/video.svg"}
alt="Video"
width={24}
height={24}
className="text-muted-foreground"
/>
) : (
<Image src={'/assets/icons/circle-user.svg'} alt="In-person" width={24} height={24} />
<Image src={"/assets/icons/circle-user.svg"} alt="In-person" width={24} height={24} />
)}
<span className="text-sm capitalize">{appointment.appointmentType}</span>
</div>
</div>
<Separator />
<div>
<h3 className="font-semibold mb-2 flex items-center">
<Image src={'/assets/icons/utils/file.svg'} alt="File" width={24} height={24} className="mr-2 text-muted-foreground" />
<Image
src={"/assets/icons/utils/file.svg"}
alt="File"
width={24}
height={24}
className="mr-2 text-muted-foreground"
/>
Reason for Visit
</h3>
<p className="text-sm text-muted-foreground">{appointment.reason}</p>
Expand All @@ -149,18 +174,24 @@ export default function AppointmentDetailsPage() {
<div>
<h3 className="font-semibold mb-2 flex items-center justify-between">
<span className="flex items-center">
<Image src={'/assets/icons/utils/file.svg'} alt="Notes" width={24} height={24} className="mr-2 text-muted-foreground" />
<Image
src={"/assets/icons/utils/file.svg"}
alt="Notes"
width={24}
height={24}
className="mr-2 text-muted-foreground"
/>
Notes
</span>
<ButtonV2
variant="ghost"
size="sm"
onClick={() => {
setNewNote(appointment.notes || "")
setIsEditingNote(true)
setNewNote(appointment.notes || "");
setIsEditingNote(true);
}}
>
<Image src={'/assets/icons/edit.svg'} alt="Edit" width={20} height={20} className="mr-2" />
<Image src={"/assets/icons/edit.svg"} alt="Edit" width={20} height={20} className="mr-2" />
Edit
</ButtonV2>
</h3>
Expand Down Expand Up @@ -213,7 +244,9 @@ export default function AppointmentDetailsPage() {
</div>
<div className="text-center sm:text-left">
<h3 className="font-semibold">{appointment.doctor?.name}</h3>
<p className="text-sm text-muted-foreground">{appointment.doctor?.qualifications?.join(", ")}</p>
<p className="text-sm text-muted-foreground">
{appointment.doctor?.qualifications?.join(", ")}
</p>
</div>
</div>
<Separator />
Expand Down Expand Up @@ -318,5 +351,5 @@ export default function AppointmentDetailsPage() {
handleCancelAppointment={handleCancelAppointment}
/>
</div>
)
}
);
}
Loading

1 comment on commit dd44a9c

@vercel
Copy link

@vercel vercel bot commented on dd44a9c Oct 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.