diff --git a/package.json b/package.json index 323b64c..9640d98 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "axios": "^1.7.9", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", - "date-fns": "^2.30.0", "dotenv": "^16.4.7", "formidable": "^3.5.2", "hoyahax-2025": "file:", @@ -39,7 +38,6 @@ "openai": "^4.80.1", "openai-whisper": "^1.0.2", "react": "^19.0.0", - "react-day-picker": "^9.5.0", "react-dom": "^19.0.0", "recharts": "^2.15.0", "svix": "^1.45.1", diff --git a/src/app/(panels)/suite/doctor/dashboard/Calender.jsx b/src/app/(panels)/suite/doctor/dashboard/Calender.jsx deleted file mode 100644 index 2eeb0a0..0000000 --- a/src/app/(panels)/suite/doctor/dashboard/Calender.jsx +++ /dev/null @@ -1,24 +0,0 @@ -"use client" -import { useState } from "react" - -import { Calendar } from "@/components/ui/calendar" - -import { Card, CardContent } from "@/components/ui/card" - -export function ScheduleCalender() { - - const [date, setDate] = useState(new Date()) - - return ( - - - - - - ) -} diff --git a/src/app/(panels)/suite/doctor/dashboard/page.tsx b/src/app/(panels)/suite/doctor/dashboard/page.tsx index ace1329..559038a 100644 --- a/src/app/(panels)/suite/doctor/dashboard/page.tsx +++ b/src/app/(panels)/suite/doctor/dashboard/page.tsx @@ -2,7 +2,6 @@ import { PatientTable } from "./PatientTable" -import { ScheduleCalender } from "./Calender" export default function Dashboard() { @@ -17,7 +16,6 @@ export default function Dashboard() {

Dashboard

-
) diff --git a/src/app/(panels)/suite/layout.jsx b/src/app/(panels)/suite/layout.jsx new file mode 100644 index 0000000..942b910 --- /dev/null +++ b/src/app/(panels)/suite/layout.jsx @@ -0,0 +1,40 @@ +"use client" + +import { useState, useEffect } from "react"; +import { useUser } from "@clerk/nextjs"; + +import axios from "axios"; + +export default function RootLayout({ + children, +}) { + const { user } = useUser(); + const [userData, setUserData] = useState(null); + + useEffect(() => { + if (user) { + axios.get(`/api/user?userId=${user.id}`).then(response => { + setUserData(response.data); + }); + } + }, [user]); + + if (userData) { + if (userData.role === "caregiver") { + window.location.href = "suite/doctor/dashboard"; + } + if (userData.role === "patient") { + window.location.href = "suite/patient/dashboard"; + } + } else { + window.location.href = "/"; + window.location.href = "/"; + return null; + } + + + + return ( + <>{children} + ) +} diff --git a/tsconfig.json b/tsconfig.json index 1eb83cb..d29ef96 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -22,6 +22,6 @@ "@/*": ["./src/*"] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/app/api/connectDB.js", "src/lib/utils.js", "src/app/(web)/account/page.jsx", "src/app/(panels)/suite/patient/account/page.jsx", "src/app/(panels)/suite/patient/dashboard/MedicationTable.jsx", "src/app/(panels)/suite/patient/dashboard/page.jsx", "src/app/api/transcribe/route.js", "src/components/ui/calendar.jsx", "src/app/(web)/page.jsx", "src/app/(web)/transcribe/page.jsx", "src/app/(web)/login/page.jsx"], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", "src/app/api/connectDB.js", "src/lib/utils.js", "src/app/(web)/account/page.jsx", "src/app/(panels)/suite/patient/account/page.jsx", "src/app/(panels)/suite/patient/dashboard/MedicationTable.jsx", "src/app/(panels)/suite/patient/dashboard/page.jsx", "src/app/api/transcribe/route.js", "src/components/ui/calendar.jsx", "src/app/(web)/page.jsx", "src/app/(web)/transcribe/page.jsx", "src/app/(web)/login/page.jsx", "src/app/(panels)/suite/layout.jsx"], "exclude": ["node_modules"] }