[DE mobile] Add review, review change handler in context menu

This commit is contained in:
JuliaSvinareva 2021-03-17 21:57:52 +03:00
parent c5ef8766d6
commit 4687d2b127
7 changed files with 101 additions and 15 deletions

View file

@ -120,6 +120,7 @@ class Review extends Component {
onAcceptAll={this.onAcceptAll} onAcceptAll={this.onAcceptAll}
onRejectAll={this.onRejectAll} onRejectAll={this.onRejectAll}
onDisplayMode={this.onDisplayMode} onDisplayMode={this.onDisplayMode}
noBack={this.props.noBack}
/> />
) )
} }
@ -520,6 +521,7 @@ class ReviewChange extends Component {
onRejectCurrentChange={this.onRejectCurrentChange} onRejectCurrentChange={this.onRejectCurrentChange}
onGotoNextChange={this.onGotoNextChange} onGotoNextChange={this.onGotoNextChange}
onDeleteChange={this.onDeleteChange} onDeleteChange={this.onDeleteChange}
noBack={this.props.noBack}
/> />
) )
} }

View file

@ -16,7 +16,15 @@ const PageUsers = inject("users")(observer(props => {
const storeUsers = props.users; const storeUsers = props.users;
return ( return (
<Page name="collab__users"> <Page name="collab__users">
<Navbar title={_t.textUsers} backLink={_t.textBack}></Navbar> <Navbar title={_t.textUsers} backLink={_t.textBack}>
{Device.phone &&
<NavRight>
<Link sheetClose=".coauth__sheet">
<Icon icon='icon-expand-down'/>
</Link>
</NavRight>
}
</Navbar>
<BlockTitle>{_t.textEditUser}</BlockTitle> <BlockTitle>{_t.textEditUser}</BlockTitle>
<List className="coauth__list"> <List className="coauth__list">
{storeUsers.users.map((model, i) => ( {storeUsers.users.map((model, i) => (
@ -39,6 +47,15 @@ const routes = [
path: '/review/', path: '/review/',
component: ReviewController component: ReviewController
}, },
{
path: '/cm-review/',
component: ReviewController,
options: {
props: {
noBack: true
}
}
},
{ {
path: '/display-mode/', path: '/display-mode/',
component: PageDisplayMode component: PageDisplayMode
@ -47,6 +64,15 @@ const routes = [
path: '/review-change/', path: '/review-change/',
component: ReviewChangeController component: ReviewChangeController
}, },
{
path: '/cm-review-change/',
component: ReviewChangeController,
options: {
props: {
noBack: true
}
}
},
{ {
path: '/comments/', path: '/comments/',
component: ViewCommentsController, component: ViewCommentsController,
@ -62,10 +88,10 @@ const PageCollaboration = inject('storeAppOptions')(observer(props => {
const { t } = useTranslation(); const { t } = useTranslation();
const _t = t('Common.Collaboration', {returnObjects: true}); const _t = t('Common.Collaboration', {returnObjects: true});
return ( return (
<View style={props.style} stackPages={true} routes={routes}> <View style={props.style} stackPages={true} routes={routes} url={props.page && `/${props.page}/`}>
<Page name="collab__main"> <Page name="collab__main">
<Navbar title={_t.textCollaboration}> <Navbar title={_t.textCollaboration}>
{props.isSheet && {Device.phone &&
<NavRight> <NavRight>
<Link sheetClose=".coauth__sheet"> <Link sheetClose=".coauth__sheet">
<Icon icon='icon-expand-down'/> <Icon icon='icon-expand-down'/>
@ -108,10 +134,10 @@ class CollaborationView extends Component {
return ( return (
show_popover ? show_popover ?
<Popover id="coauth-popover" className="popover__titled" onPopoverClosed={() => this.props.onclosed()}> <Popover id="coauth-popover" className="popover__titled" onPopoverClosed={() => this.props.onclosed()}>
<PageCollaboration style={{height: '410px'}}/> <PageCollaboration style={{height: '410px'}} page={this.props.page}/>
</Popover> : </Popover> :
<Sheet className="coauth__sheet" push onSheetClosed={() => this.props.onclosed()}> <Sheet className="coauth__sheet" push onSheetClosed={() => this.props.onclosed()}>
<PageCollaboration isSheet={true}/> <PageCollaboration page={this.props.page}/>
</Sheet> </Sheet>
) )
} }
@ -135,7 +161,7 @@ const Collaboration = props => {
}; };
return ( return (
<CollaborationView usePopover={!Device.phone} onclosed={onviewclosed} /> <CollaborationView usePopover={!Device.phone} onclosed={onviewclosed} page={props.page}/>
) )
}; };

View file

@ -1,6 +1,6 @@
import React, { Component, useEffect } from 'react'; import React, { Component, useEffect } from 'react';
import { observer, inject } from "mobx-react"; import { observer, inject } from "mobx-react";
import { Page, Navbar, List, ListItem, Icon, Toggle, Toolbar, Link } from 'framework7-react'; import { Page, Navbar, NavRight, List, ListItem, Icon, Toggle, Toolbar, Link } from 'framework7-react';
import { f7 } from 'framework7-react'; import { f7 } from 'framework7-react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import {Device} from "../../../utils/device"; import {Device} from "../../../utils/device";
@ -14,7 +14,15 @@ const PageReview = props => {
return ( return (
<Page> <Page>
<Navbar title={_t.textReview} backLink={_t.textBack}/> <Navbar title={_t.textReview} backLink={!props.noBack && _t.textBack}>
{Device.phone &&
<NavRight>
<Link sheetClose=".coauth__sheet">
<Icon icon='icon-expand-down'/>
</Link>
</NavRight>
}
</Navbar>
<List> <List>
{canReview && {canReview &&
<ListItem title={_t.textTrackChanges} className={isDisableAllSettings ? 'disabled' : ''}> <ListItem title={_t.textTrackChanges} className={isDisableAllSettings ? 'disabled' : ''}>
@ -58,7 +66,15 @@ const DisplayMode = props => {
const mode = props.storeReview.displayMode; const mode = props.storeReview.displayMode;
return ( return (
<Page> <Page>
<Navbar title={_t.textDisplayMode} backLink={_t.textBack}/> <Navbar title={_t.textDisplayMode} backLink={_t.textBack}>
{Device.phone &&
<NavRight>
<Link sheetClose=".coauth__sheet">
<Icon icon='icon-expand-down'/>
</Link>
</NavRight>
}
</Navbar>
<List mediaList> <List mediaList>
<ListItem title={_t.textMarkup} <ListItem title={_t.textMarkup}
subtitle={_t.textAllChangesEditing} subtitle={_t.textAllChangesEditing}
@ -99,7 +115,15 @@ const PageReviewChange = props => {
const isLockPrevNext = (displayMode === "final" || displayMode === "original"); const isLockPrevNext = (displayMode === "final" || displayMode === "original");
return ( return (
<Page className='page-review'> <Page className='page-review'>
<Navbar title={_t.textReviewChange} backLink={_t.textBack}/> <Navbar title={_t.textReviewChange} backLink={!props.noBack && _t.textBack}>
{Device.phone &&
<NavRight>
<Link sheetClose=".coauth__sheet">
<Icon icon='icon-expand-down'/>
</Link>
</NavRight>
}
</Navbar>
<Toolbar position='bottom'> <Toolbar position='bottom'>
<span className='change-buttons row'> <span className='change-buttons row'>
{!props.isReviewOnly && {!props.isReviewOnly &&

View file

@ -38,6 +38,12 @@
.navbar-inner { .navbar-inner {
z-index: auto; z-index: auto;
} }
.sheet-close {
width: 44px;
height: 44px;
display: flex;
justify-content: center;
}
} }
.popover__titled { .popover__titled {

View file

@ -21,6 +21,14 @@
--f7-dialog-button-text-color: @themeColor; --f7-dialog-button-text-color: @themeColor;
.navbar {
.sheet-close {
width: 56px;
height: 56px;
display: flex;
justify-content: center;
}
}
// Buttons // Buttons
.segmented { .segmented {
.decrement, .increment { .decrement, .increment {

View file

@ -20,6 +20,7 @@ class ContextMenu extends ContextMenuController {
// console.log('context menu controller created'); // console.log('context menu controller created');
this.onApiShowComment = this.onApiShowComment.bind(this); this.onApiShowComment = this.onApiShowComment.bind(this);
this.onApiHideComment = this.onApiHideComment.bind(this); this.onApiHideComment = this.onApiHideComment.bind(this);
this.onApiShowChange = this.onApiShowChange.bind(this);
} }
static closeContextMenu() { static closeContextMenu() {
@ -32,6 +33,7 @@ class ContextMenu extends ContextMenuController {
const api = Common.EditorApi.get(); const api = Common.EditorApi.get();
api.asc_unregisterCallback('asc_onShowComment', this.onApiShowComment); api.asc_unregisterCallback('asc_onShowComment', this.onApiShowComment);
api.asc_unregisterCallback('asc_onHideComment', this.onApiHideComment); api.asc_unregisterCallback('asc_onHideComment', this.onApiHideComment);
api.asc_unregisterCallback('asc_onShowRevisionsChange', this.onApiShowChange);
} }
@ -43,6 +45,10 @@ class ContextMenu extends ContextMenuController {
this.isComments = false; this.isComments = false;
} }
onApiShowChange(sdkchange) {
this.inRevisionChange = sdkchange && sdkchange.length>0;
}
// onMenuClosed() { // onMenuClosed() {
// super.onMenuClosed(); // super.onMenuClosed();
// } // }
@ -73,6 +79,16 @@ class ContextMenu extends ContextMenuController {
case 'viewcomment': case 'viewcomment':
Common.Notifications.trigger('viewcomment'); Common.Notifications.trigger('viewcomment');
break; break;
case 'review':
setTimeout(() => {
this.props.openOptions('coauth', 'cm-review');
}, 400);
break;
case 'reviewchange':
setTimeout(() => {
this.props.openOptions('coauth', 'cm-review-change');
}, 400);
break;
} }
console.log("click context menu item: " + action); console.log("click context menu item: " + action);
@ -107,6 +123,7 @@ class ContextMenu extends ContextMenuController {
const api = Common.EditorApi.get(); const api = Common.EditorApi.get();
api.asc_registerCallback('asc_onShowComment', this.onApiShowComment); api.asc_registerCallback('asc_onShowComment', this.onApiShowComment);
api.asc_registerCallback('asc_onHideComment', this.onApiHideComment); api.asc_registerCallback('asc_onHideComment', this.onApiHideComment);
api.asc_registerCallback('asc_onShowRevisionsChange', this.onApiShowChange);
} }
initMenuItems() { initMenuItems() {
@ -246,7 +263,7 @@ class ContextMenu extends ContextMenuController {
// } // }
if ( canReview ) { if ( canReview ) {
if (false /*_inRevisionChange*/) { if (this.inRevisionChange) {
itemsText.push({ itemsText.push({
caption: _t.menuReviewChange, caption: _t.menuReviewChange,
event: 'reviewchange' event: 'reviewchange'

View file

@ -23,7 +23,7 @@ export default class MainPage extends Component {
}; };
} }
handleClickToOpenOptions = opts => { handleClickToOpenOptions = (opts, page) => {
ContextMenu.closeContextMenu(); ContextMenu.closeContextMenu();
this.setState(state => { this.setState(state => {
@ -34,7 +34,10 @@ export default class MainPage extends Component {
else if ( opts == 'settings' ) else if ( opts == 'settings' )
return {settingsVisible: true}; return {settingsVisible: true};
else if ( opts == 'coauth' ) else if ( opts == 'coauth' )
return {collaborationVisible: true}; return {
collaborationVisible: true,
collaborationPage: page
};
}); });
}; };
@ -95,9 +98,9 @@ export default class MainPage extends Component {
} }
{ {
!this.state.collaborationVisible ? null : !this.state.collaborationVisible ? null :
<Collaboration onclosed={this.handleOptionsViewClosed.bind(this, 'coauth')} /> <Collaboration onclosed={this.handleOptionsViewClosed.bind(this, 'coauth')} page={this.state.collaborationPage} />
} }
<ContextMenu /> <ContextMenu openOptions={this.handleClickToOpenOptions.bind(this)} />
</Page> </Page>
) )
} }