diff --git a/web/ASC.Web.Client/src/components/pages/Settings/Layout/index.js b/web/ASC.Web.Client/src/components/pages/Settings/Layout/index.js index 91876edc40..c1d5750f1c 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/Layout/index.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/Layout/index.js @@ -4,7 +4,7 @@ import { PageLayout } from "asc-web-common"; import { I18nextProvider } from "react-i18next"; import { ArticleHeaderContent, ArticleBodyContent } from "./Article"; import { SectionHeaderContent } from "./Section"; -import { store } from "asc-web-common"; +import { store, utils } from "asc-web-common"; import { createI18N } from "../../../../helpers/i18n"; @@ -14,6 +14,7 @@ const i18n = createI18N({ }); const { setCurrentProductId } = store.auth.actions; +const { changeLanguage } = utils; const Layout = ({ currentProductId, @@ -23,7 +24,7 @@ const Layout = ({ }) => { useEffect(() => { currentProductId !== "settings" && setCurrentProductId("settings"); - i18n.changeLanguage(language); + changeLanguage(i18n); }, [language, currentProductId, setCurrentProductId]); return ( diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/common/customization.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/common/customization.js index 3a94141067..98ce1d9a18 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/common/customization.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/categories/common/customization.js @@ -3,8 +3,7 @@ import { connect } from "react-redux"; import { withTranslation } from "react-i18next"; import { Text, Loader, toastr, Link, Icons } from "asc-web-components"; import styled from "styled-components"; -import { Trans } from "react-i18next"; -import { store, utils, api } from "asc-web-common"; +import { store, utils } from "asc-web-common"; import { setLanguageAndTime, getPortalTimezones @@ -103,8 +102,6 @@ class Customization extends React.Component { document.title = `${t("Customization")} – ${t("OrganizationName")}`; - changeLanguage(props.i18n); - this.state = { isLoadedData: false, isLoading: false, @@ -235,10 +232,11 @@ class Customization extends React.Component { color="#333333" /> - - {" "} - {language.label} / {timezone.label}{" "} - + {language && language.label && timezone && timezone.label && ( + + {`${language.label} / ${timezone.label}`} + + )} {t("LanguageAndTimeZoneSettingsDescription")} @@ -273,8 +271,8 @@ function mapStateToProps(state) { return { portalLanguage: state.auth.settings.culture, portalTimeZoneId: state.auth.settings.timezone, - language: state.auth.user.cultureName || - state.auth.settings.culture || { label: "en-US" }, + language: + state.auth.user.cultureName || state.auth.settings.culture || "en-US", rawTimezones: state.auth.settings.timezones, rawCultures: state.auth.settings.cultures, nameSchemaId: state.auth.settings.nameSchemaId diff --git a/web/ASC.Web.Client/src/components/pages/Settings/categories/common/index.js b/web/ASC.Web.Client/src/components/pages/Settings/categories/common/index.js deleted file mode 100644 index ee78757a19..0000000000 --- a/web/ASC.Web.Client/src/components/pages/Settings/categories/common/index.js +++ /dev/null @@ -1,31 +0,0 @@ -import React, { lazy, Suspense } from "react"; -import { Route, Switch } from "react-router-dom"; -import { withRouter } from "react-router"; -import { Loader } from "asc-web-components"; - -const CustomizationSettings = lazy(() => import("./customization")); -// const WhiteLabel = lazy(() => import("./whitelabel")); - -const Common = ({ match }) => { - const basePath = '/settings/common'; - - return ( - }> - - - {/* */} - - - ); -}; - - -export default withRouter(Common); diff --git a/web/ASC.Web.Client/src/components/pages/Settings/index.js b/web/ASC.Web.Client/src/components/pages/Settings/index.js index 3d54f95fbc..80e613fce5 100644 --- a/web/ASC.Web.Client/src/components/pages/Settings/index.js +++ b/web/ASC.Web.Client/src/components/pages/Settings/index.js @@ -1,25 +1,36 @@ -import React, { lazy,Suspense } from "react"; +import React, { lazy, Suspense } from "react"; import { Route, Switch, Redirect } from "react-router-dom"; import { withRouter } from "react-router"; -import Layout from './Layout'; +import Layout from "./Layout"; import { Loader } from "asc-web-components"; const SecuritySettings = lazy(() => import("./categories/security")); -const CustomizationSettings = lazy(() => import("./categories/common/customization")); -const LanguageAndTimeZoneSettings = lazy(() => import("./categories/common/language-and-time-zone")); +const CustomizationSettings = lazy(() => + import("./categories/common/customization") +); +const LanguageAndTimeZoneSettings = lazy(() => + import("./categories/common/language-and-time-zone") +); const CustomTitles = lazy(() => import("./categories/common/custom-titles")); +//const WhiteLabel = lazy(() => import("./categories/common/whitelabel")); + const Settings = () => { - const basePath = '/settings'; - + const basePath = "/settings"; + return ( - - }> + + } + > - { path={[`${basePath}/common/customization/custom-titles`]} component={CustomTitles} /> - + {/* */} +