From c89f854a1b6fa1a32d485c01302be95c4186ae2e Mon Sep 17 00:00:00 2001
From: Rutik Kulkarni <86470947+RutikKulkarni@users.noreply.github.com>
Date: Thu, 8 Aug 2024 18:57:37 +0530
Subject: [PATCH] Revert "Add feature to display user's first name and
location"
---
frontend/src/components/Widget/User/User.jsx | 37 ++++++++-----------
.../components/Widget/User/imports/index.js | 4 +-
frontend/src/utility/exports/index.js | 1 -
frontend/src/utility/userPersistence.js | 27 +-------------
4 files changed, 19 insertions(+), 50 deletions(-)
diff --git a/frontend/src/components/Widget/User/User.jsx b/frontend/src/components/Widget/User/User.jsx
index 1749def..b716288 100644
--- a/frontend/src/components/Widget/User/User.jsx
+++ b/frontend/src/components/Widget/User/User.jsx
@@ -1,6 +1,15 @@
-import React, { useContext, useEffect, useState } from 'react';
-import { useNavigate } from 'react-router-dom';
-import { userStyles as styles, BiUser, FiLogOut, HiOutlineLightBulb, LuLifeBuoy, ThemeContext, ToggleThemeSwitcher, UserSvg, clearUserData, fetchUserData } from './imports/index'; // Ensure this path is correct
+import { React, useContext, useNavigate } from "../imports/index";
+import {
+ userStyles as styles,
+ BiUser,
+ FiLogOut,
+ HiOutlineLightBulb,
+ LuLifeBuoy,
+ ThemeContext,
+ ToggleThemeSwitcher,
+ UserSvg,
+ clearUserData,
+} from "./imports/index";
/**
* User widget component displaying user information and actions.
@@ -12,27 +21,13 @@ import { userStyles as styles, BiUser, FiLogOut, HiOutlineLightBulb, LuLifeBuoy,
const Widget = React.forwardRef((props, ref) => {
const { theme } = useContext(ThemeContext);
const navigate = useNavigate();
- const [userData, setUserData] = useState({ firstName: 'Name', location: 'Location' });
-
- useEffect(() => {
- const loadUserData = async () => {
- const data = await fetchUserData();
- if (data) {
- setUserData({
- firstName: data.firstName || 'Name',
- location: data.location || 'Location',
- });
- }
- };
- loadUserData();
- }, []);
/**
* Handles user logout action, clearing user data from local storage.
*/
const handleLogout = () => {
clearUserData();
- navigate('/login');
+ navigate("/login");
props.closeWidget();
};
@@ -40,7 +35,7 @@ const Widget = React.forwardRef((props, ref) => {
* Navigates to the user's account page.
*/
const handleMyAccount = () => {
- navigate('/MyAccount');
+ navigate("/MyAccount");
props.closeWidget();
};
@@ -51,8 +46,8 @@ const Widget = React.forwardRef((props, ref) => {
{userData.location}
+Pune, Maharashtra