From 638fccb784af9b1fa31ac4d739f825985e33c6fb Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Wed, 3 Jan 2024 01:00:34 +0530 Subject: [PATCH 01/18] Corrected npm start command in README.md for local development --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 78f9f4f2..c23f5803 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Frontend dashboard of the scholarX platform ``` - Start the server with ``` - npm start + npm run dev ``` - Visit your app at http://localhost:3000 From 638ec2754c3522703a515bdf006795b588080240 Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Thu, 4 Jan 2024 12:20:24 +0530 Subject: [PATCH 02/18] Fixed README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c23f5803..10071100 100644 --- a/README.md +++ b/README.md @@ -17,4 +17,4 @@ Frontend dashboard of the scholarX platform npm run dev ``` -- Visit your app at http://localhost:3000 +- Visit your app at http://localhost:5173 From 335507c61631fdcf003298bf8af7836961f6f291 Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Tue, 9 Jan 2024 23:46:06 +0530 Subject: [PATCH 03/18] Fixed Facebook icon in nav bar and Apply button issue --- src/components/Home/Home.tsx | 6 ++++-- src/components/Layout/MenuDrawer/MenuDrawer.tsx | 9 ++++----- src/components/Layout/Navbar/Navbar.tsx | 9 ++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/components/Home/Home.tsx b/src/components/Home/Home.tsx index 0fc18551..f2fd529e 100644 --- a/src/components/Home/Home.tsx +++ b/src/components/Home/Home.tsx @@ -26,8 +26,10 @@ const Home: React.FC = () => (
diff --git a/src/components/Layout/MenuDrawer/MenuDrawer.tsx b/src/components/Layout/MenuDrawer/MenuDrawer.tsx index 7ce33742..d0b8cc2a 100644 --- a/src/components/Layout/MenuDrawer/MenuDrawer.tsx +++ b/src/components/Layout/MenuDrawer/MenuDrawer.tsx @@ -4,6 +4,7 @@ import { TwitterOutlined, LinkedinFilled, InstagramOutlined, + FacebookFilled, } from '@ant-design/icons'; import { Avatar, Button, Drawer, Space, Typography } from 'antd'; @@ -55,11 +56,9 @@ const MenuDrawer: React.FC = ({ openMenu, setOpenMenu }) => { target="_blank" rel="noreferrer" > - { target="_blank" rel="noreferrer" > - Date: Wed, 10 Jan 2024 23:17:22 +0530 Subject: [PATCH 04/18] Fixed Apply button and See more button used TailwindCSS --- src/components/Home/Home.tsx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/components/Home/Home.tsx b/src/components/Home/Home.tsx index f2fd529e..7eac1fef 100644 --- a/src/components/Home/Home.tsx +++ b/src/components/Home/Home.tsx @@ -24,16 +24,18 @@ const Home: React.FC = () => ( Unlock Mentorship Opportunities with ScholarX
- - +
+ + +
From 92a661bc016b84e3f8722dda519a470c2050cf9f Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Wed, 10 Jan 2024 23:48:52 +0530 Subject: [PATCH 05/18] Backend API URL Problem --- README.md | 11 +++++++++++ src/constants.ts | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 10071100..c117df47 100644 --- a/README.md +++ b/README.md @@ -18,3 +18,14 @@ Frontend dashboard of the scholarX platform ``` - Visit your app at http://localhost:5173 + + +## Backend Server Setup + +In order to run the application locally and connect the backend API, you need to set up the backend server URL. + +1. Open the `constants.ts` file. +2. You will see a line of code that looks like this: `export const API_URL = 'http://localhost:4000/api';` +3. Replace `'http://localhost:4000/api'` with the URL of your backend server. + +Please note that you should not commit this change to the repository. It's recommended to use environment variables for different environments. diff --git a/src/constants.ts b/src/constants.ts index 4a43cf3e..b07eebe3 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1 +1 @@ -export const API_URL = 'http://localhost:3000/api'; +export const API_URL = 'http://localhost:4000/api'; From 32595c89f435004372a4daf4e4ff7d40d7923800 Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Thu, 11 Jan 2024 11:08:50 +0530 Subject: [PATCH 06/18] Fixed Apply button and See more buttons (Removed template iterals) --- src/components/Home/Home.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/components/Home/Home.tsx b/src/components/Home/Home.tsx index 7eac1fef..749b0e33 100644 --- a/src/components/Home/Home.tsx +++ b/src/components/Home/Home.tsx @@ -25,14 +25,10 @@ const Home: React.FC = () => (
- -
From c26820e3492b1d1bce79b92e0dac4860b2ae4fad Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Thu, 11 Jan 2024 11:52:24 +0530 Subject: [PATCH 07/18] Connect with Backend API --- README.md | 4 ++-- src/constants.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c117df47..6483d7a5 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Frontend dashboard of the scholarX platform In order to run the application locally and connect the backend API, you need to set up the backend server URL. 1. Open the `constants.ts` file. -2. You will see a line of code that looks like this: `export const API_URL = 'http://localhost:4000/api';` -3. Replace `'http://localhost:4000/api'` with the URL of your backend server. +2. You will see a line of code that looks like this: `export const API_URL = 'http://localhost:3000/api';` +3. Replace `'http://localhost:3000/api'` with the URL of your backend server. Please note that you should not commit this change to the repository. It's recommended to use environment variables for different environments. diff --git a/src/constants.ts b/src/constants.ts index b07eebe3..4a43cf3e 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1 +1 @@ -export const API_URL = 'http://localhost:4000/api'; +export const API_URL = 'http://localhost:3000/api'; From 1e5b97f41028a18b0b52fb164851824b4ad89b86 Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Thu, 11 Jan 2024 12:49:21 +0530 Subject: [PATCH 08/18] added \ --- .env | 1 + src/constants.ts | 3 ++- src/contexts/UserContext.tsx | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 00000000..83101049 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +VITE_API_URL=http://localhost:4000/api \ No newline at end of file diff --git a/src/constants.ts b/src/constants.ts index 4a43cf3e..68a02646 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1 +1,2 @@ -export const API_URL = 'http://localhost:3000/api'; +export const API_URL: string = import.meta.env.VITE_API_URL; +console.log(API_URL); diff --git a/src/contexts/UserContext.tsx b/src/contexts/UserContext.tsx index 9164606b..f832f8b4 100644 --- a/src/contexts/UserContext.tsx +++ b/src/contexts/UserContext.tsx @@ -27,7 +27,7 @@ export const UserProvider: React.FC<{ children: React.ReactNode }> = ({ setUser(response.data); }) .catch((error) => { - if (error.response.status !== 401) { + if (error.response !== undefined && error.response.status !== 401) { console.error({ message: 'Something went wrong when fetching the user', description: error.toString(), From a9666e965bb653ff4cbf476ef9401de54f7bd602 Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Thu, 11 Jan 2024 13:03:23 +0530 Subject: [PATCH 09/18] Added environment variable to connect backend api --- README.md | 21 ++++++++++++++------- example.env | 2 +- src/constants.ts | 2 +- src/vite-env.d.ts | 4 ++++ 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 6483d7a5..ec295e6e 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,16 @@ Frontend dashboard of the scholarX platform ## Setup Development Environment -- Clone your forked repository +1. Clone your forked repository ``` git clone https://github.com/USERNAME/scholarx-frontend cd scholarx-frontend ``` -- Install all the dependencies +2. Install all the dependencies ``` npm install ``` + - Start the server with ``` npm run dev @@ -20,12 +21,18 @@ Frontend dashboard of the scholarX platform - Visit your app at http://localhost:5173 -## Backend Server Setup +## Connecting to the Backend API + +The URL for the backend API is stored in an environment variable. To set this up: + +1. Create a `.env` file in the root of your project. +2. Add the following line to the `.env` file, replacing `your-api-url` with the actual URL of your backend API: + +```env +VITE_API_URL=your-api-url -In order to run the application locally and connect the backend API, you need to set up the backend server URL. +3. Save the `.env` file. The application will now use this URL to make requests to the backend API. -1. Open the `constants.ts` file. -2. You will see a line of code that looks like this: `export const API_URL = 'http://localhost:3000/api';` -3. Replace `'http://localhost:3000/api'` with the URL of your backend server. +Note: The VITE_ prefix is required for Vite to load the variable into import.meta.env. For more information, see the Vite documentation[https://vitejs.dev/guide/env-and-mode.html]. Please note that you should not commit this change to the repository. It's recommended to use environment variables for different environments. diff --git a/example.env b/example.env index da62ae98..83101049 100644 --- a/example.env +++ b/example.env @@ -1 +1 @@ -# This is an example environment file for configuring dynamic values. +VITE_API_URL=http://localhost:4000/api \ No newline at end of file diff --git a/src/constants.ts b/src/constants.ts index 68a02646..3507b5a9 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,2 +1,2 @@ -export const API_URL: string = import.meta.env.VITE_API_URL; +export const API_URL = import.meta.env.VITE_API_URL; console.log(API_URL); diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index e578524b..50a8bd03 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -1,2 +1,6 @@ // eslint-disable-next-line @typescript-eslint/triple-slash-reference /// + +interface ImportMetaEnv { + readonly VITE_API_URL: string; +} From dfc70284432a311d2a386cc6aa3ab7b0c094943c Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Thu, 11 Jan 2024 13:07:27 +0530 Subject: [PATCH 10/18] Fixed typos in README --- .gitignore | 2 +- README.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 6b8510e2..20ef7cb5 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,7 @@ .env.test.local .env.production.local .eslintcache - +.env npm-debug.log* yarn-debug.log* yarn-error.log* diff --git a/README.md b/README.md index ec295e6e..8fa8e23b 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,10 @@ The URL for the backend API is stored in an environment variable. To set this up ```env VITE_API_URL=your-api-url +``` 3. Save the `.env` file. The application will now use this URL to make requests to the backend API. -Note: The VITE_ prefix is required for Vite to load the variable into import.meta.env. For more information, see the Vite documentation[https://vitejs.dev/guide/env-and-mode.html]. +Note: The VITE_ prefix is required for Vite to load the variable into import.meta.env. For more information, see the [Vite documentation](https://vitejs.dev/guide/env-and-mode.html). Please note that you should not commit this change to the repository. It's recommended to use environment variables for different environments. From 4f86fd08641f74f54fa88697b2159e205076b386 Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Thu, 11 Jan 2024 13:11:37 +0530 Subject: [PATCH 11/18] added .end to .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 20ef7cb5..cabb6db3 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,7 @@ .env.test.local .env.production.local .eslintcache -.env +/.env npm-debug.log* yarn-debug.log* yarn-error.log* From 5fc0a50af09f135b9a0f942d6dc00a96f59ab09c Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Thu, 11 Jan 2024 15:19:55 +0530 Subject: [PATCH 12/18] fixed typos in example.env file --- .env | 2 +- example.env | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 83101049..cefe01a0 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -VITE_API_URL=http://localhost:4000/api \ No newline at end of file +VITE_API_URL=http://localhost:4000/api diff --git a/example.env b/example.env index 83101049..cefe01a0 100644 --- a/example.env +++ b/example.env @@ -1 +1 @@ -VITE_API_URL=http://localhost:4000/api \ No newline at end of file +VITE_API_URL=http://localhost:4000/api From c07988c3ac01968ba0adb0b7f725353efefc0ba9 Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Thu, 11 Jan 2024 21:15:25 +0530 Subject: [PATCH 13/18] changed API_URL setup --- README.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8bb4c854..d4ddfc76 100644 --- a/README.md +++ b/README.md @@ -24,14 +24,11 @@ Frontend dashboard of the scholarX platform The URL for the backend API is stored in an environment variable. To set this up: -1. Create a `.env` file in the root of your project. -2. Add the following line to the `.env` file, replacing `your-api-url` with the actual URL of your backend API: +- Copy the .env file: -```env -VITE_API_URL=your-api-url -``` -3. Save the `.env` file. The application will now use this URL to make requests to the backend API. +```cp .env.example .env``` + +Replace the environment variables in the newly created .env file with your configuration. -Note: The VITE_ prefix is required for Vite to load the variable into import.meta.env. For more information, see the [Vite documentation](https://vitejs.dev/guide/env-and-mode.html). Please note that you should not commit this change to the repository. It's recommended to use environment variables for different environments. From 051651390ce789286752e3f999432c50eca9c5b6 Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Thu, 11 Jan 2024 21:35:29 +0530 Subject: [PATCH 14/18] Fixed example.env --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d4ddfc76..ec765beb 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,9 @@ The URL for the backend API is stored in an environment variable. To set this up - Copy the .env file: -```cp .env.example .env``` + ``` + cp example.env .env + ``` Replace the environment variables in the newly created .env file with your configuration. From 2459152378908dd60e103238d3dc01722986df78 Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Fri, 12 Jan 2024 06:13:59 +0530 Subject: [PATCH 15/18] Stop tracking .env file --- .env | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .env diff --git a/.env b/.env deleted file mode 100644 index cefe01a0..00000000 --- a/.env +++ /dev/null @@ -1 +0,0 @@ -VITE_API_URL=http://localhost:4000/api From 46118e6227e1e9c53efb5f131d6e17fedeeb5550 Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Sat, 13 Jan 2024 15:57:25 +0530 Subject: [PATCH 16/18] fixed "Become a menter" button using Tailwind --- src/components/Home/Home.tsx | 2 +- .../Layout/MenuDrawer/MenuDrawer.tsx | 32 ++++++++++++++++++- src/components/Layout/Navbar/Navbar.tsx | 12 +++---- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/components/Home/Home.tsx b/src/components/Home/Home.tsx index 749b0e33..a70c6d80 100644 --- a/src/components/Home/Home.tsx +++ b/src/components/Home/Home.tsx @@ -28,7 +28,7 @@ const Home: React.FC = () => ( -
diff --git a/src/components/Layout/MenuDrawer/MenuDrawer.tsx b/src/components/Layout/MenuDrawer/MenuDrawer.tsx index d0b8cc2a..9378aa6f 100644 --- a/src/components/Layout/MenuDrawer/MenuDrawer.tsx +++ b/src/components/Layout/MenuDrawer/MenuDrawer.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useContext, useState } from 'react'; import { TwitterOutlined, @@ -8,6 +8,12 @@ import { } from '@ant-design/icons'; import { Avatar, Button, Drawer, Space, Typography } from 'antd'; +import { + UserContext, + type UserContextType, +} from './../../../contexts/UserContext'; +import { useNavigate } from 'react-router-dom'; + import styles from './MenuDrawer.module.css'; const { Text } = Typography; @@ -18,6 +24,11 @@ interface MenuDrawerProps { } const MenuDrawer: React.FC = ({ openMenu, setOpenMenu }) => { + const [isLoginModalVisible, setIsLoginModalVisible] = useState(false); + const navigate = useNavigate(); + + const { user } = useContext(UserContext) as UserContextType; + const handleOpenMenu = (): boolean => { return openMenu; }; @@ -26,6 +37,19 @@ const MenuDrawer: React.FC = ({ openMenu, setOpenMenu }) => { setOpenMenu(false); }; + const handleLoginModalOpen = (): void => { + setIsLoginModalVisible(true); + }; + + const handleMentorRegistration = (): void => { + console.log('Clicked'); + if (user === null) { + handleLoginModalOpen(); + } else { + navigate('/mentor-registration'); + } + }; + return ( = ({ openMenu, setOpenMenu }) => {
Join Us + { Join Us +
- From 16c2662c32a1ad084e423abecfb2fd5cadd0fac5 Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Sun, 14 Jan 2024 00:43:59 +0530 Subject: [PATCH 17/18] Fixed that "Become a Mentor" button issue in MenuDrawer --- .../Layout/MenuDrawer/MenuDrawer.tsx | 33 ++++--------------- src/components/Layout/Navbar/Navbar.tsx | 7 +++- 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/src/components/Layout/MenuDrawer/MenuDrawer.tsx b/src/components/Layout/MenuDrawer/MenuDrawer.tsx index 9378aa6f..7f0a03bf 100644 --- a/src/components/Layout/MenuDrawer/MenuDrawer.tsx +++ b/src/components/Layout/MenuDrawer/MenuDrawer.tsx @@ -1,4 +1,4 @@ -import React, { useContext, useState } from 'react'; +import React from 'react'; import { TwitterOutlined, @@ -8,12 +8,6 @@ import { } from '@ant-design/icons'; import { Avatar, Button, Drawer, Space, Typography } from 'antd'; -import { - UserContext, - type UserContextType, -} from './../../../contexts/UserContext'; -import { useNavigate } from 'react-router-dom'; - import styles from './MenuDrawer.module.css'; const { Text } = Typography; @@ -21,14 +15,14 @@ const { Text } = Typography; interface MenuDrawerProps { openMenu: boolean; setOpenMenu: (value: boolean) => void; + handleMentorRegistration: () => void; } -const MenuDrawer: React.FC = ({ openMenu, setOpenMenu }) => { - const [isLoginModalVisible, setIsLoginModalVisible] = useState(false); - const navigate = useNavigate(); - - const { user } = useContext(UserContext) as UserContextType; - +const MenuDrawer: React.FC = ({ + openMenu, + setOpenMenu, + handleMentorRegistration, +}) => { const handleOpenMenu = (): boolean => { return openMenu; }; @@ -37,19 +31,6 @@ const MenuDrawer: React.FC = ({ openMenu, setOpenMenu }) => { setOpenMenu(false); }; - const handleLoginModalOpen = (): void => { - setIsLoginModalVisible(true); - }; - - const handleMentorRegistration = (): void => { - console.log('Clicked'); - if (user === null) { - handleLoginModalOpen(); - } else { - navigate('/mentor-registration'); - } - }; - return ( { } else { navigate('/mentor-registration'); } + setOpenMenu(false); }; return ( @@ -168,7 +169,11 @@ const Navbar: React.FC = () => { - + {isLoginModalVisible ? ( ) : null} From 66bfb481338eee4799cd3495123095e5f60c6704 Mon Sep 17 00:00:00 2001 From: mayura-andrew Date: Sun, 14 Jan 2024 13:27:35 +0530 Subject: [PATCH 18/18] Fixed LoginModal mobile responsiveness --- src/components/LoginModal/index.tsx | 2 +- src/components/LogoutModal/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/LoginModal/index.tsx b/src/components/LoginModal/index.tsx index 9dfc4ab3..d8555d12 100644 --- a/src/components/LoginModal/index.tsx +++ b/src/components/LoginModal/index.tsx @@ -50,7 +50,7 @@ const LoginModal: React.FC = ({ handleClose }) => { return (
-
+
diff --git a/src/components/LogoutModal/index.tsx b/src/components/LogoutModal/index.tsx index 6434fdcc..3751bd1f 100644 --- a/src/components/LogoutModal/index.tsx +++ b/src/components/LogoutModal/index.tsx @@ -34,7 +34,7 @@ const LogoutModal: React.FC = ({ onClose }) => { return (
-
+