From 2ffa1329e56c1e74f4e6d38420d3eb29f0da2eae Mon Sep 17 00:00:00 2001 From: nitishkumar333 Date: Sat, 6 Jan 2024 15:31:55 +0530 Subject: [PATCH 1/3] fixed Organization not found error in left drawer --- .../LeftDrawer/LeftDrawer.module.css | 16 +- src/components/LeftDrawer/LeftDrawer.tsx | 70 +-- .../LeftDrawerOrg/LeftDrawerOrg.module.css | 17 +- .../LeftDrawerOrg/LeftDrawerOrg.tsx | 74 +-- .../MemberDetail/MemberDetail.test.tsx | 26 ++ src/screens/MemberDetail/MemberDetail.tsx | 427 +++++++++--------- 6 files changed, 368 insertions(+), 262 deletions(-) diff --git a/src/components/LeftDrawer/LeftDrawer.module.css b/src/components/LeftDrawer/LeftDrawer.module.css index a75b674b41..0ec1f97e9f 100644 --- a/src/components/LeftDrawer/LeftDrawer.module.css +++ b/src/components/LeftDrawer/LeftDrawer.module.css @@ -66,14 +66,14 @@ width: 100%; height: 52px; border-radius: 8px; - background-color: var(--bs-white); display: flex; align-items: center; + padding: 2.5rem 1rem 2.5rem 1rem; } .leftDrawer .profileContainer:focus { outline: none; - background-color: var(--bs-gray-100); + background-color: #5ac989; } .leftDrawer .imageContainer { @@ -96,6 +96,10 @@ font-weight: 600; } +.leftDrawer .profileContainer .profileText .primaryText .primaryTextWhite { + color: white; +} + .leftDrawer .profileContainer .profileText .secondaryText { font-size: 0.8rem; font-weight: 400; @@ -104,6 +108,14 @@ text-transform: capitalize; } +.leftDrawer .profileContainer .profileText .secondaryTextBlack { + color: var(--bs-secondary); +} + +.leftDrawer .profileContainer .profileText .secondaryTextWhite { + color: rgb(230, 230, 230); +} + .logout { margin-bottom: 50px; } diff --git a/src/components/LeftDrawer/LeftDrawer.tsx b/src/components/LeftDrawer/LeftDrawer.tsx index 94cbbf0367..ca0bce0aa5 100644 --- a/src/components/LeftDrawer/LeftDrawer.tsx +++ b/src/components/LeftDrawer/LeftDrawer.tsx @@ -1,7 +1,7 @@ import React from 'react'; import Button from 'react-bootstrap/Button'; import { useTranslation } from 'react-i18next'; -import { useHistory } from 'react-router-dom'; +import { useHistory, Link } from 'react-router-dom'; import { ReactComponent as AngleRightIcon } from 'assets/svgs/angleRight.svg'; import { ReactComponent as LogoutIcon } from 'assets/svgs/logout.svg'; import { ReactComponent as OrganizationsIcon } from 'assets/svgs/organizations.svg'; @@ -137,33 +137,51 @@ const leftDrawer = ({ )}
- + + + + + +
+ + + +
+ {userData?.user?.image ? ( + + ) : ( + + )} +
+ + + {/* User section */} +
+

+ + {userData?.user?.firstName} {userData?.user?.lastName} + +

+

+ {t('role')} :{' '} + {userData?.user?.userType}

-
- - +

+ {t('email')} :{' '} + {userData?.user?.email} +

+

+ {t('createdOn')} :{' '} + {prettyDate(userData?.user?.createdAt)} +

+
+ + +
+
+
+ {/* Main Section And Activity section */} +
+ + {/* Main Section */} + +
+
+
+ {t('main')} +
+
+
+ + {t('firstName')} + {userData?.user?.firstName} + + + {t('lastName')} + {userData?.user?.lastName} + + + {t('role')} + {userData?.user?.userType} + + + {t('memberOfOrganization')} + + {userData?.user?.organizationUserBelongsTo ?? 'None'} + + + + {t('language')} + + {getLanguageName(userData?.user?.appLanguageCode)} + + + + {t('adminApproved')} + + {userData?.user?.adminApproved ? 'Yes' : 'No'} + + + + {t('pluginCreationAllowed')} + + {userData?.user?.pluginCreationAllowed ? 'Yes' : 'No'} + + + + {t('createdOn')} + + {prettyDate(userData?.user?.createdAt)} + + +
-
- - -
- {userData?.user?.image ? ( - - ) : ( - - )} + + {/* Activity Section */} + + {/* Organizations */} +
+
+
+ {t('organizations')} +
- - - {/* User section */} -
-

- - {userData?.user?.firstName} {userData?.user?.lastName} - -

-

- {t('role')} :{' '} - {userData?.user?.userType} -

-

- {t('email')} :{' '} - {userData?.user?.email} -

-

- {t('createdOn')} :{' '} - {prettyDate(userData?.user?.createdAt)} -

+
+ + {t('created')} + + {userData?.user?.createdOrganizations?.length} + + + + {t('joined')} + + {userData?.user?.joinedOrganizations?.length} + + + + {t('adminForOrganizations')} + {userData?.user?.adminFor?.length} + + + {t('membershipRequests')} + + {userData?.user?.membershipRequests?.length} + +
- - -
-
-
- {/* Main Section And Activity section */} -
- - {/* Main Section */} - -
-
-
- {t('main')} -
-
-
- - {t('firstName')} - {userData?.user?.firstName} - - - {t('lastName')} - {userData?.user?.lastName} - - - {t('role')} - {userData?.user?.userType} - - - {t('memberOfOrganization')} - - {userData?.user?.organizationUserBelongsTo ?? - 'None'} - - - - {t('language')} - - {getLanguageName(userData?.user?.appLanguageCode)} - - - - {t('adminApproved')} - - {userData?.user?.adminApproved ? 'Yes' : 'No'} - - - - {t('pluginCreationAllowed')} - - {userData?.user?.pluginCreationAllowed - ? 'Yes' - : 'No'} - - - - {t('createdOn')} - - {prettyDate(userData?.user?.createdAt)} - - -
-
- - {/* Activity Section */} - - {/* Organizations */} -
-
-
- {t('organizations')} -
-
-
- - {t('created')} - - {userData?.user?.createdOrganizations?.length} - - - - {t('joined')} - - {userData?.user?.joinedOrganizations?.length} - - - - {t('adminForOrganizations')} - {userData?.user?.adminFor?.length} - - - {t('membershipRequests')} - - {userData?.user?.membershipRequests?.length} - - -
-
- {/* Events */} -
-
-
- {t('events')} -
-
-
- - {t('created')} - - {userData?.user?.createdEvents?.length} - - - - {t('joined')} - - {userData?.user?.registeredEvents?.length} - - - - {t('adminForEvents')} - - {userData?.user?.eventAdmin?.length} - - -
-
- -
-
-
- ) : ( - - )} - - - +
+ {/* Events */} +
+
+
+ {t('events')} +
+
+
+ + {t('created')} + + {userData?.user?.createdEvents?.length} + + + + {t('joined')} + + {userData?.user?.registeredEvents?.length} + + + + {t('adminForEvents')} + {userData?.user?.eventAdmin?.length} + +
+
+ + +
+
+ ) : ( + + )} + +
+ ); + + return ( + <> + {calledFrom == 'orgdash' ? ( + + {memberDetails} + + ) : ( + + {memberDetails} + + )} ); }; From f66df72df4362eaa5759b4447d3718ce5db6ea52 Mon Sep 17 00:00:00 2001 From: nitishkumar333 Date: Sat, 6 Jan 2024 18:15:09 +0530 Subject: [PATCH 2/3] removed redundant css and type --- src/components/LeftDrawer/LeftDrawer.module.css | 13 ++----------- .../LeftDrawerOrg/LeftDrawerOrg.module.css | 17 ++--------------- src/components/LeftDrawerOrg/LeftDrawerOrg.tsx | 6 +----- src/screens/MemberDetail/MemberDetail.tsx | 8 ++------ 4 files changed, 7 insertions(+), 37 deletions(-) diff --git a/src/components/LeftDrawer/LeftDrawer.module.css b/src/components/LeftDrawer/LeftDrawer.module.css index 0ec1f97e9f..81b309a187 100644 --- a/src/components/LeftDrawer/LeftDrawer.module.css +++ b/src/components/LeftDrawer/LeftDrawer.module.css @@ -71,11 +71,6 @@ padding: 2.5rem 1rem 2.5rem 1rem; } -.leftDrawer .profileContainer:focus { - outline: none; - background-color: #5ac989; -} - .leftDrawer .imageContainer { width: 68px; } @@ -97,7 +92,7 @@ } .leftDrawer .profileContainer .profileText .primaryText .primaryTextWhite { - color: white; + color: var(--bs-white); } .leftDrawer .profileContainer .profileText .secondaryText { @@ -108,12 +103,8 @@ text-transform: capitalize; } -.leftDrawer .profileContainer .profileText .secondaryTextBlack { - color: var(--bs-secondary); -} - .leftDrawer .profileContainer .profileText .secondaryTextWhite { - color: rgb(230, 230, 230); + color: var(--bs-gray-100); } .logout { diff --git a/src/components/LeftDrawerOrg/LeftDrawerOrg.module.css b/src/components/LeftDrawerOrg/LeftDrawerOrg.module.css index f7c8e0f678..a6a7e2ef53 100644 --- a/src/components/LeftDrawerOrg/LeftDrawerOrg.module.css +++ b/src/components/LeftDrawerOrg/LeftDrawerOrg.module.css @@ -115,15 +115,6 @@ padding: 2.5rem 1rem 2.5rem 1rem; } -.leftDrawer .profileContainer:focus { - background-color: #5ac989 !important; -} - -.leftDrawer .profileContainer:focus { - outline: none; - background-color: var(--bs-gray-100); -} - .leftDrawer .imageContainer { width: 68px; } @@ -144,7 +135,7 @@ font-weight: 600; } .leftDrawer .profileContainer .profileText .primaryText .primaryTextWhite { - color: white; + color: var(--bs-white); } .leftDrawer .profileContainer .profileText .secondaryText { @@ -155,12 +146,8 @@ text-transform: capitalize; } -.leftDrawer .profileContainer .profileText .secondaryTextBlack { - color: var(--bs-secondary); -} - .leftDrawer .profileContainer .profileText .secondaryTextWhite { - color: rgb(230, 230, 230); + color: var(--bs-gray-100); } .logout { diff --git a/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx b/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx index ef701a3ef9..bc38154de1 100644 --- a/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx +++ b/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx @@ -214,11 +214,7 @@ const leftDrawerOrg = ({ {`${userType}`.toLowerCase()} diff --git a/src/screens/MemberDetail/MemberDetail.tsx b/src/screens/MemberDetail/MemberDetail.tsx index 6aff556673..1c6d834699 100644 --- a/src/screens/MemberDetail/MemberDetail.tsx +++ b/src/screens/MemberDetail/MemberDetail.tsx @@ -19,11 +19,7 @@ import Loader from 'components/Loader/Loader'; type MemberDetailProps = { id: string; // This is the userId - from?: string; -}; -type LocationStateProps = { - id: string; - from: string; // stores from where this component is called + from?: string; // stores from where this component was called }; const MemberDetail: React.FC = ({ @@ -36,7 +32,7 @@ const MemberDetail: React.FC = ({ const [state, setState] = useState(1); - const location = useLocation(); + const location = useLocation(); const currentUrl = location.state?.id || localStorage.getItem('id') || id; document.title = t('title'); From 30d88c861bebc494acb3abef6e1f06763f6db19a Mon Sep 17 00:00:00 2001 From: nitishkumar333 Date: Mon, 22 Jan 2024 15:46:32 +0530 Subject: [PATCH 3/3] escape characters --- src/components/LeftDrawer/LeftDrawer.tsx | 2 +- src/components/LeftDrawerEvent/LeftDrawerEvent.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/LeftDrawer/LeftDrawer.tsx b/src/components/LeftDrawer/LeftDrawer.tsx index ca0bce0aa5..72b3ff5215 100644 --- a/src/components/LeftDrawer/LeftDrawer.tsx +++ b/src/components/LeftDrawer/LeftDrawer.tsx @@ -154,7 +154,7 @@ const leftDrawer = ({ {`profile ) : ( {`dummy )} diff --git a/src/components/LeftDrawerEvent/LeftDrawerEvent.tsx b/src/components/LeftDrawerEvent/LeftDrawerEvent.tsx index 795f6016cb..dae4deaf87 100644 --- a/src/components/LeftDrawerEvent/LeftDrawerEvent.tsx +++ b/src/components/LeftDrawerEvent/LeftDrawerEvent.tsx @@ -164,7 +164,7 @@ const leftDrawerEvent = ({ {`Profile ) : ( {`Dummy )}