diff --git a/app/components/Headbar/index.tsx b/app/components/Headbar/index.tsx
deleted file mode 100644
index 4f9af52..0000000
--- a/app/components/Headbar/index.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-import Link from "next/link";
-import { Button, Divider, User } from "@nextui-org/react";
-import { CiLogin } from "react-icons/ci";
-import { GoPlus } from "react-icons/go";
-import { User as UserType } from "@/types";
-import { logoutAction } from "@lib/actions";
-import Notifications from "../Notifications";
-
-type HeadbarProps = {
- user: UserType;
- role: string;
-};
-
-export default async function Headbar({ user, role }: HeadbarProps) {
- return (
-
-
-
- Patient Fitness Tracker
-
-
-
-
-
-
-
-
- {`@${user.username}`}
- }
- />
-
-
-
-
- );
-}
diff --git a/app/components/Notifications/index.tsx b/app/components/Notifications/index.tsx
deleted file mode 100644
index db2dae1..0000000
--- a/app/components/Notifications/index.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-"use client";
-
-import { CiBellOn } from "react-icons/ci";
-import {
- NovuProvider,
- PopoverNotificationCenter,
-} from "@novu/notification-center";
-
-export default function Notifications({ userId }: { userId: string }) {
- return (
-
-
- {({ unseenCount }) => }
-
-
- );
-}
-
-const CustomBellIcon = ({
- unseenCount = 0,
-}: {
- unseenCount: number | undefined;
-}) => {
- return (
- 0 ? "red" : "black"}
- style={{
- cursor: "pointer",
- }}
- >
- {unseenCount > 0 && (
-
- {unseenCount}
-
- )}
-
- );
-};
diff --git a/app/components/SpinnerLoader/index.tsx b/app/components/SpinnerLoader/index.tsx
deleted file mode 100644
index 0a934f3..0000000
--- a/app/components/SpinnerLoader/index.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-"use client";
-import { motion, useAnimate } from "framer-motion";
-import { useEffect } from "react";
-
-const SpinnerLoader: React.FC = () => {
- const text: string = "Loading in progress. please wait";
- const characters: string[] = text.split("");
-
- const radius: number = 80;
- const fontSize: string = "15px";
- const letterSpacing: number = 10.5;
- type AnimationStep = [
- string,
- { opacity: number },
- { duration: number; at: string }
- ];
- const [scope, animate] = useAnimate();
-
- useEffect(() => {
- const animateLoader = async () => {
- const letterAnimation: AnimationStep[] = [];
- characters.forEach((_, i) => {
- letterAnimation.push([
- `.letter-${i}`,
- { opacity: 0 },
- { duration: 0.3, at: i === 0 ? "+0.8" : "-0.28" },
- ]);
- });
- characters.forEach((_, i) => {
- letterAnimation.push([
- `.letter-${i}`,
- { opacity: 1 },
- { duration: 0.3, at: i === 0 ? "+0.8" : "-0.28" },
- ]);
- });
- animate(letterAnimation, {
- repeat: Number.POSITIVE_INFINITY,
- });
- animate(
- scope.current,
- { rotate: 360 },
- { duration: 4, repeat: Number.POSITIVE_INFINITY }
- );
- };
- animateLoader();
- }, [animate, scope, characters]);
-
- const letter = "absolute top-0 left-[50%] text-black";
- return (
-
-
-
-
- {characters.map((ch, i) => (
-
- key={i}
- className={`${letter} letter-${i}`}
- style={{
- transformOrigin: `0 ${radius}px`,
- transform: `rotate(${i * letterSpacing}deg)`,
- fontSize,
- }}
- >
- {ch}
-
- ))}
-
-
-
- );
-};
-
-export default SpinnerLoader;
diff --git a/app/components/brandlogo/index.tsx b/app/components/brandlogo/index.tsx
deleted file mode 100644
index 2c41211..0000000
--- a/app/components/brandlogo/index.tsx
+++ /dev/null
@@ -1,10 +0,0 @@
-import Image from "next/image";
-
-export default function BrandLogo() {
- return (
-
-
-
Patient Fitness Tracker
-
- );
-}
diff --git a/app/components/carousel/index.tsx b/app/components/carousel/index.tsx
deleted file mode 100644
index c42fb68..0000000
--- a/app/components/carousel/index.tsx
+++ /dev/null
@@ -1,95 +0,0 @@
-"use client";
-import { Card, Image } from "@nextui-org/react";
-import React, { useEffect, useRef, useState } from "react";
-
-const Carousel = ({
- data,
-}: {
- data: {
- image: string;
- title: string;
- desc: string;
- }[];
-}) => {
- const [currentImg, setCurrentImg] = useState(0);
- const [carouselSize, setCarouselSize] = useState({ width: 0, height: 0 });
- const carouselRef = useRef(null);
- const [intervalId, setIntervalId] = useState("");
-
- useEffect(() => {
- let elem = carouselRef.current as unknown as HTMLDivElement;
- let { width, height } = elem.getBoundingClientRect();
- if (carouselRef.current) {
- setCarouselSize({
- width,
- height,
- });
- }
-
- // Function to increment image index
- const incrementImageIndex = () => {
- setCurrentImg((prev) => (prev + 1) % data.length);
- };
-
- // Set interval for automatic sliding
- const id = setInterval(incrementImageIndex, 3000);
-
- // Clear interval on unmount
- return () => clearInterval(id);
- }, [data]);
-
- const handleClick = (index: number) => {
- clearInterval(intervalId); // Clear automatic sliding interval
- setCurrentImg(index);
- };
-
- return (
-
- {/* Carousel container */}
-
- {/* Image container */}
-
- {data.map((v, i) => (
-
- ))}
-
-
-
- {/* Navigation buttons */}
-
- {data.map((_, index) => (
-
- ))}
-
-
- );
-};
-
-export default Carousel;
diff --git a/app/components/error-boundary/index.tsx b/app/components/error-boundary/index.tsx
deleted file mode 100644
index 297fdd9..0000000
--- a/app/components/error-boundary/index.tsx
+++ /dev/null
@@ -1,85 +0,0 @@
-"use client";
-import { logoutAction } from "@/lib/actions";
-import { Button, Image } from "@nextui-org/react";
-import React, { ErrorInfo, ReactNode } from "react";
-
-interface ErrorBoundaryProps {
- children: ReactNode;
-}
-
-interface ErrorBoundaryState {
- hasError: boolean;
- errorMessage: string;
-}
-
-class ErrorBoundary extends React.Component<
- ErrorBoundaryProps,
- ErrorBoundaryState
-> {
- constructor(props: ErrorBoundaryProps) {
- super(props);
- this.state = { hasError: false, errorMessage: "" };
- }
-
- static getDerivedStateFromError(error: Error): ErrorBoundaryState {
- return { hasError: true, errorMessage: error.message };
- }
-
- componentDidCatch(error: Error, errorInfo: ErrorInfo): void {
- console.log(error, errorInfo);
- this.setState({ errorMessage: error.message });
- }
-
- handleRetry = () => {
- console.log("Retrying...");
- window.location.reload();
- };
-
- handleLogout = async () => {
- console.log("Logging out...");
- await logoutAction();
- };
-
- render(): ReactNode {
- if (this.state.hasError) {
- return (
-
-
-
-
- Oops! Something went wrong.
-
-
- We're sorry, but there was an error{" "}
- {this.state.errorMessage}. Please try
- again.
-
-
-
-
-
-
-
- );
- }
-
- return this.props.children;
- }
-}
-
-export default ErrorBoundary;
diff --git a/app/components/headbar/index.tsx b/app/components/headbar/index.tsx
deleted file mode 100644
index 4f9af52..0000000
--- a/app/components/headbar/index.tsx
+++ /dev/null
@@ -1,60 +0,0 @@
-import Link from "next/link";
-import { Button, Divider, User } from "@nextui-org/react";
-import { CiLogin } from "react-icons/ci";
-import { GoPlus } from "react-icons/go";
-import { User as UserType } from "@/types";
-import { logoutAction } from "@lib/actions";
-import Notifications from "../Notifications";
-
-type HeadbarProps = {
- user: UserType;
- role: string;
-};
-
-export default async function Headbar({ user, role }: HeadbarProps) {
- return (
-
-
-
- Patient Fitness Tracker
-
-
-
-
-
-
-
-
- {`@${user.username}`}
- }
- />
-
-
-
-
- );
-}
diff --git a/app/components/index.tsx b/app/components/index.tsx
deleted file mode 100644
index 2314f60..0000000
--- a/app/components/index.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import BrandLogo from "./brandlogo";
-import Carousel from "./carousel";
-import ErrorBoundary from "./error-boundary";
-import Headbar from "./headbar";
-// import Notifications from "./Notifications";
-import OtpSection from "./otp";
-import SpinnerLoader from "./SpinnerLoader";
-
-export {
- BrandLogo,
- Carousel,
- ErrorBoundary,
- Headbar,
- // Notifications,
- OtpSection,
- SpinnerLoader,
-};
diff --git a/app/components/notifications/index.tsx b/app/components/notifications/index.tsx
deleted file mode 100644
index db2dae1..0000000
--- a/app/components/notifications/index.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-"use client";
-
-import { CiBellOn } from "react-icons/ci";
-import {
- NovuProvider,
- PopoverNotificationCenter,
-} from "@novu/notification-center";
-
-export default function Notifications({ userId }: { userId: string }) {
- return (
-
-
- {({ unseenCount }) => }
-
-
- );
-}
-
-const CustomBellIcon = ({
- unseenCount = 0,
-}: {
- unseenCount: number | undefined;
-}) => {
- return (
- 0 ? "red" : "black"}
- style={{
- cursor: "pointer",
- }}
- >
- {unseenCount > 0 && (
-
- {unseenCount}
-
- )}
-
- );
-};
diff --git a/app/components/otp/index.tsx b/app/components/otp/index.tsx
deleted file mode 100644
index 8f36a23..0000000
--- a/app/components/otp/index.tsx
+++ /dev/null
@@ -1,148 +0,0 @@
-"use client";
-
-import {
- Modal,
- ModalBody,
- ModalContent,
- Image,
- useDisclosure,
- Input,
- Button,
-} from "@nextui-org/react";
-import { useRouter } from "next/navigation";
-import React, { useRef, useState } from "react";
-import toast, { Toaster } from "react-hot-toast";
-import verifyOtp from "@lib/verifyOtp";
-
-type userDataType = {
- userData: {
- email: string;
- role: string;
- action: string;
- };
-};
-
-export default function OtpSection({ userData }: userDataType) {
- const { onOpenChange } = useDisclosure();
-
- const [otp, setOtp] = useState("");
- const [showError, setShowError] = useState("");
-
- const router = useRouter();
- const inputsRefs = useRef>(
- Array.from({ length: 5 }, () => null)
- );
-
- const handleInputChange = (
- e: React.ChangeEvent,
- index: number
- ) => {
- const value = e.target.value;
- setShowError("");
- setOtp((prevOtp) => prevOtp + value);
- if (value && index < 4) {
- inputsRefs.current[index + 1]?.focus();
- }
- };
-
- const resetOtpInputs = () => {
- inputsRefs.current.forEach((input) => {
- if (input) {
- input.value = "";
- }
- });
- setOtp("");
- };
-
- const handleSubmit = async () => {
- const data = await verifyOtp(
- userData.email,
- userData.role,
- userData.action,
- otp
- );
-
- if (data.error) {
- setShowError(data.error);
- resetOtpInputs();
- } else {
- setShowError("");
-
- const sendingOtpPromise = new Promise((resolve) => {
- setTimeout(async () => {
- resolve(true);
- router.push(`/${userData.role}`);
- }, 1000);
- });
-
- toast.promise(
- sendingOtpPromise,
- {
- loading: "Please wait...",
- success: `${
- userData.action === "Login"
- ? "You are now logged in."
- : "Your account has been created."
- }`,
- error: "Error while verifying OTP",
- },
- { position: "bottom-center" }
- );
- }
- };
-
- return (
-
-
- {(onClose) => (
- <>
-
-
- Enter your OTP
-
-
-
- {[...Array(5)].map((_, index) => (
- handleInputChange(e, index)}
- ref={(el) => (inputsRefs.current[index] = el)}
- value={otp[index] || ""}
- />
- ))}
-
-
- {showError && (
-
- OTP is not valid
-
- )}
-
-
-
- >
- )}
-
-
-
- );
-}