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

Redesign: Standardise User Management Screens for Admin and Super Admin #1988

Closed
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
7188257
fixed failing tests
Doraemon012 May 17, 2024
7ba67d0
fixed formatting
Doraemon012 May 17, 2024
83b51f8
Enhanced code coverage
Doraemon012 May 23, 2024
d55f74f
Update src/components/OrgMemberDetail/OrgMemberDetails.test.tsx
varshith257 May 23, 2024
9407be7
fixed failing tests
Doraemon012 May 23, 2024
ee5e922
fixed failing test
Doraemon012 May 23, 2024
0c86d37
Merge branch 'develop' into talawa-admin-t
Doraemon012 May 23, 2024
b80ec57
Resolved conflicts
Doraemon012 Jun 2, 2024
99ebd9d
Merge branch 'develop' into talawa-admin-t
Doraemon012 Jun 2, 2024
bb61827
fixed formatting
Doraemon012 Jun 2, 2024
0dcc032
Merge branch 'talawa-admin-t' of https://github.com/Doraemon012/talaw…
Doraemon012 Jun 2, 2024
eb017a9
fixed formatting
Doraemon012 Jun 2, 2024
73b318a
added translations
Doraemon012 Jun 2, 2024
6787698
Added remaining translations
Doraemon012 Jun 3, 2024
5cc8cca
Merge branch 'develop' into talawa-admin-t
Doraemon012 Jun 3, 2024
fe69035
enhanced coverage
Doraemon012 Jun 3, 2024
d571f56
Merge branch 'talawa-admin-t' of https://github.com/Doraemon012/talaw…
Doraemon012 Jun 3, 2024
cce831c
enhanced coverage
Doraemon012 Jun 3, 2024
a801c09
fixed styling
Doraemon012 Jun 5, 2024
2f8633f
fixed titles
Doraemon012 Jun 5, 2024
d65e3e9
Merge branch 'develop' into talawa-admin-t
Doraemon012 Jun 5, 2024
064f9dc
fixed formatting
Doraemon012 Jun 5, 2024
6b878c9
Merge branch 'talawa-admin-t' of https://github.com/Doraemon012/talaw…
Doraemon012 Jun 5, 2024
63df040
fixed formatting
Doraemon012 Jun 5, 2024
c947df0
fixed bug in title handeling and enhanced coverage
Doraemon012 Jun 24, 2024
8447f09
Merge branch 'develop' into talawa-admin-t
Doraemon012 Jun 24, 2024
5db8ed3
fixed formatting
Doraemon012 Jun 24, 2024
760a229
added missing translation
Doraemon012 Jun 24, 2024
1137ec0
removed comments
Doraemon012 Jun 24, 2024
d65b820
fixed formatting
Doraemon012 Jun 24, 2024
8565d6e
fixed ui
Doraemon012 Aug 25, 2024
4ad402a
Merge branch 'develop' into talawa-admin-t
Doraemon012 Aug 25, 2024
3201833
removed useless fields
Doraemon012 Aug 25, 2024
1ea2ddb
removed comments in css
Doraemon012 Aug 25, 2024
a296b3e
removed useless fields
Doraemon012 Aug 25, 2024
849d3b5
fixed formatting
Doraemon012 Aug 25, 2024
6ef7537
Merge remote-tracking branch 'origin/talawa-admin-t' into talawa-admin-t
Doraemon012 Aug 25, 2024
0765a1e
fixed formatting
Doraemon012 Aug 25, 2024
7edfc02
fixed tsdoc comments
Doraemon012 Aug 25, 2024
02d869b
fixed formatting
Doraemon012 Aug 25, 2024
b791eac
added translations
Doraemon012 Aug 25, 2024
d92dc4f
fixed failing test in OrgPeopleOrganizationsCard
Doraemon012 Aug 25, 2024
ddd94a8
fixed failing tests
Doraemon012 Aug 25, 2024
efaf116
Merge branch 'develop' into talawa-admin-t
Doraemon012 Aug 28, 2024
08a8748
Merge branch 'develop' into talawa-admin-t
Doraemon012 Sep 3, 2024
8152c23
fixed conflicts
Doraemon012 Sep 3, 2024
b9d9c4c
Merge branch 'develop' into talawa-admin-t
Doraemon012 Sep 27, 2024
b93ebcf
Fixed formating.tsx
Doraemon012 Sep 27, 2024
392ab42
Fixed error in OrgPeopleOrganizationsCard.tsx
Doraemon012 Sep 27, 2024
9d7f9dd
fixed failing tests
Doraemon012 Sep 29, 2024
645ba48
fixed formatting
Doraemon012 Sep 29, 2024
b7c0eb2
Merge branch 'develop' into talawa-admin-t
Doraemon012 Sep 29, 2024
f9cc50b
fixed failing test in leftdrawerorg
Doraemon012 Oct 5, 2024
fa768e5
Merge branch 'develop' into talawa-admin-t
Doraemon012 Oct 5, 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
2 changes: 2 additions & 0 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,5 @@
"Plugin Store": "Plugin Store",
"Settings": "Settings"
}


33 changes: 32 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,21 @@
"manage": "Manage",
"sampleOrganization": "Sample Organization"
},
"orgPeopleOrganizationsCard": {
"admins": "Admins",
"members": "Members",
"manage": "Manage",
"notMember": "User is not a member",
"unblock": "UnBlock",
"block": "Block",
"blockedSuccessfully": "User blocked successfully",
"unBlockedSuccessfully": "User Un-Blocked successfully",
"blockedUser": "User is blocked",
"roleUpdated": "Role Updated.",
"no": "No",
"yes": "Yes",
"memberRemoved": "The Member is removed"
},
"paginationList": {
"rowsPerPage": "rows per page",
"all": "All"
Expand Down Expand Up @@ -179,7 +194,8 @@
"noMembershipRequests": "No Membership requests present"
},
"organizationPeople": {
"title": "Talawa Members",
"title": "Members",
"title_superadmin": "Users",
"filterByName": "Filter by Name",
"filterByLocation": "Filter by Location",
"filterByEvent": "Filter by Event",
Expand Down Expand Up @@ -580,6 +596,13 @@
"installMsg": "This feature is now enabled in your organization"
},
"memberDetail": {
"overview": "Overview",
"organizations": "Organizations",
"events": "Events",
"tags": "Tags",
"title": "User Details"
},
"orgMemberDetail": {
"title": "User Details",
"addAdmin": "Add Admin",
"alreadyIsAdmin": "Member is already an Admin",
Expand Down Expand Up @@ -614,6 +637,14 @@
"addedAsAdmin": "User is added as admin.",
"userType": "User Type"
},
"memberOrganization": {
"sort": "Sort",
"noOrgError": "Organizations not found, please create an organization through dashboard",
"noOrgErrorTitle": "Organizations Not Found",
"noOrgErrorDescription": "Please create an organization through dashboard",
"noResultsFoundFor": "No results found for",
"endOfResults": "End of results"
},
"userLogin": {
"login": "Login",
"loginIntoYourAccount": "Login into your account",
Expand Down
33 changes: 32 additions & 1 deletion public/locales/sp/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,21 @@
"noNotifications": "No Notificaciones",
"close": "Cerca"
},
"orgPeopleOrganizationsCard": {
"admins": "Administradores",
"members": "Miembros",
"manage": "Gestionar",
"notMember": "El usuario no es miembro",
"unblock": "Desbloquear",
"block": "Bloquear",
"blockedUser": "Usuario bloqueado",
"blockedSuccessfully": "Usuario bloqueado exitosamente",
"unBlockedSuccessfully": "Usuario desbloqueado exitosamente",
"roleUpdated": "Rol actualizado.",
"no": "No",
"yes": "Sí",
"memberRemoved": "El miembro ha sido eliminado"
},
"orgList": {
"title": "Organizaciones Talawa",
"you": "Tú",
Expand Down Expand Up @@ -261,7 +276,8 @@
"talawaApiUnavailable": "El servicio Talawa-API no está disponible. ¿Está funcionando? Compruebe también la conectividad de su red."
},
"organizationPeople": {
"title": "Miembros Talawa",
"title": "Miembros",
"title_superadmin": "Usuarios",
"filterByName": "Filtrar por nombre",
"filterByLocation": "Filtrar por Ubicación",
"filterByEvent": "Filtrar por Evento",
Expand Down Expand Up @@ -766,6 +782,21 @@
"uninstall": "Desinstalar"
},
"memberDetail": {
"overview": "Resumen",
"organizations": "Organizaciones",
"events": "Eventos",
"tags": "Etiquetas",
"title": "Detalles del Usuario"
},
"memberOrganization": {
"sort": "Ordenar",
"noOrgError": "Organizaciones no encontradas, por favor crea una organización a través del panel de control",
"noOrgErrorTitle": "Organizaciones no encontradas",
"noOrgErrorDescription": "Por favor, crea una organización a través del panel de control",
"noResultsFoundFor": "No se encontraron resultados para",
"endOfResults": "Fin de los resultados"
},
"orgMemberDetail": {
"title": "Detalles del usuario",
"addAdmin": "Agregar administrador",
"alreadyIsAdmin": "El Miembro ya es Administrador",
Expand Down
7 changes: 7 additions & 0 deletions src/GraphQl/Queries/Queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ export const ORGANIZATION_CONNECTION_LIST = gql`
sortingCode
state
}
blockedUsers {
_id
firstName
lastName
email
}
description
}
}
`;
Expand Down
41 changes: 37 additions & 4 deletions src/components/LeftDrawerOrg/LeftDrawerOrg.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,20 @@ const MOCKS_EMPTY = [
},
];

const defaultScreensForSuperadmin = [
'Dashboard',
'Users',
'Events',
'Posts',
'Block/Unblock',
'Plugins',
'Settings',
'All Organizations',
];

const defaultScreens = [
'Dashboard',
'People',
'Members',
'Events',
'Posts',
'Block/Unblock',
Expand Down Expand Up @@ -269,7 +280,7 @@ const linkEmpty = new StaticMockLink(MOCKS_EMPTY, true);
describe('Testing LeftDrawerOrg component for SUPERADMIN', () => {
test('Component should be rendered properly', async () => {
setItem('UserImage', '');
setItem('SuperAdmin', true);
setItem('SuperAdmin', false);
Doraemon012 marked this conversation as resolved.
Show resolved Hide resolved
setItem('FirstName', 'John');
setItem('LastName', 'Doe');
render(
Expand All @@ -289,6 +300,28 @@ describe('Testing LeftDrawerOrg component for SUPERADMIN', () => {
});
});

test('Component should be rendered properly for superadmin', async () => {
setItem('UserImage', '');
setItem('SuperAdmin', true);
setItem('FirstName', 'John');
setItem('LastName', 'Doe');
render(
<MockedProvider addTypename={false} link={link}>
<BrowserRouter>
<Provider store={store}>
<I18nextProvider i18n={i18nForTest}>
<LeftDrawerOrg {...props} />
</I18nextProvider>
</Provider>
</BrowserRouter>
</MockedProvider>,
);
await wait();
defaultScreensForSuperadmin.map((screenName) => {
expect(screen.getByText(screenName)).toBeInTheDocument();
});
});

test('Testing Profile Page & Organization Detail Modal', async () => {
setItem('UserImage', '');
setItem('SuperAdmin', true);
Expand Down Expand Up @@ -330,7 +363,7 @@ describe('Testing LeftDrawerOrg component for SUPERADMIN', () => {
expect(global.window.location.pathname).toContain('/orgdash/id=123');
});

test('Testing when screen size is less than 820px', async () => {
test('Testing when screen size is less than 820px for superadmins', async () => {
setItem('SuperAdmin', true);
render(
<MockedProvider addTypename={false} link={link}>
Expand All @@ -346,7 +379,7 @@ describe('Testing LeftDrawerOrg component for SUPERADMIN', () => {
await wait();
resizeWindow(800);
expect(screen.getByText(/Dashboard/i)).toBeInTheDocument();
expect(screen.getByText(/People/i)).toBeInTheDocument();
expect(screen.getByText(/Users/i)).toBeInTheDocument();

const peopelBtn = screen.getByTestId(/People/i);
userEvent.click(peopelBtn);
Expand Down
13 changes: 11 additions & 2 deletions src/components/LeftDrawerOrg/LeftDrawerOrg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { ReactComponent as AngleRightIcon } from 'assets/svgs/angleRight.svg';
import { ReactComponent as TalawaLogo } from 'assets/svgs/talawa.svg';
import styles from './LeftDrawerOrg.module.css';
import Avatar from 'components/Avatar/Avatar';
import useLocalStorage from 'utils/useLocalstorage';

export interface InterfaceLeftDrawerProps {
orgId: string;
Expand All @@ -28,6 +29,9 @@ const leftDrawerOrg = ({
setHideDrawer,
}: InterfaceLeftDrawerProps): JSX.Element => {
const { t: tCommon } = useTranslation('common');
const { getItem } = useLocalStorage();
const isSuperAdmin = getItem('SuperAdmin');

const [showDropdown, setShowDropdown] = React.useState(false);

const [organization, setOrganization] =
Expand All @@ -43,7 +47,6 @@ const leftDrawerOrg = ({
} = useQuery(ORGANIZATIONS_LIST, {
variables: { id: orgId },
});
// Set organization data
useEffect(() => {
Doraemon012 marked this conversation as resolved.
Show resolved Hide resolved
let isMounted = true;
if (data && isMounted) {
Expand Down Expand Up @@ -151,7 +154,13 @@ const leftDrawerOrg = ({
}
/>
</div>
{tCommon(name)}

{name == 'People'
Doraemon012 marked this conversation as resolved.
Show resolved Hide resolved
? isSuperAdmin
? 'Users'
: 'Members'
: tCommon(name)}
Doraemon012 marked this conversation as resolved.
Show resolved Hide resolved

</Button>
)}
</NavLink>
Expand Down
Loading
Loading