diff --git a/client/components/button/VideoButtonPatient.tsx b/client/components/button/VideoSectionButtonPatient.tsx
similarity index 60%
rename from client/components/button/VideoButtonPatient.tsx
rename to client/components/button/VideoSectionButtonPatient.tsx
index a39ebe23..b9e4e933 100644
--- a/client/components/button/VideoButtonPatient.tsx
+++ b/client/components/button/VideoSectionButtonPatient.tsx
@@ -1,44 +1,53 @@
'use client';
-import React, { useState } from 'react';
+import React, { memo, useState } from 'react';
import { ButtonV2 } from './ButtonV2';
import Image from 'next/image';
import { Badge } from '@/components/ui/badge'
import VideoCallModal from '../models/VideoSectionsModel';
+import { useGetSectionsInOneDayPatient } from '@/lib/hooks/video/usePatient';
+import { Skeleton } from '../ui/skeleton';
-const VideoButtonPatient = () => {
+const VideoSectionButtonPatient = () => {
+ const { data: upcomingSections, isLoading } = useGetSectionsInOneDayPatient();
+ const [isModalOpen, setIsModalOpen] = useState(false);
+ console.log(upcomingSections);
+
+ if(isLoading) return
+
const handleClick = () => {
console.log('Video button clicked');
}
+
return (
<>
- {/*
- {upcomingSections.length > 0 && (
+ {upcomingSections!.length > 0 && (
- {upcomingSections.length}
+ {upcomingSections!.length}
- )} */}
+ )}
View Upcoming Video Calls
- {/* */}
+ />
>
)
}
-export default VideoButtonPatient
\ No newline at end of file
+export default memo(VideoSectionButtonPatient)
\ No newline at end of file
diff --git a/client/components/layout/NavBar.tsx b/client/components/layout/NavBar.tsx
index 5367e68b..3cbbe5c4 100644
--- a/client/components/layout/NavBar.tsx
+++ b/client/components/layout/NavBar.tsx
@@ -22,7 +22,7 @@ import { useState } from "react";
import LogoutModel from "../models/LogoutModel";
import { ButtonV2 } from "../button/ButtonV2";
import NotificationButtonPatient from "../button/NotificationButtonPatient";
-import VideoButtonPatient from "../button/VideoButtonPatient";
+import VideoSectionButtonPatient from "../button/VideoSectionButtonPatient";
export const NavBar = () => {
const path = usePathname();
@@ -133,7 +133,7 @@ export const NavBar = () => {
-
+
diff --git a/client/lib/api/slots/route.ts b/client/lib/api/slots/index.ts
similarity index 100%
rename from client/lib/api/slots/route.ts
rename to client/lib/api/slots/index.ts
diff --git a/client/lib/api/video/index.ts b/client/lib/api/video/index.ts
new file mode 100644
index 00000000..12db5bdc
--- /dev/null
+++ b/client/lib/api/video/index.ts
@@ -0,0 +1,23 @@
+import { withTempBaseUrl } from "@/lib/utils/withTempBaseUrl";
+import patientAxiosInstance from "../patient/authorizedRoutes";
+import doctorAxiosInstance from "../doctor/authorizedRoutes";
+
+const patientBaseUrl = `${process.env.NEXT_PUBLIC_API_URL}/video/patient`;
+const doctorBaseUrl = `${process.env.NEXT_PUBLIC_API_URL}/video/doctor`;
+
+export const getSectionsInOneDayPatient = async () => {
+ const response = await withTempBaseUrl(patientAxiosInstance, patientBaseUrl, {
+ method: "GET",
+ url: `/day`,
+ });
+ return response.data;
+};
+
+export const getSectionsInOneDayDoctor = async () => {
+ const response = await withTempBaseUrl(doctorAxiosInstance, doctorBaseUrl, {
+ method: "GET",
+ url: `/day`,
+ });
+ return response.data;
+};
+
diff --git a/client/lib/hooks/slots/useSlot.ts b/client/lib/hooks/slots/useSlot.ts
index e6125218..30e35a46 100644
--- a/client/lib/hooks/slots/useSlot.ts
+++ b/client/lib/hooks/slots/useSlot.ts
@@ -11,7 +11,7 @@ import {
addSlotsAllDayDoctor,
deleteSlotsAllDayDoctor,
getSlotsOfDoctor,
-} from "@/lib/api/slots/route";
+} from "@/lib/api/slots";
export const useAddSlotsDoctor = () => {
return useMutation, { slots: ISlot[]; day: Days }>({
diff --git a/client/lib/hooks/video/useDoctor.ts b/client/lib/hooks/video/useDoctor.ts
new file mode 100644
index 00000000..3875bbaf
--- /dev/null
+++ b/client/lib/hooks/video/useDoctor.ts
@@ -0,0 +1,10 @@
+import { getSectionsInOneDayDoctor } from "@/lib/api/video";
+import IVideoSection from "@/types/entities";
+import { useQuery } from "@tanstack/react-query";
+
+export const useGetSectionsInOneDayDoctor = () => {
+ return useQuery({
+ queryKey: ["section-day"],
+ queryFn: () => getSectionsInOneDayDoctor(),
+ });
+};
diff --git a/client/lib/hooks/video/usePatient.ts b/client/lib/hooks/video/usePatient.ts
new file mode 100644
index 00000000..c8a3e8ae
--- /dev/null
+++ b/client/lib/hooks/video/usePatient.ts
@@ -0,0 +1,10 @@
+import { getSectionsInOneDayPatient } from "@/lib/api/video";
+import IVideoSection from "@/types/entities";
+import { useQuery } from "@tanstack/react-query";
+
+export const useGetSectionsInOneDayPatient = () => {
+ return useQuery({
+ queryKey: ["section-day"],
+ queryFn: () => getSectionsInOneDayPatient(),
+ });
+};
diff --git a/server/src/use_case/slot/GetSlotUseCase.ts b/server/src/use_case/slot/GetSlotUseCase.ts
index 3e213564..4a87b189 100644
--- a/server/src/use_case/slot/GetSlotUseCase.ts
+++ b/server/src/use_case/slot/GetSlotUseCase.ts
@@ -46,7 +46,6 @@ export default class GetSlotUseCase {
return dayNames[dayOfWeek] as Days;
}
- // parsing the slot start time to date
private parseTimeStringToDate (timeString: string): Date {
const [time, modifier] = timeString.split(' ');
let [hours, minutes] = time.split(':').map(Number);