merge with branch feature/update_react_i18next

This commit is contained in:
Sebastian Sdorra
2019-10-24 14:22:39 +02:00
144 changed files with 578 additions and 862 deletions

View File

@@ -1,13 +1,10 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Repository } from "@scm-manager/ui-types"; import { Repository } from "@scm-manager/ui-types";
type Props = { type Props = WithTranslation & {
url: string; url: string;
repository: Repository; repository: Repository;
// context props
t: (p: string) => string;
}; };
class CloneInformation extends React.Component<Props> { class CloneInformation extends React.Component<Props> {
@@ -54,4 +51,4 @@ class CloneInformation extends React.Component<Props> {
} }
} }
export default translate("plugins")(CloneInformation); export default withTranslation("plugins")(CloneInformation);

View File

@@ -1,10 +1,9 @@
import React from "react"; import React from "react";
import { WithTranslation, withTranslation } from "react-i18next";
import { Branch } from "@scm-manager/ui-types"; import { Branch } from "@scm-manager/ui-types";
import { translate } from "react-i18next";
type Props = { type Props = WithTranslation & {
branch: Branch; branch: Branch;
t: (p: string) => string;
}; };
class GitBranchInformation extends React.Component<Props> { class GitBranchInformation extends React.Component<Props> {
@@ -26,4 +25,4 @@ class GitBranchInformation extends React.Component<Props> {
} }
} }
export default translate("plugins")(GitBranchInformation); export default withTranslation("plugins")(GitBranchInformation);

View File

@@ -1,7 +1,6 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Links } from "@scm-manager/ui-types"; import { Links } from "@scm-manager/ui-types";
import { InputField, Checkbox } from "@scm-manager/ui-components"; import { InputField, Checkbox } from "@scm-manager/ui-components";
type Configuration = { type Configuration = {
@@ -11,14 +10,11 @@ type Configuration = {
_links: Links; _links: Links;
}; };
type Props = { type Props = WithTranslation & {
initialConfiguration: Configuration; initialConfiguration: Configuration;
readOnly: boolean; readOnly: boolean;
onConfigurationChange: (p1: Configuration, p2: boolean) => void; onConfigurationChange: (p1: Configuration, p2: boolean) => void;
// context props
t: (p: string) => string;
}; };
type State = Configuration & {}; type State = Configuration & {};
@@ -76,4 +72,4 @@ class GitConfigurationForm extends React.Component<Props, State> {
} }
} }
export default translate("plugins")(GitConfigurationForm); export default withTranslation("plugins")(GitConfigurationForm);

View File

@@ -1,12 +1,10 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Title, Configuration } from "@scm-manager/ui-components"; import { Title, Configuration } from "@scm-manager/ui-components";
import GitConfigurationForm from "./GitConfigurationForm"; import GitConfigurationForm from "./GitConfigurationForm";
type Props = { type Props = WithTranslation & {
link: string; link: string;
t: (p: string) => string;
}; };
class GitGlobalConfiguration extends React.Component<Props> { class GitGlobalConfiguration extends React.Component<Props> {
@@ -22,4 +20,4 @@ class GitGlobalConfiguration extends React.Component<Props> {
} }
} }
export default translate("plugins")(GitGlobalConfiguration); export default withTranslation("plugins")(GitGlobalConfiguration);

View File

@@ -1,12 +1,11 @@
import React from "react"; import React from "react";
import { WithTranslation, withTranslation } from "react-i18next";
import { Repository } from "@scm-manager/ui-types"; import { Repository } from "@scm-manager/ui-types";
import { translate } from "react-i18next";
type Props = { type Props = WithTranslation & {
repository: Repository; repository: Repository;
target: string; target: string;
source: string; source: string;
t: (p: string) => string;
}; };
class GitMergeInformation extends React.Component<Props> { class GitMergeInformation extends React.Component<Props> {
@@ -47,4 +46,4 @@ class GitMergeInformation extends React.Component<Props> {
} }
} }
export default translate("plugins")(GitMergeInformation); export default withTranslation("plugins")(GitMergeInformation);

View File

@@ -1,12 +1,10 @@
import React, { FormEvent } from "react"; import React, { FormEvent } from "react";
import { WithTranslation, withTranslation } from "react-i18next";
import { apiClient, BranchSelector, ErrorPage, Loading, Subtitle, SubmitButton } from "@scm-manager/ui-components";
import { Branch, Repository, Link } from "@scm-manager/ui-types"; import { Branch, Repository, Link } from "@scm-manager/ui-types";
import { translate } from "react-i18next"; import { apiClient, BranchSelector, ErrorPage, Loading, Subtitle, SubmitButton } from "@scm-manager/ui-components";
type Props = { type Props = WithTranslation & {
repository: Repository; repository: Repository;
t: (p: string) => string;
}; };
type State = { type State = {
@@ -196,4 +194,4 @@ class RepositoryConfig extends React.Component<Props, State> {
}; };
} }
export default translate("plugins")(RepositoryConfig); export default withTranslation("plugins")(RepositoryConfig);

View File

@@ -1,10 +1,9 @@
import React from "react"; import React from "react";
import { WithTranslation, withTranslation } from "react-i18next";
import { Branch } from "@scm-manager/ui-types"; import { Branch } from "@scm-manager/ui-types";
import { translate } from "react-i18next";
type Props = { type Props = WithTranslation & {
branch: Branch; branch: Branch;
t: (p: string) => string;
}; };
class HgBranchInformation extends React.Component<Props> { class HgBranchInformation extends React.Component<Props> {
@@ -26,4 +25,4 @@ class HgBranchInformation extends React.Component<Props> {
} }
} }
export default translate("plugins")(HgBranchInformation); export default withTranslation("plugins")(HgBranchInformation);

View File

@@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import { WithTranslation, withTranslation } from "react-i18next";
import { Links } from "@scm-manager/ui-types"; import { Links } from "@scm-manager/ui-types";
import { translate } from "react-i18next";
import { InputField, Checkbox } from "@scm-manager/ui-components"; import { InputField, Checkbox } from "@scm-manager/ui-components";
type Configuration = { type Configuration = {
@@ -15,14 +15,11 @@ type Configuration = {
_links: Links; _links: Links;
}; };
type Props = { type Props = WithTranslation & {
initialConfiguration: Configuration; initialConfiguration: Configuration;
readOnly: boolean; readOnly: boolean;
onConfigurationChange: (p1: Configuration, p2: boolean) => void; onConfigurationChange: (p1: Configuration, p2: boolean) => void;
// context props
t: (p: string) => string;
}; };
type State = Configuration & { type State = Configuration & {
@@ -127,4 +124,4 @@ class HgConfigurationForm extends React.Component<Props, State> {
} }
} }
export default translate("plugins")(HgConfigurationForm); export default withTranslation("plugins")(HgConfigurationForm);

View File

@@ -1,13 +1,10 @@
import React from "react"; import React from "react";
import { WithTranslation, withTranslation } from "react-i18next";
import { Title, Configuration } from "@scm-manager/ui-components"; import { Title, Configuration } from "@scm-manager/ui-components";
import { translate } from "react-i18next";
import HgConfigurationForm from "./HgConfigurationForm"; import HgConfigurationForm from "./HgConfigurationForm";
type Props = { type Props = WithTranslation & {
link: string; link: string;
// context props
t: (p: string) => string;
}; };
class HgGlobalConfiguration extends React.Component<Props> { class HgGlobalConfiguration extends React.Component<Props> {
@@ -22,4 +19,4 @@ class HgGlobalConfiguration extends React.Component<Props> {
} }
} }
export default translate("plugins")(HgGlobalConfiguration); export default withTranslation("plugins")(HgGlobalConfiguration);

View File

@@ -1,11 +1,10 @@
import React from "react"; import React from "react";
import { repositories } from "@scm-manager/ui-components"; import { WithTranslation, withTranslation } from "react-i18next";
import { Repository } from "@scm-manager/ui-types"; import { Repository } from "@scm-manager/ui-types";
import { translate } from "react-i18next"; import { repositories } from "@scm-manager/ui-components";
type Props = { type Props = WithTranslation & {
repository: Repository; repository: Repository;
t: (p: string) => string;
}; };
class ProtocolInformation extends React.Component<Props> { class ProtocolInformation extends React.Component<Props> {
@@ -62,4 +61,4 @@ class ProtocolInformation extends React.Component<Props> {
} }
} }
export default translate("plugins")(ProtocolInformation); export default withTranslation("plugins")(ProtocolInformation);

View File

@@ -1,11 +1,10 @@
import React from "react"; import React from "react";
import { repositories } from "@scm-manager/ui-components"; import { withTranslation, WithTranslation } from "react-i18next";
import { Repository } from "@scm-manager/ui-types"; import { Repository } from "@scm-manager/ui-types";
import { translate } from "react-i18next"; import { repositories } from "@scm-manager/ui-components";
type Props = { type Props = WithTranslation & {
repository: Repository; repository: Repository;
t: (p: string) => string;
}; };
class ProtocolInformation extends React.Component<Props> { class ProtocolInformation extends React.Component<Props> {
@@ -26,4 +25,4 @@ class ProtocolInformation extends React.Component<Props> {
} }
} }
export default translate("plugins")(ProtocolInformation); export default withTranslation("plugins")(ProtocolInformation);

View File

@@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import { withTranslation, WithTranslation } from "react-i18next";
import { Links } from "@scm-manager/ui-types"; import { Links } from "@scm-manager/ui-types";
import { translate } from "react-i18next";
import { Checkbox, Select } from "@scm-manager/ui-components"; import { Checkbox, Select } from "@scm-manager/ui-components";
type Configuration = { type Configuration = {
@@ -9,14 +9,11 @@ type Configuration = {
_links: Links; _links: Links;
}; };
type Props = { type Props = WithTranslation & {
initialConfiguration: Configuration; initialConfiguration: Configuration;
readOnly: boolean; readOnly: boolean;
onConfigurationChange: (p1: Configuration, p2: boolean) => void; onConfigurationChange: (p1: Configuration, p2: boolean) => void;
// context props
t: (p: string) => string;
}; };
type State = Configuration; type State = Configuration;
@@ -84,4 +81,4 @@ class SvnConfigurationForm extends React.Component<Props, State> {
} }
} }
export default translate("plugins")(SvnConfigurationForm); export default withTranslation("plugins")(SvnConfigurationForm);

View File

@@ -1,13 +1,10 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Title, Configuration } from "@scm-manager/ui-components"; import { Title, Configuration } from "@scm-manager/ui-components";
import SvnConfigurationForm from "./SvnConfigurationForm"; import SvnConfigurationForm from "./SvnConfigurationForm";
type Props = { type Props = WithTranslation & {
link: string; link: string;
// context props
t: (p: string) => string;
}; };
class SvnGlobalConfiguration extends React.Component<Props> { class SvnGlobalConfiguration extends React.Component<Props> {
@@ -22,4 +19,4 @@ class SvnGlobalConfiguration extends React.Component<Props> {
} }
} }
export default translate("plugins")(SvnGlobalConfiguration); export default withTranslation("plugins")(SvnGlobalConfiguration);

View File

@@ -1,16 +1,19 @@
import i18n from "i18next"; import i18n from "i18next";
import { reactI18nextModule } from "react-i18next"; import { initReactI18next } from "react-i18next";
import { addDecorator, configure } from "@storybook/react"; import { addDecorator, configure } from "@storybook/react";
import { withI18next } from "storybook-addon-i18next"; import { withI18next } from "storybook-addon-i18next";
import "!style-loader!css-loader!sass-loader!../../ui-styles/src/scm.scss"; import "!style-loader!css-loader!sass-loader!../../ui-styles/src/scm.scss";
i18n.use(reactI18nextModule).init({ i18n.use(initReactI18next).init({
whitelist: ["en", "de", "es"], whitelist: ["en", "de", "es"],
lng: "en", lng: "en",
fallbackLng: "en", fallbackLng: "en",
interpolation: { interpolation: {
escapeValue: false escapeValue: false
},
react: {
useSuspense: false
} }
}); });

View File

@@ -29,7 +29,6 @@
"@types/query-string": "5", "@types/query-string": "5",
"@types/react": "^16.9.9", "@types/react": "^16.9.9",
"@types/react-dom": "^16.9.2", "@types/react-dom": "^16.9.2",
"@types/react-i18next": "^7.8.3",
"@types/react-router-dom": "^5.1.0", "@types/react-router-dom": "^5.1.0",
"@types/react-select": "^2.0.19", "@types/react-select": "^2.0.19",
"@types/react-syntax-highlighter": "^11.0.1", "@types/react-syntax-highlighter": "^11.0.1",
@@ -54,7 +53,7 @@
"react": "^16.8.6", "react": "^16.8.6",
"react-diff-view": "^1.8.1", "react-diff-view": "^1.8.1",
"react-dom": "^16.8.6", "react-dom": "^16.8.6",
"react-i18next": "^7.9.0", "react-i18next": "^10.13.1",
"react-markdown": "^4.0.6", "react-markdown": "^4.0.6",
"react-router-dom": "^5.1.2", "react-router-dom": "^5.1.2",
"react-select": "^2.1.2", "react-select": "^2.1.2",

View File

@@ -2,11 +2,10 @@ import React from "react";
import { BackendError } from "./errors"; import { BackendError } from "./errors";
import Notification from "./Notification"; import Notification from "./Notification";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
type Props = { type Props = WithTranslation & {
error: BackendError; error: BackendError;
t: (p: string) => string;
}; };
class BackendErrorNotification extends React.Component<Props> { class BackendErrorNotification extends React.Component<Props> {
@@ -122,4 +121,4 @@ class BackendErrorNotification extends React.Component<Props> {
}; };
} }
export default translate("plugins")(BackendErrorNotification); export default withTranslation("plugins")(BackendErrorNotification);

View File

@@ -1,13 +1,13 @@
import React from "react"; import React from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import classNames from "classnames"; import classNames from "classnames";
import styled from "styled-components"; import styled from "styled-components";
import { binder, ExtensionPoint } from "@scm-manager/ui-extensions"; import { binder, ExtensionPoint } from "@scm-manager/ui-extensions";
import { Branch, Repository } from "@scm-manager/ui-types"; import { Branch, Repository } from "@scm-manager/ui-types";
import Icon from "./Icon"; import Icon from "./Icon";
type Props = { type Props = WithTranslation & {
repository: Repository; repository: Repository;
branch: Branch; branch: Branch;
defaultBranch: Branch; defaultBranch: Branch;
@@ -15,9 +15,6 @@ type Props = {
revision: string; revision: string;
path: string; path: string;
baseUrl: string; baseUrl: string;
// Context props
t: (p: string) => string;
}; };
const FlexStartNav = styled.nav` const FlexStartNav = styled.nav`
@@ -99,4 +96,4 @@ class Breadcrumb extends React.Component<Props> {
} }
} }
export default translate("commons")(Breadcrumb); export default withTranslation("commons")(Breadcrumb);

View File

@@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import { translate, InjectedI18nProps } from "react-i18next"; import { withTranslation, WithTranslation } from "react-i18next";
import { formatDistance, format, parseISO, Locale } from "date-fns"; import { formatDistance, format, parseISO, Locale } from "date-fns";
import { enUS, de, es } from "date-fns/locale"; import { enUS, de, es } from "date-fns/locale";
import styled from "styled-components"; import styled from "styled-components";
@@ -16,7 +16,7 @@ const supportedLocales: LocaleMap = {
es es
}; };
type Props = InjectedI18nProps & { type Props = WithTranslation & {
date?: DateInput; date?: DateInput;
timeZone?: string; timeZone?: string;
@@ -90,4 +90,4 @@ class DateFromNow extends React.Component<Props> {
} }
} }
export default translate()(DateFromNow); export default withTranslation()(DateFromNow);

View File

@@ -1,11 +1,10 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { BackendError, ForbiddenError, UnauthorizedError } from "./errors"; import { BackendError, ForbiddenError, UnauthorizedError } from "./errors";
import Notification from "./Notification"; import Notification from "./Notification";
import BackendErrorNotification from "./BackendErrorNotification"; import BackendErrorNotification from "./BackendErrorNotification";
type Props = { type Props = WithTranslation & {
t: (p: string) => string;
error?: Error; error?: Error;
}; };
@@ -40,4 +39,4 @@ class ErrorNotification extends React.Component<Props> {
} }
} }
export default translate("commons")(ErrorNotification); export default withTranslation("commons")(ErrorNotification);

View File

@@ -1,14 +1,9 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import AutocompleteProps from "./UserGroupAutocomplete"; import AutocompleteProps from "./UserGroupAutocomplete";
import UserGroupAutocomplete from "./UserGroupAutocomplete"; import UserGroupAutocomplete from "./UserGroupAutocomplete";
type Props = AutocompleteProps & { class GroupAutocomplete extends React.Component<AutocompleteProps & WithTranslation> {
// Context props
t: (p: string) => string;
};
class GroupAutocomplete extends React.Component<Props> {
render() { render() {
const { t } = this.props; const { t } = this.props;
return ( return (
@@ -23,4 +18,4 @@ class GroupAutocomplete extends React.Component<Props> {
} }
} }
export default translate("commons")(GroupAutocomplete); export default withTranslation("commons")(GroupAutocomplete);

View File

@@ -1,15 +1,12 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { PagedCollection } from "@scm-manager/ui-types"; import { PagedCollection } from "@scm-manager/ui-types";
import { Button } from "./buttons"; import { Button } from "./buttons";
type Props = { type Props = WithTranslation & {
collection: PagedCollection; collection: PagedCollection;
page: number; page: number;
filter?: string; filter?: string;
// context props
t: (p: string) => string;
}; };
class LinkPaginator extends React.Component<Props> { class LinkPaginator extends React.Component<Props> {
@@ -123,4 +120,4 @@ class LinkPaginator extends React.Component<Props> {
return null; return null;
} }
} }
export default translate("commons")(LinkPaginator); export default withTranslation("commons")(LinkPaginator);

View File

@@ -1,10 +1,9 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import Image from "./Image"; import Image from "./Image";
type Props = { type Props = WithTranslation & {
t: (p: string) => string;
message?: string; message?: string;
}; };
@@ -33,4 +32,4 @@ class Loading extends React.Component<Props> {
} }
} }
export default translate("commons")(Loading); export default withTranslation("commons")(Loading);

View File

@@ -1,16 +1,12 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import Image from "./Image"; import Image from "./Image";
type Props = { class Logo extends React.Component<WithTranslation> {
t: (p: string) => string;
};
class Logo extends React.Component<Props> {
render() { render() {
const { t } = this.props; const { t } = this.props;
return <Image src="/images/logo.png" alt={t("logo.alt")} />; return <Image src="/images/logo.png" alt={t("logo.alt")} />;
} }
} }
export default translate("commons")(Logo); export default withTranslation("commons")(Logo);

View File

@@ -1,12 +1,11 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { PagedCollection, Link } from "@scm-manager/ui-types"; import { PagedCollection, Link } from "@scm-manager/ui-types";
import { Button } from "./buttons"; import { Button } from "./buttons";
type Props = { type Props = WithTranslation & {
collection: PagedCollection; collection: PagedCollection;
onPageChange?: (p: string) => void; onPageChange?: (p: string) => void;
t: (p: string) => string;
}; };
class Paginator extends React.Component<Props> { class Paginator extends React.Component<Props> {
@@ -108,4 +107,4 @@ class Paginator extends React.Component<Props> {
); );
} }
} }
export default translate("commons")(Paginator); export default withTranslation("commons")(Paginator);

View File

@@ -1,15 +1,12 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { PagedCollection } from "@scm-manager/ui-types"; import { PagedCollection } from "@scm-manager/ui-types";
import { Button } from "./index"; import { Button } from "./index";
type Props = { type Props = WithTranslation & {
collection: PagedCollection; collection: PagedCollection;
page: number; page: number;
updatePage: (p: number) => void; updatePage: (p: number) => void;
// context props
t: (p: string) => string;
}; };
class StatePaginator extends React.Component<Props> { class StatePaginator extends React.Component<Props> {
@@ -123,4 +120,4 @@ class StatePaginator extends React.Component<Props> {
); );
} }
} }
export default translate("commons")(StatePaginator); export default withTranslation("commons")(StatePaginator);

View File

@@ -1,14 +1,9 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import AutocompleteProps from "./UserGroupAutocomplete"; import AutocompleteProps from "./UserGroupAutocomplete";
import UserGroupAutocomplete from "./UserGroupAutocomplete"; import UserGroupAutocomplete from "./UserGroupAutocomplete";
type Props = AutocompleteProps & { class UserAutocomplete extends React.Component<AutocompleteProps & WithTranslation> {
// Context props
t: (p: string) => string;
};
class UserAutocomplete extends React.Component<Props> {
render() { render() {
const { t } = this.props; const { t } = this.props;
return ( return (
@@ -23,4 +18,4 @@ class UserAutocomplete extends React.Component<Props> {
} }
} }
export default translate("commons")(UserAutocomplete); export default withTranslation("commons")(UserAutocomplete);

View File

@@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Links, Link } from "@scm-manager/ui-types"; import { Links, Link } from "@scm-manager/ui-types";
import { apiClient, SubmitButton, Loading, ErrorNotification } from "../"; import { apiClient, SubmitButton, Loading, ErrorNotification } from "../";
import { FormEvent } from "react"; import { FormEvent } from "react";
@@ -10,12 +10,9 @@ type RenderProps = {
onConfigurationChange: (p1: ConfigurationType, p2: boolean) => void; onConfigurationChange: (p1: ConfigurationType, p2: boolean) => void;
}; };
type Props = { type Props = WithTranslation & {
link: string; link: string;
render: (props: RenderProps) => any; // ??? render: (props: RenderProps) => any; // ???
// context props
t: (p: string) => string;
}; };
type ConfigurationType = { type ConfigurationType = {
@@ -190,4 +187,4 @@ class Configuration extends React.Component<Props, State> {
} }
} }
export default translate("config")(Configuration); export default withTranslation("config")(Configuration);

View File

@@ -2,7 +2,7 @@ import React from "react";
import { binder } from "@scm-manager/ui-extensions"; import { binder } from "@scm-manager/ui-extensions";
import { NavLink } from "../navigation"; import { NavLink } from "../navigation";
import { Route } from "react-router-dom"; import { Route } from "react-router-dom";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Repository, Links, Link } from "@scm-manager/ui-types"; import { Repository, Links, Link } from "@scm-manager/ui-types";
type GlobalRouteProps = { type GlobalRouteProps = {
@@ -15,6 +15,8 @@ type RepositoryRouteProps = {
repository: Repository; repository: Repository;
}; };
type RepositoryNavProps = WithTranslation & { url: string };
class ConfigurationBinder { class ConfigurationBinder {
i18nNamespace = "plugins"; i18nNamespace = "plugins";
@@ -34,7 +36,7 @@ class ConfigurationBinder {
}; };
// create NavigationLink with translated label // create NavigationLink with translated label
const ConfigNavLink = translate(this.i18nNamespace)(({ t }) => { const ConfigNavLink = withTranslation(this.i18nNamespace)(({ t }) => {
return this.navLink("/admin/settings" + to, labelI18nKey, t); return this.navLink("/admin/settings" + to, labelI18nKey, t);
}); });
@@ -64,7 +66,7 @@ class ConfigurationBinder {
}; };
// create NavigationLink with translated label // create NavigationLink with translated label
const RepoNavLink = translate(this.i18nNamespace)(({ t, url }) => { const RepoNavLink = withTranslation(this.i18nNamespace)(({ t, url }: RepositoryNavProps) => {
return this.navLink(url + to, labelI18nKey, t); return this.navLink(url + to, labelI18nKey, t);
}); });
@@ -94,7 +96,7 @@ class ConfigurationBinder {
}; };
// create NavigationLink with translated label // create NavigationLink with translated label
const RepoNavLink = translate(this.i18nNamespace)(({ t, url }) => { const RepoNavLink = withTranslation(this.i18nNamespace)(({ t, url }: RepositoryNavProps) => {
return this.navLink(url + "/settings" + to, labelI18nKey, t); return this.navLink(url + "/settings" + to, labelI18nKey, t);
}); });

View File

@@ -1,14 +1,10 @@
import React, { ChangeEvent } from "react"; import React, { ChangeEvent, FormEvent } from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import { FormEvent } from "react";
type Props = { type Props = WithTranslation & {
filter: (p: string) => void; filter: (p: string) => void;
value?: string; value?: string;
// context props
t: (p: string) => string;
}; };
type State = { type State = {
@@ -59,4 +55,4 @@ class FilterInput extends React.Component<Props, State> {
} }
} }
export default translate("commons")(FilterInput); export default withTranslation("commons")(FilterInput);

View File

@@ -1,14 +1,13 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { DisplayedUser } from "@scm-manager/ui-types"; import { DisplayedUser } from "@scm-manager/ui-types";
import TagGroup from "./TagGroup"; import TagGroup from "./TagGroup";
type Props = { type Props = WithTranslation & {
members: string[]; members: string[];
memberListChanged: (p: string[]) => void; memberListChanged: (p: string[]) => void;
label?: string; label?: string;
helpText?: string; helpText?: string;
t: (p: string) => string;
}; };
class MemberNameTagGroup extends React.Component<Props> { class MemberNameTagGroup extends React.Component<Props> {
@@ -39,4 +38,4 @@ class MemberNameTagGroup extends React.Component<Props> {
}; };
} }
export default translate("groups")(MemberNameTagGroup); export default withTranslation("groups")(MemberNameTagGroup);

View File

@@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import InputField from "./InputField"; import InputField from "./InputField";
type State = { type State = {
@@ -8,11 +8,9 @@ type State = {
passwordValid: boolean; passwordValid: boolean;
passwordConfirmationFailed: boolean; passwordConfirmationFailed: boolean;
}; };
type Props = { type Props = WithTranslation & {
passwordChanged: (p1: string, p2: boolean) => void; passwordChanged: (p1: string, p2: boolean) => void;
passwordValidator?: (p: string) => boolean; passwordValidator?: (p: string) => boolean;
// Context props
t: (p: string) => string;
}; };
class PasswordConfirmation extends React.Component<Props, State> { class PasswordConfirmation extends React.Component<Props, State> {
@@ -106,4 +104,4 @@ class PasswordConfirmation extends React.Component<Props, State> {
}; };
} }
export default translate("commons")(PasswordConfirmation); export default withTranslation("commons")(PasswordConfirmation);

View File

@@ -1,11 +1,10 @@
import React, { ReactNode } from "react"; import React, { ReactNode } from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import PrimaryNavigationLink from "./PrimaryNavigationLink"; import PrimaryNavigationLink from "./PrimaryNavigationLink";
import { Links } from "@scm-manager/ui-types"; import { Links } from "@scm-manager/ui-types";
import { binder, ExtensionPoint } from "@scm-manager/ui-extensions"; import { binder, ExtensionPoint } from "@scm-manager/ui-extensions";
type Props = { type Props = WithTranslation & {
t: (p: string) => string;
links: Links; links: Links;
}; };
@@ -88,4 +87,4 @@ class PrimaryNavigation extends React.Component<Props> {
} }
} }
export default translate("commons")(PrimaryNavigation); export default withTranslation("commons")(PrimaryNavigation);

View File

@@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import { translate, InjectedTranslateProps } from "react-i18next"; import { withTranslation, WithTranslation } from "react-i18next";
import classNames from "classnames"; import classNames from "classnames";
import styled from "styled-components"; import styled from "styled-components";
// @ts-ignore // @ts-ignore
@@ -10,7 +10,7 @@ import Icon from "../Icon";
import { File, Hunk as HunkType, DiffObjectProps } from "./DiffTypes"; import { File, Hunk as HunkType, DiffObjectProps } from "./DiffTypes";
type Props = DiffObjectProps & type Props = DiffObjectProps &
InjectedTranslateProps & { WithTranslation & {
file: File; file: File;
defaultCollapse?: boolean; defaultCollapse?: boolean;
}; };
@@ -271,4 +271,4 @@ class DiffFile extends React.Component<Props, State> {
} }
} }
export default translate("repos")(DiffFile); export default withTranslation("repos")(DiffFile);

View File

@@ -1,13 +1,10 @@
import React from "react"; import React from "react";
import { Changeset } from "@scm-manager/ui-types"; import { Changeset } from "@scm-manager/ui-types";
import { ExtensionPoint } from "@scm-manager/ui-extensions"; import { ExtensionPoint } from "@scm-manager/ui-extensions";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
type Props = { type Props = WithTranslation & {
changeset: Changeset; changeset: Changeset;
// context props
t: (p: string) => string;
}; };
class ChangesetAuthor extends React.Component<Props> { class ChangesetAuthor extends React.Component<Props> {
@@ -50,4 +47,4 @@ class ChangesetAuthor extends React.Component<Props> {
} }
} }
export default translate("repos")(ChangesetAuthor); export default withTranslation("repos")(ChangesetAuthor);

View File

@@ -2,14 +2,11 @@ import React from "react";
import { Changeset, Repository } from "@scm-manager/ui-types"; import { Changeset, Repository } from "@scm-manager/ui-types";
import { ButtonAddons, Button } from "../../buttons"; import { ButtonAddons, Button } from "../../buttons";
import { createChangesetLink, createSourcesLink } from "./changesets"; import { createChangesetLink, createSourcesLink } from "./changesets";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
type Props = { type Props = WithTranslation & {
repository: Repository; repository: Repository;
changeset: Changeset; changeset: Changeset;
// context props
t: (p: string) => string;
}; };
class ChangesetButtonGroup extends React.Component<Props> { class ChangesetButtonGroup extends React.Component<Props> {
@@ -26,4 +23,4 @@ class ChangesetButtonGroup extends React.Component<Props> {
} }
} }
export default translate("repos")(ChangesetButtonGroup); export default withTranslation("repos")(ChangesetButtonGroup);

View File

@@ -2,14 +2,11 @@ import React from "react";
import { Changeset, Link } from "@scm-manager/ui-types"; import { Changeset, Link } from "@scm-manager/ui-types";
import LoadingDiff from "../LoadingDiff"; import LoadingDiff from "../LoadingDiff";
import Notification from "../../Notification"; import Notification from "../../Notification";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
type Props = { type Props = WithTranslation & {
changeset: Changeset; changeset: Changeset;
defaultCollapse?: boolean; defaultCollapse?: boolean;
// context props
t: (p: string) => string;
}; };
class ChangesetDiff extends React.Component<Props> { class ChangesetDiff extends React.Component<Props> {
@@ -36,4 +33,4 @@ class ChangesetDiff extends React.Component<Props> {
} }
} }
export default translate("repos")(ChangesetDiff); export default withTranslation("repos")(ChangesetDiff);

View File

@@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import { Interpolate, translate } from "react-i18next"; import { Trans } from "react-i18next";
import classNames from "classnames"; import classNames from "classnames";
import styled from "styled-components"; import styled from "styled-components";
import { ExtensionPoint } from "@scm-manager/ui-extensions"; import { ExtensionPoint } from "@scm-manager/ui-extensions";
@@ -15,9 +15,6 @@ import ChangesetButtonGroup from "./ChangesetButtonGroup";
type Props = { type Props = {
repository: Repository; repository: Repository;
changeset: Changeset; changeset: Changeset;
// context props
t: (p: string) => string;
}; };
const Wrapper = styled.div` const Wrapper = styled.div`
@@ -98,10 +95,10 @@ class ChangesetRow extends React.Component<Props> {
</ExtensionPoint> </ExtensionPoint>
</h4> </h4>
<p className="is-hidden-touch"> <p className="is-hidden-touch">
<Interpolate i18nKey="changeset.summary" id={changesetId} time={dateFromNow} /> <Trans i18nKey="repos:changeset.summary" components={[changesetId, dateFromNow]} />
</p> </p>
<p className="is-hidden-desktop"> <p className="is-hidden-desktop">
<Interpolate i18nKey="changeset.shortSummary" id={changesetId} time={dateFromNow} /> <Trans i18nKey="repos:changeset.shortSummary" components={[changesetId, dateFromNow]} />
</p> </p>
<AuthorWrapper className="is-size-7"> <AuthorWrapper className="is-size-7">
<ChangesetAuthor changeset={changeset} /> <ChangesetAuthor changeset={changeset} />
@@ -131,4 +128,4 @@ class ChangesetRow extends React.Component<Props> {
} }
} }
export default translate("repos")(ChangesetRow); export default ChangesetRow;

View File

@@ -1,14 +1,11 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Tag } from "@scm-manager/ui-types"; import { Tag } from "@scm-manager/ui-types";
import Tooltip from "../../Tooltip"; import Tooltip from "../../Tooltip";
import ChangesetTagBase from "./ChangesetTagBase"; import ChangesetTagBase from "./ChangesetTagBase";
type Props = { type Props = WithTranslation & {
tags: Tag[]; tags: Tag[];
// context props
t: (p: string) => string;
}; };
class ChangesetTagsCollapsed extends React.Component<Props> { class ChangesetTagsCollapsed extends React.Component<Props> {
@@ -23,4 +20,4 @@ class ChangesetTagsCollapsed extends React.Component<Props> {
} }
} }
export default translate("repos")(ChangesetTagsCollapsed); export default withTranslation("repos")(ChangesetTagsCollapsed);

View File

@@ -27,7 +27,7 @@
"jest": "^24.9.0", "jest": "^24.9.0",
"query-string": "^5.0.1", "query-string": "^5.0.1",
"react": "^16.10.2", "react": "^16.10.2",
"react-i18next": "^7.9.0", "react-i18next": "^10.13.1",
"react-redux": "^5.0.7", "react-redux": "^5.0.7",
"react-router-dom": "^5.1.2", "react-router-dom": "^5.1.2",
"redux": "^4.0.0", "redux": "^4.0.0",

View File

@@ -1,6 +1,6 @@
jest.mock("react-i18next", () => ({ jest.mock("react-i18next", () => ({
// this mock makes sure any components using the translate HoC receive the t function as a prop // this mock makes sure any components using the translate HoC receive the t function as a prop
translate: () => (Component: any) => { withTranslation: () => (Component: any) => {
Component.defaultProps = { Component.defaultProps = {
...Component.defaultProps, ...Component.defaultProps,
t: (key: string) => key t: (key: string) => key

View File

@@ -7,14 +7,14 @@
"@scm-manager/ui-extensions": "^2.0.0-SNAPSHOT", "@scm-manager/ui-extensions": "^2.0.0-SNAPSHOT",
"classnames": "^2.2.5", "classnames": "^2.2.5",
"history": "^4.10.1", "history": "^4.10.1",
"i18next": "^11.4.0", "i18next": "^17.3.0",
"i18next-browser-languagedetector": "^2.2.2", "i18next-browser-languagedetector": "^4.0.0",
"i18next-fetch-backend": "^0.1.0", "i18next-fetch-backend": "^2.2.0",
"memoize-one": "^5.0.4", "memoize-one": "^5.0.4",
"query-string": "5", "query-string": "5",
"react": "^16.10.2", "react": "^16.10.2",
"react-dom": "^16.10.2", "react-dom": "^16.10.2",
"react-i18next": "^7.9.0", "react-i18next": "^10.13.1",
"react-redux": "^5.0.7", "react-redux": "^5.0.7",
"react-router-dom": "^5.1.2", "react-router-dom": "^5.1.2",
"react-select": "^2.1.2", "react-select": "^2.1.2",
@@ -38,7 +38,6 @@
"@types/query-string": "5", "@types/query-string": "5",
"@types/react": "^16.9.9", "@types/react": "^16.9.9",
"@types/react-dom": "^16.9.2", "@types/react-dom": "^16.9.2",
"@types/react-i18next": "^7.8.3",
"@types/react-redux": "5.0.7", "@types/react-redux": "5.0.7",
"@types/react-router-dom": "^5.1.0", "@types/react-router-dom": "^5.1.0",
"@types/styled-components": "^4.1.19", "@types/styled-components": "^4.1.19",

View File

@@ -78,8 +78,8 @@
}, },
"changeset": { "changeset": {
"description": "Beschreibung", "description": "Beschreibung",
"summary": "Changeset {{id}} wurde committet {{time}}", "summary": "Changeset <0/> wurde <1/> committet",
"shortSummary": "Committet {{id}} {{time}}", "shortSummary": "Committet <0/> <1/>",
"tags": "Tags", "tags": "Tags",
"diffNotSupported": "Diff des Changesets wird von diesem Repositorytyp nicht unterstützt", "diffNotSupported": "Diff des Changesets wird von diesem Repositorytyp nicht unterstützt",
"author": { "author": {

View File

@@ -78,8 +78,8 @@
}, },
"changeset": { "changeset": {
"description": "Description", "description": "Description",
"summary": "Changeset {{id}} was committed {{time}}", "summary": "Changeset <0/> was committed <1/>",
"shortSummary": "Committed {{id}} {{time}}", "shortSummary": "Committed <0/> <1/>",
"tags": "Tags", "tags": "Tags",
"diffNotSupported": "Diff of changesets is not supported by the type of repository", "diffNotSupported": "Diff of changesets is not supported by the type of repository",
"author": { "author": {

View File

@@ -78,8 +78,8 @@
}, },
"changeset": { "changeset": {
"description": "Descripción", "description": "Descripción",
"summary": "El changeset {{id}} fue entregado {{time}}", "summary": "El changeset <0/> fue entregado <1/>",
"shortSummary": "Entregado {{id}} {{time}}", "shortSummary": "Entregado <0/> <1/>",
"tags": "Etiquetas", "tags": "Etiquetas",
"diffNotSupported": "La comparación de changesets no es soportada por el tipo de repositorio", "diffNotSupported": "La comparación de changesets no es soportada por el tipo de repositorio",
"author": { "author": {

View File

@@ -1,11 +1,10 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Checkbox, InputField, Subtitle } from "@scm-manager/ui-components"; import { Checkbox, InputField, Subtitle } from "@scm-manager/ui-components";
type Props = { type Props = WithTranslation & {
baseUrl: string; baseUrl: string;
forceBaseUrl: boolean; forceBaseUrl: boolean;
t: (p: string) => string;
onChange: (p1: boolean, p2: any, p3: string) => void; onChange: (p1: boolean, p2: any, p3: string) => void;
hasUpdatePermission: boolean; hasUpdatePermission: boolean;
}; };
@@ -49,4 +48,4 @@ class BaseUrlSettings extends React.Component<Props> {
}; };
} }
export default translate("config")(BaseUrlSettings); export default withTranslation("config")(BaseUrlSettings);

View File

@@ -1,21 +1,19 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { SubmitButton, Notification } from "@scm-manager/ui-components";
import { NamespaceStrategies, Config } from "@scm-manager/ui-types"; import { NamespaceStrategies, Config } from "@scm-manager/ui-types";
import { SubmitButton, Notification } from "@scm-manager/ui-components";
import ProxySettings from "./ProxySettings"; import ProxySettings from "./ProxySettings";
import GeneralSettings from "./GeneralSettings"; import GeneralSettings from "./GeneralSettings";
import BaseUrlSettings from "./BaseUrlSettings"; import BaseUrlSettings from "./BaseUrlSettings";
import LoginAttempt from "./LoginAttempt"; import LoginAttempt from "./LoginAttempt";
type Props = { type Props = WithTranslation & {
submitForm: (p: Config) => void; submitForm: (p: Config) => void;
config?: Config; config?: Config;
loading?: boolean; loading?: boolean;
configReadPermission: boolean; configReadPermission: boolean;
configUpdatePermission: boolean; configUpdatePermission: boolean;
namespaceStrategies?: NamespaceStrategies; namespaceStrategies?: NamespaceStrategies;
// context props
t: (p: string) => string;
}; };
type State = { type State = {
@@ -189,4 +187,4 @@ class ConfigForm extends React.Component<Props, State> {
}; };
} }
export default translate("config")(ConfigForm); export default withTranslation("config")(ConfigForm);

View File

@@ -1,10 +1,10 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Checkbox, InputField } from "@scm-manager/ui-components"; import { Checkbox, InputField } from "@scm-manager/ui-components";
import { NamespaceStrategies } from "@scm-manager/ui-types"; import { NamespaceStrategies } from "@scm-manager/ui-types";
import NamespaceStrategySelect from "./NamespaceStrategySelect"; import NamespaceStrategySelect from "./NamespaceStrategySelect";
type Props = { type Props = WithTranslation & {
realmDescription: string; realmDescription: string;
loginInfoUrl: string; loginInfoUrl: string;
disableGroupingGrid: boolean; disableGroupingGrid: boolean;
@@ -17,8 +17,6 @@ type Props = {
namespaceStrategies?: NamespaceStrategies; namespaceStrategies?: NamespaceStrategies;
onChange: (p1: boolean, p2: any, p3: string) => void; onChange: (p1: boolean, p2: any, p3: string) => void;
hasUpdatePermission: boolean; hasUpdatePermission: boolean;
// context props
t: (p: string) => string;
}; };
class GeneralSettings extends React.Component<Props> { class GeneralSettings extends React.Component<Props> {
@@ -122,4 +120,4 @@ class GeneralSettings extends React.Component<Props> {
}; };
} }
export default translate("config")(GeneralSettings); export default withTranslation("config")(GeneralSettings);

View File

@@ -1,11 +1,10 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { InputField, Subtitle, validation as validator } from "@scm-manager/ui-components"; import { InputField, Subtitle, validation as validator } from "@scm-manager/ui-components";
type Props = { type Props = WithTranslation & {
loginAttemptLimit: number; loginAttemptLimit: number;
loginAttemptLimitTimeout: number; loginAttemptLimitTimeout: number;
t: (p: string) => string;
onChange: (p1: boolean, p2: any, p3: string) => void; onChange: (p1: boolean, p2: any, p3: string) => void;
hasUpdatePermission: boolean; hasUpdatePermission: boolean;
}; };
@@ -76,4 +75,4 @@ class LoginAttempt extends React.Component<Props, State> {
}; };
} }
export default translate("config")(LoginAttempt); export default withTranslation("config")(LoginAttempt);

View File

@@ -1,17 +1,15 @@
import React from "react"; import React from "react";
import { translate, TFunction } from "react-i18next"; import { withTranslation, WithTranslation } from "react-i18next";
import { Select } from "@scm-manager/ui-components";
import { NamespaceStrategies } from "@scm-manager/ui-types"; import { NamespaceStrategies } from "@scm-manager/ui-types";
import { Select } from "@scm-manager/ui-components";
type Props = { type Props = WithTranslation & {
namespaceStrategies: NamespaceStrategies; namespaceStrategies: NamespaceStrategies;
label: string; label: string;
value?: string; value?: string;
disabled?: boolean; disabled?: boolean;
helpText?: string; helpText?: string;
onChange: (value: string, name?: string) => void; onChange: (value: string, name?: string) => void;
// context props
t: TFunction;
}; };
class NamespaceStrategySelect extends React.Component<Props> { class NamespaceStrategySelect extends React.Component<Props> {
@@ -59,4 +57,4 @@ class NamespaceStrategySelect extends React.Component<Props> {
} }
} }
export default translate("plugins")(NamespaceStrategySelect); export default withTranslation("plugins")(NamespaceStrategySelect);

View File

@@ -1,16 +1,15 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Checkbox, InputField, Subtitle, AddEntryToTableField } from "@scm-manager/ui-components"; import { Checkbox, InputField, Subtitle, AddEntryToTableField } from "@scm-manager/ui-components";
import ProxyExcludesTable from "../table/ProxyExcludesTable"; import ProxyExcludesTable from "../table/ProxyExcludesTable";
type Props = { type Props = WithTranslation & {
proxyPassword: string; proxyPassword: string;
proxyPort: number; proxyPort: number;
proxyServer: string; proxyServer: string;
proxyUser: string; proxyUser: string;
enableProxy: boolean; enableProxy: boolean;
proxyExcludes: string[]; proxyExcludes: string[];
t: (p: string) => string;
onChange: (p1: boolean, p2: any, p3: string) => void; onChange: (p1: boolean, p2: any, p3: string) => void;
hasUpdatePermission: boolean; hasUpdatePermission: boolean;
}; };
@@ -131,4 +130,4 @@ class ProxySettings extends React.Component<Props> {
}; };
} }
export default translate("config")(ProxySettings); export default withTranslation("config")(ProxySettings);

View File

@@ -1,10 +1,9 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import ArrayConfigTable from "./ArrayConfigTable"; import ArrayConfigTable from "./ArrayConfigTable";
type Props = { type Props = WithTranslation & {
proxyExcludes: string[]; proxyExcludes: string[];
t: (p: string) => string;
onChange: (p1: boolean, p2: any, p3: string) => void; onChange: (p1: boolean, p2: any, p3: string) => void;
disabled: boolean; disabled: boolean;
}; };
@@ -31,4 +30,4 @@ class ProxyExcludesTable extends React.Component<Props, State> {
}; };
} }
export default translate("config")(ProxyExcludesTable); export default withTranslation("config")(ProxyExcludesTable);

View File

@@ -1,10 +1,10 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next";
import { Redirect, Route, Switch } from "react-router-dom";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
import { History } from "history";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { compose } from "redux"; import { compose } from "redux";
import { WithTranslation, withTranslation } from "react-i18next";
import { Redirect, Route, Switch } from "react-router-dom";
import { History } from "history";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
import { Links } from "@scm-manager/ui-types"; import { Links } from "@scm-manager/ui-types";
import { Page, Navigation, NavLink, Section, SubNavigation } from "@scm-manager/ui-components"; import { Page, Navigation, NavLink, Section, SubNavigation } from "@scm-manager/ui-components";
import { getLinks, getAvailablePluginsLink, getInstalledPluginsLink } from "../../modules/indexResource"; import { getLinks, getAvailablePluginsLink, getInstalledPluginsLink } from "../../modules/indexResource";
@@ -15,13 +15,12 @@ import RepositoryRoles from "../roles/containers/RepositoryRoles";
import SingleRepositoryRole from "../roles/containers/SingleRepositoryRole"; import SingleRepositoryRole from "../roles/containers/SingleRepositoryRole";
import CreateRepositoryRole from "../roles/containers/CreateRepositoryRole"; import CreateRepositoryRole from "../roles/containers/CreateRepositoryRole";
type Props = { type Props = WithTranslation & {
links: Links; links: Links;
availablePluginsLink: string; availablePluginsLink: string;
installedPluginsLink: string; installedPluginsLink: string;
// context objects // context objects
t: (p: string) => string;
match: any; match: any;
history: History; history: History;
}; };
@@ -150,5 +149,5 @@ const mapStateToProps = (state: any) => {
export default compose( export default compose(
connect(mapStateToProps), connect(mapStateToProps),
translate("admin") withTranslation("admin")
)(Admin); )(Admin);

View File

@@ -1,17 +1,14 @@
import React from "react"; import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import { Image, Loading, Subtitle, Title } from "@scm-manager/ui-components"; import { Image, Loading, Subtitle, Title } from "@scm-manager/ui-components";
import { getAppVersion } from "../../modules/indexResource"; import { getAppVersion } from "../../modules/indexResource";
type Props = { type Props = WithTranslation & {
loading: boolean; loading: boolean;
error: Error; error: Error;
version: string; version: string;
// context props
t: (p: string) => string;
}; };
const BoxShadowBox = styled.div` const BoxShadowBox = styled.div`
@@ -86,4 +83,4 @@ const mapStateToProps = (state: any) => {
}; };
}; };
export default connect(mapStateToProps)(translate("admin")(AdminDetails)); export default connect(mapStateToProps)(withTranslation("admin")(AdminDetails));

View File

@@ -1,6 +1,9 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { connect } from "react-redux";
import { Config, NamespaceStrategies } from "@scm-manager/ui-types";
import { Title, Loading, ErrorNotification } from "@scm-manager/ui-components"; import { Title, Loading, ErrorNotification } from "@scm-manager/ui-components";
import { getConfigLink } from "../../modules/indexResource";
import { import {
fetchConfig, fetchConfig,
getFetchConfigFailure, getFetchConfigFailure,
@@ -12,10 +15,7 @@ import {
getModifyConfigFailure, getModifyConfigFailure,
modifyConfigReset modifyConfigReset
} from "../modules/config"; } from "../modules/config";
import { connect } from "react-redux";
import { Config, NamespaceStrategies } from "@scm-manager/ui-types";
import ConfigForm from "../components/form/ConfigForm"; import ConfigForm from "../components/form/ConfigForm";
import { getConfigLink } from "../../modules/indexResource";
import { import {
fetchNamespaceStrategiesIfNeeded, fetchNamespaceStrategiesIfNeeded,
getFetchNamespaceStrategiesFailure, getFetchNamespaceStrategiesFailure,
@@ -23,7 +23,7 @@ import {
isFetchNamespaceStrategiesPending isFetchNamespaceStrategiesPending
} from "../modules/namespaceStrategies"; } from "../modules/namespaceStrategies";
type Props = { type Props = WithTranslation & {
loading: boolean; loading: boolean;
error: Error; error: Error;
config: Config; config: Config;
@@ -36,9 +36,6 @@ type Props = {
fetchConfig: (link: string) => void; fetchConfig: (link: string) => void;
configReset: (p: void) => void; configReset: (p: void) => void;
fetchNamespaceStrategiesIfNeeded: (p: void) => void; fetchNamespaceStrategiesIfNeeded: (p: void) => void;
// context objects
t: (p: string) => string;
}; };
type State = { type State = {
@@ -181,4 +178,4 @@ const mapStateToProps = state => {
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("config")(GlobalConfig)); )(withTranslation("config")(GlobalConfig));

View File

@@ -2,15 +2,12 @@ import React from "react";
import PluginActionModal from "./PluginActionModal"; import PluginActionModal from "./PluginActionModal";
import { PendingPlugins } from "@scm-manager/ui-types"; import { PendingPlugins } from "@scm-manager/ui-types";
import { apiClient } from "@scm-manager/ui-components"; import { apiClient } from "@scm-manager/ui-components";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
type Props = { type Props = WithTranslation & {
onClose: () => void; onClose: () => void;
refresh: () => void; refresh: () => void;
pendingPlugins: PendingPlugins; pendingPlugins: PendingPlugins;
// context props
t: (p: string) => string;
}; };
class CancelPendingActionModal extends React.Component<Props> { class CancelPendingActionModal extends React.Component<Props> {
@@ -37,4 +34,4 @@ class CancelPendingActionModal extends React.Component<Props> {
}; };
} }
export default translate("admin")(CancelPendingActionModal); export default withTranslation("admin")(CancelPendingActionModal);

View File

@@ -1,14 +1,11 @@
import React from "react"; import React from "react";
import { Button } from "@scm-manager/ui-components"; import { WithTranslation, withTranslation } from "react-i18next";
import { PendingPlugins } from "@scm-manager/ui-types"; import { PendingPlugins } from "@scm-manager/ui-types";
import { translate } from "react-i18next"; import { Button } from "@scm-manager/ui-components";
import ExecutePendingModal from "./ExecutePendingModal"; import ExecutePendingModal from "./ExecutePendingModal";
type Props = { type Props = WithTranslation & {
pendingPlugins: PendingPlugins; pendingPlugins: PendingPlugins;
// context props
t: (p: string) => string;
}; };
type State = { type State = {
@@ -55,4 +52,4 @@ class ExecutePendingAction extends React.Component<Props, State> {
} }
} }
export default translate("admin")(ExecutePendingAction); export default withTranslation("admin")(ExecutePendingAction);

View File

@@ -1,16 +1,13 @@
import React from "react"; import React from "react";
import PluginActionModal from "./PluginActionModal"; import { WithTranslation, withTranslation } from "react-i18next";
import { PendingPlugins } from "@scm-manager/ui-types"; import { PendingPlugins } from "@scm-manager/ui-types";
import waitForRestart from "./waitForRestart";
import { apiClient, Notification } from "@scm-manager/ui-components"; import { apiClient, Notification } from "@scm-manager/ui-components";
import { translate } from "react-i18next"; import waitForRestart from "./waitForRestart";
import PluginActionModal from "./PluginActionModal";
type Props = { type Props = WithTranslation & {
onClose: () => void; onClose: () => void;
pendingPlugins: PendingPlugins; pendingPlugins: PendingPlugins;
// context props
t: (p: string) => string;
}; };
class ExecutePendingActionModal extends React.Component<Props> { class ExecutePendingActionModal extends React.Component<Props> {
@@ -36,4 +33,4 @@ class ExecutePendingActionModal extends React.Component<Props> {
}; };
} }
export default translate("admin")(ExecutePendingActionModal); export default withTranslation("admin")(ExecutePendingActionModal);

View File

@@ -1,16 +1,13 @@
import React from "react"; import React from "react";
import { apiClient, Button, ButtonGroup, ErrorNotification, Modal, Notification } from "@scm-manager/ui-components"; import { apiClient, Button, ButtonGroup, ErrorNotification, Modal, Notification } from "@scm-manager/ui-components";
import { PendingPlugins } from "@scm-manager/ui-types"; import { PendingPlugins } from "@scm-manager/ui-types";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import waitForRestart from "./waitForRestart"; import waitForRestart from "./waitForRestart";
import SuccessNotification from "./SuccessNotification"; import SuccessNotification from "./SuccessNotification";
type Props = { type Props = WithTranslation & {
onClose: () => void; onClose: () => void;
pendingPlugins: PendingPlugins; pendingPlugins: PendingPlugins;
// context props
t: (p: string) => string;
}; };
type State = { type State = {
@@ -167,4 +164,4 @@ class ExecutePendingModal extends React.Component<Props, State> {
} }
} }
export default translate("admin")(ExecutePendingModal); export default withTranslation("admin")(ExecutePendingModal);

View File

@@ -1,10 +1,10 @@
import * as React from "react"; import * as React from "react";
import { Button, ButtonGroup, ErrorNotification, Modal } from "@scm-manager/ui-components"; import { WithTranslation, withTranslation } from "react-i18next";
import { PendingPlugins, PluginCollection } from "@scm-manager/ui-types"; import { PendingPlugins, PluginCollection } from "@scm-manager/ui-types";
import { translate } from "react-i18next"; import { Button, ButtonGroup, ErrorNotification, Modal } from "@scm-manager/ui-components";
import SuccessNotification from "./SuccessNotification"; import SuccessNotification from "./SuccessNotification";
type Props = { type Props = WithTranslation & {
onClose: () => void; onClose: () => void;
actionType: string; actionType: string;
pendingPlugins?: PendingPlugins; pendingPlugins?: PendingPlugins;
@@ -15,9 +15,6 @@ type Props = {
label: string; label: string;
children?: React.Node; children?: React.Node;
// context props
t: (p: string) => string;
}; };
type State = { type State = {
@@ -199,4 +196,4 @@ class PluginActionModal extends React.Component<Props, State> {
} }
} }
export default translate("admin")(PluginActionModal); export default withTranslation("admin")(PluginActionModal);

View File

@@ -1,6 +1,5 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import classNames from "classnames";
import styled from "styled-components"; import styled from "styled-components";
import { Plugin } from "@scm-manager/ui-types"; import { Plugin } from "@scm-manager/ui-types";
import { CardColumn, Icon } from "@scm-manager/ui-components"; import { CardColumn, Icon } from "@scm-manager/ui-components";
@@ -13,12 +12,9 @@ export const PluginAction = {
UNINSTALL: "uninstall" UNINSTALL: "uninstall"
}; };
type Props = { type Props = WithTranslation & {
plugin: Plugin; plugin: Plugin;
refresh: () => void; refresh: () => void;
// context props
t: (p: string) => string;
}; };
type State = { type State = {
@@ -173,4 +169,4 @@ class PluginEntry extends React.Component<Props, State> {
} }
} }
export default translate("admin")(PluginEntry); export default withTranslation("admin")(PluginEntry);

View File

@@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import classNames from "classnames"; import classNames from "classnames";
import styled from "styled-components"; import styled from "styled-components";
import { Plugin } from "@scm-manager/ui-types"; import { Plugin } from "@scm-manager/ui-types";
@@ -16,14 +16,11 @@ import waitForRestart from "./waitForRestart";
import SuccessNotification from "./SuccessNotification"; import SuccessNotification from "./SuccessNotification";
import { PluginAction } from "./PluginEntry"; import { PluginAction } from "./PluginEntry";
type Props = { type Props = WithTranslation & {
plugin: Plugin; plugin: Plugin;
pluginAction: string; pluginAction: string;
refresh: () => void; refresh: () => void;
onClose: () => void; onClose: () => void;
// context props
t: (key: string, params?: object) => string;
}; };
type State = { type State = {
@@ -268,4 +265,4 @@ class PluginModal extends React.Component<Props, State> {
} }
} }
export default translate("admin")(PluginModal); export default withTranslation("admin")(PluginModal);

View File

@@ -1,13 +1,8 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Notification } from "@scm-manager/ui-components"; import { Notification } from "@scm-manager/ui-components";
type Props = { class InstallSuccessNotification extends React.Component<WithTranslation> {
// context props
t: (p: string) => string;
};
class InstallSuccessNotification extends React.Component<Props> {
render() { render() {
const { t } = this.props; const { t } = this.props;
return ( return (
@@ -19,4 +14,4 @@ class InstallSuccessNotification extends React.Component<Props> {
} }
} }
export default translate("admin")(InstallSuccessNotification); export default withTranslation("admin")(InstallSuccessNotification);

View File

@@ -1,16 +1,13 @@
import React from "react"; import React from "react";
import PluginActionModal from "./PluginActionModal"; import { WithTranslation, withTranslation } from "react-i18next";
import { PluginCollection } from "@scm-manager/ui-types"; import { PluginCollection } from "@scm-manager/ui-types";
import { apiClient } from "@scm-manager/ui-components"; import { apiClient } from "@scm-manager/ui-components";
import { translate } from "react-i18next"; import PluginActionModal from "./PluginActionModal";
type Props = { type Props = WithTranslation & {
onClose: () => void; onClose: () => void;
refresh: () => void; refresh: () => void;
installedPlugins: PluginCollection; installedPlugins: PluginCollection;
// context props
t: (p: string) => string;
}; };
class UpdateAllActionModal extends React.Component<Props> { class UpdateAllActionModal extends React.Component<Props> {
@@ -37,4 +34,4 @@ class UpdateAllActionModal extends React.Component<Props> {
}; };
} }
export default translate("admin")(UpdateAllActionModal); export default withTranslation("admin")(UpdateAllActionModal);

View File

@@ -1,6 +1,6 @@
import * as React from "react"; import * as React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { compose } from "redux"; import { compose } from "redux";
import { PendingPlugins, PluginCollection } from "@scm-manager/ui-types"; import { PendingPlugins, PluginCollection } from "@scm-manager/ui-types";
import { import {
@@ -32,7 +32,7 @@ import ExecutePendingActionModal from "../components/ExecutePendingActionModal";
import CancelPendingActionModal from "../components/CancelPendingActionModal"; import CancelPendingActionModal from "../components/CancelPendingActionModal";
import UpdateAllActionModal from "../components/UpdateAllActionModal"; import UpdateAllActionModal from "../components/UpdateAllActionModal";
type Props = { type Props = WithTranslation & {
loading: boolean; loading: boolean;
error: Error; error: Error;
collection: PluginCollection; collection: PluginCollection;
@@ -43,9 +43,6 @@ type Props = {
pendingPluginsLink: string; pendingPluginsLink: string;
pendingPlugins: PendingPlugins; pendingPlugins: PendingPlugins;
// context objects
t: (key: string, params?: object) => string;
// dispatched functions // dispatched functions
fetchPluginsByLink: (link: string) => void; fetchPluginsByLink: (link: string) => void;
fetchPendingPlugins: (link: string) => void; fetchPendingPlugins: (link: string) => void;
@@ -291,7 +288,7 @@ const mapDispatchToProps = dispatch => {
}; };
export default compose( export default compose(
translate("admin"), withTranslation("admin"),
connect( connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps

View File

@@ -1,12 +1,9 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { RepositoryRole } from "@scm-manager/ui-types"; import { RepositoryRole } from "@scm-manager/ui-types";
type Props = { type Props = WithTranslation & {
role: RepositoryRole; role: RepositoryRole;
// context props
t: (p: string) => string;
}; };
class AvailableVerbs extends React.Component<Props> { class AvailableVerbs extends React.Component<Props> {
@@ -31,4 +28,4 @@ class AvailableVerbs extends React.Component<Props> {
} }
} }
export default translate("plugins")(AvailableVerbs); export default withTranslation("plugins")(AvailableVerbs);

View File

@@ -1,16 +1,13 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { RepositoryRole } from "@scm-manager/ui-types";
import { ExtensionPoint } from "@scm-manager/ui-extensions"; import { ExtensionPoint } from "@scm-manager/ui-extensions";
import PermissionRoleDetailsTable from "./PermissionRoleDetailsTable"; import { RepositoryRole } from "@scm-manager/ui-types";
import { Button } from "@scm-manager/ui-components"; import { Button } from "@scm-manager/ui-components";
import PermissionRoleDetailsTable from "./PermissionRoleDetailsTable";
type Props = { type Props = WithTranslation & {
role: RepositoryRole; role: RepositoryRole;
url: string; url: string;
// context props
t: (p: string) => string;
}; };
class PermissionRoleDetails extends React.Component<Props> { class PermissionRoleDetails extends React.Component<Props> {
@@ -42,4 +39,4 @@ class PermissionRoleDetails extends React.Component<Props> {
} }
} }
export default translate("admin")(PermissionRoleDetails); export default withTranslation("admin")(PermissionRoleDetails);

View File

@@ -1,13 +1,10 @@
import React from "react"; import React from "react";
import { WithTranslation, withTranslation } from "react-i18next";
import { RepositoryRole } from "@scm-manager/ui-types"; import { RepositoryRole } from "@scm-manager/ui-types";
import { translate } from "react-i18next";
import AvailableVerbs from "./AvailableVerbs"; import AvailableVerbs from "./AvailableVerbs";
type Props = { type Props = WithTranslation & {
role: RepositoryRole; role: RepositoryRole;
// context props
t: (p: string) => string;
}; };
class PermissionRoleDetailsTable extends React.Component<Props> { class PermissionRoleDetailsTable extends React.Component<Props> {
@@ -34,4 +31,4 @@ class PermissionRoleDetailsTable extends React.Component<Props> {
} }
} }
export default translate("admin")(PermissionRoleDetailsTable); export default withTranslation("admin")(PermissionRoleDetailsTable);

View File

@@ -1,14 +1,11 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { RepositoryRole } from "@scm-manager/ui-types"; import { RepositoryRole } from "@scm-manager/ui-types";
import PermissionRoleRow from "./PermissionRoleRow"; import PermissionRoleRow from "./PermissionRoleRow";
type Props = { type Props = WithTranslation & {
baseUrl: string; baseUrl: string;
roles: RepositoryRole[]; roles: RepositoryRole[];
// context props
t: (p: string) => string;
}; };
class PermissionRoleTable extends React.Component<Props> { class PermissionRoleTable extends React.Component<Props> {
@@ -31,4 +28,4 @@ class PermissionRoleTable extends React.Component<Props> {
} }
} }
export default translate("admin")(PermissionRoleTable); export default withTranslation("admin")(PermissionRoleTable);

View File

@@ -1,13 +1,10 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import { Tag } from "@scm-manager/ui-components"; import { Tag } from "@scm-manager/ui-components";
type Props = { type Props = WithTranslation & {
system?: boolean; system?: boolean;
// context props
t: (p: string) => string;
}; };
const LeftMarginTag = styled(Tag)` const LeftMarginTag = styled(Tag)`
@@ -26,4 +23,4 @@ class SystemRoleTag extends React.Component<Props> {
} }
} }
export default translate("admin")(SystemRoleTag); export default withTranslation("admin")(SystemRoleTag);

View File

@@ -1,23 +1,20 @@
import React from "react"; import React from "react";
import RepositoryRoleForm from "./RepositoryRoleForm";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { History } from "history";
import { RepositoryRole } from "@scm-manager/ui-types";
import { ErrorNotification, Subtitle, Title } from "@scm-manager/ui-components"; import { ErrorNotification, Subtitle, Title } from "@scm-manager/ui-components";
import { createRole, getCreateRoleFailure, getFetchVerbsFailure, isFetchVerbsPending } from "../modules/roles"; import { createRole, getCreateRoleFailure, getFetchVerbsFailure, isFetchVerbsPending } from "../modules/roles";
import { RepositoryRole } from "@scm-manager/ui-types";
import { getRepositoryRolesLink, getRepositoryVerbsLink } from "../../../modules/indexResource"; import { getRepositoryRolesLink, getRepositoryVerbsLink } from "../../../modules/indexResource";
import { History } from "history"; import RepositoryRoleForm from "./RepositoryRoleForm";
type Props = { type Props = WithTranslation & {
repositoryRolesLink: string; repositoryRolesLink: string;
error?: Error; error?: Error;
history: History; history: History;
// dispatch function // dispatch function
addRole: (link: string, role: RepositoryRole, callback?: () => void) => void; addRole: (link: string, role: RepositoryRole, callback?: () => void) => void;
// context objects
t: (p: string) => string;
}; };
class CreateRepositoryRole extends React.Component<Props> { class CreateRepositoryRole extends React.Component<Props> {
@@ -47,7 +44,7 @@ class CreateRepositoryRole extends React.Component<Props> {
} }
} }
const mapStateToProps = (state, ownProps) => { const mapStateToProps = (state) => {
const loading = isFetchVerbsPending(state); const loading = isFetchVerbsPending(state);
const error = getFetchVerbsFailure(state) || getCreateRoleFailure(state); const error = getFetchVerbsFailure(state) || getCreateRoleFailure(state);
const verbsLink = getRepositoryVerbsLink(state); const verbsLink = getRepositoryVerbsLink(state);
@@ -72,4 +69,4 @@ const mapDispatchToProps = dispatch => {
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("admin")(CreateRepositoryRole)); )(withTranslation("admin")(CreateRepositoryRole));

View File

@@ -1,13 +1,13 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next";
import { RepositoryRole } from "@scm-manager/ui-types";
import { Subtitle, DeleteButton, confirmAlert, ErrorNotification } from "@scm-manager/ui-components";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { withRouter } from "react-router-dom"; import { withRouter } from "react-router-dom";
import { WithTranslation, withTranslation } from "react-i18next";
import { History } from "history"; import { History } from "history";
import { RepositoryRole } from "@scm-manager/ui-types";
import { Subtitle, DeleteButton, confirmAlert, ErrorNotification } from "@scm-manager/ui-components";
import { deleteRole, getDeleteRoleFailure, isDeleteRolePending } from "../modules/roles"; import { deleteRole, getDeleteRoleFailure, isDeleteRolePending } from "../modules/roles";
type Props = { type Props = WithTranslation & {
loading: boolean; loading: boolean;
error: Error; error: Error;
role: RepositoryRole; role: RepositoryRole;
@@ -16,7 +16,6 @@ type Props = {
// context props // context props
history: History; history: History;
t: (p: string) => string;
}; };
class DeleteRepositoryRole extends React.Component<Props> { class DeleteRepositoryRole extends React.Component<Props> {
@@ -96,4 +95,4 @@ const mapDispatchToProps = dispatch => {
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(withRouter(translate("admin")(DeleteRepositoryRole))); )(withRouter(withTranslation("admin")(DeleteRepositoryRole)));

View File

@@ -1,21 +1,21 @@
import React from "react"; import React from "react";
import RepositoryRoleForm from "./RepositoryRoleForm"; import RepositoryRoleForm from "./RepositoryRoleForm";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { getModifyRoleFailure, isModifyRolePending, modifyRole } from "../modules/roles"; import { getModifyRoleFailure, isModifyRolePending, modifyRole } from "../modules/roles";
import { ErrorNotification, Subtitle } from "@scm-manager/ui-components"; import { ErrorNotification, Subtitle, Loading } from "@scm-manager/ui-components";
import { RepositoryRole } from "@scm-manager/ui-types"; import { RepositoryRole } from "@scm-manager/ui-types";
import { History } from "history"; import { History } from "history";
import DeleteRepositoryRole from "./DeleteRepositoryRole"; import DeleteRepositoryRole from "./DeleteRepositoryRole";
type Props = { type Props = WithTranslation & {
disabled: boolean; disabled: boolean;
role: RepositoryRole; role: RepositoryRole;
repositoryRolesLink: string; repositoryRolesLink: string;
loading?: boolean;
error?: Error; error?: Error;
// context objects // context objects
t: (p: string) => string;
history: History; history: History;
//dispatch function //dispatch function
@@ -32,9 +32,11 @@ class EditRepositoryRole extends React.Component<Props> {
}; };
render() { render() {
const { error, t } = this.props; const { loading, error, t } = this.props;
if (error) { if (loading) {
return <Loading />;
} else if (error) {
return <ErrorNotification error={error} />; return <ErrorNotification error={error} />;
} }
@@ -70,4 +72,4 @@ const mapDispatchToProps = dispatch => {
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("admin")(EditRepositoryRole)); )(withTranslation("admin")(EditRepositoryRole));

View File

@@ -1,22 +1,19 @@
import React from "react"; import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { RepositoryRole } from "@scm-manager/ui-types"; import { RepositoryRole } from "@scm-manager/ui-types";
import { InputField, SubmitButton } from "@scm-manager/ui-components"; import { InputField, SubmitButton } from "@scm-manager/ui-components";
import PermissionCheckbox from "../../../repos/permissions/components/PermissionCheckbox";
import { fetchAvailableVerbs, getFetchVerbsFailure, getVerbsFromState, isFetchVerbsPending } from "../modules/roles";
import { getRepositoryRolesLink, getRepositoryVerbsLink } from "../../../modules/indexResource"; import { getRepositoryRolesLink, getRepositoryVerbsLink } from "../../../modules/indexResource";
import { fetchAvailableVerbs, getFetchVerbsFailure, getVerbsFromState, isFetchVerbsPending } from "../modules/roles";
import PermissionCheckbox from "../../../repos/permissions/components/PermissionCheckbox";
type Props = { type Props = WithTranslation & {
role?: RepositoryRole; role?: RepositoryRole;
loading?: boolean; loading?: boolean;
availableVerbs: string[]; availableVerbs: string[];
verbsLink: string; verbsLink: string;
submitForm: (p: RepositoryRole) => void; submitForm: (p: RepositoryRole) => void;
// context objects
t: (p: string) => string;
// dispatch functions // dispatch functions
fetchAvailableVerbs: (link: string) => void; fetchAvailableVerbs: (link: string) => void;
}; };
@@ -123,7 +120,7 @@ class RepositoryRoleForm extends React.Component<Props, State> {
} }
} }
const mapStateToProps = (state, ownProps) => { const mapStateToProps = (state) => {
const loading = isFetchVerbsPending(state); const loading = isFetchVerbsPending(state);
const error = getFetchVerbsFailure(state); const error = getFetchVerbsFailure(state);
const verbsLink = getRepositoryVerbsLink(state); const verbsLink = getRepositoryVerbsLink(state);
@@ -150,4 +147,4 @@ const mapDispatchToProps = dispatch => {
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("admin")(RepositoryRoleForm)); )(withTranslation("admin")(RepositoryRoleForm));

View File

@@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { withRouter } from "react-router-dom"; import { withRouter } from "react-router-dom";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { History } from "history"; import { History } from "history";
import { RepositoryRole, PagedCollection } from "@scm-manager/ui-types"; import { RepositoryRole, PagedCollection } from "@scm-manager/ui-types";
import { Title, Subtitle, Loading, Notification, LinkPaginator, urls, CreateButton } from "@scm-manager/ui-components"; import { Title, Subtitle, Loading, Notification, LinkPaginator, urls, CreateButton } from "@scm-manager/ui-components";
@@ -16,7 +16,7 @@ import {
import PermissionRoleTable from "../components/PermissionRoleTable"; import PermissionRoleTable from "../components/PermissionRoleTable";
import { getRepositoryRolesLink } from "../../../modules/indexResource"; import { getRepositoryRolesLink } from "../../../modules/indexResource";
type Props = { type Props = WithTranslation & {
baseUrl: string; baseUrl: string;
roles: RepositoryRole[]; roles: RepositoryRole[];
loading: boolean; loading: boolean;
@@ -27,7 +27,6 @@ type Props = {
rolesLink: string; rolesLink: string;
// context objects // context objects
t: (p: string) => string;
history: History; history: History;
location: any; location: any;
@@ -123,5 +122,5 @@ export default withRouter(
connect( connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("admin")(RepositoryRoles)) )(withTranslation("admin")(RepositoryRoles))
); );

View File

@@ -1,18 +1,17 @@
import React from "react"; import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Loading, ErrorPage, Title } from "@scm-manager/ui-components"; import { Route, withRouter } from "react-router-dom";
import { Route } from "react-router-dom"; import { WithTranslation, withTranslation } from "react-i18next";
import { History } from "history"; import { History } from "history";
import { translate } from "react-i18next";
import { RepositoryRole } from "@scm-manager/ui-types";
import { getRepositoryRolesLink } from "../../../modules/indexResource";
import { ExtensionPoint } from "@scm-manager/ui-extensions"; import { ExtensionPoint } from "@scm-manager/ui-extensions";
import { RepositoryRole } from "@scm-manager/ui-types";
import { Loading, ErrorPage, Title } from "@scm-manager/ui-components";
import { getRepositoryRolesLink } from "../../../modules/indexResource";
import { fetchRoleByName, getFetchRoleFailure, getRoleByName, isFetchRolePending } from "../modules/roles"; import { fetchRoleByName, getFetchRoleFailure, getRoleByName, isFetchRolePending } from "../modules/roles";
import { withRouter } from "react-router-dom";
import PermissionRoleDetail from "../components/PermissionRoleDetails"; import PermissionRoleDetail from "../components/PermissionRoleDetails";
import EditRepositoryRole from "./EditRepositoryRole"; import EditRepositoryRole from "./EditRepositoryRole";
type Props = { type Props = WithTranslation & {
roleName: string; roleName: string;
role: RepositoryRole; role: RepositoryRole;
loading: boolean; loading: boolean;
@@ -24,7 +23,6 @@ type Props = {
fetchRoleByName: (p1: string, p2: string) => void; fetchRoleByName: (p1: string, p2: string) => void;
// context objects // context objects
t: (p: string) => string;
match: any; match: any;
history: History; history: History;
}; };
@@ -107,5 +105,5 @@ export default withRouter(
connect( connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("admin")(SingleRepositoryRole)) )(withTranslation("admin")(SingleRepositoryRole))
); );

View File

@@ -1,16 +1,13 @@
import * as React from "react"; import * as React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import classNames from "classnames"; import classNames from "classnames";
import styled from "styled-components"; import styled from "styled-components";
import { InfoItem } from "./InfoItem"; import { InfoItem } from "./InfoItem";
import { Icon } from "@scm-manager/ui-components"; import { Icon } from "@scm-manager/ui-components";
type Props = { type Props = WithTranslation & {
type: "plugin" | "feature"; type: "plugin" | "feature";
item: InfoItem; item: InfoItem;
// context props
t: (p: string) => string;
}; };
const BottomMarginA = styled.a` const BottomMarginA = styled.a`
@@ -73,4 +70,4 @@ class InfoBox extends React.Component<Props> {
} }
} }
export default translate("commons")(InfoBox); export default withTranslation("commons")(InfoBox);

View File

@@ -1,15 +1,12 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import { Image, ErrorNotification, InputField, SubmitButton, UnauthorizedError } from "@scm-manager/ui-components"; import { Image, ErrorNotification, InputField, SubmitButton, UnauthorizedError } from "@scm-manager/ui-components";
type Props = { type Props = WithTranslation & {
error?: Error; error?: Error;
loading: boolean; loading: boolean;
loginHandler: (username: string, password: string) => void; loginHandler: (username: string, password: string) => void;
// context props
t: (p: string) => string;
}; };
type State = { type State = {
@@ -106,4 +103,4 @@ class LoginForm extends React.Component<Props, State> {
} }
} }
export default translate("commons")(LoginForm); export default withTranslation("commons")(LoginForm);

View File

@@ -1,10 +1,9 @@
import React, { Component } from "react"; import React, { Component } from "react";
import Main from "./Main"; import Main from "./Main";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { withRouter } from "react-router-dom"; import { withRouter } from "react-router-dom";
import { fetchMe, getFetchMeFailure, getMe, isAuthenticated, isFetchMePending } from "../modules/auth"; import { fetchMe, getFetchMeFailure, getMe, isAuthenticated, isFetchMePending } from "../modules/auth";
import { ErrorPage, Footer, Header, Loading, PrimaryNavigation } from "@scm-manager/ui-components"; import { ErrorPage, Footer, Header, Loading, PrimaryNavigation } from "@scm-manager/ui-components";
import { Links, Me } from "@scm-manager/ui-types"; import { Links, Me } from "@scm-manager/ui-types";
import { import {
@@ -14,7 +13,7 @@ import {
isFetchIndexResourcesPending isFetchIndexResourcesPending
} from "../modules/indexResource"; } from "../modules/indexResource";
type Props = { type Props = WithTranslation & {
me: Me; me: Me;
authenticated: boolean; authenticated: boolean;
error: Error; error: Error;
@@ -24,9 +23,6 @@ type Props = {
// dispatcher functions // dispatcher functions
fetchMe: (link: string) => void; fetchMe: (link: string) => void;
// context props
t: (p: string) => string;
}; };
class App extends Component<Props> { class App extends Component<Props> {
@@ -86,5 +82,5 @@ export default withRouter(
connect( connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("commons")(App)) )(withTranslation("commons")(App))
); );

View File

@@ -6,13 +6,12 @@ import {
PasswordConfirmation, PasswordConfirmation,
SubmitButton SubmitButton
} from "@scm-manager/ui-components"; } from "@scm-manager/ui-components";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Me } from "@scm-manager/ui-types"; import { Me } from "@scm-manager/ui-types";
import { changePassword } from "../modules/changePassword"; import { changePassword } from "../modules/changePassword";
type Props = { type Props = WithTranslation & {
me: Me; me: Me;
t: (p: string) => string;
}; };
type State = { type State = {
@@ -150,4 +149,4 @@ class ChangeUserPassword extends React.Component<Props, State> {
}; };
} }
export default translate("commons")(ChangeUserPassword); export default withTranslation("commons")(ChangeUserPassword);

View File

@@ -1,9 +1,8 @@
import React, { Component } from "react"; import React, { Component } from "react";
import App from "./App"; import App from "./App";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { withRouter } from "react-router-dom"; import { withRouter } from "react-router-dom";
import { Loading, ErrorBoundary } from "@scm-manager/ui-components"; import { Loading, ErrorBoundary } from "@scm-manager/ui-components";
import { import {
fetchIndexResources, fetchIndexResources,
@@ -16,16 +15,13 @@ import { IndexResources } from "@scm-manager/ui-types";
import ScrollToTop from "./ScrollToTop"; import ScrollToTop from "./ScrollToTop";
import IndexErrorPage from "./IndexErrorPage"; import IndexErrorPage from "./IndexErrorPage";
type Props = { type Props = WithTranslation & {
error: Error; error: Error;
loading: boolean; loading: boolean;
indexResources: IndexResources; indexResources: IndexResources;
// dispatcher functions // dispatcher functions
fetchIndexResources: () => void; fetchIndexResources: () => void;
// context props
t: (p: string) => string;
}; };
type State = { type State = {
@@ -93,5 +89,5 @@ export default withRouter(
connect( connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("commons")(Index)) )(withTranslation("commons")(Index))
); );

View File

@@ -1,10 +1,9 @@
import React from "react"; import React from "react";
import { translate, TFunction } from "react-i18next"; import { withTranslation, WithTranslation } from "react-i18next";
import { ErrorPage } from "@scm-manager/ui-components"; import { ErrorPage } from "@scm-manager/ui-components";
type Props = { type Props = WithTranslation & {
error: Error; error: Error;
t: TFunction;
}; };
class IndexErrorPage extends React.Component<Props> { class IndexErrorPage extends React.Component<Props> {
@@ -14,4 +13,4 @@ class IndexErrorPage extends React.Component<Props> {
} }
} }
export default translate("commons")(IndexErrorPage); export default withTranslation("commons")(IndexErrorPage);

View File

@@ -2,7 +2,6 @@ import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Redirect, withRouter } from "react-router-dom"; import { Redirect, withRouter } from "react-router-dom";
import { compose } from "redux"; import { compose } from "redux";
import { translate } from "react-i18next";
import styled from "styled-components"; import styled from "styled-components";
import { getLoginFailure, isAuthenticated, isLoginPending, login } from "../modules/auth"; import { getLoginFailure, isAuthenticated, isLoginPending, login } from "../modules/auth";
import { getLoginInfoLink, getLoginLink } from "../modules/indexResource"; import { getLoginInfoLink, getLoginLink } from "../modules/indexResource";
@@ -19,7 +18,6 @@ type Props = {
login: (link: string, username: string, password: string) => void; login: (link: string, username: string, password: string) => void;
// context props // context props
t: (p: string) => string;
from: any; from: any;
location: any; location: any;
}; };

View File

@@ -1,13 +1,13 @@
import React from "react"; import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Redirect } from "react-router-dom"; import { Redirect } from "react-router-dom";
import { logout, isAuthenticated, isLogoutPending, getLogoutFailure, isRedirecting } from "../modules/auth"; import { logout, isAuthenticated, isLogoutPending, getLogoutFailure, isRedirecting } from "../modules/auth";
import { Loading, ErrorPage } from "@scm-manager/ui-components"; import { Loading, ErrorPage } from "@scm-manager/ui-components";
import { getLogoutLink } from "../modules/indexResource"; import { getLogoutLink } from "../modules/indexResource";
type Props = { type Props = WithTranslation & {
authenticated: boolean; authenticated: boolean;
loading: boolean; loading: boolean;
redirecting: boolean; redirecting: boolean;
@@ -16,9 +16,6 @@ type Props = {
// dispatcher functions // dispatcher functions
logout: (link: string) => void; logout: (link: string) => void;
// context props
t: (p: string) => string;
}; };
class Logout extends React.Component<Props> { class Logout extends React.Component<Props> {
@@ -62,4 +59,4 @@ const mapDispatchToProps = dispatch => {
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("commons")(Logout)); )(withTranslation("commons")(Logout));

View File

@@ -1,21 +1,19 @@
import React from "react"; import React from "react";
import { Route, withRouter } from "react-router-dom"; import { Route, withRouter } from "react-router-dom";
import { getMe } from "../modules/auth"; import { getMe } from "../modules/auth";
import { compose } from "redux"; import { compose } from "redux";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Me } from "@scm-manager/ui-types"; import { Me } from "@scm-manager/ui-types";
import { ErrorPage, Page, Navigation, SubNavigation, Section, NavLink } from "@scm-manager/ui-components"; import { ErrorPage, Page, Navigation, SubNavigation, Section, NavLink } from "@scm-manager/ui-components";
import ChangeUserPassword from "./ChangeUserPassword"; import ChangeUserPassword from "./ChangeUserPassword";
import ProfileInfo from "./ProfileInfo"; import ProfileInfo from "./ProfileInfo";
import { ExtensionPoint } from "@scm-manager/ui-extensions"; import { ExtensionPoint } from "@scm-manager/ui-extensions";
type Props = { type Props = WithTranslation & {
me: Me; me: Me;
// Context props // Context props
t: (p: string) => string;
match: any; match: any;
}; };
type State = {}; type State = {};
@@ -87,7 +85,7 @@ const mapStateToProps = state => {
}; };
export default compose( export default compose(
translate("commons"), withTranslation("commons"),
connect(mapStateToProps), connect(mapStateToProps),
withRouter withRouter
)(Profile); )(Profile);

View File

@@ -1,13 +1,10 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Me } from "@scm-manager/ui-types"; import { Me } from "@scm-manager/ui-types";
import { MailLink, AvatarWrapper, AvatarImage } from "@scm-manager/ui-components"; import { MailLink, AvatarWrapper, AvatarImage } from "@scm-manager/ui-components";
type Props = { type Props = WithTranslation & {
me: Me; me: Me;
// Context props
t: (p: string) => string;
}; };
class ProfileInfo extends React.Component<Props> { class ProfileInfo extends React.Component<Props> {
@@ -69,4 +66,4 @@ class ProfileInfo extends React.Component<Props> {
} }
} }
export default translate("commons")(ProfileInfo); export default withTranslation("commons")(ProfileInfo);

View File

@@ -1,5 +1,6 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Group, SelectValue } from "@scm-manager/ui-types";
import { import {
Subtitle, Subtitle,
AutocompleteAddEntryToTableField, AutocompleteAddEntryToTableField,
@@ -9,12 +10,10 @@ import {
Textarea, Textarea,
Checkbox Checkbox
} from "@scm-manager/ui-components"; } from "@scm-manager/ui-components";
import { Group, SelectValue } from "@scm-manager/ui-types";
import * as validator from "./groupValidation"; import * as validator from "./groupValidation";
type Props = { type Props = WithTranslation & {
t: (p: string) => string;
submitForm: (p: Group) => void; submitForm: (p: Group) => void;
loading?: boolean; loading?: boolean;
group?: Group; group?: Group;
@@ -218,4 +217,4 @@ class GroupForm extends React.Component<Props, State> {
}; };
} }
export default translate("groups")(GroupForm); export default withTranslation("groups")(GroupForm);

View File

@@ -1,12 +1,11 @@
import React from "react"; import React from "react";
import { Group } from "@scm-manager/ui-types"; import { Group } from "@scm-manager/ui-types";
import { NavLink } from "@scm-manager/ui-components"; import { NavLink } from "@scm-manager/ui-components";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
type Props = { type Props = WithTranslation & {
group: Group; group: Group;
editUrl: string; editUrl: string;
t: (p: string) => string;
}; };
class EditGroupNavLink extends React.Component<Props> { class EditGroupNavLink extends React.Component<Props> {
@@ -24,4 +23,4 @@ class EditGroupNavLink extends React.Component<Props> {
} }
} }
export default translate("groups")(EditGroupNavLink); export default withTranslation("groups")(EditGroupNavLink);

View File

@@ -1,10 +1,9 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Group } from "@scm-manager/ui-types"; import { Group } from "@scm-manager/ui-types";
import { NavLink } from "@scm-manager/ui-components"; import { NavLink } from "@scm-manager/ui-components";
type Props = { type Props = WithTranslation & {
t: (p: string) => string;
group: Group; group: Group;
permissionsUrl: string; permissionsUrl: string;
}; };
@@ -24,4 +23,4 @@ class ChangePermissionNavLink extends React.Component<Props> {
}; };
} }
export default translate("groups")(ChangePermissionNavLink); export default withTranslation("groups")(ChangePermissionNavLink);

View File

@@ -1,14 +1,11 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Group } from "@scm-manager/ui-types"; import { Group } from "@scm-manager/ui-types";
import { DateFromNow, Checkbox } from "@scm-manager/ui-components"; import { DateFromNow, Checkbox } from "@scm-manager/ui-components";
import GroupMember from "./GroupMember"; import GroupMember from "./GroupMember";
type Props = { type Props = WithTranslation & {
group: Group; group: Group;
// Context props
t: (p: string) => string;
}; };
class Details extends React.Component<Props> { class Details extends React.Component<Props> {
@@ -75,4 +72,4 @@ class Details extends React.Component<Props> {
} }
} }
export default translate("groups")(Details); export default withTranslation("groups")(Details);

View File

@@ -1,14 +1,11 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { Group } from "@scm-manager/ui-types"; import { Group } from "@scm-manager/ui-types";
import { Icon } from "@scm-manager/ui-components"; import { Icon } from "@scm-manager/ui-components";
type Props = { type Props = WithTranslation & {
group: Group; group: Group;
// context props
t: (p: string) => string;
}; };
class GroupRow extends React.Component<Props> { class GroupRow extends React.Component<Props> {
@@ -36,4 +33,4 @@ class GroupRow extends React.Component<Props> {
} }
} }
export default translate("groups")(GroupRow); export default withTranslation("groups")(GroupRow);

View File

@@ -1,10 +1,9 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import GroupRow from "./GroupRow"; import GroupRow from "./GroupRow";
import { Group } from "@scm-manager/ui-types"; import { Group } from "@scm-manager/ui-types";
type Props = { type Props = WithTranslation & {
t: (p: string) => string;
groups: Group[]; groups: Group[];
}; };
@@ -29,4 +28,4 @@ class GroupTable extends React.Component<Props> {
} }
} }
export default translate("groups")(GroupTable); export default withTranslation("groups")(GroupTable);

View File

@@ -1,16 +1,14 @@
import React from "react"; import React from "react";
import { Page } from "@scm-manager/ui-components";
import { translate } from "react-i18next";
import GroupForm from "../components/GroupForm";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { createGroup, isCreateGroupPending, getCreateGroupFailure, createGroupReset } from "../modules/groups"; import { WithTranslation, withTranslation } from "react-i18next";
import { Group } from "@scm-manager/ui-types";
import { History } from "history"; import { History } from "history";
import { Group } from "@scm-manager/ui-types";
import { Page } from "@scm-manager/ui-components";
import { getGroupsLink, getUserAutoCompleteLink } from "../../modules/indexResource"; import { getGroupsLink, getUserAutoCompleteLink } from "../../modules/indexResource";
import { createGroup, isCreateGroupPending, getCreateGroupFailure, createGroupReset } from "../modules/groups";
import GroupForm from "../components/GroupForm";
type Props = { type Props = WithTranslation & {
t: (p: string) => string;
createGroup: (link: string, group: Group, callback?: () => void) => void; createGroup: (link: string, group: Group, callback?: () => void) => void;
history: History; history: History;
loading?: boolean; loading?: boolean;
@@ -20,9 +18,7 @@ type Props = {
autocompleteLink: string; autocompleteLink: string;
}; };
type State = {}; class CreateGroup extends React.Component<Props> {
class CreateGroup extends React.Component<Props, State> {
componentDidMount() { componentDidMount() {
this.props.resetForm(); this.props.resetForm();
} }
@@ -88,4 +84,4 @@ const mapStateToProps = state => {
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("groups")(CreateGroup)); )(withTranslation("groups")(CreateGroup));

View File

@@ -1,13 +1,13 @@
import React from "react"; 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 { Group } from "@scm-manager/ui-types"; import { Group } from "@scm-manager/ui-types";
import { Subtitle, DeleteButton, confirmAlert, ErrorNotification } from "@scm-manager/ui-components"; import { Subtitle, DeleteButton, confirmAlert, ErrorNotification } from "@scm-manager/ui-components";
import { deleteGroup, getDeleteGroupFailure, isDeleteGroupPending } from "../modules/groups"; import { deleteGroup, getDeleteGroupFailure, isDeleteGroupPending } from "../modules/groups";
import { connect } from "react-redux";
import { withRouter } from "react-router-dom";
import { History } from "history";
type Props = { type Props = WithTranslation & {
loading: boolean; loading: boolean;
error: Error; error: Error;
group: Group; group: Group;
@@ -16,7 +16,6 @@ type Props = {
// context props // context props
history: History; history: History;
t: (p: string) => string;
}; };
export class DeleteGroup extends React.Component<Props> { export class DeleteGroup extends React.Component<Props> {
@@ -96,4 +95,4 @@ const mapDispatchToProps = dispatch => {
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(withRouter(translate("groups")(DeleteGroup))); )(withRouter(withTranslation("groups")(DeleteGroup)));

View File

@@ -1,16 +1,8 @@
import React from "react"; import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { History } from "history"; import { History } from "history";
import { Group, PagedCollection } from "@scm-manager/ui-types"; import { Group, PagedCollection } from "@scm-manager/ui-types";
import {
fetchGroupsByPage,
getGroupsFromState,
isFetchGroupsPending,
getFetchGroupsFailure,
isPermittedToCreateGroups,
selectListAsCollection
} from "../modules/groups";
import { import {
Page, Page,
PageActions, PageActions,
@@ -20,10 +12,18 @@ import {
urls, urls,
CreateButton CreateButton
} from "@scm-manager/ui-components"; } from "@scm-manager/ui-components";
import { GroupTable } from "./../components/table";
import { getGroupsLink } from "../../modules/indexResource"; import { getGroupsLink } from "../../modules/indexResource";
import {
fetchGroupsByPage,
getGroupsFromState,
isFetchGroupsPending,
getFetchGroupsFailure,
isPermittedToCreateGroups,
selectListAsCollection
} from "../modules/groups";
import { GroupTable } from "./../components/table";
type Props = { type Props = WithTranslation & {
groups: Group[]; groups: Group[];
loading: boolean; loading: boolean;
error: Error; error: Error;
@@ -33,7 +33,6 @@ type Props = {
groupLink: string; groupLink: string;
// context objects // context objects
t: (p: string) => string;
history: History; history: History;
location: any; location: any;
@@ -124,4 +123,4 @@ const mapDispatchToProps = dispatch => {
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("groups")(Groups)); )(withTranslation("groups")(Groups));

View File

@@ -1,20 +1,19 @@
import React from "react"; import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Page, ErrorPage, Loading, Navigation, SubNavigation, Section, NavLink } from "@scm-manager/ui-components";
import { Route } from "react-router-dom"; import { Route } from "react-router-dom";
import { WithTranslation, withTranslation } from "react-i18next";
import { History } from "history";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
import { Group } from "@scm-manager/ui-types";
import { Page, ErrorPage, Loading, Navigation, SubNavigation, Section, NavLink } from "@scm-manager/ui-components";
import { getGroupsLink } from "../../modules/indexResource";
import { fetchGroupByName, getGroupByName, isFetchGroupPending, getFetchGroupFailure } from "../modules/groups";
import { Details } from "./../components/table"; import { Details } from "./../components/table";
import { EditGroupNavLink, SetPermissionsNavLink } from "./../components/navLinks"; import { EditGroupNavLink, SetPermissionsNavLink } from "./../components/navLinks";
import { Group } from "@scm-manager/ui-types";
import { History } from "history";
import { fetchGroupByName, getGroupByName, isFetchGroupPending, getFetchGroupFailure } from "../modules/groups";
import { translate } from "react-i18next";
import EditGroup from "./EditGroup"; import EditGroup from "./EditGroup";
import { getGroupsLink } from "../../modules/indexResource";
import SetPermissions from "../../permissions/components/SetPermissions"; import SetPermissions from "../../permissions/components/SetPermissions";
import { ExtensionPoint } from "@scm-manager/ui-extensions";
type Props = { type Props = WithTranslation & {
name: string; name: string;
group: Group; group: Group;
loading: boolean; loading: boolean;
@@ -25,7 +24,6 @@ type Props = {
fetchGroupByName: (p1: string, p2: string) => void; fetchGroupByName: (p1: string, p2: string) => void;
// context objects // context objects
t: (p: string) => string;
match: any; match: any;
history: History; history: History;
}; };
@@ -123,4 +121,4 @@ const mapDispatchToProps = dispatch => {
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps mapDispatchToProps
)(translate("groups")(SingleGroup)); )(withTranslation("groups")(SingleGroup));

View File

@@ -1,7 +1,8 @@
import i18n from "i18next"; import i18n from "i18next";
// @ts-ignore
import Backend from "i18next-fetch-backend"; import Backend from "i18next-fetch-backend";
import LanguageDetector from "i18next-browser-languagedetector"; import LanguageDetector from "i18next-browser-languagedetector";
import { reactI18nextModule } from "react-i18next"; import { initReactI18next } from "react-i18next";
import { urls } from "@scm-manager/ui-components"; import { urls } from "@scm-manager/ui-components";
const loadPath = urls.withContextPath("/locales/{{lng}}/{{ns}}.json"); const loadPath = urls.withContextPath("/locales/{{lng}}/{{ns}}.json");
@@ -11,7 +12,7 @@ const loadPath = urls.withContextPath("/locales/{{lng}}/{{ns}}.json");
i18n i18n
.use(Backend) .use(Backend)
.use(LanguageDetector) .use(LanguageDetector)
.use(reactI18nextModule) .use(initReactI18next)
.init({ .init({
fallbackLng: "en", fallbackLng: "en",
@@ -29,7 +30,8 @@ i18n
}, },
react: { react: {
wait: true wait: true,
useSuspense: false
}, },
backend: { backend: {

View File

@@ -1,13 +1,12 @@
import React from "react"; import React from "react";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import { Checkbox } from "@scm-manager/ui-components"; import { Checkbox } from "@scm-manager/ui-components";
type Props = { type Props = WithTranslation & {
permission: string; permission: string;
checked: boolean; checked: boolean;
onChange: (value: boolean, name: string) => void; onChange: (value: boolean, name: string) => void;
disabled: boolean; disabled: boolean;
t: (p: string) => string;
}; };
class PermissionCheckbox extends React.Component<Props> { class PermissionCheckbox extends React.Component<Props> {
@@ -36,4 +35,4 @@ class PermissionCheckbox extends React.Component<Props> {
}; };
} }
export default translate("plugins")(PermissionCheckbox); export default withTranslation("plugins")(PermissionCheckbox);

View File

@@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import classNames from "classnames"; import classNames from "classnames";
import styled from "styled-components"; import styled from "styled-components";
import { Link } from "@scm-manager/ui-types"; import { Link } from "@scm-manager/ui-types";
@@ -9,12 +9,9 @@ import { getLink } from "../../modules/indexResource";
import { loadPermissionsForEntity, setPermissions } from "./handlePermissions"; import { loadPermissionsForEntity, setPermissions } from "./handlePermissions";
import PermissionCheckbox from "./PermissionCheckbox"; import PermissionCheckbox from "./PermissionCheckbox";
type Props = { type Props = WithTranslation & {
availablePermissionLink: string; availablePermissionLink: string;
selectedPermissionsLink: Link; selectedPermissionsLink: Link;
// context props
t: (p: string) => string;
}; };
type State = { type State = {
@@ -189,4 +186,4 @@ const mapStateToProps = state => {
}; };
}; };
export default connect(mapStateToProps)(translate("permissions")(SetPermissions)); export default connect(mapStateToProps)(withTranslation("permissions")(SetPermissions));

View File

@@ -1,14 +1,11 @@
import React from "react"; import React from "react";
import { WithTranslation, withTranslation } from "react-i18next";
import { Repository, Branch } from "@scm-manager/ui-types"; import { Repository, Branch } from "@scm-manager/ui-types";
import { ButtonAddons, Button } from "@scm-manager/ui-components"; import { ButtonAddons, Button } from "@scm-manager/ui-components";
import { translate } from "react-i18next";
type Props = { type Props = WithTranslation & {
repository: Repository; repository: Repository;
branch: Branch; branch: Branch;
// context props
t: (p: string) => string;
}; };
class BranchButtonGroup extends React.Component<Props> { class BranchButtonGroup extends React.Component<Props> {
@@ -29,4 +26,4 @@ class BranchButtonGroup extends React.Component<Props> {
} }
} }
export default translate("repos")(BranchButtonGroup); export default withTranslation("repos")(BranchButtonGroup);

View File

@@ -1,14 +1,12 @@
import React from "react"; import React from "react";
import { Repository, Branch } from "@scm-manager/ui-types"; import { Repository, Branch } from "@scm-manager/ui-types";
import { translate } from "react-i18next"; import { WithTranslation, withTranslation } from "react-i18next";
import BranchButtonGroup from "./BranchButtonGroup"; import BranchButtonGroup from "./BranchButtonGroup";
import DefaultBranchTag from "./DefaultBranchTag"; import DefaultBranchTag from "./DefaultBranchTag";
type Props = { type Props = WithTranslation & {
repository: Repository; repository: Repository;
branch: Branch; branch: Branch;
// context props
t: (p: string) => string;
}; };
class BranchDetail extends React.Component<Props> { class BranchDetail extends React.Component<Props> {
@@ -28,4 +26,4 @@ class BranchDetail extends React.Component<Props> {
} }
} }
export default translate("repos")(BranchDetail); export default withTranslation("repos")(BranchDetail);

Some files were not shown because too many files have changed in this diff Show More