From e4db3d987cd592ee6fa995e401eed28f2f75342b Mon Sep 17 00:00:00 2001 From: Rhythm <65298117+Rhythm1710@users.noreply.github.com> Date: Thu, 23 May 2024 21:33:44 +0530 Subject: [PATCH 01/10] Patient Routes --- backend/routes/patient_routes.py | 52 +++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/backend/routes/patient_routes.py b/backend/routes/patient_routes.py index f04bee3..9c30f83 100644 --- a/backend/routes/patient_routes.py +++ b/backend/routes/patient_routes.py @@ -1,9 +1,53 @@ -from fastapi import APIRouter +from typing import Annotated +from pydantic import BaseModel, Field +from sqlalchemy.orm import Session +from fastapi import APIRouter, Depends, HTTPException, Path +from starlette import status +from models import Patient +from .auth_routes import get_current_patient +from passlib.context import CryptContext from database import SessionLocal, engine + patient_router = APIRouter(prefix="/patient", tags=["Patient"]) session = SessionLocal(bind=engine) -@patient_router.get("/") -def get_patient(): - return {"message": "Get all patients details"} +#User Verification Model +class UserVerification(BaseModel): + password: str + new_password: str = Field(min_length=6) + +#Database dependency +def get_db(): + db = SessionLocal() + try: + yield db + finally: + db.close() + + +db_dependency = Annotated[Session, Depends(get_db)] +user_dependency = Annotated[dict, Depends(get_current_patient)] +bcrypt_context = CryptContext(schemes=['bcrypt'], deprecated='auto') + + +@patient_router.get("/patient", status_code=status.HTTP_200_OK) +async def get_patient(user: user_dependency, db: db_dependency): + if user is None: + raise HTTPException(status_code=401, detail='Authentication Failed') + return db.query(Patient).filter(Patient.patient_id == user.get('id')).first() + + +@patient_router.put("/change_password", status_code=status.HTTP_204_NO_CONTENT) +async def change_password(user: user_dependency, db: db_dependency, user_verification: UserVerification): + if user is None: + raise HTTPException(status_code=401, detail='Authentication Failed') + user_model = db.query(Patient).filter( + Patient.patient_id == user.get('id')).first() + + if not bcrypt_context.verify(user_verification.password, user_model.patient_password): + raise HTTPException(status_code=401, detail='Error on password change') + user_model.patient_password = bcrypt_context.hash( + user_verification.new_password) + db.add(user_model) + db.commit() From c7847e3eee9d05b40d9031510186d5e73a5e3fef Mon Sep 17 00:00:00 2001 From: Ayushmaanagarwal1121 Date: Wed, 29 May 2024 08:57:10 +0530 Subject: [PATCH 02/10] Animation not showing in contact page send message button fixed --- src/Pages/ContactPage.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Pages/ContactPage.jsx b/src/Pages/ContactPage.jsx index c5fda52..6b8c482 100644 --- a/src/Pages/ContactPage.jsx +++ b/src/Pages/ContactPage.jsx @@ -75,7 +75,7 @@ function ContactPage() { From 7da1979d0e8f84195db69e37e7354a86c9493a95 Mon Sep 17 00:00:00 2001 From: Ayushmaanagarwal1121 Date: Thu, 30 May 2024 12:42:30 +0530 Subject: [PATCH 03/10] added hovering effect on blog cards --- src/Pages/BlogPage.jsx | 2 +- src/index.css | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Pages/BlogPage.jsx b/src/Pages/BlogPage.jsx index cc2b072..e84deb0 100644 --- a/src/Pages/BlogPage.jsx +++ b/src/Pages/BlogPage.jsx @@ -83,7 +83,7 @@ const BlogPage = () => {
{blogs.map((blog) => { - return + return
Blog Image
diff --git a/src/index.css b/src/index.css index 152efc1..9ba730a 100644 --- a/src/index.css +++ b/src/index.css @@ -126,3 +126,10 @@ body.dark .privacy { outline: none; box-shadow: 0 0 0 4px rgba(66, 153, 225, 0.5); /* Focus ring */ } + +.blog-card:hover{ + scale: 1.05; + transition: scale ease-in-out 0.3s; + box-shadow: 0px 0px 15px white; + border-radius: 10px; +} From 0bce1519f6a881cfbb0a63644eb998c1422de4e1 Mon Sep 17 00:00:00 2001 From: Ayushmaanagarwal1121 Date: Thu, 30 May 2024 12:53:10 +0530 Subject: [PATCH 04/10] hamburger animation --- src/components/Header/MenuOverlay.jsx | 5 +++-- src/index.css | 29 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/components/Header/MenuOverlay.jsx b/src/components/Header/MenuOverlay.jsx index 2d1ff75..6a9eb80 100644 --- a/src/components/Header/MenuOverlay.jsx +++ b/src/components/Header/MenuOverlay.jsx @@ -1,4 +1,4 @@ -import React from "react"; // Importing React to use JSX syntax +import React, { useState } from "react"; // Importing React to use JSX syntax import PropTypes from "prop-types"; // Importing PropTypes for type-checking import { Link, NavLink } from "react-router-dom"; // Importing Link and NavLink for navigation @@ -7,11 +7,12 @@ const MenuOverlay = ({ links, setIsNavBarOpen, theme:[theme, handleThemeChange], const handleClick = () => { toggleBodyScroll(); setIsNavBarOpen(false); + setClosingAnimation(true) }; return ( // ul element to contain the menu links -
    +
      {/* Mapping over the links array to create each link item */} {links.map((link, index) => (
    • diff --git a/src/index.css b/src/index.css index 152efc1..3e4787b 100644 --- a/src/index.css +++ b/src/index.css @@ -53,6 +53,35 @@ body.dark .blog { color: white; } +.close-animation{ + overflow: hidden; + animation: close both 0.8s ; + } + + @keyframes close { + from{ + height:calc(100vh - 7.375rem) + + }to{ + height: 0px; + } + + } + +.open-animation{ +overflow: hidden; +animation: open both 0.8s ; +} + +@keyframes open { + from{ + height: 0px; + + }to{ + height:calc(100vh - 7.375rem) + } + +} body.dark .contact { background-color: black; color: white; From e1ad2c260566ee18f1eb12fb80a4ac5b73796a7c Mon Sep 17 00:00:00 2001 From: arpit4521 Date: Thu, 30 May 2024 16:57:18 +0530 Subject: [PATCH 05/10] edited code for dynamic year --- src/components/Footer/Footer.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Footer/Footer.jsx b/src/components/Footer/Footer.jsx index 327c27d..8a01a91 100644 --- a/src/components/Footer/Footer.jsx +++ b/src/components/Footer/Footer.jsx @@ -91,7 +91,7 @@ function Footer() {
- © 2024 Nactore Organization, Building for democracy with care + © {new Date().getFullYear().toString()} Nactore Organization, Building for democracy with care
From f2987e38f71d892b315859b2238369045d34df13 Mon Sep 17 00:00:00 2001 From: PranavKeshav24 <127531721+PranavKeshav24@users.noreply.github.com> Date: Thu, 30 May 2024 17:59:26 +0530 Subject: [PATCH 06/10] Made changes to the styles of 'Find your Home Care Taker' form in dark theme. --- src/components/Form/Form.jsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/components/Form/Form.jsx b/src/components/Form/Form.jsx index 0f8c3fd..f2a47e3 100644 --- a/src/components/Form/Form.jsx +++ b/src/components/Form/Form.jsx @@ -3,7 +3,7 @@ import React from "react"; function Form() { return ( <> -
+

Find your Home Care Taker

@@ -11,13 +11,13 @@ function Form() {
From 98a3e3de36853541b5ef1254cce61396c012b781 Mon Sep 17 00:00:00 2001 From: PranavKeshav24 <127531721+PranavKeshav24@users.noreply.github.com> Date: Thu, 30 May 2024 18:20:17 +0530 Subject: [PATCH 07/10] Changed the border color in dark mode for input fields. --- src/components/Form/Form.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Form/Form.jsx b/src/components/Form/Form.jsx index f2a47e3..d943419 100644 --- a/src/components/Form/Form.jsx +++ b/src/components/Form/Form.jsx @@ -17,7 +17,7 @@ function Form() { Select Medical Need @@ -79,7 +79,7 @@ function Form() {
From c9a30e1dd769fa899542981462a47fa90ed86255 Mon Sep 17 00:00:00 2001 From: PranavKeshav24 <127531721+PranavKeshav24@users.noreply.github.com> Date: Thu, 30 May 2024 18:38:25 +0530 Subject: [PATCH 08/10] Implemented scroll to top on navigation link click --- src/components/Header/Header.jsx | 46 +++++++++++++++++--------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/components/Header/Header.jsx b/src/components/Header/Header.jsx index 79167ad..7900f8d 100644 --- a/src/components/Header/Header.jsx +++ b/src/components/Header/Header.jsx @@ -1,5 +1,5 @@ import React, { useContext, useEffect, useState } from "react"; -import { Link, NavLink } from "react-router-dom"; +import { Link, NavLink, useLocation } from "react-router-dom"; import MenuOverlay from "./MenuOverlay"; import { FaXmark } from "react-icons/fa6"; import "../../index.css"; @@ -9,27 +9,27 @@ const navLinks = [ { title: "Home", to: "/", - icon: "ri-home-fill"// Added icon property + icon: "ri-home-fill", // Added icon property }, { title: "Careers", to: "/careers", - icon: "ri-focus-2-fill" + icon: "ri-focus-2-fill", }, { title: "Blog", to: "/blog", - icon: "ri-newspaper-fill" + icon: "ri-newspaper-fill", }, { title: "Contact", to: "/contact", - icon: "ri-customer-service-2-fill" + icon: "ri-customer-service-2-fill", }, { title: "About", to: "/about", - icon: "ri-nurse-fill" + icon: "ri-nurse-fill", }, ]; @@ -37,40 +37,42 @@ function Header() { const [isNavBarOpen, setIsNavBarOpen] = useState(false); const { theme, toggleTheme } = useContext(ThemeContext); const [themes, setThemes] = useState("light"); + const location = useLocation(); + + useEffect(() => { + window.scrollTo(0, 0); + }, [location]); const handleThemeChange = () => { toggleTheme(); setThemes((prevTheme) => (prevTheme === "light" ? "dark" : "light")); }; - const toggleBodyScroll = ()=>{ + const toggleBodyScroll = () => { const styles = { - position:"fixed", - maxWidth:"100vw", - overflow: "hidden" - } - - if(document.body.style.position===""){ - for(const i in styles){ - document.body.style[i] = styles[i] + position: "fixed", + maxWidth: "100vw", + overflow: "hidden", + }; + + if (document.body.style.position === "") { + for (const i in styles) { + document.body.style[i] = styles[i]; } - return + return; } - for(const i in styles){ - document.body.style[i] = "" + for (const i in styles) { + document.body.style[i] = ""; } - } - + }; return (
- Logo -
From 965281fd71a9388dea106b0c53cc4e2b3173925f Mon Sep 17 00:00:00 2001 From: Rhythm <65298117+Rhythm1710@users.noreply.github.com> Date: Fri, 31 May 2024 20:37:59 +0530 Subject: [PATCH 09/10] Patient Routes Signed-off-by: Rhythm <65298117+Rhythm1710@users.noreply.github.com> --- backend/routes/auth_routes.py | 8 ++++---- backend/routes/patient_routes.py | 12 +++++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/backend/routes/auth_routes.py b/backend/routes/auth_routes.py index d0fd7cc..f684f8b 100644 --- a/backend/routes/auth_routes.py +++ b/backend/routes/auth_routes.py @@ -1,7 +1,7 @@ from uuid import uuid4 from jose import jwt,JWTError from fastapi import Form -from fastapi.security import OAuth2PasswordBearer +from fastapi.security import OAuth2PasswordBearer,OAuth2PasswordRequestForm from passlib.context import CryptContext from models import Patient from database import SessionLocal @@ -37,7 +37,7 @@ def __init__(self,email:str=Form(...),password:str=Form(...)): bcrypt_context = CryptContext(schemes=['bcrypt'], deprecated='auto') -oauth2_bearer = OAuth2PasswordBearer(tokenUrl='auth/token') +oauth2_bearer = OAuth2PasswordBearer(tokenUrl='auth/login') # Models for validation @@ -126,9 +126,9 @@ async def create_user(db: db_dependency, # Route to create access token for a patient @auth_router.post("/login", response_model=Token) -async def login_for_access_token(form_data: Annotated[OAuth2EmailRequestForm, Depends()], +async def login_for_access_token(form_data: Annotated[OAuth2PasswordRequestForm, Depends()], db: db_dependency): - user = authenticate_patient(form_data.email, form_data.password, db) + user = authenticate_patient(form_data.username, form_data.password, db) if not user: raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail='Could not validate user.') diff --git a/backend/routes/patient_routes.py b/backend/routes/patient_routes.py index 9c30f83..33a4396 100644 --- a/backend/routes/patient_routes.py +++ b/backend/routes/patient_routes.py @@ -31,11 +31,11 @@ def get_db(): bcrypt_context = CryptContext(schemes=['bcrypt'], deprecated='auto') -@patient_router.get("/patient", status_code=status.HTTP_200_OK) +@patient_router.get("/get_patient", status_code=status.HTTP_200_OK) async def get_patient(user: user_dependency, db: db_dependency): if user is None: raise HTTPException(status_code=401, detail='Authentication Failed') - return db.query(Patient).filter(Patient.patient_id == user.get('id')).first() + return db.query(Patient).filter(Patient.patient_id == user.get('patient_id')).first() @patient_router.put("/change_password", status_code=status.HTTP_204_NO_CONTENT) @@ -43,7 +43,7 @@ async def change_password(user: user_dependency, db: db_dependency, user_verific if user is None: raise HTTPException(status_code=401, detail='Authentication Failed') user_model = db.query(Patient).filter( - Patient.patient_id == user.get('id')).first() + Patient.patient_id == user.get('patient_id')).first() if not bcrypt_context.verify(user_verification.password, user_model.patient_password): raise HTTPException(status_code=401, detail='Error on password change') @@ -51,3 +51,9 @@ async def change_password(user: user_dependency, db: db_dependency, user_verific user_verification.new_password) db.add(user_model) db.commit() + +@patient_router.get('/get_all_patients',status_code=status.HTTP_200_OK) +async def get_all_patients(user:user_dependency,db:db_dependency): + if user is None: + raise HTTPException(status_code=401, detail='Authentication Failed') + return db.query(Patient).all() \ No newline at end of file From 02b1551e7998949ad5547d399056aa9697eae0b4 Mon Sep 17 00:00:00 2001 From: Amruta Kothawade <116087736+Amruta7203@users.noreply.github.com> Date: Sat, 1 Jun 2024 15:43:28 +0530 Subject: [PATCH 10/10] Redirecting social media links to a new tab --- src/components/Footer/Footer.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Footer/Footer.jsx b/src/components/Footer/Footer.jsx index 327c27d..60eadef 100644 --- a/src/components/Footer/Footer.jsx +++ b/src/components/Footer/Footer.jsx @@ -41,12 +41,12 @@ function Footer() {