import React, { Component, useEffect } from 'react'; import { observer, inject } from "mobx-react"; import { Popover, List, ListItem, Navbar, NavRight, Sheet, BlockTitle, Page, View, Icon, Link } from 'framework7-react'; import { f7 } from 'framework7-react'; import { useTranslation } from 'react-i18next'; import {Device} from "../../../utils/device"; import {ReviewController, ReviewChangeController} from "../../controller/collaboration/Review"; import {PageDisplayMode} from "./Review"; import {ViewCommentsController} from "../../controller/collaboration/Comments"; const PageUsers = inject("users")(observer(props => { const { t } = useTranslation(); const _t = t('Common.Collaboration', {returnObjects: true}); const storeUsers = props.users; return ( {Device.phone && } {_t.textEditUser} {storeUsers.editUsers.map((user, i) => ( 1 ? ` (${user.count})` : '')} key={i}>
{user.initials}
))}
) })); const routes = [ { path: '/users/', component: PageUsers }, { path: '/review/', component: ReviewController }, { path: '/cm-review/', component: ReviewController, options: { props: { noBack: true } } }, { path: '/display-mode/', component: PageDisplayMode }, { path: '/review-change/', component: ReviewChangeController }, { path: '/cm-review-change/', component: ReviewChangeController, options: { props: { noBack: true } } }, { path: '/comments/', component: ViewCommentsController, options: { props: { allComments: true } } } ]; const PageCollaboration = inject('storeAppOptions', 'users')(observer(props => { const { t } = useTranslation(); const _t = t('Common.Collaboration', {returnObjects: true}); const appOptions = props.storeAppOptions; return ( {Device.phone && } {props.users.editUsers.length > 0 && } {appOptions.canViewComments && } {window.editorType === 'de' && (appOptions.canReview || appOptions.canViewReview) && } ) })); 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()} closeByOutsideClick={false}> : this.props.onclosed()}> ) } } const Collaboration = props => { useEffect(() => { if ( Device.phone ) { f7.sheet.open('.coauth__sheet'); } else { f7.popover.open('#coauth-popover', '#btn-coauth'); } return () => { // component will unmount } }); const onviewclosed = () => { if ( props.onclosed ) props.onclosed(); }; return ( ) }; export {PageCollaboration} export default Collaboration;