From 3912fe46200d4463adeb028d453312e66c49b20f Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Mon, 8 Feb 2021 19:32:25 +0300 Subject: [PATCH] [mobile] Edit collaboration --- apps/common/mobile/lib/view/Collaboration.jsx | 144 +++++++++--------- apps/documenteditor/mobile/locale/en.json | 10 +- apps/documenteditor/mobile/src/page/main.jsx | 6 +- .../mobile/src/router/routes.js | 8 +- .../mobile/src/page/main.jsx | 2 +- .../mobile/src/router/routes.js | 8 +- .../mobile/src/page/main.jsx | 2 +- .../mobile/src/router/routes.js | 8 +- 8 files changed, 85 insertions(+), 103 deletions(-) diff --git a/apps/common/mobile/lib/view/Collaboration.jsx b/apps/common/mobile/lib/view/Collaboration.jsx index f51a73f8a..13c75c730 100644 --- a/apps/common/mobile/lib/view/Collaboration.jsx +++ b/apps/common/mobile/lib/view/Collaboration.jsx @@ -1,95 +1,92 @@ import React, { Component, useEffect } from 'react'; import { observer, inject } from "mobx-react"; -import { Popover, List, ListItem, Navbar, NavTitle, NavRight } from 'framework7-react'; -import { Sheet, Toolbar, BlockTitle, Link, Page, View, Icon } from 'framework7-react'; +import { Popover, List, ListItem, Navbar, NavRight, Sheet, BlockTitle, Page, View, Icon, Link } from 'framework7-react'; import { f7 } from 'framework7-react'; -import { withTranslation, useTranslation } from 'react-i18next'; +import { useTranslation } from 'react-i18next'; +import {Device} from "../../utils/device"; -@inject('users') -@observer -class PageUsers extends Component { - constructor(props){ - super(props) +const PageUsers = inject("users")(observer(props => { + const { t } = useTranslation(); + const _t = t('Common.Collaboration', {returnObjects: true}); + const storeUsers = props.users; + return ( + + + {_t.textEditUser} + + {storeUsers.users.map((model, i) => ( + + + + ))} + + + ) +})); + +const routes = [ + { + path: '/users/', + component: PageUsers } +]; - render() { - const { t } = this.props; - const userlist = this.props.users; - return ( - - - {t("Collaboration.textEditUser")} - - {userlist.users.map((model, i) => ( - - - - ))} - - ) - } -}; - -const PageCollaboration = () => { - "use strict"; - - return - - - Close - +const PageCollaboration = props => { + const { t } = useTranslation(); + const _t = t('Common.Collaboration', {returnObjects: true}); + return ( + + + + {props.isSheet && + + + + + + } - - + + - ; + + + ) }; -class CollaborationPopover extends Component { +class CollaborationView extends Component { constructor(props) { super(props); + + this.onoptionclick = this.onoptionclick.bind(this); + } + onoptionclick(page){ + f7.views.current.router.navigate(page); } render() { + const show_popover = this.props.usePopover; return ( - - - - - - - - - + show_popover ? + this.props.onclosed()}> + + : + this.props.onclosed()}> + + ) } } -class CollaborationSheet extends Component { - constructor(props) { - super(props); - - this.routes = [ - {path: '/', component: 'PageCollaboration'}, - {path: '/users/', component: 'PageUsers'} - ]; - } - render() { - return ( - this.props.onclosed()}> - - - - - ) - } -} - -const CollaborationView = props => { +const Collaboration = props => { useEffect(() => { - f7.sheet.open('.coauth__sheet'); + if ( Device.phone ) { + f7.sheet.open('.coauth__sheet'); + } else { + f7.popover.open('#coauth-popover', '#btn-coauth'); + } return () => { // component will unmount @@ -101,11 +98,10 @@ const CollaborationView = props => { }; return ( - + ) }; -const pageusers = withTranslation()(PageUsers); // export withTranslation()(CollaborationPopover); -export {CollaborationPopover, CollaborationSheet, PageCollaboration, pageusers as PageUsers} -export default CollaborationView; +export {PageCollaboration} +export default Collaboration; diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index 1f05770b6..0865859e7 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -32,6 +32,13 @@ "textThemeColors": "Theme Colors", "textStandartColors": "Standart Colors", "textCustomColors": "Custom Colors" + }, + "Collaboration": { + "textCollaboration": "Collaboration", + "textBack": "Back", + "textUsers": "Users", + "textEditUser": "Users who are editing the file:", + "textComments": "Comments" } }, "Settings": { @@ -102,9 +109,6 @@ "advDRMOptions": "Protected File", "txtProtected": "Once you enter the password and open the file, the current password to the file will be reset" }, - "Collaboration": { - "textEditUser": "Users who are editing the file:" - }, "Edit": { "textClose": "Close", "textBack": "Back", diff --git a/apps/documenteditor/mobile/src/page/main.jsx b/apps/documenteditor/mobile/src/page/main.jsx index d57ce35a4..fbfc689c6 100644 --- a/apps/documenteditor/mobile/src/page/main.jsx +++ b/apps/documenteditor/mobile/src/page/main.jsx @@ -4,7 +4,7 @@ import { Page, View, Navbar, NavLeft, NavRight, Link, Icon } from 'framework7-re import EditOptions from '../view/edit/Edit'; import AddOptions from '../view/add/Add'; import Settings from '../view/settings/Settings'; -import CollaborationView from '../../../../common/mobile/lib/view/Collaboration.jsx' +import Collaboration from '../../../../common/mobile/lib/view/Collaboration.jsx' import { Device } from '../../../../common/mobile/utils/device' import { Search, SearchSettings } from '../controller/Search'; import { ContextMenu } from '../controller/ContextMenu'; @@ -62,7 +62,7 @@ export default class MainPage extends Component { this.handleClickToOpenOptions('edit')}> this.handleClickToOpenOptions('add')}> { Device.phone ? null : } - this.handleClickToOpenOptions('coauth')}> + this.handleClickToOpenOptions('coauth')}> this.handleClickToOpenOptions('settings')}> { Device.phone ? null : } @@ -88,7 +88,7 @@ export default class MainPage extends Component { } { !this.state.collaborationVisible ? null : - + } {/**/} diff --git a/apps/documenteditor/mobile/src/router/routes.js b/apps/documenteditor/mobile/src/router/routes.js index 7b608915b..d64d8ccbe 100644 --- a/apps/documenteditor/mobile/src/router/routes.js +++ b/apps/documenteditor/mobile/src/router/routes.js @@ -1,17 +1,11 @@ import MainPage from '../page/main'; -import { PageUsers } from '../../../../common/mobile/lib/view/Collaboration.jsx'; - var routes = [ { path: '/', component: MainPage, - }, - { - path: '/users/', - component: PageUsers - }, + } ]; export default routes; diff --git a/apps/presentationeditor/mobile/src/page/main.jsx b/apps/presentationeditor/mobile/src/page/main.jsx index dbdddc29c..fd98c63b0 100644 --- a/apps/presentationeditor/mobile/src/page/main.jsx +++ b/apps/presentationeditor/mobile/src/page/main.jsx @@ -58,7 +58,7 @@ export default class MainPage extends Component { this.handleClickToOpenOptions('edit')}> this.handleClickToOpenOptions('add')}> - this.handleClickToOpenOptions('coauth')}> + this.handleClickToOpenOptions('coauth')}> this.handleClickToOpenOptions('settings')}> diff --git a/apps/presentationeditor/mobile/src/router/routes.js b/apps/presentationeditor/mobile/src/router/routes.js index 027d62ae6..d5dc65d43 100644 --- a/apps/presentationeditor/mobile/src/router/routes.js +++ b/apps/presentationeditor/mobile/src/router/routes.js @@ -1,17 +1,11 @@ import MainPage from '../page/main'; -import { PageCollaboration, PageUsers } from '../../../../common/mobile/lib/view/Collaboration.jsx'; - var routes = [ { path: '/', component: MainPage, - }, - { - path: '/users/', - component: PageUsers - }, + } ]; export default routes; diff --git a/apps/spreadsheeteditor/mobile/src/page/main.jsx b/apps/spreadsheeteditor/mobile/src/page/main.jsx index 8ea7ea17a..1e9f7eada 100644 --- a/apps/spreadsheeteditor/mobile/src/page/main.jsx +++ b/apps/spreadsheeteditor/mobile/src/page/main.jsx @@ -67,7 +67,7 @@ export default class MainPage extends Component { this.handleClickToOpenOptions('edit')}> this.handleClickToOpenOptions('add')}> - this.handleClickToOpenOptions('coauth')}> + this.handleClickToOpenOptions('coauth')}> this.handleClickToOpenOptions('settings')}> diff --git a/apps/spreadsheeteditor/mobile/src/router/routes.js b/apps/spreadsheeteditor/mobile/src/router/routes.js index 027d62ae6..d5dc65d43 100644 --- a/apps/spreadsheeteditor/mobile/src/router/routes.js +++ b/apps/spreadsheeteditor/mobile/src/router/routes.js @@ -1,17 +1,11 @@ import MainPage from '../page/main'; -import { PageCollaboration, PageUsers } from '../../../../common/mobile/lib/view/Collaboration.jsx'; - var routes = [ { path: '/', component: MainPage, - }, - { - path: '/users/', - component: PageUsers - }, + } ]; export default routes;