Skip to content

Commit

Permalink
Merge pull request #253 from ONLYOFFICE/feature/my-profile
Browse files Browse the repository at this point in the history
Feature/my profile
  • Loading branch information
ilyaoleshko authored May 20, 2021
2 parents 5d94113 + 28a5a3d commit 93ba0e8
Show file tree
Hide file tree
Showing 42 changed files with 373 additions and 390 deletions.
49 changes: 28 additions & 21 deletions packages/asc-web-common/components/PrivateRoute/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React, { useEffect } from "react";
import { Redirect, Route } from "react-router-dom";
//import Loader from "@appserver/components/loader";
import PageLayout from "../PageLayout";
//import PageLayout from "../PageLayout";
// import Error401 from "studio/Error401";
// import Error404 from "studio/Error404";
import AppLoader from "../AppLoader";
Expand All @@ -22,11 +22,12 @@ const PrivateRoute = ({ component: Component, ...rest }) => {
computedMatch,
setModuleInfo,
modules,
homepage,
currentProductId,
wizardCompleted,
} = rest;

const { userId } = computedMatch.params;
const { params, path } = computedMatch;
const { userId } = params;

const renderComponent = (props) => {
if (isLoaded && !isAuthenticated) {
Expand Down Expand Up @@ -101,21 +102,30 @@ const PrivateRoute = ({ component: Component, ...rest }) => {
};

useEffect(() => {
const currentModule = modules.find((m) => {
if (
computedMatch.path !== "/" &&
m.link.indexOf(computedMatch.path) !== -1
) {
return true;
}
});

if (currentModule && homepage !== computedMatch.path) {
const { id } = currentModule;

setModuleInfo(currentModule.origLink || currentModule.link, id);
if (!isLoaded) return;

let currentModule;

if (path === "" || path === "/") {
currentModule = {
id: "home",
origLink: "/",
};
} else if (path.startsWith("/my")) {
currentModule = {
id: "f4d98afd-d336-4332-8778-3c6945c81ea0",
origLink: "/products/people",
};
} else {
currentModule = modules.find((m) => m.link.startsWith(path));
}
}, [computedMatch.path]);

if (!currentModule) return;

const { id, origLink, link } = currentModule;

setModuleInfo(origLink || link, id);
}, [path, modules, isLoaded]);

//console.log("PrivateRoute render", rest);
return <Route {...rest} render={renderComponent} />;
Expand All @@ -131,9 +141,8 @@ export default inject(({ auth }) => {
moduleStore,
} = auth;
const { user } = userStore;
const { setModuleInfo, homepage } = settingsStore;
const { modules } = moduleStore;
const { wizardCompleted } = settingsStore;
const { setModuleInfo, wizardCompleted } = settingsStore;

return {
modules,
Expand All @@ -142,8 +151,6 @@ export default inject(({ auth }) => {
isAdmin,
isLoaded,
setModuleInfo,
homepage,
wizardCompleted,
//getUser: store.userStore.getCurrentUser,
};
})(observer(PrivateRoute));
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ body.drag-cursor * {
6 6,
auto !important;
}

body.desktop {
user-select: none;
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-o-user-select: none;
mozuserselect: none;
}
8 changes: 7 additions & 1 deletion packages/asc-web-common/store/SettingsStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@ class SettingsStore {
};

setModuleInfo = (homepage, productId) => {
if (this.homepage == homepage) return;
if (this.homepage === homepage || this.currentProductId === productId)
return;

console.log(`setModuleInfo('${homepage}', '${productId}')`);

this.homepage = homepage;
this.setCurrentProductId(productId);

Expand All @@ -223,7 +227,9 @@ class SettingsStore {
? homepage
: `${homepage}/`
: "/";

console.log("SET base URL", baseUrl);

baseElm[0].setAttribute("href", baseUrl);
}
};
Expand Down
10 changes: 9 additions & 1 deletion products/ASC.CRM/Client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
//import "./wdyr";
import React from "react";
import Shell from "studio/shell";
import ErrorBoundary from "@appserver/common/components/ErrorBoundary";
import "@appserver/common/custom.scss";

const App = () => <Shell />;
const App = () => {
return (
<ErrorBoundary>
<Shell />
</ErrorBoundary>
);
};

export default App;
1 change: 0 additions & 1 deletion products/ASC.CRM/Client/src/Crm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import PrivateRoute from "@appserver/common/components/PrivateRoute";
import AppLoader from "@appserver/common/components/AppLoader";
import { combineUrl, updateTempContent } from "@appserver/common/utils";
import config from "../package.json";
import "./custom.scss";
import i18n from "./i18n";
import { I18nextProvider } from "react-i18next";
import Home from "./pages/Home";
Expand Down
27 changes: 0 additions & 27 deletions products/ASC.CRM/Client/src/custom.scss

This file was deleted.

10 changes: 9 additions & 1 deletion products/ASC.Calendar/Client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
//import "./wdyr";
import React from "react";
import Shell from "studio/shell";
import ErrorBoundary from "@appserver/common/components/ErrorBoundary";
import "@appserver/common/custom.scss";

const App = () => <Shell />;
const App = () => {
return (
<ErrorBoundary>
<Shell />
</ErrorBoundary>
);
};

export default App;
1 change: 0 additions & 1 deletion products/ASC.Calendar/Client/src/Calendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import PrivateRoute from "@appserver/common/components/PrivateRoute";
import AppLoader from "@appserver/common/components/AppLoader";
import { combineUrl, updateTempContent } from "@appserver/common/utils";
import config from "../package.json";
import "./custom.scss";
import i18n from "./i18n";
import { I18nextProvider } from "react-i18next";
import Home from "./pages/Home";
Expand Down
27 changes: 0 additions & 27 deletions products/ASC.Calendar/Client/src/custom.scss

This file was deleted.

10 changes: 8 additions & 2 deletions products/ASC.Files/Client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
//import "./wdyr";
import React from "react";
import Shell from "studio/shell";
//import "./wdyr";
import ErrorBoundary from "@appserver/common/components/ErrorBoundary";
import "@appserver/common/custom.scss";

const App = () => {
return <Shell />;
return (
<ErrorBoundary>
<Shell />
</ErrorBoundary>
);
};

export default App;
1 change: 0 additions & 1 deletion products/ASC.Files/Client/src/Files.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import AppLoader from "@appserver/common/components/AppLoader";
import toastr from "studio/toastr";
import { combineUrl, updateTempContent } from "@appserver/common/utils";
import stores from "./store/index";
import "./custom.scss";
import i18n from "./i18n";
import { I18nextProvider } from "react-i18next";
import { regDesktop } from "@appserver/common/desktop";
Expand Down
47 changes: 0 additions & 47 deletions products/ASC.Files/Client/src/index.js
Original file line number Diff line number Diff line change
@@ -1,48 +1 @@
import("./bootstrap");

//import "./wdyr";

// import React from "react";
// import ReactDOM from "react-dom";
// import "./custom.scss";
// import App from "./App";

// import * as serviceWorker from "./serviceWorker";
// import { ErrorBoundary, store as commonStore } from "asc-web-common";
// import { Provider as MobxProvider } from "mobx-react";
// import filesStore from "./store/FilesStore";
// import settingsStore from "./store/SettingsStore";
// import mediaViewerDataStore from "./store/MediaViewerDataStore";
// import formatsStore from "./store/FormatsStore";
// import versionHistoryStore from "./store/VersionHistoryStore";
// import uploadDataStore from "./store/UploadDataStore";
// import dialogsStore from "./store/DialogsStore";
// import treeFoldersStore from "./store/TreeFoldersStore";
// import selectedFolderStore from "./store/SelectedFolderStore";

// const { authStore } = commonStore;

// ReactDOM.render(
// <MobxProvider
// auth={authStore}
// filesStore={filesStore}
// settingsStore={settingsStore}
// mediaViewerDataStore={mediaViewerDataStore}
// formatsStore={formatsStore}
// versionHistoryStore={versionHistoryStore}
// uploadDataStore={uploadDataStore}
// dialogsStore={dialogsStore}
// treeFoldersStore={treeFoldersStore}
// selectedFolderStore={selectedFolderStore}
// >
// <ErrorBoundary>
// <App />
// </ErrorBoundary>
// </MobxProvider>,
// document.getElementById("root")
// );

// // If you want your app to work offline and load faster, you can change
// // unregister() to register() below. Note this comes with some pitfalls.
// // Learn more about service workers: https://bit.ly/CRA-PWA
// serviceWorker.register();
10 changes: 9 additions & 1 deletion products/ASC.Mail/Client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
//import "./wdyr";
import React from "react";
import Shell from "studio/shell";
import ErrorBoundary from "@appserver/common/components/ErrorBoundary";
import "@appserver/common/custom.scss";

const App = () => <Shell />;
const App = () => {
return (
<ErrorBoundary>
<Shell />
</ErrorBoundary>
);
};

export default App;
1 change: 0 additions & 1 deletion products/ASC.Mail/Client/src/Mail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import PrivateRoute from "@appserver/common/components/PrivateRoute";
import AppLoader from "@appserver/common/components/AppLoader";
import { combineUrl, updateTempContent } from "@appserver/common/utils";
import config from "../package.json";
import "./custom.scss";
import i18n from "./i18n";
import { I18nextProvider } from "react-i18next";
import Home from "./pages/Home";
Expand Down
27 changes: 0 additions & 27 deletions products/ASC.Mail/Client/src/custom.scss

This file was deleted.

10 changes: 9 additions & 1 deletion products/ASC.People/Client/src/App.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
//import "./wdyr";
import React from "react";
import Shell from "studio/shell";
import ErrorBoundary from "@appserver/common/components/ErrorBoundary";
import "@appserver/common/custom.scss";

const App = () => <Shell />;
const App = () => {
return (
<ErrorBoundary>
<Shell />
</ErrorBoundary>
);
};

export default App;
1 change: 0 additions & 1 deletion products/ASC.People/Client/src/People.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import PrivateRoute from "@appserver/common/components/PrivateRoute";
import AppLoader from "@appserver/common/components/AppLoader";
import { combineUrl, updateTempContent } from "@appserver/common/utils";
import config from "../package.json";
import "./custom.scss";
import i18n from "./i18n";
import { I18nextProvider } from "react-i18next";
import Home from "./pages/Home";
Expand Down
Loading

0 comments on commit 93ba0e8

Please sign in to comment.