Skip to content

Commit

Permalink
✨ appointments styles updated
Browse files Browse the repository at this point in the history
  • Loading branch information
sinanptm committed Sep 26, 2024
1 parent abb4a36 commit 5e6d2ef
Show file tree
Hide file tree
Showing 35 changed files with 312 additions and 314 deletions.
293 changes: 144 additions & 149 deletions client/app/(patient)/appointments/[id]/page.tsx

Large diffs are not rendered by default.

183 changes: 93 additions & 90 deletions client/app/(patient)/appointments/page.tsx
Original file line number Diff line number Diff line change
@@ -1,95 +1,98 @@
"use client";
'use client'

import Pagination from "@/components/navigation/Pagination";
import { useGetAppointmentsPatient } from "@/lib/hooks/appointment/useAppointmentPatient";
import GetStatusBadge from "@/components/page-components/doctor/appointment/GetStatusBadge";
import { Card, CardContent, CardHeader, CardTitle, CardFooter } from "@/components/ui/card";
import { ButtonV2 } from "@/components/common/ButtonV2";
import { useRouter } from "next/navigation";
import { format } from "date-fns";
import { Calendar, FileText, Video, User } from "lucide-react";
import { useState } from "react";
import { useState } from "react"
import { useRouter } from "next/navigation"
import { format } from "date-fns"
import { FileText, Video, User } from "lucide-react"
import { useGetAppointmentsPatient } from "@/lib/hooks/appointment/useAppointmentPatient"
import Pagination from "@/components/navigation/Pagination"
import GetStatusBadge from "@/components/page-components/doctor/appointment/GetStatusBadge"
import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
import { Skeleton } from "@/components/ui/skeleton"
import { ButtonV2 } from "@/components/button/ButtonV2"

const AppointmentsPageSection = ({ searchParams }: { searchParams: { page: number } }) => {
const page = searchParams.page || 1;
const [currentPage, setCurrentPage] = useState(page);
const { data, isLoading } = useGetAppointmentsPatient(page-1, 4);
const router = useRouter();
export default function AppointmentsPageSection({ searchParams }: { searchParams: { page: number } }) {
const page = searchParams.page || 1
const [currentPage, setCurrentPage] = useState(page)
const { data, isLoading } = useGetAppointmentsPatient(page - 1, 4)
const router = useRouter()

const handlePageChange = (pageIndex: number) => {
if (pageIndex > data?.totalPages! || pageIndex < 1) return null;
router.replace(`/appointments?page=${pageIndex}`);
setCurrentPage(pageIndex);
};
const handlePageChange = (pageIndex: number) => {
if (pageIndex > data?.totalPages! || pageIndex < 1) return null
router.replace(`/appointments?page=${pageIndex}`)
setCurrentPage(pageIndex)
}

const handleViewDetails = (appointmentId: string) => {
router.push(`/appointments/${appointmentId}`);
};
const handleViewDetails = (appointmentId: string) => {
router.push(`/appointments/${appointmentId}`)
}

return (
<div className="min-h-screen p-4 sm:p-6 md:p-8">
<div className="max-w-4xl mx-auto space-y-4">
<h1 className="text-3xl font-bold text-green-400 mb-6">My Appointments</h1>

{data?.items.map((appointment) => (
<Card
key={appointment._id}
className="mb-4 bg-dark-400 border-gray-400 shadow-md hover:shadow-lg transition-shadow duration-300"
>
<CardHeader className="py-3 px-4 bg-gray-750 border-b border-gray-700">
<CardTitle className="flex justify-between items-center text-base">
<div className="flex items-center space-x-2">
<Calendar className="w-4 h-4 text-green-400" />
<span className="text-gray-100">
{format(new Date(appointment.appointmentDate!), "dd/MM/yy")}
</span>
</div>
<GetStatusBadge status={appointment.status!} />
</CardTitle>
</CardHeader>
<CardContent className="py-3 px-4">
<div className="grid grid-cols-2 gap-2 text-sm">
<div className="flex items-center space-x-2">
{appointment.appointmentType === "video-consulting" ? (
<Video className="w-4 h-4 text-blue-400" />
) : (
<User className="w-4 h-4 text-blue-400" />
)}
<p className="text-gray-300">{appointment.appointmentType}</p>
</div>
<div className="flex items-center space-x-2">
<FileText className="w-4 h-4 text-blue-400" />
<p className="text-gray-300 truncate">{appointment.reason}</p>
</div>
</div>
</CardContent>
<CardFooter className="py-2 px-4 bg-gray-750 border-t border-gray-700 flex justify-end">
<ButtonV2
variant="gooeyRight"
size="sm"
onClick={() => handleViewDetails(appointment._id!)}
className="text-green-400 border-green-500"
>
View Details
</ButtonV2>
</CardFooter>
</Card>
))}

<div className="mt-6">
{!isLoading && (
<Pagination
currentPage={currentPage}
handlePageChange={handlePageChange}
hasNextPage={data?.hasNextPage!}
hasPrevPage={data?.hasPreviousPage!}
totalPages={data?.totalPages!}
/>
)}
</div>
</div>
</div>
);
};

export default AppointmentsPageSection;
return (
<div className="container mx-auto py-10">
<h1 className="text-4xl font-bold mb-8 text-primary">My Appointments</h1>
{isLoading ? (
<div className="space-y-4">
{[...Array(4)].map((_, index) => (
<Card key={index} className="bg-card">
<CardHeader>
<Skeleton className="h-6 w-1/3" />
</CardHeader>
<CardContent>
<Skeleton className="h-4 w-full mb-2" />
<Skeleton className="h-4 w-2/3" />
</CardContent>
<CardFooter>
<Skeleton className="h-10 w-28" />
</CardFooter>
</Card>
))}
</div>
) : (
<div className="space-y-6">
{data?.items.map((appointment) => (
<Card key={appointment._id} className="bg-card hover:shadow-lg transition-shadow duration-300">
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-lg font-medium">
Appointment on {format(new Date(appointment.appointmentDate!), "MMMM d, yyyy")}
</CardTitle>
<GetStatusBadge status={appointment.status!} />
</CardHeader>
<CardContent>
<div className="grid grid-cols-2 gap-4">
<div className="flex items-center space-x-2">
{appointment.appointmentType === "video-consulting" ? (
<Video className="h-4 w-4 text-primary" />
) : (
<User className="h-4 w-4 text-primary" />
)}
<span className="text-sm text-muted-foreground capitalize">{appointment.appointmentType}</span>
</div>
<div className="flex items-center space-x-2 col-span-2">
<FileText className="h-4 w-4 text-primary" />
<span className="text-sm text-muted-foreground truncate">{appointment.reason}</span>
</div>
</div>
</CardContent>
<CardFooter>
<ButtonV2 onClick={() => handleViewDetails(appointment._id!)} variant="ringHover" className="w-full">
View Details
</ButtonV2>
</CardFooter>
</Card>
))}
</div>
)}
{!isLoading && (
<div className="mt-8">
<Pagination
currentPage={currentPage}
handlePageChange={handlePageChange}
hasNextPage={data?.hasNextPage!}
hasPrevPage={data?.hasPreviousPage!}
totalPages={data?.totalPages!}
/>
</div>
)}
</div>
)
}
2 changes: 1 addition & 1 deletion client/app/(patient)/chats/@chatList/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use client'
import { ButtonV2 } from "@/components/common/ButtonV2";
import { ButtonV2 } from "@/components/button/ButtonV2";
import NewChatModal, { ChatModelUser } from "@/components/models/chat/AddChatModel";
import ChatList from "@/components/page-components/chat/ChatList"
import { toast } from "@/components/ui/use-toast";
Expand Down
2 changes: 1 addition & 1 deletion client/app/(patient)/new-appointment/cancel/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Image from "next/image";
import Link from "next/link";
import { useParams } from "next/navigation";
import { XCircle } from "lucide-react";
import { ButtonV2 } from "@/components/common/ButtonV2";
import { ButtonV2 } from "@/components/button/ButtonV2";
import { useEffect, useState } from "react";
import { BreadcrumbCollapsed } from "@/components/navigation/BreadCrumbs";

Expand Down
2 changes: 1 addition & 1 deletion client/app/(patient)/profile/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Skeleton } from "@/components/ui/skeleton";
import Image from "next/image";
import { useState } from "react";
import { useGetPatientProfile } from "@/lib/hooks/patient/usePatient";
import { ButtonV2 } from "@/components/common/ButtonV2";
import { ButtonV2 } from "@/components/button/ButtonV2";
import dynamic from "next/dynamic";
import Loading from "@/components/skeletons/Loader";

Expand Down
2 changes: 1 addition & 1 deletion client/app/(patient)/signin/reset-password/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { z } from "zod";
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "@/components/ui/card";
import CustomFormField from "@/components/common/CustomFormField";
import { FormFieldType } from "@/types/fromTypes";
import SubmitButton from "@/components/common/SubmitButton";
import SubmitButton from "@/components/button/SubmitButton";
import { useUpdatePassword } from "@/lib/hooks/patient/usePatientAuth";
import { Form } from "@/components/ui/form";
import { useAuth } from "@/lib/hooks/useAuth";
Expand Down
2 changes: 1 addition & 1 deletion client/app/doctor/@auth/reset-password/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { z } from "zod";
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "@/components/ui/card";
import CustomFormField from "@/components/common/CustomFormField";
import { FormFieldType } from "@/types/fromTypes";
import SubmitButton from "@/components/common/SubmitButton";
import SubmitButton from "@/components/button/SubmitButton";
import { useUpdatePassword } from "@/lib/hooks/patient/usePatientAuth";
import { Form } from "@/components/ui/form";
import { useAuth } from "@/lib/hooks/useAuth";
Expand Down
2 changes: 1 addition & 1 deletion client/app/doctor/appointments/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import AppointmentCancellationModal from '@/components/models/appointment/Confir
import { Calendar, Clock, FileText, Video, User, Phone, AlertCircle } from 'lucide-react'
import { format } from 'date-fns'
import { useState } from 'react'
import { ButtonV2 } from '@/components/common/ButtonV2'
import { ButtonV2 } from '@/components/button/ButtonV2'

export default function AppointmentDetailsPage() {
const params = useParams()
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion client/components/button/NotificationButtonDoctor.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { forwardRef, useState } from "react";
import { Bell } from "lucide-react";
import { Badge } from "@/components/ui/badge";
import { ButtonV2 } from "@/components/common/ButtonV2";
import { ButtonV2 } from "@/components/button/ButtonV2";
import NotificationModal from "@/components/models/NotificationModel";
import {
useGetAllDoctorNotifications,
Expand Down
2 changes: 1 addition & 1 deletion client/components/button/NotificationButtonPatient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { Bell } from "lucide-react";
import { Badge } from "@/components/ui/badge";
import { ButtonV2 } from "@/components/common/ButtonV2";
import { ButtonV2 } from "@/components/button/ButtonV2";
import { useState } from "react";
import { useGetAllPatientNotifications, useClearPatientNotification, useClearMultiplePatientNotifications } from "@/lib/hooks/notification/useNotificationPatient";
import { INotification } from "@/types";
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion client/components/forms/admin/SigninForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useForm } from "react-hook-form";
import { z } from "zod";
import { Form } from "@/components/ui/form";
import CustomFormField from "@/components/common/CustomFormField";
import SubmitButton from "@/components/common/SubmitButton";
import SubmitButton from "@/components/button/SubmitButton";
import { signinFormValidation } from "@/components/forms/actions/adminValidation";
import { FormFieldType } from "@/types/fromTypes";
import { useSigninAdmin } from "@/lib/hooks/admin/useAdminAuth";
Expand Down
2 changes: 1 addition & 1 deletion client/components/forms/doctor/ForgetPasswordForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from "@/components/ui/alert-dialog";
import { Button } from "@/components/ui/button";
import { Form } from "@/components/ui/form";
import SubmitButton from "../../common/SubmitButton";
import SubmitButton from "../../button/SubmitButton";
import CustomFormField from "../../common/CustomFormField";
import { FormFieldType } from "@/types/fromTypes";
import { toast } from "../../ui/use-toast";
Expand Down
2 changes: 1 addition & 1 deletion client/components/forms/doctor/SigninForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useForm } from "react-hook-form";
import { z } from "zod";
import { Form, FormMessage } from "@/components/ui/form";
import CustomFormField from "@/components/common/CustomFormField";
import SubmitButton from "@/components/common/SubmitButton";
import SubmitButton from "@/components/button/SubmitButton";
import { signinFormValidation } from "@/components/forms/actions/adminValidation";
import { FormFieldType } from "@/types/fromTypes";
import Link from "next/link";
Expand Down
61 changes: 13 additions & 48 deletions client/components/forms/doctor/SignupForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

import { useState } from "react";
import { zodResolver } from "@hookform/resolvers/zod";
import { Controller, useFieldArray, useForm } from "react-hook-form";
import { useForm } from "react-hook-form";
import { z } from "zod";
import { Form, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
import CustomFormField from "@/components/common/CustomFormField";
import SubmitButton from "@/components/common/SubmitButton";
import SubmitButton from "@/components/button/SubmitButton";
import { FormFieldType } from "@/types/fromTypes";
import Link from "next/link";
import { useRouter } from "next/navigation";
import { useToast } from "@/components/ui/use-toast";
import { Button } from "@/components/ui/button";
import { useSignUpDoctor, useUpdateProfileImageDoctor } from "@/lib/hooks/doctor/useDoctorAuth";
import useCrop from "@/lib/hooks/useCrop";
import CropImage from "@/components/common/CropImage";
import getCroppedImg from "@/lib/utils/cropImage";
import { Input } from "@/components/ui/input";
import { getPresignedUrlDoctor } from "@/lib/api/doctor/authenticationRoutes";
import axios from "axios";
import { PlusCircle, X } from "lucide-react";
import { DoctorDegrees } from "@/constants";
import { MultiSelect } from "@/components/ui/multi-select"

const ALLOWED_FILE_TYPES = ["image/jpeg", "image/png"];
const MAX_FILE_SIZE = 5 * 1024 * 1024;
Expand Down Expand Up @@ -101,15 +101,10 @@ const SignUpForm = () => {
name: "",
email: "",
confirmPassword: "",
qualifications: [""],
qualifications: [],
},
});

const { fields, append, remove } = useFieldArray({
control: form.control,
name: "qualifications" as never,
});

const onSubmit = async (formData: FormValues) => {
setError("");
setLoading(true);
Expand Down Expand Up @@ -290,46 +285,16 @@ const SignUpForm = () => {
<FormField
control={form.control}
name="qualifications"
render={() => (
render={({ field }) => (
<FormItem className="space-y-4">
<FormLabel>Qualifications *</FormLabel>
<div className="flex flex-wrap items-center gap-2">
{fields.map((field, index) => (
<div key={field.id} className="flex items-center bg-secondary rounded-full pl-3 pr-1 py-1">
<Controller
name={`qualifications.${index}`}
control={form.control}
render={({ field }) => (
<Input
{...field}
placeholder="Enter qualification"
className="border-none bg-transparent p-0 h-auto text-sm focus-visible:ring-0 focus-visible:ring-offset-0"
/>
)}
/>
<Button
type="button"
variant="ghost"
size="sm"
className="h-auto p-1 hover:bg-secondary-foreground/10 rounded-full"
onClick={() => remove(index)}
aria-label="Remove qualification"
>
<X className="h-4 w-4" />
</Button>
</div>
))}
<Button
type="button"
variant="outline"
size="sm"
onClick={() => append("")}
className="rounded-full"
>
<PlusCircle className="h-4 w-4 mr-2" />
Add
</Button>
</div>
<MultiSelect
options={DoctorDegrees.map(degree => ({ label: degree, value: degree }))}
placeholder="Select qualifications"
className="w-full"
{...field}
onValueChange={(value) => field.onChange(value)}
/>
<FormMessage className="shad-error" />
</FormItem>
)}
Expand Down
2 changes: 1 addition & 1 deletion client/components/forms/patient/AppointmentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useForm } from "react-hook-form";
import { z } from "zod";
import { Form } from "@/components/ui/form";
import CustomFormField from "@/components/common/CustomFormField";
import SubmitButton from "@/components/common/SubmitButton";
import SubmitButton from "@/components/button/SubmitButton";
import { appointmentFormValidation } from "@/components/forms/actions/userValidation";
import { SelectItem } from "@/components/ui/select";
import Image from "next/image";
Expand Down
Loading

1 comment on commit 5e6d2ef

@vercel
Copy link

@vercel vercel bot commented on 5e6d2ef Sep 26, 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.