Web: Client: Data Import: replace translation injection with translation hook

This commit is contained in:
Vladimir Khvan 2024-06-21 14:29:21 +05:00
parent 99a53fc435
commit 3bd39de506

View File

@ -25,7 +25,7 @@
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
import { inject, observer } from "mobx-react"; import { inject, observer } from "mobx-react";
import { withTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Consumer } from "@docspace/shared/utils/context"; import { Consumer } from "@docspace/shared/utils/context";
import TableView from "./TableView"; import TableView from "./TableView";
@ -39,7 +39,6 @@ const checkedAccountType = "result";
const AccountsTable = (props: AccountsTableProps) => { const AccountsTable = (props: AccountsTableProps) => {
const { const {
t,
accountsData, accountsData,
viewAs, viewAs,
changeGroupType, changeGroupType,
@ -47,6 +46,8 @@ const AccountsTable = (props: AccountsTableProps) => {
toggleAllAccounts, toggleAllAccounts,
} = props as InjectedTypeSelectTableProps; } = props as InjectedTypeSelectTableProps;
const { t, ready } = useTranslation(["ChangeUserTypeDialog", "People"]);
const setTypeDocspaceAdmin = () => { const setTypeDocspaceAdmin = () => {
changeGroupType(UserTypes.DocSpaceAdmin); changeGroupType(UserTypes.DocSpaceAdmin);
toggleAllAccounts(false, [], checkedAccountType); toggleAllAccounts(false, [], checkedAccountType);
@ -78,6 +79,8 @@ const AccountsTable = (props: AccountsTableProps) => {
}, },
]; ];
if (!ready) return;
return ( return (
<Consumer> <Consumer>
{(context) => {(context) =>
@ -110,6 +113,4 @@ export default inject<TStore>(({ setup, importAccountsStore }) => {
UserTypes, UserTypes,
toggleAllAccounts, toggleAllAccounts,
}; };
})( })(observer(AccountsTable));
withTranslation(["ChangeUserTypeDialog", "People"])(observer(AccountsTable)),
);