mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 08:55:44 +01:00
Migrate react-i18next translate components
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import React from "react";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { User } from "@scm-manager/ui-types";
|
||||
import { SubmitButton, Notification, ErrorNotification, PasswordConfirmation } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
import { setPassword } from "./setPassword";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
user: User;
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
type State = {
|
||||
@@ -128,4 +127,4 @@ class SetUserPassword extends React.Component<Props, State> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("users")(SetUserPassword);
|
||||
export default withTranslation("users")(SetUserPassword);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { User } from "@scm-manager/ui-types";
|
||||
import {
|
||||
Subtitle,
|
||||
@@ -11,11 +11,10 @@ import {
|
||||
} from "@scm-manager/ui-components";
|
||||
import * as userValidator from "./userValidation";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
submitForm: (p: User) => void;
|
||||
user?: User;
|
||||
loading?: boolean;
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
type State = {
|
||||
@@ -58,10 +57,7 @@ class UserForm extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
isFalsy(value) {
|
||||
if (!value) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return !value;
|
||||
}
|
||||
|
||||
createUserComponentsAreInvalid = () => {
|
||||
@@ -230,4 +226,4 @@ class UserForm extends React.Component<Props, State> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("users")(UserForm);
|
||||
export default withTranslation("users")(UserForm);
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import React from "react";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { User } from "@scm-manager/ui-types";
|
||||
import { NavLink } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
user: User;
|
||||
editUrl: string;
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
class EditUserNavLink extends React.Component<Props> {
|
||||
@@ -24,4 +23,4 @@ class EditUserNavLink extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("users")(EditUserNavLink);
|
||||
export default withTranslation("users")(EditUserNavLink);
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { User } from "@scm-manager/ui-types";
|
||||
import { NavLink } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
t: (p: string) => string;
|
||||
type Props = WithTranslation & {
|
||||
user: User;
|
||||
passwordUrl: string;
|
||||
};
|
||||
@@ -24,4 +23,4 @@ class ChangePasswordNavLink extends React.Component<Props> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("users")(ChangePasswordNavLink);
|
||||
export default withTranslation("users")(ChangePasswordNavLink);
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { User } from "@scm-manager/ui-types";
|
||||
import { NavLink } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
t: (p: string) => string;
|
||||
type Props = WithTranslation & {
|
||||
user: User;
|
||||
permissionsUrl: string;
|
||||
};
|
||||
@@ -24,4 +23,4 @@ class ChangePermissionNavLink extends React.Component<Props> {
|
||||
};
|
||||
}
|
||||
|
||||
export default translate("users")(ChangePermissionNavLink);
|
||||
export default withTranslation("users")(ChangePermissionNavLink);
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import React from "react";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { User } from "@scm-manager/ui-types";
|
||||
import { translate } from "react-i18next";
|
||||
import { Checkbox, MailLink, DateFromNow } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
user: User;
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
class Details extends React.Component<Props> {
|
||||
@@ -56,4 +55,4 @@ class Details extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("users")(Details);
|
||||
export default withTranslation("users")(Details);
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
import { User } from "@scm-manager/ui-types";
|
||||
import { Icon } from "@scm-manager/ui-components";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
user: User;
|
||||
|
||||
// context props
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
class UserRow extends React.Component<Props> {
|
||||
@@ -39,4 +36,4 @@ class UserRow extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("users")(UserRow);
|
||||
export default withTranslation("users")(UserRow);
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import UserRow from "./UserRow";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { User } from "@scm-manager/ui-types";
|
||||
import UserRow from "./UserRow";
|
||||
|
||||
type Props = {
|
||||
t: (p: string) => string;
|
||||
type Props = WithTranslation & {
|
||||
users: User[];
|
||||
};
|
||||
|
||||
@@ -30,4 +29,4 @@ class UserTable extends React.Component<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
export default translate("users")(UserTable);
|
||||
export default withTranslation("users")(UserTable);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import UserForm from "../components/UserForm";
|
||||
import { User } from "@scm-manager/ui-types";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { History } from "history";
|
||||
import { createUser, createUserReset, isCreateUserPending, getCreateUserFailure } from "../modules/users";
|
||||
import { User } from "@scm-manager/ui-types";
|
||||
import { Page } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
import { getUsersLink } from "../../modules/indexResource";
|
||||
import { createUser, createUserReset, isCreateUserPending, getCreateUserFailure } from "../modules/users";
|
||||
import UserForm from "../components/UserForm";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
loading?: boolean;
|
||||
error?: Error;
|
||||
usersLink: string;
|
||||
@@ -18,7 +18,6 @@ type Props = {
|
||||
resetForm: () => void;
|
||||
|
||||
// context objects
|
||||
t: (p: string) => string;
|
||||
history: History;
|
||||
};
|
||||
|
||||
@@ -72,4 +71,4 @@ const mapStateToProps = (state, ownProps) => {
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(translate("users")(CreateUser));
|
||||
)(withTranslation("users")(CreateUser));
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { History } from "history";
|
||||
import { User } from "@scm-manager/ui-types";
|
||||
import { Subtitle, DeleteButton, confirmAlert, ErrorNotification } from "@scm-manager/ui-components";
|
||||
import { deleteUser, getDeleteUserFailure, isDeleteUserPending } from "../modules/users";
|
||||
import { connect } from "react-redux";
|
||||
import { withRouter } from "react-router-dom";
|
||||
import { History } from "history";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
loading: boolean;
|
||||
error: Error;
|
||||
user: User;
|
||||
@@ -16,7 +16,6 @@ type Props = {
|
||||
|
||||
// context props
|
||||
history: History;
|
||||
t: (p: string) => string;
|
||||
};
|
||||
|
||||
class DeleteUser extends React.Component<Props> {
|
||||
@@ -96,4 +95,4 @@ const mapDispatchToProps = dispatch => {
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withRouter(translate("users")(DeleteUser)));
|
||||
)(withRouter(withTranslation("users")(DeleteUser)));
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { Page, Loading, Navigation, SubNavigation, Section, NavLink, ErrorPage } from "@scm-manager/ui-components";
|
||||
import { Route } from "react-router-dom";
|
||||
import { History } from "history";
|
||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
import { User } from "@scm-manager/ui-types";
|
||||
import { Page, Loading, Navigation, SubNavigation, Section, NavLink, ErrorPage } from "@scm-manager/ui-components";
|
||||
import { Details } from "./../components/table";
|
||||
import EditUser from "./EditUser";
|
||||
import { User } from "@scm-manager/ui-types";
|
||||
import { History } from "history";
|
||||
import { fetchUserByName, getUserByName, isFetchUserPending, getFetchUserFailure } from "../modules/users";
|
||||
import { EditUserNavLink, SetPasswordNavLink, SetPermissionsNavLink } from "./../components/navLinks";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { getUsersLink } from "../../modules/indexResource";
|
||||
import SetUserPassword from "../components/SetUserPassword";
|
||||
import SetPermissions from "../../permissions/components/SetPermissions";
|
||||
import { ExtensionPoint } from "@scm-manager/ui-extensions";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
name: string;
|
||||
user: User;
|
||||
loading: boolean;
|
||||
@@ -25,7 +25,6 @@ type Props = {
|
||||
fetchUserByName: (p1: string, p2: string) => void;
|
||||
|
||||
// context objects
|
||||
t: (p: string) => string;
|
||||
match: any;
|
||||
history: History;
|
||||
};
|
||||
@@ -122,4 +121,4 @@ const mapDispatchToProps = dispatch => {
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(translate("users")(SingleUser));
|
||||
)(withTranslation("users")(SingleUser));
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { translate } from "react-i18next";
|
||||
import { WithTranslation, withTranslation } from "react-i18next";
|
||||
import { History } from "history";
|
||||
import { User, PagedCollection } from "@scm-manager/ui-types";
|
||||
import {
|
||||
fetchUsersByPage,
|
||||
getUsersFromState,
|
||||
selectListAsCollection,
|
||||
isPermittedToCreateUsers,
|
||||
isFetchUsersPending,
|
||||
getFetchUsersFailure
|
||||
} from "../modules/users";
|
||||
import {
|
||||
Page,
|
||||
PageActions,
|
||||
@@ -20,10 +12,18 @@ import {
|
||||
urls,
|
||||
CreateButton
|
||||
} from "@scm-manager/ui-components";
|
||||
import { UserTable } from "./../components/table";
|
||||
import { getUsersLink } from "../../modules/indexResource";
|
||||
import {
|
||||
fetchUsersByPage,
|
||||
getUsersFromState,
|
||||
selectListAsCollection,
|
||||
isPermittedToCreateUsers,
|
||||
isFetchUsersPending,
|
||||
getFetchUsersFailure
|
||||
} from "../modules/users";
|
||||
import { UserTable } from "./../components/table";
|
||||
|
||||
type Props = {
|
||||
type Props = WithTranslation & {
|
||||
users: User[];
|
||||
loading: boolean;
|
||||
error: Error;
|
||||
@@ -33,7 +33,6 @@ type Props = {
|
||||
usersLink: string;
|
||||
|
||||
// context objects
|
||||
t: (p: string) => string;
|
||||
history: History;
|
||||
location: any;
|
||||
|
||||
@@ -124,4 +123,4 @@ const mapDispatchToProps = dispatch => {
|
||||
export default connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(translate("users")(Users));
|
||||
)(withTranslation("users")(Users));
|
||||
|
||||
Reference in New Issue
Block a user