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

[Translation] Table heading, Buttons, Profile dropdown for ADMIN PANEL #2021

Merged
merged 4 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
11 changes: 10 additions & 1 deletion public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"search": "Search",
"description": "Description",
"saveChanges": "Save Changes",
"resetChanges": "Reset Changes",
"displayImage": "Display Image",
"enterEmail": "Enter Email",
"emailAddress": "Email Address",
Expand Down Expand Up @@ -61,5 +62,13 @@
"Membership Requests": "Membership Requests",
"Plugins": "Plugins",
"Plugin Store": "Plugin Store",
"Settings": "Settings"
"Settings": "Settings",
"createdOn": "Created On",
"createdBy": "Created By",
"usersRole": "User's Role",
"changeRole": "Change Role",
"action": "Action",
"removeUser": "Remove User",
"remove": "Remove",
"viewProfile": "View Profile"
}
4 changes: 3 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@
"roleUpdated": "Role Updated.",
"joinNow": "Join Now",
"visit": "Visit",
"withdraw": "Widthdraw"
"withdraw": "Widthdraw",
"removeUserFrom": "Remove User from {{org}}",
"removeConfirmation": "Are you sure you want to remove '{{name}}' from organization '{{org}}'?"
},
"communityProfile": {
"title": "Community Profile",
Expand Down
11 changes: 10 additions & 1 deletion public/locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"search": "Recherche",
"description": "Description",
"saveChanges": "Sauvegarder les modifications",
"resetChanges": "Réinitialiser les modifications",
"displayImage": "Afficher l'image",
"enterEmail": "Entrez l'e-mail",
"emailAddress": "Adresse e-mail",
Expand Down Expand Up @@ -61,5 +62,13 @@
"Membership Requests": "Demandes d'Adhésion",
"Plugins": "Plugins",
"Plugin Store": "Magasin de Plugins",
"Settings": "Paramètres"
"Settings": "Paramètres",
"createdOn": "Créé Le",
"createdBy": "Créé Par",
"usersRole": "Rôle de l'Utilisateur",
"changeRole": "Changer de Rôle",
"action": "Action",
"removeUser": "Supprimer l'Utilisateur",
"remove": "Supprimer",
"viewProfile": "Voir le Profil"
}
4 changes: 3 additions & 1 deletion public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@
"roleUpdated": "Rôle mis à jour.",
"joinNow": "Adhérer maintenant",
"visit": "Visite",
"withdraw": "Largeur de tirage"
"withdraw": "Largeur de tirage",
"removeUserFrom": "Supprimer l'Utilisateur de {{org}}",
"removeConfirmation": "Êtes-vous sûr de vouloir supprimer '{{name}}' de l'organisation '{{org}}' ?"
},
"communityProfile": {
"title": "Profil de la communauté",
Expand Down
11 changes: 10 additions & 1 deletion public/locales/hi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"search": "खोज",
"description": "विवरण",
"saveChanges": "परिवर्तनों को सुरक्षित करें",
"resetChanges": "परिवर्तनों को रीसेट करें",
"displayImage": "प्रदर्शन छवि",
"enterEmail": "ईमेल दर्ज करें",
"emailAddress": "मेल पता",
Expand Down Expand Up @@ -61,5 +62,13 @@
"Membership Requests": "सदस्यता अनुरोध",
"Plugins": "प्लगइन्स",
"Plugin Store": "प्लगइन स्टोर",
"Settings": "सेटिंग्स"
"Settings": "सेटिंग्स",
"createdOn": "बनाया गया",
"createdBy": "के द्वारा बनाया गया",
"usersRole": "उपयोगकर्ता की भूमिका",
"changeRole": "भूमिका बदलें",
"action": "क्रिया",
"removeUser": "उपयोगकर्ता हटाएं",
"remove": "हटाएं",
"viewProfile": "प्रोफ़ाइल देखें"
}
4 changes: 3 additions & 1 deletion public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@
"roleUpdated": "भूमिका अद्यतन की गई.",
"joinNow": "अब शामिल हों",
"visit": "मिलने जाना",
"withdraw": "चौड़ाई निकालना"
"withdraw": "चौड़ाई निकालना",
"removeUserFrom": "{{org}} से उपयोगकर्ता हटाएं",
"removeConfirmation": "क्या आप वाकई '{{org}}' संगठन से '{{name}}' को हटाना चाहते हैं?"
},
"communityProfile": {
"title": "सामुदायिक प्रोफ़ाइल",
Expand Down
11 changes: 10 additions & 1 deletion public/locales/sp/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"search": "Search",
"description": "Description",
"saveChanges": "Save Changes",
"resetChanges": "Reset Changes",
"displayImage": "Display Image",
"enterEmail": "Enter Email",
"emailAddress": "Email Address",
Expand Down Expand Up @@ -61,5 +62,13 @@
"Membership Requests": "Solicitudes de Membresía",
"Plugins": "Complementos",
"Plugin Store": "Tienda de Complementos",
"Settings": "Configuraciones"
"Settings": "Configuraciones",
"createdOn": "Creado En",
"createdBy": "Creado Por",
"usersRole": "Rol del Usuario",
"changeRole": "Cambiar Rol",
"action": "Acción",
"removeUser": "Eliminar Usuario",
"remove": "Eliminar",
"viewProfile": "Ver Perfil"
}
4 changes: 3 additions & 1 deletion public/locales/sp/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@
"orgJoined": "Unido a la organización exitosamente",
"MembershipRequestSent": "Solicitud de membresía enviada exitosamente",
"AlreadyJoined": "Ya eres miembro de esta organización.",
"errorOccured": "Se produjo un error. Por favor, inténtalo de nuevo más tarde."
"errorOccured": "Se produjo un error. Por favor, inténtalo de nuevo más tarde.",
"removeUserFrom": "Eliminar Usuario de {{org}}",
"removeConfirmation": "¿Está seguro de que desea eliminar a '{{name}}' de la organización '{{org}}'?"
},
"communityProfile": {
"title": "Perfil de la comunidad",
Expand Down
11 changes: 10 additions & 1 deletion public/locales/zh/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"search": "搜索",
"description": "描述",
"saveChanges": "保存更改",
"resetChanges": "重置更改",
"displayImage": "显示图像",
"enterEmail": "输入电子邮件",
"emailAddress": "电子邮件地址",
Expand Down Expand Up @@ -61,5 +62,13 @@
"Membership Requests": "会员请求",
"Plugins": "插件",
"Plugin Store": "插件商店",
"Settings": "设置"
"Settings": "设置",
"createdOn": "创建于",
"createdBy": "创建者",
"usersRole": "用户角色",
"changeRole": "更改角色",
"action": "操作",
"removeUser": "删除用户",
"remove": "删除",
"viewProfile": "查看个人资料"
}
4 changes: 3 additions & 1 deletion public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@
"roleUpdated": "角色已更新。",
"joinNow": "立即加入",
"visit": "访问",
"withdraw": "拉幅"
"withdraw": "拉幅",
"removeUserFrom": "从{{org}}中删除用户",
"removeConfirmation": "您确定要将'{{name}}'从组织'{{org}}'中删除吗?"
},
"communityProfile": {
"title": "社区简介",
Expand Down
6 changes: 4 additions & 2 deletions src/components/ProfileDropdown/ProfileDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import useLocalStorage from 'utils/useLocalstorage';
import styles from './ProfileDropdown.module.css';
import { REVOKE_REFRESH_TOKEN } from 'GraphQl/Mutations/mutations';
import { useMutation } from '@apollo/client';
import { useTranslation } from 'react-i18next';

const profileDropdown = (): JSX.Element => {
const { t: tCommon } = useTranslation('common');
const [revokeRefreshToken] = useMutation(REVOKE_REFRESH_TOKEN);
const { getItem } = useLocalStorage();
const superAdmin = getItem('SuperAdmin');
Expand Down Expand Up @@ -90,14 +92,14 @@ const profileDropdown = (): JSX.Element => {
}
aria-label="View Profile"
>
View Profile
{tCommon('viewProfile')}
</Dropdown.Item>
<Dropdown.Item
style={{ color: 'red' }}
onClick={logout}
data-testid="logoutBtn"
>
Logout
{tCommon('logout')}
</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
Expand Down
56 changes: 25 additions & 31 deletions src/components/UsersTableItem/UsersTableItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,13 @@ const UsersTableItem = (props: Props): JSX.Element => {
<Table className={styles.modalTable} responsive>
<thead>
<tr>
<th>Name</th>
<th>Address</th>
<th>Created on</th>
<th>Created By</th>
<th>Users Role</th>
<th>Change Role</th>
<th>Action</th>
<th>{tCommon('name')}</th>
<th>{tCommon('address')}</th>
<th>{tCommon('createdOn')}</th>
<th>{tCommon('createdBy')}</th>
<th>{tCommon('usersRole')}</th>
<th>{tCommon('changeRole')}</th>
<th>{tCommon('action')}</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -345,7 +345,7 @@ const UsersTableItem = (props: Props): JSX.Element => {
setShowRemoveUserModal(true);
}}
>
Remove User
{tCommon('removeUser')}
</Button>
</td>
</tr>
Expand All @@ -362,7 +362,7 @@ const UsersTableItem = (props: Props): JSX.Element => {
onClick={() => setShowJoinedOrganizations(false)}
data-testid={`closeJoinedOrgsBtn${user.user._id}`}
>
Close
{tCommon('close')}
</Button>
</Modal.Footer>
</Modal>
Expand Down Expand Up @@ -419,13 +419,13 @@ const UsersTableItem = (props: Props): JSX.Element => {
<Table className={styles.modalTable} responsive>
<thead>
<tr>
<th>Name</th>
<th>Address</th>
<th>Created on</th>
<th>Created By</th>
<th>Users Role</th>
<th>Change Role</th>
<th>Action</th>
<th>{tCommon('name')}</th>
<th>{tCommon('address')}</th>
<th>{tCommon('createdOn')}</th>
<th>{tCommon('createdBy')}</th>
<th>{tCommon('usersRole')}</th>
<th>{tCommon('changeRole')}</th>
<th>{tCommon('action')}</th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -528,7 +528,7 @@ const UsersTableItem = (props: Props): JSX.Element => {
setShowRemoveUserModal(true);
}}
>
Remove User
{tCommon('removeUser')}
</Button>
</td>
</tr>
Expand All @@ -545,7 +545,7 @@ const UsersTableItem = (props: Props): JSX.Element => {
onClick={() => setShowBlockedOrganizations(false)}
data-testid={`closeBlockedByOrgsBtn${user.user._id}`}
>
Close
{tCommon('close')}
</Button>
</Modal.Footer>
</Modal>
Expand All @@ -557,21 +557,15 @@ const UsersTableItem = (props: Props): JSX.Element => {
>
<Modal.Header className="bg-danger" closeButton>
<Modal.Title className="text-white">
Remove User from {removeUserProps.orgName}
{t('removeUserFrom', { org: removeUserProps.orgName })}
</Modal.Title>
</Modal.Header>
<Modal.Body>
<p>
Are you sure you want to remove{' '}
<strong>
&ldquo;{user.user.firstName} {user.user.lastName}&rdquo;
</strong>{' '}
from organization{' '}
<strong>
&ldquo;
{removeUserProps.orgName}&rdquo;
</strong>{' '}
?
{t('removeConfirmation', {
name: `${user.user.firstName} ${user.user.lastName}`,
org: removeUserProps.orgName,
})}
</p>
</Modal.Body>
<Modal.Footer>
Expand All @@ -580,14 +574,14 @@ const UsersTableItem = (props: Props): JSX.Element => {
onClick={() => onHideRemoveUserModal()}
data-testid={`closeRemoveUserModal${user.user._id}`}
>
Close
{tCommon('close')}
</Button>
<Button
variant="danger"
onClick={() => confirmRemoveUser()}
data-testid={`confirmRemoveUser${user.user._id}`}
>
Remove
{tCommon('remove')}
</Button>
</Modal.Footer>
</Modal>
Expand Down
15 changes: 8 additions & 7 deletions src/screens/CommunityProfile/CommunityProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const CommunityProfile = (): JSX.Element => {
const { t } = useTranslation('translation', {
keyPrefix: 'communityProfile',
});
const { t: tCommon } = useTranslation('common');

document.title = t('title');

Expand Down Expand Up @@ -82,7 +83,7 @@ const CommunityProfile = (): JSX.Element => {
});
}, [data]);

const handleOnChange = (e: any): void => {
const handleOnChange = (e: React.ChangeEvent<HTMLInputElement>): void => {
setProfileVariable({
...profileVariable,
[e.target.name]: e.target.value,
Expand Down Expand Up @@ -114,9 +115,9 @@ const CommunityProfile = (): JSX.Element => {
},
});
toast.success(t('profileChangedMsg'));
} catch (error: any) {
} catch (error: unknown) {
/* istanbul ignore next */
errorHandler(t, error);
errorHandler(t, error as Error);
}
};

Expand Down Expand Up @@ -144,9 +145,9 @@ const CommunityProfile = (): JSX.Element => {
},
});
toast.success(t(`resetData`));
} catch (error: any) {
} catch (error: unknown) {
/* istanbul ignore next */
errorHandler(t, error);
errorHandler(t, error as Error);
}
};

Expand Down Expand Up @@ -358,14 +359,14 @@ const CommunityProfile = (): JSX.Element => {
data-testid="resetChangesBtn"
disabled={isDisabled()}
>
Reset Changes
{tCommon('resetChanges')}
</Button>
<Button
type="submit"
data-testid="saveChangesBtn"
disabled={isDisabled()}
>
Save Changes
{tCommon('saveChanges')}
</Button>
</div>
</Form>
Expand Down
Loading