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: The Login and Organization Screens #3309

Merged
Merged
Changes from 7 commits
Commits
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
7 changes: 7 additions & 0 deletions public/images/svg/angleRight.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions src/assets/css/app.css

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

22 changes: 4 additions & 18 deletions src/components/LeftDrawer/LeftDrawer.spec.tsx
Original file line number Diff line number Diff line change
@@ -93,13 +93,9 @@ describe('Testing Left Drawer component for SUPERADMIN', () => {
orgsBtn.click();
});

expect(
orgsBtn.className.includes('text-black btn btn-success'),
).toBeTruthy();
expect(rolesBtn.className.includes('text-secondary btn')).toBeTruthy();
expect(
communityProfileBtn.className.includes('text-secondary btn'),
).toBeTruthy();
expect(orgsBtn.className.includes('btn btn-success')).toBeTruthy();
expect(rolesBtn.className.includes('btn')).toBeTruthy();
expect(communityProfileBtn.className.includes('btn')).toBeTruthy();

await act(async () => {
userEvent.click(rolesBtn);
@@ -171,14 +167,6 @@ describe('Testing Left Drawer component for SUPERADMIN', () => {

expect(screen.getByText('My Organizations')).toBeInTheDocument();
expect(screen.getByText('Talawa Admin Portal')).toBeInTheDocument();

const orgsBtn = screen.getByTestId(/orgsBtn/i);

await act(async () => {
orgsBtn.click();
});

expect(orgsBtn.className.includes('text-black')).toBeTruthy();
});
});

@@ -207,9 +195,7 @@ describe('Testing Left Drawer component for ADMIN', () => {
orgsBtn.click();
});

expect(
orgsBtn.className.includes('text-black btn btn-success'),
).toBeTruthy();
expect(orgsBtn.className.includes('btn btn-success')).toBeTruthy();

// These screens aren't meant for admins, so they should not be present
expect(screen.queryByTestId(/rolesBtn/i)).toBeNull();
167 changes: 94 additions & 73 deletions src/components/LeftDrawer/LeftDrawer.tsx
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
import TalawaLogo from 'assets/svgs/talawa.svg?react';
import styles from 'style/app.module.css';
import useLocalStorage from 'utils/useLocalstorage';
import ProfileDropdown from 'components/ProfileDropdown/ProfileDropdown';
prathmesh703 marked this conversation as resolved.
Show resolved Hide resolved

export interface InterfaceLeftDrawerProps {
hideDrawer: boolean | null; // Controls the visibility of the drawer
@@ -63,80 +64,100 @@
<h5 className={`${styles.titleHeader} text-secondary`}>
{tCommon('menu')}
</h5>
<div className={styles.optionList}>
<NavLink to={'/orglist'} onClick={handleLinkClick}>
{({ isActive }) => (
<Button
variant={isActive === true ? 'success' : ''}
className={`${
isActive === true ? 'text-black' : 'text-secondary'
}`}
style={{
backgroundColor: isActive === true ? '#EAEBEF' : '',
}}
data-testid="orgsBtn"
>
<div className={styles.iconWrapper}>
<OrganizationsIcon
fill={
isActive === true
? 'var(--bs-black)'
: 'var(--bs-secondary)'
}
/>
</div>
{t('my organizations')}
</Button>
<div className={`d-flex flex-column ${styles.sidebarcompheight} `}>
<div className={styles.optionList}>
<NavLink to={'/orglist'} onClick={handleLinkClick}>
{({ isActive }) => (
<Button

Check warning on line 71 in src/components/LeftDrawer/LeftDrawer.tsx

Codecov / codecov/patch

src/components/LeftDrawer/LeftDrawer.tsx#L71

Added line #L71 was not covered by tests
variant={isActive === true ? 'success' : ''}
style={{
backgroundColor:
isActive === true ? 'var(--sidebar-option-bg)' : '',
fontWeight: isActive ? 'bold' : 'normal',
color: isActive
? 'var(--sidebar-option-text-active)'
: 'var(--sidebar-option-text-inactive)',
}}
data-testid="orgsBtn"
>
<div className={styles.iconWrapper}>
<OrganizationsIcon
fill="none"
stroke={`${
isActive === true
? 'var(--sidebar-icon-stroke-active)'
: 'var(--sidebar-icon-stroke-inactive)'
}`}
/>
</div>
{t('my organizations')}
</Button>
)}
</NavLink>
{superAdmin && (
<>
<NavLink to={'/users'} onClick={handleLinkClick}>
{({ isActive }) => (
<Button

Check warning on line 101 in src/components/LeftDrawer/LeftDrawer.tsx

Codecov / codecov/patch

src/components/LeftDrawer/LeftDrawer.tsx#L101

Added line #L101 was not covered by tests
variant={isActive === true ? 'success' : ''}
style={{
backgroundColor:
isActive === true ? 'var(--sidebar-option-bg)' : '',
fontWeight: isActive ? 'bold' : 'normal',
color: isActive
? 'var(--sidebar-option-text-active)'
: 'var(--sidebar-option-text-inactive)',
}}
data-testid="rolesBtn"
>
<div className={styles.iconWrapper}>
<RolesIcon
fill="none"
stroke={`${
isActive === true
? 'var(--sidebar-icon-stroke-active)'
: 'var(--sidebar-icon-stroke-inactive)'
}`}
prathmesh703 marked this conversation as resolved.
Show resolved Hide resolved
/>
</div>
{tCommon('users')}
</Button>
)}
</NavLink>
<NavLink to={'/communityProfile'} onClick={handleLinkClick}>
{({ isActive }) => (
<Button

Check warning on line 129 in src/components/LeftDrawer/LeftDrawer.tsx

Codecov / codecov/patch

src/components/LeftDrawer/LeftDrawer.tsx#L129

Added line #L129 was not covered by tests
variant={isActive === true ? 'success' : ''}
style={{
backgroundColor:
isActive === true ? 'var(--sidebar-option-bg)' : '',
fontWeight: isActive ? 'bold' : 'normal',
color: isActive
? 'var(--sidebar-option-text-active)'
: 'var(--sidebar-option-text-inactive)',
}}
data-testid="communityProfileBtn"
>
<div className={styles.iconWrapper}>
<SettingsIcon
fill="none"
stroke={`${
isActive === true
? 'var(--sidebar-icon-stroke-active)'
: 'var(--sidebar-icon-stroke-inactive)'
}`}
/>
</div>
{t('communityProfile')}
</Button>
)}
</NavLink>
</>
)}
</NavLink>
{superAdmin && (
<>
<NavLink to={'/users'} onClick={handleLinkClick}>
{({ isActive }) => (
<Button
variant={isActive === true ? 'success' : ''}
className={`${
isActive === true ? 'text-white' : 'text-secondary'
}`}
data-testid="rolesBtn"
>
<div className={styles.iconWrapper}>
<RolesIcon
fill={`${
isActive === true
? 'var(--bs-white)'
: 'var(--bs-secondary)'
}`}
/>
</div>
{tCommon('users')}
</Button>
)}
</NavLink>
<NavLink to={'/communityProfile'} onClick={handleLinkClick}>
{({ isActive }) => (
<Button
variant={isActive === true ? 'success' : ''}
className={`${
isActive === true ? 'text-white' : 'text-secondary'
}`}
data-testid="communityProfileBtn"
>
<div className={styles.iconWrapper}>
<SettingsIcon
stroke={`${
isActive === true
? 'var(--bs-white)'
: 'var(--bs-secondary)'
}`}
/>
</div>
{t('communityProfile')}
</Button>
)}
</NavLink>
</>
)}
</div>
<div className="mt-auto">
<ProfileDropdown />
</div>
</div>
</div>
</>
24 changes: 13 additions & 11 deletions src/components/LoginPortalToggle/LoginPortalToggle.module.css
Original file line number Diff line number Diff line change
@@ -6,29 +6,31 @@
text-align: center;
vertical-align: middle;
cursor: pointer;
color: var(--bs-gray-900);
color: var(--brown-color);
border-radius: 0.3rem;
width: 100%;
box-sizing: border-box;
border: 1px solid var(--bs-gray-700);
border: 1px solid var(--grey-light);
font-weight: 500;
transition: all 0.25s ease;
background-color: var(--grey-light);
}

.navLinkClass:hover {
color: var(--bs-white);
background-color: var(--bs-gray);
border-color: var(--bs-gray);
box-shadow: var(--hover-shadow);
background-color: var(--grey-light);
border-color: var(--grey-light);
}

.activeLink {
color: white;
border: 1px solid var(--bs-primary);
background-color: var(--toggle-button-bg);
color: var(--brown-color);
border: 1px solid var(--light-blue);
background-color: var(--light-blue);
}

.activeLink:hover {
color: var(--bs-white);
background-color: var(--toggle-button-bg);
border: 1px solid var(--bs-primary);
box-shadow: var(--hover-shadow);
color: var(--brown-color);
border: 1px solid var(--light-blue);
background-color: var(--light-blue);
}
Loading