Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Organization Not Found in Left Drawer #1592

Merged
merged 31 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
08c3fe4
Fixed Organization Not Found in Left Drawer
GlenDsza Feb 16, 2024
157039e
Merge branch 'PalisadoesFoundation:develop' into develop
GlenDsza Feb 17, 2024
57a3e99
Fix State update when MemberDetail is unmounted
GlenDsza Feb 17, 2024
048ebd0
Merge branch 'develop' of https://github.com/GlenDsza/talawa-admin in…
GlenDsza Feb 17, 2024
7a556ef
Shifted UseEffect to be called from top level function
GlenDsza Feb 17, 2024
8d48386
Shift useEffect to be called form top-level
GlenDsza Feb 17, 2024
d375701
Add Test Coverage for images in MemberDetail
GlenDsza Feb 17, 2024
91798ce
Fixed Linting issues & removed unrelated code to current PR from Logi…
GlenDsza Feb 17, 2024
cc12b41
prettier update
GlenDsza Feb 18, 2024
1ecacd9
Merge remote-tracking branch 'upstream/develop' into develop
GlenDsza Feb 18, 2024
6831e69
Fix improper testcase in MemberDetail.test
GlenDsza Feb 18, 2024
fffad1d
Merge branch 'PalisadoesFoundation:develop' into develop
GlenDsza Feb 19, 2024
f12d207
State Update on Unmount Resolved in Testing
GlenDsza Feb 22, 2024
030647b
Merge branch 'PalisadoesFoundation:develop' into develop
GlenDsza Feb 26, 2024
c5aba47
Added dicebear url constants
GlenDsza Feb 26, 2024
857f3cb
Merge branch 'develop' into develop
GlenDsza Feb 28, 2024
25e2dbf
Merge remote-tracking branch 'upstream/develop' into develop
GlenDsza Feb 28, 2024
73b0fa3
Merge remote-tracking branch 'upstream/develop' into develop
GlenDsza Feb 29, 2024
69bca08
Revert changes in Readme & package-lock.json
GlenDsza Feb 29, 2024
9f23361
Added tests for LeftDrawer & MemberDetail for full coverage
GlenDsza Feb 29, 2024
0150d57
Refactor OrganizationScreen & SuperAdminScreen
GlenDsza Feb 29, 2024
338f7ae
Merge remote-tracking branch 'upstream/develop' into develop
GlenDsza Feb 29, 2024
cd9f8ca
Remove commented line
GlenDsza Feb 29, 2024
9f924bd
Merge branch 'develop' into develop
palisadoes Feb 29, 2024
791e417
Merge remote-tracking branch 'upstream/develop' into develop
GlenDsza Feb 29, 2024
0a9b154
Merge branch 'PalisadoesFoundation:develop' into develop
GlenDsza Feb 29, 2024
6ad43a0
Merge branch 'develop' of https://github.com/GlenDsza/talawa-admin in…
GlenDsza Feb 29, 2024
d33e81d
Modified tests in OrganizationScreen & SuperAdminScreen
GlenDsza Mar 1, 2024
be9ce38
Merge branch 'PalisadoesFoundation:develop' into develop
GlenDsza Mar 2, 2024
d1644aa
Revert README.md
GlenDsza Mar 2, 2024
6b5aae7
Merge branch 'develop' into develop
GlenDsza Mar 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 0 additions & 99 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/components/LeftDrawer/LeftDrawer.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
.leftDrawer .profileContainer {
border: none;
width: 100%;
padding: 2.1rem 0.5rem;
height: 52px;
border-radius: 8px;
background-color: var(--bs-white);
GlenDsza marked this conversation as resolved.
Show resolved Hide resolved
display: flex;
align-items: center;
}
Expand Down
63 changes: 36 additions & 27 deletions src/components/LeftDrawer/LeftDrawer.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -104,34 +104,43 @@ const leftDrawer = ({
)}
</div>
<div style={{ marginTop: 'auto' }}>
<button
className={styles.profileContainer}
data-testid="profileBtn"
onClick={(): void => {
history.push(`/member/id=${userId}`);
<Link
to={{
pathname: `/member/id=${userId}`,
state: { from: 'orglist' },
}}
>
<div className={styles.imageContainer}>
{userImage && userImage !== 'null' ? (
<img src={userImage} alt={`profile picture`} />
) : (
<img
src={`https://api.dicebear.com/5.x/initials/svg?seed=${firstName}%20${lastName}`}
alt={`dummy picture`}
/>
)}
</div>
<div className={styles.profileText}>
<span className={styles.primaryText}>
{firstName} {lastName}
</span>
<span className={styles.secondaryText}>
{`${userType}`.toLowerCase()}
</span>
</div>
<AngleRightIcon fill={'var(--bs-secondary)'} />
</button>

<Button
key={'profileBtn'}
className={styles.profileContainer}
variant={screenName === 'Profile' ? 'success' : 'light'}
data-testid="profileBtn"
>
<div className={styles.imageContainer}>
{userImage && userImage !== 'null' ? (
<img src={userImage} alt={`profile picture`} />
) : (
<img
src={`https://api.dicebear.com/5.x/initials/svg?seed=${firstName}%20${lastName}`}
GlenDsza marked this conversation as resolved.
Show resolved Hide resolved
alt={`dummy picture`}
/>
)}
</div>
<div className={styles.profileText}>
<span className={styles.primaryText}>
{firstName} {lastName}
</span>
<span
className={`${styles.secondaryText} ${
screenName === 'Profile' && 'text-white'
}`}
>
{`${userType}`.toLowerCase()}
</span>
</div>
<AngleRightIcon fill={'var(--bs-secondary)'} />
</Button>
</Link>
<Button
variant="light"
className={`mt-4 d-flex justify-content-start px-0 w-100 bg-danger text-white ${styles.logout}`}
Expand Down
2 changes: 1 addition & 1 deletion src/components/LeftDrawerOrg/LeftDrawerOrg.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@
border: none;
width: 100%;
margin-top: 5rem;
padding: 2.1rem 0.5rem;
height: 52px;
border-radius: 8px;
background-color: var(--bs-white);
display: flex;
align-items: center;
}
Expand Down
62 changes: 36 additions & 26 deletions src/components/LeftDrawerOrg/LeftDrawerOrg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import IconComponent from 'components/IconComponent/IconComponent';
import React, { useEffect, useState } 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 type { TargetsType } from 'state/reducers/routesReducer';
import type { InterfaceQueryOrganizationsListObject } from 'utils/interfaces';
import { ReactComponent as AngleRightIcon } from 'assets/svgs/angleRight.svg';
Expand Down Expand Up @@ -176,33 +176,43 @@ const leftDrawerOrg = ({

{/* Profile Section & Logout Btn */}
<div style={{ marginTop: 'auto' }}>
<button
className={styles.profileContainer}
data-testid="profileBtn"
onClick={(): void => {
history.push(`/member/id=${userId}`);
<Link
to={{
pathname: `/member/id=${userId}`,
state: { from: 'orgdash' },
}}
>
<div className={styles.imageContainer}>
{userImage && userImage !== 'null' ? (
<img src={userImage} alt={`profile picture`} />
) : (
<img
src={`https://api.dicebear.com/5.x/initials/svg?seed=${firstName}%20${lastName}`}
alt={`dummy picture`}
/>
)}
</div>
<div className={styles.profileText}>
<span className={styles.primaryText}>
{firstName} {lastName}
</span>
<span className={styles.secondaryText}>
{`${userType}`.toLowerCase()}
</span>
</div>
<AngleRightIcon fill={'var(--bs-secondary)'} />
</button>
<Button
key={'profileBtn'}
variant={screenName === 'Profile' ? 'success' : 'light'}
className={styles.profileContainer}
data-testid="profileBtn"
>
<div className={styles.imageContainer}>
{userImage && userImage !== 'null' ? (
<img src={userImage} alt={`profile picture`} />
) : (
<img
src={`https://api.dicebear.com/5.x/initials/svg?seed=${firstName}%20${lastName}`}
GlenDsza marked this conversation as resolved.
Show resolved Hide resolved
alt={`dummy picture`}
/>
)}
</div>
<div className={styles.profileText}>
<span className={styles.primaryText}>
{firstName} {lastName}
</span>
<span
className={`${styles.secondaryText} ${
screenName === 'Profile' && 'text-white'
}`}
>
{`${userType}`.toLowerCase()}
</span>
</div>
<AngleRightIcon fill={'var(--bs-secondary)'} />
</Button>
</Link>
<Button
variant="light"
className={`mt-4 d-flex justify-content-start px-0 w-100 ${styles.logout}`}
Expand Down
26 changes: 26 additions & 0 deletions src/screens/MemberDetail/MemberDetail.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,32 @@ describe('MemberDetail', () => {
expect(getLangName('')).toBe('Unavailable');
});

test('should render OrganizationScreen if called from Organization Dashboard', async () => {
const props = {
id: 'rishav-jha-mech',
from: 'orgdash',
};

render(
<MockedProvider addTypename={false} link={link1}>
<BrowserRouter>
<Provider store={store}>
<I18nextProvider i18n={i18nForTest}>
<MemberDetail {...props} />
</I18nextProvider>
</Provider>
</BrowserRouter>
</MockedProvider>
);

expect(screen.queryByText('Loading data...')).not.toBeInTheDocument();
await wait();
expect(screen.getAllByText(/People/i)).toBeTruthy();
expect(screen.getAllByText(/Events/i)).toBeTruthy();
expect(screen.getAllByText(/Posts/i)).toBeTruthy();
expect(screen.getAllByText(/Advertisement/i)).toBeTruthy();
});

test('Should display dicebear image if image is null', async () => {
const props = {
id: 'rishav-jha-mech',
Expand Down
Loading
Loading