Migrate react-i18next translate components

This commit is contained in:
Florian Scholdei
2019-10-23 15:47:08 +02:00
parent e4668ae304
commit db075974db
121 changed files with 498 additions and 740 deletions

View File

@@ -1,4 +1,10 @@
import React from "react";
import { connect } from "react-redux";
import { compose } from "redux";
import { withRouter } from "react-router-dom";
import { WithTranslation, withTranslation } from "react-i18next";
import { Branch, Repository } from "@scm-manager/ui-types";
import { CreateButton, ErrorNotification, Loading, Notification, Subtitle } from "@scm-manager/ui-components";
import {
fetchBranches,
getBranches,
@@ -7,15 +13,9 @@ import {
isPermittedToCreateBranches
} from "../modules/branches";
import { orderBranches } from "../util/orderBranches";
import { connect } from "react-redux";
import { Branch, Repository } from "@scm-manager/ui-types";
import { compose } from "redux";
import { translate } from "react-i18next";
import { withRouter } from "react-router-dom";
import { CreateButton, ErrorNotification, Loading, Notification, Subtitle } from "@scm-manager/ui-components";
import BranchTable from "../components/BranchTable";
type Props = {
type Props = WithTranslation & {
repository: Repository;
baseUrl: string;
loading: boolean;
@@ -29,7 +29,6 @@ type Props = {
// Context props
history: any;
match: any;
t: (p: string) => string;
};
class BranchesOverview extends React.Component<Props> {
@@ -101,7 +100,7 @@ const mapDispatchToProps = dispatch => {
};
export default compose(
translate("repos"),
withTranslation("repos"),
withRouter,
connect(
mapStateToProps,

View File

@@ -1,8 +1,12 @@
import React from "react";
import { ErrorNotification, Loading, Subtitle } from "@scm-manager/ui-components";
import { translate } from "react-i18next";
import BranchForm from "../components/BranchForm";
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";
import { WithTranslation, withTranslation } from "react-i18next";
import queryString from "query-string";
import { History } from "history";
import { Repository, Branch, BranchRequest } from "@scm-manager/ui-types";
import { ErrorNotification, Loading, Subtitle } from "@scm-manager/ui-components";
import BranchForm from "../components/BranchForm";
import {
fetchBranches,
getBranches,
@@ -14,12 +18,8 @@ import {
isFetchBranchesPending,
getFetchBranchesFailure
} from "../modules/branches";
import { History } from "history";
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";
import queryString from "query-string";
type Props = {
type Props = WithTranslation & {
loading?: boolean;
error?: Error;
repository: Repository;
@@ -38,7 +38,6 @@ type Props = {
resetForm: (p: Repository) => void;
// context objects
t: (p: string) => string;
history: History;
location: any;
};
@@ -131,5 +130,5 @@ export default withRouter(
connect(
mapStateToProps,
mapDispatchToProps
)(translate("repos")(CreateBranch))
)(withTranslation("repos")(CreateBranch))
);