Merge branch 'feature/mobx' of github.com:ONLYOFFICE/AppServer into feature/mobx
This commit is contained in:
commit
697c6fc8b8
@ -143,8 +143,8 @@ server {
|
||||
proxy_pass http://localhost:5002;
|
||||
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
||||
|
||||
location ~* /(sockjs-node|locales) {
|
||||
rewrite products/people(.*)/(sockjs-node|locales)/(.*) /$2/$3 break;
|
||||
location ~* /(sockjs-node) {
|
||||
rewrite products/people(.*)/(sockjs-node)/(.*) /$2/$3 break;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
@ -158,6 +158,19 @@ server {
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
location ~* /locales {
|
||||
proxy_pass http://localhost:5002;
|
||||
proxy_redirect off;
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) {
|
||||
root $public_root;
|
||||
try_files /$basename /index.html =404;
|
||||
@ -169,8 +182,8 @@ server {
|
||||
proxy_pass http://localhost:5008;
|
||||
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
||||
|
||||
location ~* /(sockjs-node|locales) {
|
||||
rewrite products/files(.*)/(sockjs-node|locales)/(.*) /$2/$3 break;
|
||||
location ~* /sockjs-node {
|
||||
rewrite products/files(.*)/sockjs-node/(.*) /$2/$3 break;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
@ -184,6 +197,19 @@ server {
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
location ~* /locales {
|
||||
proxy_pass http://localhost:5008;
|
||||
proxy_redirect off;
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) {
|
||||
root $public_root;
|
||||
try_files /$basename /index.html =404;
|
||||
|
@ -1,42 +0,0 @@
|
||||
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
||||
const path = require("path");
|
||||
module.exports = (config) => {
|
||||
config.plugins.push(
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
from: path.join(
|
||||
"src",
|
||||
path.sep,
|
||||
"components",
|
||||
path.sep,
|
||||
"**",
|
||||
path.sep,
|
||||
"locales",
|
||||
path.sep,
|
||||
"**"
|
||||
),
|
||||
to: "locales",
|
||||
transformPath(targetPath) {
|
||||
const reversedArrayOfFolders = path
|
||||
.dirname(targetPath)
|
||||
.split(path.sep)
|
||||
.reverse();
|
||||
const localePath = reversedArrayOfFolders.pop();
|
||||
const finalPath = path.join(
|
||||
path.sep,
|
||||
localePath,
|
||||
path.sep,
|
||||
reversedArrayOfFolders[2],
|
||||
path.sep,
|
||||
reversedArrayOfFolders[0],
|
||||
path.sep,
|
||||
path.basename(targetPath)
|
||||
);
|
||||
return finalPath;
|
||||
},
|
||||
},
|
||||
])
|
||||
);
|
||||
|
||||
return config;
|
||||
};
|
@ -12,8 +12,7 @@
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"history": "4.10.1",
|
||||
"i18next": "19.0.3",
|
||||
"i18next-browser-languagedetector": "4.0.1",
|
||||
"i18next-xhr-backend": "3.2.2",
|
||||
"i18next-http-backend": "^1.1.0",
|
||||
"lodash": "4.17.19",
|
||||
"lodash-es": "4.17.15",
|
||||
"merge": "^1.2.1",
|
||||
@ -37,7 +36,6 @@
|
||||
"copy-webpack-plugin": "^5.1.2",
|
||||
"cross-env": "^6.0.3",
|
||||
"prettier": "2.1.2",
|
||||
"react-app-rewired": "^2.1.8",
|
||||
"react-scripts": "4.0.1",
|
||||
"rimraf": "3.0.2",
|
||||
"webpack-bundle-analyzer": "^3.9.0",
|
||||
@ -48,11 +46,11 @@
|
||||
},
|
||||
"scripts": {
|
||||
"analyse": "node analyse.js",
|
||||
"start": "react-app-rewired start",
|
||||
"build": "rimraf ./build && react-app-rewired build && npm run build-sw && npm run clean-cra-sw",
|
||||
"start": "react-scripts start",
|
||||
"build": "rimraf ./build && react-scripts build && npm run build-sw && npm run clean-cra-sw",
|
||||
"build-sw": "node ./src/sw-build.js",
|
||||
"clean-cra-sw": "rm -f build/precache-manifest.*.js && rm -f build/service-worker.js",
|
||||
"test": "cross-env CI=true react-app-rewired test --env=jsdom",
|
||||
"test": "cross-env CI=true react-scripts test --env=jsdom",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"browserslist": {
|
||||
|
@ -5,6 +5,7 @@ import DocEditor from "./components/pages/DocEditor";
|
||||
import Settings from "./components/pages/Settings";
|
||||
import VersionHistory from "./components/pages/VersionHistory";
|
||||
import config from "../package.json";
|
||||
import "./i18n";
|
||||
|
||||
import {
|
||||
history,
|
||||
|
@ -1,18 +1,11 @@
|
||||
import React, { useEffect } from "react";
|
||||
import React from "react";
|
||||
import styled from "styled-components";
|
||||
import { Link } from "asc-web-components";
|
||||
import { history, utils } from "asc-web-common";
|
||||
import { withTranslation, I18nextProvider } from "react-i18next";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import { history } from "asc-web-common";
|
||||
import { withTranslation } from "react-i18next";
|
||||
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
const { changeLanguage } = utils;
|
||||
|
||||
const i18n = createI18N({
|
||||
page: "Article",
|
||||
localesPath: "Article",
|
||||
});
|
||||
|
||||
const StyledThirdParty = styled.div`
|
||||
margin-top: 42px;
|
||||
|
||||
@ -203,18 +196,7 @@ const PureThirdPartyListContainer = ({
|
||||
);
|
||||
};
|
||||
|
||||
const ThirdPartyListContainer = withTranslation()(PureThirdPartyListContainer);
|
||||
|
||||
const ThirdPartyList = (props) => {
|
||||
useEffect(() => {
|
||||
changeLanguage(i18n);
|
||||
}, []);
|
||||
return (
|
||||
<I18nextProvider i18n={i18n}>
|
||||
<ThirdPartyListContainer {...props} />
|
||||
</I18nextProvider>
|
||||
);
|
||||
};
|
||||
const ThirdPartyList = withTranslation("Article")(PureThirdPartyListContainer);
|
||||
|
||||
export default inject(
|
||||
({
|
||||
|
@ -2,18 +2,10 @@ import React, { useEffect } from "react";
|
||||
import { withRouter } from "react-router";
|
||||
import { TreeMenu, TreeNode, Icons } from "asc-web-components";
|
||||
import styled from "styled-components";
|
||||
import { history, utils } from "asc-web-common";
|
||||
import { withTranslation, I18nextProvider } from "react-i18next";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import { history } from "asc-web-common";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
const i18n = createI18N({
|
||||
page: "Settings",
|
||||
localesPath: "pages/Settings",
|
||||
});
|
||||
|
||||
const { changeLanguage } = utils;
|
||||
|
||||
const StyledTreeMenu = styled(TreeMenu)`
|
||||
margin-top: 18px !important;
|
||||
@media (max-width: 1024px) {
|
||||
@ -175,18 +167,7 @@ const PureTreeSettings = ({
|
||||
);
|
||||
};
|
||||
|
||||
const TreeSettingsContainer = withTranslation()(PureTreeSettings);
|
||||
|
||||
const TreeSettings = (props) => {
|
||||
useEffect(() => {
|
||||
changeLanguage(i18n);
|
||||
}, []);
|
||||
return (
|
||||
<I18nextProvider i18n={i18n}>
|
||||
<TreeSettingsContainer {...props} />
|
||||
</I18nextProvider>
|
||||
);
|
||||
};
|
||||
const TreeSettings = withTranslation("Settings")(PureTreeSettings);
|
||||
|
||||
export default inject(
|
||||
({
|
||||
|
@ -1,20 +1,13 @@
|
||||
import React, { useEffect } from "react";
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { withRouter } from "react-router";
|
||||
import { MainButton, DropDownItem } from "asc-web-components";
|
||||
import { withTranslation, I18nextProvider } from "react-i18next";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { isMobile } from "react-device-detect";
|
||||
import { utils as commonUtils, constants, Loaders } from "asc-web-common";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import { constants, Loaders } from "asc-web-common";
|
||||
import { encryptionUploadDialog } from "../../../helpers/desktop";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
const i18n = createI18N({
|
||||
page: "Article",
|
||||
localesPath: "Article",
|
||||
});
|
||||
|
||||
const { changeLanguage } = commonUtils;
|
||||
const { FileAction } = constants;
|
||||
|
||||
class PureArticleMainButtonContent extends React.Component {
|
||||
@ -146,21 +139,10 @@ class PureArticleMainButtonContent extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const ArticleMainButtonContentContainer = withTranslation()(
|
||||
const ArticleMainButtonContent = withTranslation("Article")(
|
||||
PureArticleMainButtonContent
|
||||
);
|
||||
|
||||
const ArticleMainButtonContent = (props) => {
|
||||
useEffect(() => {
|
||||
changeLanguage(i18n);
|
||||
}, []);
|
||||
return (
|
||||
<I18nextProvider i18n={i18n}>
|
||||
<ArticleMainButtonContentContainer {...props} />
|
||||
</I18nextProvider>
|
||||
);
|
||||
};
|
||||
|
||||
ArticleMainButtonContent.propTypes = {
|
||||
history: PropTypes.object.isRequired,
|
||||
};
|
||||
|
@ -8,19 +8,10 @@ import {
|
||||
FieldContainer,
|
||||
toastr,
|
||||
} from "asc-web-components";
|
||||
import { utils as commonUtils } from "asc-web-common";
|
||||
import { loopTreeFolders } from "../../../helpers/files-helpers";
|
||||
import { withTranslation, I18nextProvider } from "react-i18next";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
const i18n = createI18N({
|
||||
page: "ConnectDialog",
|
||||
localesPath: "dialogs/ConnectDialog",
|
||||
});
|
||||
|
||||
const { changeLanguage } = commonUtils;
|
||||
|
||||
const PureConnectDialogContainer = (props) => {
|
||||
const {
|
||||
visible,
|
||||
@ -321,18 +312,9 @@ const PureConnectDialogContainer = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
const ConnectDialogContainer = withTranslation()(PureConnectDialogContainer);
|
||||
|
||||
const ConnectDialog = (props) => {
|
||||
useEffect(() => {
|
||||
changeLanguage(i18n);
|
||||
}, []);
|
||||
return (
|
||||
<I18nextProvider i18n={i18n}>
|
||||
<ConnectDialogContainer {...props} />
|
||||
</I18nextProvider>
|
||||
);
|
||||
};
|
||||
const ConnectDialog = withTranslation("ConnectDialog")(
|
||||
PureConnectDialogContainer
|
||||
);
|
||||
|
||||
export default inject(
|
||||
({ filesStore, settingsStore, treeFoldersStore, selectedFolderStore }) => {
|
||||
|
@ -3,20 +3,11 @@ import { withRouter } from "react-router";
|
||||
import ModalDialogContainer from "../ModalDialogContainer";
|
||||
import { ModalDialog, Button, Text, Checkbox } from "asc-web-components";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { utils } from "asc-web-common";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import { inject, observer } from "mobx-react";
|
||||
const i18n = createI18N({
|
||||
page: "ConvertDialog",
|
||||
localesPath: "dialogs/ConvertDialog",
|
||||
});
|
||||
|
||||
const { changeLanguage } = utils;
|
||||
|
||||
class ConvertDialogComponent extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
changeLanguage(i18n);
|
||||
|
||||
this.state = {
|
||||
saveOriginalFormat: true,
|
||||
@ -29,22 +20,6 @@ class ConvertDialogComponent extends React.Component {
|
||||
onChangeMessageVisible = () =>
|
||||
this.setState({ hideMessage: !this.state.hideMessage });
|
||||
|
||||
// shouldComponentUpdate(nextProps, nextState) {
|
||||
// if (this.props.visible !== nextProps.visible) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// if (this.state.saveOriginalFormat !== nextState.saveOriginalFormat) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// if (this.state.hideMessage !== nextState.hideMessage) {
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// return false;
|
||||
// }
|
||||
|
||||
onConvert = () => this.props.convertUploadedFiles(this.props.t);
|
||||
onClose = () => this.props.setDialogVisible(this.props.t);
|
||||
|
||||
@ -105,13 +80,7 @@ class ConvertDialogComponent extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const ModalDialogContainerTranslated = withTranslation()(
|
||||
ConvertDialogComponent
|
||||
);
|
||||
|
||||
const ConvertDialog = (props) => (
|
||||
<ModalDialogContainerTranslated i18n={i18n} {...props} />
|
||||
);
|
||||
const ConvertDialog = withTranslation("ConvertDialog")(ConvertDialogComponent);
|
||||
|
||||
export default inject(({ uploadDataStore, treeFoldersStore }) => {
|
||||
const { setTreeFolders } = treeFoldersStore;
|
||||
|
@ -9,18 +9,12 @@ import {
|
||||
Scrollbar,
|
||||
} from "asc-web-components";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { api, utils, toastr } from "asc-web-common";
|
||||
import { api, toastr } from "asc-web-common";
|
||||
import { TIMEOUT } from "../../../helpers/constants";
|
||||
import { loopTreeFolders } from "../../../helpers/files-helpers";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import { inject, observer } from "mobx-react";
|
||||
const i18n = createI18N({
|
||||
page: "DeleteDialog",
|
||||
localesPath: "dialogs/DeleteDialog",
|
||||
});
|
||||
|
||||
const { files } = api;
|
||||
const { changeLanguage } = utils;
|
||||
|
||||
class DeleteDialogComponent extends React.Component {
|
||||
constructor(props) {
|
||||
@ -48,7 +42,6 @@ class DeleteDialogComponent extends React.Component {
|
||||
}
|
||||
i++;
|
||||
}
|
||||
changeLanguage(i18n);
|
||||
|
||||
this.state = { foldersList, filesList, selection };
|
||||
}
|
||||
@ -277,11 +270,7 @@ class DeleteDialogComponent extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const ModalDialogContainerTranslated = withTranslation()(DeleteDialogComponent);
|
||||
|
||||
const DeleteDialog = (props) => (
|
||||
<ModalDialogContainerTranslated i18n={i18n} {...props} />
|
||||
);
|
||||
const DeleteDialog = withTranslation("DeleteDialog")(DeleteDialogComponent);
|
||||
|
||||
export default inject(
|
||||
({
|
||||
|
@ -2,23 +2,11 @@ import React from "react";
|
||||
import { withRouter } from "react-router";
|
||||
import { ModalDialog, Button } from "asc-web-components";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { utils, toastr, api } from "asc-web-common";
|
||||
import { toastr, api } from "asc-web-common";
|
||||
import { loopTreeFolders } from "../../../helpers/files-helpers";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import { inject, observer } from "mobx-react";
|
||||
const i18n = createI18N({
|
||||
page: "DeleteThirdPartyDialog",
|
||||
localesPath: "dialogs/DeleteThirdPartyDialog",
|
||||
});
|
||||
|
||||
const { changeLanguage } = utils;
|
||||
|
||||
class DeleteThirdPartyDialogComponent extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
changeLanguage(i18n);
|
||||
}
|
||||
|
||||
updateTree = (path, folders) => {
|
||||
const { t, treeFolders, removeItem, setTreeFolders } = this.props;
|
||||
|
||||
@ -89,14 +77,10 @@ class DeleteThirdPartyDialogComponent extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const ModalDialogContainerTranslated = withTranslation()(
|
||||
const DeleteThirdPartyDialog = withTranslation("DeleteThirdPartyDialog")(
|
||||
DeleteThirdPartyDialogComponent
|
||||
);
|
||||
|
||||
const DeleteThirdPartyDialog = (props) => (
|
||||
<ModalDialogContainerTranslated i18n={i18n} {...props} />
|
||||
);
|
||||
|
||||
export default inject(
|
||||
({ filesStore, thirdParty, treeFoldersStore, selectedFolderStore }) => {
|
||||
const { providers, setThirdPartyProviders, deleteThirdParty } = thirdParty;
|
||||
|
@ -11,17 +11,10 @@ import {
|
||||
} from "asc-web-components";
|
||||
import { ReactSVG } from "react-svg";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { utils, api } from "asc-web-common";
|
||||
import { api } from "asc-web-common";
|
||||
import { TIMEOUT } from "../../../helpers/constants";
|
||||
import DownloadContent from "./DownloadContent";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import { inject, observer } from "mobx-react";
|
||||
const i18n = createI18N({
|
||||
page: "DownloadDialog",
|
||||
localesPath: "dialogs/DownloadDialog",
|
||||
});
|
||||
|
||||
const { changeLanguage } = utils;
|
||||
|
||||
const formatKeys = Object.freeze({
|
||||
OriginalFormat: 0,
|
||||
@ -42,8 +35,6 @@ class DownloadDialogComponent extends React.Component {
|
||||
super(props);
|
||||
const { sortedFiles } = this.props;
|
||||
|
||||
changeLanguage(i18n);
|
||||
|
||||
this.state = {
|
||||
documents: sortedFiles.documents,
|
||||
spreadsheets: sortedFiles.spreadsheets,
|
||||
@ -586,14 +577,10 @@ class DownloadDialogComponent extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const ModalDialogContainerTranslated = withTranslation()(
|
||||
const DownloadDialog = withTranslation("DownloadDialog")(
|
||||
DownloadDialogComponent
|
||||
);
|
||||
|
||||
const DownloadDialog = (props) => (
|
||||
<ModalDialogContainerTranslated i18n={i18n} {...props} />
|
||||
);
|
||||
|
||||
export default inject(({ filesStore, uploadDataStore, formatsStore }) => {
|
||||
const { secondaryProgressDataStore } = uploadDataStore;
|
||||
const { sortedFiles } = filesStore;
|
||||
|
@ -1,20 +1,13 @@
|
||||
import React, { useCallback, useEffect } from "react";
|
||||
import React, { useCallback } from "react";
|
||||
import { withRouter } from "react-router";
|
||||
import ModalDialogContainer from "../ModalDialogContainer";
|
||||
import { ModalDialog, Button, Text } from "asc-web-components";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { api, utils, toastr } from "asc-web-common";
|
||||
import { api, toastr } from "asc-web-common";
|
||||
import { TIMEOUT } from "../../../helpers/constants";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
const i18n = createI18N({
|
||||
page: "EmptyTrashDialog",
|
||||
localesPath: "dialogs/EmptyTrashDialog",
|
||||
});
|
||||
|
||||
const { files } = api;
|
||||
const { changeLanguage } = utils;
|
||||
|
||||
const EmptyTrashDialogComponent = (props) => {
|
||||
const {
|
||||
@ -29,10 +22,6 @@ const EmptyTrashDialogComponent = (props) => {
|
||||
fetchFiles,
|
||||
} = props;
|
||||
|
||||
useEffect(() => {
|
||||
changeLanguage(i18n);
|
||||
}, []);
|
||||
|
||||
const loopEmptyTrash = useCallback(
|
||||
(id) => {
|
||||
const successMessage = "Success empty recycle bin";
|
||||
@ -155,14 +144,10 @@ const EmptyTrashDialogComponent = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
const ModalDialogContainerTranslated = withTranslation()(
|
||||
const EmptyTrashDialog = withTranslation("EmptyTrashDialog")(
|
||||
EmptyTrashDialogComponent
|
||||
);
|
||||
|
||||
const EmptyTrashDialog = (props) => (
|
||||
<ModalDialogContainerTranslated i18n={i18n} {...props} />
|
||||
);
|
||||
|
||||
export default inject(
|
||||
({ initFilesStore, filesStore, uploadDataStore, selectedFolderStore }) => {
|
||||
const { isLoading } = initFilesStore;
|
||||
|
@ -1,16 +1,7 @@
|
||||
import React, { useEffect } from "react";
|
||||
import React from "react";
|
||||
import styled from "styled-components";
|
||||
import { ModalDialog, Text, Button } from "asc-web-components";
|
||||
import { utils } from "asc-web-common";
|
||||
import { withTranslation, I18nextProvider } from "react-i18next";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
|
||||
const { changeLanguage } = utils;
|
||||
|
||||
const i18n = createI18N({
|
||||
page: "ThirdPartyMoveDialog",
|
||||
localesPath: "dialogs/ThirdPartyMoveDialog",
|
||||
});
|
||||
import { withTranslation } from "react-i18next";
|
||||
|
||||
const StyledOperationDialog = styled.div`
|
||||
.operation-button {
|
||||
@ -64,17 +55,6 @@ const PureThirdPartyMoveContainer = ({
|
||||
);
|
||||
};
|
||||
|
||||
const ThirdPartyMoveContainer = withTranslation()(PureThirdPartyMoveContainer);
|
||||
|
||||
const ThirdPartyMoveDialog = (props) => {
|
||||
useEffect(() => {
|
||||
changeLanguage(i18n);
|
||||
}, []);
|
||||
return (
|
||||
<I18nextProvider i18n={i18n}>
|
||||
<ThirdPartyMoveContainer {...props} />
|
||||
</I18nextProvider>
|
||||
);
|
||||
};
|
||||
|
||||
export default ThirdPartyMoveDialog;
|
||||
export default withTranslation("ThirdPartyMoveDialog")(
|
||||
PureThirdPartyMoveContainer
|
||||
);
|
||||
|
@ -140,7 +140,6 @@ class FilesRowContent extends React.PureComponent {
|
||||
isPrivacy,
|
||||
isDesktop,
|
||||
replaceFileStream,
|
||||
i18n,
|
||||
t,
|
||||
setEncryptionAccess,
|
||||
createFolder,
|
||||
@ -166,7 +165,7 @@ class FilesRowContent extends React.PureComponent {
|
||||
.then(() => this.completeAction(itemId))
|
||||
.then(() =>
|
||||
toastr.success(
|
||||
<Trans i18nKey="FolderCreated" i18n={i18n}>
|
||||
<Trans i18nKey="FolderCreated" ns="Home">
|
||||
New folder {{ itemTitle }} is created
|
||||
</Trans>
|
||||
)
|
||||
@ -197,7 +196,7 @@ class FilesRowContent extends React.PureComponent {
|
||||
.then(() => {
|
||||
const exst = item.fileExst;
|
||||
return toastr.success(
|
||||
<Trans i18nKey="FileCreated" i18n={i18n}>
|
||||
<Trans i18nKey="FileCreated" ns="Home">
|
||||
New file {{ itemTitle }}.{{ exst }} is created
|
||||
</Trans>
|
||||
);
|
||||
@ -728,7 +727,7 @@ export default inject(
|
||||
formatsStore,
|
||||
uploadDataStore,
|
||||
treeFoldersStore,
|
||||
selectedFolderStore
|
||||
selectedFolderStore,
|
||||
},
|
||||
{ item }
|
||||
) => {
|
||||
@ -820,4 +819,4 @@ export default inject(
|
||||
addExpandedKeys,
|
||||
};
|
||||
}
|
||||
)(withRouter(withTranslation()(observer(FilesRowContent))));
|
||||
)(withRouter(withTranslation("Home")(observer(FilesRowContent))));
|
||||
|
@ -124,7 +124,7 @@ class FilesTileContent extends React.PureComponent {
|
||||
};
|
||||
|
||||
createItem = (e) => {
|
||||
const { createFile, item, setIsLoading, i18n, createFolder } = this.props;
|
||||
const { createFile, item, setIsLoading, createFolder } = this.props;
|
||||
const { itemTitle } = this.state;
|
||||
|
||||
setIsLoading(true);
|
||||
@ -136,7 +136,7 @@ class FilesTileContent extends React.PureComponent {
|
||||
.then(() => this.completeAction(e))
|
||||
.finally(() => {
|
||||
toastr.success(
|
||||
<Trans i18nKey="FolderCreated" i18n={i18n}>
|
||||
<Trans i18nKey="FolderCreated" ns="Home">
|
||||
New folder {{ itemTitle }} is created
|
||||
</Trans>
|
||||
);
|
||||
@ -147,7 +147,7 @@ class FilesTileContent extends React.PureComponent {
|
||||
.finally(() => {
|
||||
const exst = item.fileExst;
|
||||
toastr.success(
|
||||
<Trans i18nKey="FileCreated" i18n={i18n}>
|
||||
<Trans i18nKey="FileCreated" ns="Home">
|
||||
New file {{ itemTitle }}.{{ exst }} is created
|
||||
</Trans>
|
||||
);
|
||||
@ -495,4 +495,4 @@ export default inject(
|
||||
addExpandedKeys,
|
||||
};
|
||||
}
|
||||
)(withRouter(withTranslation()(observer(FilesTileContent))));
|
||||
)(withRouter(withTranslation("Home")(observer(FilesTileContent))));
|
||||
|
@ -992,7 +992,6 @@ class SectionBodyContent extends React.Component {
|
||||
privacyInstructions,
|
||||
title,
|
||||
t,
|
||||
i18n,
|
||||
} = this.props;
|
||||
const subheadingText = t("SubheadingEmptyText");
|
||||
const myDescription = t("MyEmptyContainerDescription");
|
||||
@ -1027,7 +1026,7 @@ class SectionBodyContent extends React.Component {
|
||||
</Text>
|
||||
{!isDesktop && (
|
||||
<Text fontSize="12px">
|
||||
<Trans i18nKey="PrivateRoomSupport" i18n={i18n}>
|
||||
<Trans i18nKey="PrivateRoomSupport" ns="Home">
|
||||
Work in Private Room is available via {{ organizationName }}
|
||||
desktop app.
|
||||
<Link isBold isHovered color="#116d9d" href={privacyInstructions}>
|
||||
@ -2030,7 +2029,7 @@ export default inject(
|
||||
uploadDataStore,
|
||||
dialogsStore,
|
||||
treeFoldersStore,
|
||||
selectedFolderStore
|
||||
selectedFolderStore,
|
||||
}) => {
|
||||
const { providers, capabilities } = settingsStore.thirdPartyStore;
|
||||
const { mediaViewersFormatsStore, iconFormatsStore } = formatsStore;
|
||||
@ -2194,4 +2193,4 @@ export default inject(
|
||||
getFolderIcon,
|
||||
};
|
||||
}
|
||||
)(withRouter(withTranslation()(observer(SectionBodyContent))));
|
||||
)(withRouter(withTranslation("Home")(observer(SectionBodyContent))));
|
||||
|
@ -333,5 +333,7 @@ export default inject(
|
||||
};
|
||||
}
|
||||
)(
|
||||
withRouter(withLayoutSize(withTranslation()(observer(SectionFilterContent))))
|
||||
withRouter(
|
||||
withLayoutSize(withTranslation("Home")(observer(SectionFilterContent)))
|
||||
)
|
||||
);
|
||||
|
@ -723,4 +723,4 @@ export default inject(
|
||||
clearSecondaryProgressData,
|
||||
};
|
||||
}
|
||||
)(withTranslation()(withRouter(observer(SectionHeaderContent))));
|
||||
)(withTranslation("Home")(withRouter(observer(SectionHeaderContent))));
|
||||
|
@ -13,7 +13,7 @@ const SectionPagingContent = ({
|
||||
selectedCount,
|
||||
selectedFolderId,
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const { t } = useTranslation("Home");
|
||||
const onNextClick = useCallback(
|
||||
(e) => {
|
||||
if (!filter.hasNext()) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import React, { useEffect } from "react";
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { withRouter } from "react-router";
|
||||
import { isMobile } from "react-device-detect";
|
||||
import { PageLayout, utils, api, toastr } from "asc-web-common";
|
||||
import { withTranslation, I18nextProvider, Trans } from "react-i18next";
|
||||
import { withTranslation, Trans } from "react-i18next";
|
||||
import {
|
||||
ArticleBodyContent,
|
||||
ArticleHeaderContent,
|
||||
@ -18,15 +18,10 @@ import {
|
||||
|
||||
import { ConvertDialog } from "../../dialogs";
|
||||
import { ChangeOwnerPanel } from "../../panels";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import { getFilterByLocation } from "../../../helpers/converters";
|
||||
import Panels from "./Panels";
|
||||
import { observer, inject } from "mobx-react";
|
||||
const i18n = createI18N({
|
||||
page: "Home",
|
||||
localesPath: "pages/Home",
|
||||
});
|
||||
const { changeLanguage } = utils;
|
||||
|
||||
const { FilesFilter } = api;
|
||||
|
||||
class PureHome extends React.Component {
|
||||
@ -135,32 +130,30 @@ class PureHome extends React.Component {
|
||||
};
|
||||
|
||||
showOperationToast = (type, qty, title) => {
|
||||
const { i18n } = this.props;
|
||||
|
||||
switch (type) {
|
||||
case "move":
|
||||
if (qty > 1) {
|
||||
return toastr.success(
|
||||
<Trans i18nKey="MoveItems" i18n={i18n}>
|
||||
<Trans i18nKey="MoveItems" ns="Home">
|
||||
{{ qty }} elements has been moved
|
||||
</Trans>
|
||||
);
|
||||
}
|
||||
return toastr.success(
|
||||
<Trans i18nKey="MoveItem" i18n={i18n}>
|
||||
<Trans i18nKey="MoveItem" ns="Home">
|
||||
{{ title }} moved
|
||||
</Trans>
|
||||
);
|
||||
case "duplicate":
|
||||
if (qty > 1) {
|
||||
return toastr.success(
|
||||
<Trans i18nKey="CopyItems" i18n={i18n}>
|
||||
<Trans i18nKey="CopyItems" ns="Home">
|
||||
{{ qty }} elements copied
|
||||
</Trans>
|
||||
);
|
||||
}
|
||||
return toastr.success(
|
||||
<Trans i18nKey="CopyItem" i18n={i18n}>
|
||||
<Trans i18nKey="CopyItem" ns="Home">
|
||||
{{ title }} copied
|
||||
</Trans>
|
||||
);
|
||||
@ -289,18 +282,7 @@ class PureHome extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const HomeContainer = withTranslation()(PureHome);
|
||||
|
||||
const Home = (props) => {
|
||||
useEffect(() => {
|
||||
changeLanguage(i18n);
|
||||
}, []);
|
||||
return (
|
||||
<I18nextProvider i18n={i18n}>
|
||||
<HomeContainer {...props} />
|
||||
</I18nextProvider>
|
||||
);
|
||||
};
|
||||
const Home = withTranslation("Home")(PureHome);
|
||||
|
||||
Home.propTypes = {
|
||||
history: PropTypes.object.isRequired,
|
||||
|
@ -12,16 +12,10 @@ import {
|
||||
} from "asc-web-components";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import EmptyFolderContainer from "../../../Home/Section/Body/EmptyFolderContainer";
|
||||
import { createI18N } from "../../../../../helpers/i18n";
|
||||
import { Trans } from "react-i18next";
|
||||
import { DeleteThirdPartyDialog, ConnectDialog } from "../../../../dialogs";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
const i18n = createI18N({
|
||||
page: "SectionBodyContent",
|
||||
localesPath: "pages/Settings",
|
||||
});
|
||||
|
||||
const StyledServicesBlock = styled.div`
|
||||
display: grid;
|
||||
column-gap: 55px;
|
||||
@ -391,7 +385,7 @@ class ConnectClouds extends React.Component {
|
||||
<Text as="div">
|
||||
{t("ConnectDescription")}
|
||||
{isAdmin && (
|
||||
<Trans i18nKey="ConnectAdminDescription" i18n={i18n}>
|
||||
<Trans i18nKey="ConnectAdminDescription" ns="Settings">
|
||||
For successful connection enter the necessary data at
|
||||
<Link
|
||||
isHovered
|
||||
@ -565,4 +559,4 @@ export default inject(
|
||||
openConnectWindow,
|
||||
};
|
||||
}
|
||||
)(withTranslation()(observer(ConnectClouds)));
|
||||
)(withTranslation("Settings")(observer(ConnectClouds)));
|
||||
|
@ -7,21 +7,13 @@ import {
|
||||
ArticleMainButtonContent,
|
||||
} from "../../Article";
|
||||
import { SectionHeaderContent, SectionBodyContent } from "./Section";
|
||||
import { withTranslation, I18nextProvider } from "react-i18next";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { setDocumentTitle } from "../../../helpers/utils";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
const i18n = createI18N({
|
||||
page: "Settings",
|
||||
localesPath: "pages/Settings",
|
||||
});
|
||||
|
||||
const { changeLanguage } = utils;
|
||||
|
||||
const PureSettings = ({
|
||||
match,
|
||||
history,
|
||||
//history,
|
||||
t,
|
||||
isLoading,
|
||||
settingsTree,
|
||||
@ -106,18 +98,7 @@ const PureSettings = ({
|
||||
);
|
||||
};
|
||||
|
||||
const SettingsContainer = withTranslation()(PureSettings);
|
||||
|
||||
const Settings = (props) => {
|
||||
useEffect(() => {
|
||||
changeLanguage(i18n);
|
||||
}, []);
|
||||
return (
|
||||
<I18nextProvider i18n={i18n}>
|
||||
<SettingsContainer {...props} />
|
||||
</I18nextProvider>
|
||||
);
|
||||
};
|
||||
const Settings = withTranslation("Settings")(PureSettings);
|
||||
|
||||
export default inject(
|
||||
({ initFilesStore, filesStore, settingsStore, treeFoldersStore }) => {
|
||||
|
@ -244,4 +244,4 @@ export default inject(({ auth, versionHistoryStore }) => {
|
||||
restoreVersion,
|
||||
updateCommentVersion,
|
||||
};
|
||||
})(withRouter(withTranslation()(observer(VersionRow))));
|
||||
})(withRouter(withTranslation("VersionHistory")(observer(VersionRow))));
|
||||
|
@ -1,25 +1,17 @@
|
||||
import React, { useEffect } from "react";
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { withRouter } from "react-router";
|
||||
import { PageLayout, Loaders, utils } from "asc-web-common";
|
||||
import { withTranslation, I18nextProvider } from "react-i18next";
|
||||
import { PageLayout, Loaders } from "asc-web-common";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import {
|
||||
ArticleHeaderContent,
|
||||
ArticleBodyContent,
|
||||
ArticleMainButtonContent,
|
||||
} from "../../Article";
|
||||
import { SectionHeaderContent, SectionBodyContent } from "./Section";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
//import { setDocumentTitle } from "../../../helpers/utils";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
const i18n = createI18N({
|
||||
page: "VersionHistory",
|
||||
localesPath: "pages/VersionHistory",
|
||||
});
|
||||
|
||||
const { changeLanguage } = utils;
|
||||
|
||||
class PureVersionHistory extends React.Component {
|
||||
componentDidMount() {
|
||||
const { isTabletView } = this.props;
|
||||
@ -87,18 +79,7 @@ class PureVersionHistory extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const VersionHistoryContainer = withTranslation()(PureVersionHistory);
|
||||
|
||||
const VersionHistory = (props) => {
|
||||
useEffect(() => {
|
||||
changeLanguage(i18n);
|
||||
}, []);
|
||||
return (
|
||||
<I18nextProvider i18n={i18n}>
|
||||
<VersionHistoryContainer {...props} />
|
||||
</I18nextProvider>
|
||||
);
|
||||
};
|
||||
const VersionHistory = withTranslation("VersionHistory")(PureVersionHistory);
|
||||
|
||||
VersionHistory.propTypes = {
|
||||
history: PropTypes.object.isRequired,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { Backdrop, Heading, Aside, IconButton } from "asc-web-components";
|
||||
import { GroupSelector, utils, constants } from "asc-web-common";
|
||||
import { GroupSelector, constants } from "asc-web-common";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import {
|
||||
StyledAddGroupsPanel,
|
||||
@ -10,21 +10,13 @@ import {
|
||||
StyledBody,
|
||||
} from "../StyledPanels";
|
||||
import AccessComboBox from "../SharingPanel/AccessComboBox";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
const i18n = createI18N({
|
||||
page: "AddGroupsPanel",
|
||||
localesPath: "panels/AddGroupsPanel",
|
||||
});
|
||||
|
||||
const { changeLanguage } = utils;
|
||||
const { ShareAccessRights } = constants;
|
||||
|
||||
class AddGroupsPanelComponent extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
changeLanguage(i18n);
|
||||
|
||||
this.state = {
|
||||
showActionPanel: false,
|
||||
accessRight: ShareAccessRights.ReadOnly,
|
||||
@ -178,12 +170,4 @@ AddGroupsPanelComponent.propTypes = {
|
||||
onClose: PropTypes.func,
|
||||
};
|
||||
|
||||
const AddGroupsPanelContainerTranslated = withTranslation()(
|
||||
AddGroupsPanelComponent
|
||||
);
|
||||
|
||||
const AddGroupsPanel = (props) => (
|
||||
<AddGroupsPanelContainerTranslated i18n={i18n} {...props} />
|
||||
);
|
||||
|
||||
export default AddGroupsPanel;
|
||||
export default withTranslation("AddGroupsPanel")(AddGroupsPanelComponent);
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { Backdrop, Heading, Aside, IconButton } from "asc-web-components";
|
||||
import { PeopleSelector, utils, constants } from "asc-web-common";
|
||||
import { PeopleSelector, constants } from "asc-web-common";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import {
|
||||
StyledAddUsersPanelPanel,
|
||||
@ -10,21 +10,12 @@ import {
|
||||
StyledBody,
|
||||
} from "../StyledPanels";
|
||||
import AccessComboBox from "../SharingPanel/AccessComboBox";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
const i18n = createI18N({
|
||||
page: "AddUsersPanel",
|
||||
localesPath: "panels/AddUsersPanel",
|
||||
});
|
||||
|
||||
const { changeLanguage } = utils;
|
||||
const { ShareAccessRights } = constants;
|
||||
|
||||
class AddUsersPanelComponent extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
changeLanguage(i18n);
|
||||
|
||||
this.state = {
|
||||
showActionPanel: false,
|
||||
accessRight: ShareAccessRights.ReadOnly,
|
||||
@ -208,12 +199,4 @@ AddUsersPanelComponent.propTypes = {
|
||||
onClose: PropTypes.func,
|
||||
};
|
||||
|
||||
const AddUsersPanelContainerTranslated = withTranslation()(
|
||||
AddUsersPanelComponent
|
||||
);
|
||||
|
||||
const AddUsersPanel = (props) => (
|
||||
<AddUsersPanelContainerTranslated i18n={i18n} {...props} />
|
||||
);
|
||||
|
||||
export default AddUsersPanel;
|
||||
export default withTranslation("AddUsersPanel")(AddUsersPanelComponent);
|
||||
|
@ -9,8 +9,7 @@ import {
|
||||
Aside,
|
||||
} from "asc-web-components";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { utils, toastr } from "asc-web-common";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import { toastr } from "asc-web-common";
|
||||
import OwnerSelector from "./OwnerSelector";
|
||||
import {
|
||||
StyledAsidePanel,
|
||||
@ -21,18 +20,10 @@ import {
|
||||
} from "../StyledPanels";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
const i18n = createI18N({
|
||||
page: "ChangeOwnerPanel",
|
||||
localesPath: "panels/ChangeOwnerPanel",
|
||||
});
|
||||
const { changeLanguage } = utils;
|
||||
|
||||
class ChangeOwnerComponent extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
changeLanguage(i18n);
|
||||
|
||||
const owner = props.selection[0].createdBy;
|
||||
this.state = { showPeopleSelector: false, owner };
|
||||
}
|
||||
@ -178,10 +169,8 @@ class ChangeOwnerComponent extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const ModalDialogContainerTranslated = withTranslation()(ChangeOwnerComponent);
|
||||
|
||||
const ChangeOwnerPanel = (props) => (
|
||||
<ModalDialogContainerTranslated i18n={i18n} {...props} />
|
||||
const ChangeOwnerPanel = withTranslation("ChangeOwnerPanel")(
|
||||
ChangeOwnerComponent
|
||||
);
|
||||
|
||||
export default inject(({ auth, initFilesStore, filesStore, dialogsStore }) => {
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
TextInput,
|
||||
Textarea,
|
||||
} from "asc-web-components";
|
||||
import { utils, toastr } from "asc-web-common";
|
||||
import { toastr } from "asc-web-common";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import {
|
||||
StyledEmbeddingPanel,
|
||||
@ -19,13 +19,6 @@ import {
|
||||
StyledBody,
|
||||
} from "../StyledPanels";
|
||||
import copy from "copy-to-clipboard";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
const i18n = createI18N({
|
||||
page: "EmbeddingPanel",
|
||||
localesPath: "panels/EmbeddingPanel",
|
||||
});
|
||||
|
||||
const { changeLanguage } = utils;
|
||||
|
||||
class EmbeddingPanelComponent extends React.Component {
|
||||
constructor(props) {
|
||||
@ -37,8 +30,6 @@ class EmbeddingPanelComponent extends React.Component {
|
||||
heightValue: "100%",
|
||||
link: `<iframe src="${props.embeddingLink}" width="100%" height="100%" frameborder="0" scrolling="no" allowtransparency> </iframe>`,
|
||||
};
|
||||
|
||||
changeLanguage(i18n);
|
||||
}
|
||||
|
||||
onArrowClick = () => this.props.onClose();
|
||||
@ -226,12 +217,4 @@ EmbeddingPanelComponent.propTypes = {
|
||||
onClose: PropTypes.func,
|
||||
};
|
||||
|
||||
const EmbeddingPanelContainerTranslated = withTranslation()(
|
||||
EmbeddingPanelComponent
|
||||
);
|
||||
|
||||
const EmbeddingPanel = (props) => (
|
||||
<EmbeddingPanelContainerTranslated i18n={i18n} {...props} />
|
||||
);
|
||||
|
||||
export default EmbeddingPanel;
|
||||
export default withTranslation("EmbeddingPanel")(EmbeddingPanelComponent);
|
||||
|
@ -12,7 +12,7 @@ import {
|
||||
Button,
|
||||
} from "asc-web-components";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { utils as commonUtils, api, toastr } from "asc-web-common";
|
||||
import { api, toastr } from "asc-web-common";
|
||||
import { ReactSVG } from "react-svg";
|
||||
import {
|
||||
StyledAsidePanel,
|
||||
@ -21,21 +21,12 @@ import {
|
||||
StyledBody,
|
||||
StyledFooter,
|
||||
} from "../StyledPanels";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import { inject, observer } from "mobx-react";
|
||||
const i18n = createI18N({
|
||||
page: "NewFilesPanel",
|
||||
localesPath: "panels/NewFilesPanel",
|
||||
});
|
||||
|
||||
const { changeLanguage } = commonUtils;
|
||||
|
||||
class NewFilesPanelComponent extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
changeLanguage(i18n);
|
||||
|
||||
this.state = { files: [] };
|
||||
}
|
||||
|
||||
@ -148,12 +139,7 @@ class NewFilesPanelComponent extends React.Component {
|
||||
};
|
||||
|
||||
setNewFilesCount = (folderPath, markAsReadAll, item) => {
|
||||
const {
|
||||
treeFolders,
|
||||
setTreeFolders,
|
||||
folders,
|
||||
files,
|
||||
} = this.props;
|
||||
const { treeFolders, setTreeFolders, folders, files } = this.props;
|
||||
|
||||
const data = treeFolders;
|
||||
let dataItem;
|
||||
@ -281,13 +267,7 @@ NewFilesPanelComponent.propTypes = {
|
||||
visible: PropTypes.bool,
|
||||
};
|
||||
|
||||
const NewFilesPanelContainerTranslated = withTranslation()(
|
||||
NewFilesPanelComponent
|
||||
);
|
||||
|
||||
const NewFilesPanel = (props) => (
|
||||
<NewFilesPanelContainerTranslated i18n={i18n} {...props} />
|
||||
);
|
||||
const NewFilesPanel = withTranslation("NewFilesPanel")(NewFilesPanelComponent);
|
||||
|
||||
export default inject(
|
||||
({
|
||||
|
@ -3,26 +3,17 @@ import PropTypes from "prop-types";
|
||||
import { withRouter } from "react-router";
|
||||
import { ModalDialog } from "asc-web-components";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { utils as commonUtils, toastr } from "asc-web-common";
|
||||
import { toastr } from "asc-web-common";
|
||||
import { StyledAsidePanel } from "../StyledPanels";
|
||||
import TreeFolders from "../../Article/Body/TreeFolders";
|
||||
import { ThirdPartyMoveDialog } from "../../dialogs";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
const i18n = createI18N({
|
||||
page: "OperationsPanel",
|
||||
localesPath: "panels/OperationsPanel",
|
||||
});
|
||||
|
||||
const { changeLanguage } = commonUtils;
|
||||
|
||||
class OperationsPanelComponent extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
changeLanguage(i18n);
|
||||
|
||||
this.state = {
|
||||
showProviderDialog: false,
|
||||
operationPanelVisible: props.visible,
|
||||
@ -186,14 +177,10 @@ OperationsPanelComponent.propTypes = {
|
||||
visible: PropTypes.bool,
|
||||
};
|
||||
|
||||
const OperationsPanelContainerTranslated = withTranslation()(
|
||||
const OperationsPanel = withTranslation("OperationsPanel")(
|
||||
OperationsPanelComponent
|
||||
);
|
||||
|
||||
const OperationsPanel = (props) => (
|
||||
<OperationsPanelContainerTranslated i18n={i18n} {...props} />
|
||||
);
|
||||
|
||||
export default inject(
|
||||
({
|
||||
auth,
|
||||
|
@ -12,7 +12,7 @@ import {
|
||||
} from "asc-web-components";
|
||||
import { withRouter } from "react-router";
|
||||
import { withTranslation, Trans } from "react-i18next";
|
||||
import { utils as commonUtils, constants, toastr } from "asc-web-common";
|
||||
import { constants, toastr } from "asc-web-common";
|
||||
|
||||
import {
|
||||
StyledAsidePanel,
|
||||
@ -23,14 +23,8 @@ import {
|
||||
} from "../StyledPanels";
|
||||
import { AddUsersPanel, AddGroupsPanel, EmbeddingPanel } from "../index";
|
||||
import SharingRow from "./SharingRow";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
//import { setEncryptionAccess } from "../../../helpers/desktop";
|
||||
import { inject, observer } from "mobx-react";
|
||||
const i18n = createI18N({
|
||||
page: "SharingPanel",
|
||||
localesPath: "panels/SharingPanel",
|
||||
});
|
||||
const { changeLanguage } = commonUtils;
|
||||
const { ShareAccessRights } = constants;
|
||||
|
||||
const SharingBodyStyle = { height: `calc(100vh - 156px)` };
|
||||
@ -39,8 +33,6 @@ class SharingPanelComponent extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
changeLanguage(i18n);
|
||||
|
||||
this.state = {
|
||||
showActionPanel: false,
|
||||
isNotifyUsers: false,
|
||||
@ -117,7 +109,6 @@ class SharingPanelComponent extends React.Component {
|
||||
setIsLoading,
|
||||
isPrivacy,
|
||||
replaceFileStream,
|
||||
i18n,
|
||||
t,
|
||||
uploadPanelVisible,
|
||||
updateUploadedItem,
|
||||
@ -203,7 +194,7 @@ class SharingPanelComponent extends React.Component {
|
||||
return replaceFileStream(item.id, encryptedFile, true, true).then(
|
||||
() =>
|
||||
toastr.success(
|
||||
<Trans i18nKey="EncryptedFileSharing" i18n={i18n}>
|
||||
<Trans i18nKey="EncryptedFileSharing" ns="SharingPanel">
|
||||
File {{ title }} successfully shared
|
||||
</Trans>
|
||||
)
|
||||
@ -586,13 +577,7 @@ class SharingPanelComponent extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const SharingPanelContainerTranslated = withTranslation()(
|
||||
SharingPanelComponent
|
||||
);
|
||||
|
||||
const SharingPanel = (props) => (
|
||||
<SharingPanelContainerTranslated i18n={i18n} {...props} />
|
||||
);
|
||||
const SharingPanel = withTranslation("SharingPanel")(SharingPanelComponent);
|
||||
|
||||
export default inject(
|
||||
(
|
||||
|
@ -1,7 +1,6 @@
|
||||
import React from "react";
|
||||
import { Backdrop, Heading, Aside, IconButton } from "asc-web-components";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import { utils as commonUtils } from "asc-web-common";
|
||||
import SharingPanel from "../SharingPanel";
|
||||
import {
|
||||
StyledAsidePanel,
|
||||
@ -10,24 +9,14 @@ import {
|
||||
StyledBody,
|
||||
} from "../StyledPanels";
|
||||
import FileList from "./FileList";
|
||||
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
const i18n = createI18N({
|
||||
page: "UploadPanel",
|
||||
localesPath: "panels/UploadPanel",
|
||||
});
|
||||
const { changeLanguage } = commonUtils;
|
||||
|
||||
const DownloadBodyStyle = { height: `calc(100vh - 62px)` };
|
||||
|
||||
class UploadPanelComponent extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
changeLanguage(i18n);
|
||||
|
||||
this.ref = React.createRef();
|
||||
this.scrollRef = React.createRef();
|
||||
}
|
||||
@ -127,11 +116,7 @@ class UploadPanelComponent extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const UploadPanelContainerTranslated = withTranslation()(UploadPanelComponent);
|
||||
|
||||
const UploadPanel = (props) => (
|
||||
<UploadPanelContainerTranslated i18n={i18n} {...props} />
|
||||
);
|
||||
const UploadPanel = withTranslation("UploadPanel")(UploadPanelComponent);
|
||||
|
||||
export default inject(({ dialogsStore, uploadDataStore }) => {
|
||||
const { sharingPanelVisible } = dialogsStore;
|
||||
|
@ -1,9 +1,8 @@
|
||||
import React, { useEffect } from "react";
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import { Backdrop, Heading, Aside } from "asc-web-components";
|
||||
import { utils, Loaders } from "asc-web-common";
|
||||
import { withTranslation, I18nextProvider } from "react-i18next";
|
||||
import { createI18N } from "../../../helpers/i18n";
|
||||
import { Loaders } from "asc-web-common";
|
||||
import { withTranslation } from "react-i18next";
|
||||
import {
|
||||
StyledVersionHistoryPanel,
|
||||
StyledContent,
|
||||
@ -13,13 +12,6 @@ import {
|
||||
import { SectionBodyContent } from "../../pages/VersionHistory/Section/";
|
||||
import { inject, observer } from "mobx-react";
|
||||
|
||||
const i18n = createI18N({
|
||||
page: "VersionHistory",
|
||||
localesPath: "pages/VersionHistory",
|
||||
});
|
||||
|
||||
const { changeLanguage } = utils;
|
||||
|
||||
class PureVersionHistoryPanel extends React.Component {
|
||||
componentDidUpdate(preProps) {
|
||||
const { isTabletView, fileId } = this.props;
|
||||
@ -87,20 +79,11 @@ class PureVersionHistoryPanel extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const VersionHistoryPanelContainer = withTranslation()(PureVersionHistoryPanel);
|
||||
const VersionHistoryPanel = withTranslation("VersionHistory")(
|
||||
PureVersionHistoryPanel
|
||||
);
|
||||
|
||||
const VersionHistoryPanel = (props) => {
|
||||
useEffect(() => {
|
||||
changeLanguage(i18n);
|
||||
}, []);
|
||||
return (
|
||||
<I18nextProvider i18n={i18n}>
|
||||
<VersionHistoryPanelContainer {...props} />
|
||||
</I18nextProvider>
|
||||
);
|
||||
};
|
||||
|
||||
VersionHistoryPanelContainer.propTypes = {
|
||||
VersionHistoryPanel.propTypes = {
|
||||
fileId: PropTypes.string,
|
||||
visible: PropTypes.bool,
|
||||
onClose: PropTypes.func,
|
||||
|
@ -1,36 +0,0 @@
|
||||
import i18n from "i18next";
|
||||
import Backend from "i18next-xhr-backend";
|
||||
import config from "../../package.json";
|
||||
import { constants } from "asc-web-common";
|
||||
const { i18nBaseSettings } = constants;
|
||||
|
||||
/**
|
||||
* @description create i18n instance
|
||||
* @param {object} object with method,url,data etc.
|
||||
*/
|
||||
export const createI18N = function (options) {
|
||||
const { page, localesPath, forceBackend } = options;
|
||||
|
||||
const newInstance = i18n.createInstance();
|
||||
|
||||
if (process.env.NODE_ENV === "production" || forceBackend) {
|
||||
newInstance.use(Backend).init({
|
||||
...i18nBaseSettings,
|
||||
backend: {
|
||||
loadPath: `${config.homepage}/locales/${page}/{{lng}}/{{ns}}.json`,
|
||||
},
|
||||
});
|
||||
} else if (process.env.NODE_ENV === "development") {
|
||||
const resources = {};
|
||||
|
||||
i18nBaseSettings.supportedLngs.forEach((name) => {
|
||||
resources[name] = {
|
||||
translation: require(`../components/${localesPath}/locales/${name}/translation.json`),
|
||||
};
|
||||
});
|
||||
|
||||
newInstance.init({ ...i18nBaseSettings, resources });
|
||||
}
|
||||
|
||||
return newInstance;
|
||||
};
|
59
products/ASC.Files/Client/src/i18n.js
Normal file
59
products/ASC.Files/Client/src/i18n.js
Normal file
@ -0,0 +1,59 @@
|
||||
import i18n from "i18next";
|
||||
import { initReactI18next } from "react-i18next";
|
||||
import Backend from "i18next-http-backend";
|
||||
import config from "../package.json";
|
||||
import { constants } from "asc-web-common";
|
||||
const { LANGUAGE /*i18nBaseSettings*/ } = constants;
|
||||
|
||||
//import LanguageDetector from "i18next-browser-languagedetector";
|
||||
// not like to use this?
|
||||
// have a look at the Quick start guide
|
||||
// for passing in lng and translations on init
|
||||
|
||||
const languages = ["en", "ru"];
|
||||
|
||||
i18n
|
||||
/*
|
||||
load translation using http -> see /public/locales (i.e. https://github.com/i18next/react-i18next/tree/master/example/react/public/locales)
|
||||
learn more: https://github.com/i18next/i18next-http-backend
|
||||
*/
|
||||
.use(Backend)
|
||||
/*
|
||||
detect user language
|
||||
learn more: https://github.com/i18next/i18next-browser-languageDetector
|
||||
*/
|
||||
//.use(LanguageDetector)
|
||||
/*
|
||||
pass the i18n instance to react-i18next.
|
||||
*/
|
||||
.use(initReactI18next)
|
||||
/*
|
||||
init i18next
|
||||
for all options read: https://www.i18next.com/overview/configuration-options
|
||||
*/
|
||||
.init({
|
||||
lng: localStorage.getItem(LANGUAGE) || "en",
|
||||
supportedLngs: languages,
|
||||
whitelist: languages,
|
||||
fallbackLng: "en",
|
||||
load: "languageOnly",
|
||||
//debug: true,
|
||||
|
||||
interpolation: {
|
||||
escapeValue: false, // not needed for react as it escapes by default
|
||||
format: function (value, format) {
|
||||
if (format === "lowercase") return value.toLowerCase();
|
||||
return value;
|
||||
},
|
||||
},
|
||||
|
||||
backend: {
|
||||
loadPath: `${config.homepage}/locales/{{lng}}/{{ns}}.json`,
|
||||
},
|
||||
|
||||
react: {
|
||||
useSuspense: true,
|
||||
},
|
||||
});
|
||||
|
||||
export default i18n;
|
@ -1,4 +1,4 @@
|
||||
import { makeObservable, makeAutoObservable } from "mobx";
|
||||
import { makeAutoObservable } from "mobx";
|
||||
import { presentInArray } from "../helpers/files-helpers";
|
||||
|
||||
class IconFormatsStore {
|
||||
|
@ -6014,19 +6014,12 @@ human-signals@^1.1.1:
|
||||
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
|
||||
integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==
|
||||
|
||||
i18next-browser-languagedetector@4.0.1:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/i18next-browser-languagedetector/-/i18next-browser-languagedetector-4.0.1.tgz#6a0b44a93835146287130da36ce3d04a1836879f"
|
||||
integrity sha512-RxSoX6mB8cab0CTIQ+klCS764vYRj+Jk621cnFVsINvcdlb/cdi3vQFyrPwmnowB7ReUadjHovgZX+RPIzHVQQ==
|
||||
i18next-http-backend@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/i18next-http-backend/-/i18next-http-backend-1.1.0.tgz#7ccba7252b84b031f51dee0f8e58a578736d0129"
|
||||
integrity sha512-utp3MyUQpIUD5Jxkf5xz0GWYWDSte7uuf1F4qaLtVtIqlcFcyYQ2l22el1JPK3rAL44+sjhB7+ct0Qr2WpbxNA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.5.5"
|
||||
|
||||
i18next-xhr-backend@3.2.2:
|
||||
version "3.2.2"
|
||||
resolved "https://registry.yarnpkg.com/i18next-xhr-backend/-/i18next-xhr-backend-3.2.2.tgz#769124441461b085291f539d91864e3691199178"
|
||||
integrity sha512-OtRf2Vo3IqAxsttQbpjYnmMML12IMB5e0fc5B7qKJFLScitYaXa1OhMX0n0X/3vrfFlpHL9Ro/H+ps4Ej2j7QQ==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.5.5"
|
||||
node-fetch "2.6.1"
|
||||
|
||||
i18next@19.0.3:
|
||||
version "19.0.3"
|
||||
@ -7949,6 +7942,11 @@ no-case@^3.0.4:
|
||||
lower-case "^2.0.2"
|
||||
tslib "^2.0.3"
|
||||
|
||||
node-fetch@2.6.1:
|
||||
version "2.6.1"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
|
||||
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==
|
||||
|
||||
node-forge@^0.10.0:
|
||||
version "0.10.0"
|
||||
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.10.0.tgz#32dea2afb3e9926f02ee5ce8794902691a676bf3"
|
||||
@ -9713,13 +9711,6 @@ react-app-polyfill@^2.0.0:
|
||||
regenerator-runtime "^0.13.7"
|
||||
whatwg-fetch "^3.4.1"
|
||||
|
||||
react-app-rewired@^2.1.8:
|
||||
version "2.1.8"
|
||||
resolved "https://registry.yarnpkg.com/react-app-rewired/-/react-app-rewired-2.1.8.tgz#e192f93b98daf96889418d33d3e86cf863812b56"
|
||||
integrity sha512-wjXPdKPLscA7mn0I1de1NHrbfWdXz4S1ladaGgHVKdn1hTgKK5N6EdGIJM0KrS6bKnJBj7WuqJroDTsPKKr66Q==
|
||||
dependencies:
|
||||
semver "^5.6.0"
|
||||
|
||||
react-autosize-textarea@^7.1.0:
|
||||
version "7.1.0"
|
||||
resolved "https://registry.yarnpkg.com/react-autosize-textarea/-/react-autosize-textarea-7.1.0.tgz#902c84fc395a689ca3a484dfb6bc2be9ba3694d1"
|
||||
|
@ -1,42 +0,0 @@
|
||||
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
||||
const path = require("path");
|
||||
module.exports = (config) => {
|
||||
config.plugins.push(
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
from: path.join(
|
||||
"src",
|
||||
path.sep,
|
||||
"components",
|
||||
path.sep,
|
||||
"**",
|
||||
path.sep,
|
||||
"locales",
|
||||
path.sep,
|
||||
"**"
|
||||
),
|
||||
to: "locales",
|
||||
transformPath(targetPath) {
|
||||
const reversedArrayOfFolders = path
|
||||
.dirname(targetPath)
|
||||
.split(path.sep)
|
||||
.reverse();
|
||||
const localePath = reversedArrayOfFolders.pop();
|
||||
const finalPath = path.join(
|
||||
path.sep,
|
||||
localePath,
|
||||
path.sep,
|
||||
reversedArrayOfFolders[2],
|
||||
path.sep,
|
||||
reversedArrayOfFolders[0],
|
||||
path.sep,
|
||||
path.basename(targetPath)
|
||||
);
|
||||
return finalPath;
|
||||
},
|
||||
},
|
||||
])
|
||||
);
|
||||
|
||||
return config;
|
||||
};
|
@ -12,14 +12,13 @@
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"history": "4.10.1",
|
||||
"i18next": "19.0.3",
|
||||
"i18next-browser-languagedetector": "4.0.1",
|
||||
"i18next-xhr-backend": "3.2.2",
|
||||
"i18next-http-backend": "^1.1.0",
|
||||
"lodash": "4.17.19",
|
||||
"lodash-es": "4.17.15",
|
||||
"merge": "^1.2.1",
|
||||
"node-sass": "^4.14.1",
|
||||
"mobx": "^6.1.1",
|
||||
"mobx-react": "^7.1.0",
|
||||
"node-sass": "^4.14.1",
|
||||
"oidc-client": "^1.10.1",
|
||||
"prop-types": "^15.7.2",
|
||||
"react": "^16.14.0",
|
||||
@ -37,7 +36,6 @@
|
||||
"copy-webpack-plugin": "^5.1.2",
|
||||
"cross-env": "^6.0.3",
|
||||
"prettier": "2.1.2",
|
||||
"react-app-rewired": "^2.1.8",
|
||||
"react-scripts": "4.0.1",
|
||||
"rimraf": "3.0.2",
|
||||
"webpack-bundle-analyzer": "^3.9.0",
|
||||
@ -48,11 +46,11 @@
|
||||
},
|
||||
"scripts": {
|
||||
"analyse": "node analyse.js",
|
||||
"start": "react-app-rewired start",
|
||||
"build": "rimraf ./build && react-app-rewired build && npm run build-sw && npm run clean-cra-sw",
|
||||
"start": "react-scripts start",
|
||||
"build": "rimraf ./build && react-scripts build && npm run build-sw && npm run clean-cra-sw",
|
||||
"build-sw": "node ./src/sw-build.js",
|
||||
"clean-cra-sw": "rm -f build/precache-manifest.*.js && rm -f build/service-worker.js",
|
||||
"test": "cross-env CI=true react-app-rewired test --env=jsdom",
|
||||
"test": "cross-env CI=true react-scripts test --env=jsdom",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"browserslist": {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user