[mobile] Edit collaboration

This commit is contained in:
JuliaSvinareva 2021-02-08 19:32:25 +03:00
parent 796f84932e
commit 3912fe4620
8 changed files with 85 additions and 103 deletions

View file

@ -1,95 +1,92 @@
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 { Popover, List, ListItem, Navbar, NavTitle, NavRight } from 'framework7-react'; import { Popover, List, ListItem, Navbar, NavRight, Sheet, BlockTitle, Page, View, Icon, Link } from 'framework7-react';
import { Sheet, Toolbar, BlockTitle, Link, Page, View, Icon } from 'framework7-react';
import { f7 } 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') const PageUsers = inject("users")(observer(props => {
@observer const { t } = useTranslation();
class PageUsers extends Component { const _t = t('Common.Collaboration', {returnObjects: true});
constructor(props){ const storeUsers = props.users;
super(props) return (
<Page name="collab__users">
<Navbar title={_t.textUsers} backLink={_t.textBack}></Navbar>
<BlockTitle>{_t.textEditUser}</BlockTitle>
<List className="coauth__list">
{storeUsers.users.map((model, i) => (
<ListItem title={model.asc_getUserName()} key={i}>
<Icon slot="media" icon="coauth__list__icon"
style={{backgroundColor: model.asc_getColor()}}></Icon>
</ListItem>
))}
</List>
</Page>
)
}));
const routes = [
{
path: '/users/',
component: PageUsers
} }
];
render() { const PageCollaboration = props => {
const { t } = this.props; const { t } = useTranslation();
const userlist = this.props.users; const _t = t('Common.Collaboration', {returnObjects: true});
return ( return (
<Page name="collab__users"> <View style={props.style} stackPages={true} routes={routes}>
<Navbar title="Users" backLink="Back"></Navbar> <Page name="collab__main">
<BlockTitle>{t("Collaboration.textEditUser")}</BlockTitle> <Navbar title={_t.textCollaboration}>
<List className="coauth__list"> {props.isSheet &&
{userlist.users.map((model, i) => ( <NavRight>
<ListItem title={model.asc_getUserName()} key={i}> <Link sheetClose=".coauth__sheet">
<Icon slot="media" icon="coauth__list__icon" <Icon icon='icon-expand-down'/>
style={{backgroundColor: model.asc_getColor()}}></Icon> </Link>
</ListItem> </NavRight>
))} }
</List>
</Page>)
}
};
const PageCollaboration = () => {
"use strict";
return <Page name="collab__main">
<Navbar title="Collaboration">
<NavRight>
<Link sheetClose>Close</Link>
</NavRight>
</Navbar> </Navbar>
<List> <List>
<ListItem href="/users/" title="Users"/> <ListItem link={'/users/'} title={_t.textUsers}/>
<ListItem link="#" title="Comments"/> <ListItem link="#" title={_t.textComments}/>
</List> </List>
</Page>; </Page>
</View>
)
}; };
class CollaborationPopover extends Component { class CollaborationView extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.onoptionclick = this.onoptionclick.bind(this);
}
onoptionclick(page){
f7.views.current.router.navigate(page);
} }
render() { render() {
const show_popover = this.props.usePopover;
return ( return (
<Popover className="collab__popover"> show_popover ?
<Page> <Popover id="coauth-popover" className="popover__titled" onPopoverClosed={() => this.props.onclosed()}>
<Navbar title="Collaboration"></Navbar> <PageCollaboration style={{height: '410px'}}/>
<List> </Popover> :
<ListItem link="#" title="Users"/> <Sheet className="coauth__sheet" push onSheetClosed={() => this.props.onclosed()}>
<ListItem link="#" title="Comments"/> <PageCollaboration isSheet={true}/>
</List> </Sheet>
</Page>
</Popover>
) )
} }
} }
class CollaborationSheet extends Component { const Collaboration = props => {
constructor(props) {
super(props);
this.routes = [
{path: '/', component: 'PageCollaboration'},
{path: '/users/', component: 'PageUsers'}
];
}
render() {
return (
<Sheet className="coauth__sheet" push onSheetClosed={e => this.props.onclosed()}>
<View>
<PageCollaboration />
</View>
</Sheet>
)
}
}
const CollaborationView = props => {
useEffect(() => { useEffect(() => {
f7.sheet.open('.coauth__sheet'); if ( Device.phone ) {
f7.sheet.open('.coauth__sheet');
} else {
f7.popover.open('#coauth-popover', '#btn-coauth');
}
return () => { return () => {
// component will unmount // component will unmount
@ -101,11 +98,10 @@ const CollaborationView = props => {
}; };
return ( return (
<CollaborationSheet onclosed={onviewclosed} /> <CollaborationView usePopover={!Device.phone} onclosed={onviewclosed} />
) )
}; };
const pageusers = withTranslation()(PageUsers);
// export withTranslation()(CollaborationPopover); // export withTranslation()(CollaborationPopover);
export {CollaborationPopover, CollaborationSheet, PageCollaboration, pageusers as PageUsers} export {PageCollaboration}
export default CollaborationView; export default Collaboration;

View file

@ -32,6 +32,13 @@
"textThemeColors": "Theme Colors", "textThemeColors": "Theme Colors",
"textStandartColors": "Standart Colors", "textStandartColors": "Standart Colors",
"textCustomColors": "Custom Colors" "textCustomColors": "Custom Colors"
},
"Collaboration": {
"textCollaboration": "Collaboration",
"textBack": "Back",
"textUsers": "Users",
"textEditUser": "Users who are editing the file:",
"textComments": "Comments"
} }
}, },
"Settings": { "Settings": {
@ -102,9 +109,6 @@
"advDRMOptions": "Protected File", "advDRMOptions": "Protected File",
"txtProtected": "Once you enter the password and open the file, the current password to the file will be reset" "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": { "Edit": {
"textClose": "Close", "textClose": "Close",
"textBack": "Back", "textBack": "Back",

View file

@ -4,7 +4,7 @@ import { Page, View, Navbar, NavLeft, NavRight, Link, Icon } from 'framework7-re
import EditOptions from '../view/edit/Edit'; import EditOptions from '../view/edit/Edit';
import AddOptions from '../view/add/Add'; import AddOptions from '../view/add/Add';
import Settings from '../view/settings/Settings'; 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 { Device } from '../../../../common/mobile/utils/device'
import { Search, SearchSettings } from '../controller/Search'; import { Search, SearchSettings } from '../controller/Search';
import { ContextMenu } from '../controller/ContextMenu'; import { ContextMenu } from '../controller/ContextMenu';
@ -62,7 +62,7 @@ export default class MainPage extends Component {
<Link id='btn-edit' icon='icon-edit-settings' href={false} onClick={e => this.handleClickToOpenOptions('edit')}></Link> <Link id='btn-edit' icon='icon-edit-settings' href={false} onClick={e => this.handleClickToOpenOptions('edit')}></Link>
<Link id='btn-add' icon='icon-plus' href={false} onClick={e => this.handleClickToOpenOptions('add')}></Link> <Link id='btn-add' icon='icon-plus' href={false} onClick={e => this.handleClickToOpenOptions('add')}></Link>
{ Device.phone ? null : <Link icon='icon-search' searchbarEnable='.searchbar' href={false}></Link> } { Device.phone ? null : <Link icon='icon-search' searchbarEnable='.searchbar' href={false}></Link> }
<Link href={false} icon='icon-collaboration' onClick={e => this.handleClickToOpenOptions('coauth')}></Link> <Link id='btn-coauth' href={false} icon='icon-collaboration' onClick={e => this.handleClickToOpenOptions('coauth')}></Link>
<Link id='btn-settings' icon='icon-settings' href={false} onClick={e => this.handleClickToOpenOptions('settings')}></Link> <Link id='btn-settings' icon='icon-settings' href={false} onClick={e => this.handleClickToOpenOptions('settings')}></Link>
</NavRight> </NavRight>
{ Device.phone ? null : <Search /> } { Device.phone ? null : <Search /> }
@ -88,7 +88,7 @@ export default class MainPage extends Component {
} }
{ {
!this.state.collaborationVisible ? null : !this.state.collaborationVisible ? null :
<CollaborationView onclosed={this.handleOptionsViewClosed.bind(this, 'coauth')} /> <Collaboration onclosed={this.handleOptionsViewClosed.bind(this, 'coauth')} />
} }
{/*<ContextMenu />*/} {/*<ContextMenu />*/}
</Page> </Page>

View file

@ -1,17 +1,11 @@
import MainPage from '../page/main'; import MainPage from '../page/main';
import { PageUsers } from '../../../../common/mobile/lib/view/Collaboration.jsx';
var routes = [ var routes = [
{ {
path: '/', path: '/',
component: MainPage, component: MainPage,
}, }
{
path: '/users/',
component: PageUsers
},
]; ];
export default routes; export default routes;

View file

@ -58,7 +58,7 @@ export default class MainPage extends Component {
<NavRight> <NavRight>
<Link id='btn-edit' icon='icon-edit-settings' href={false} onClick={e => this.handleClickToOpenOptions('edit')}></Link> <Link id='btn-edit' icon='icon-edit-settings' href={false} onClick={e => this.handleClickToOpenOptions('edit')}></Link>
<Link id='btn-add' icon='icon-plus' href={false} onClick={e => this.handleClickToOpenOptions('add')}></Link> <Link id='btn-add' icon='icon-plus' href={false} onClick={e => this.handleClickToOpenOptions('add')}></Link>
<Link href={false} icon='icon-collaboration' onClick={e => this.handleClickToOpenOptions('coauth')}></Link> <Link id='btn-coauth' href={false} icon='icon-collaboration' onClick={e => this.handleClickToOpenOptions('coauth')}></Link>
<Link id='btn-settings' icon='icon-settings' href={false} onClick={e => this.handleClickToOpenOptions('settings')}></Link> <Link id='btn-settings' icon='icon-settings' href={false} onClick={e => this.handleClickToOpenOptions('settings')}></Link>
</NavRight> </NavRight>
</Navbar> </Navbar>

View file

@ -1,17 +1,11 @@
import MainPage from '../page/main'; import MainPage from '../page/main';
import { PageCollaboration, PageUsers } from '../../../../common/mobile/lib/view/Collaboration.jsx';
var routes = [ var routes = [
{ {
path: '/', path: '/',
component: MainPage, component: MainPage,
}, }
{
path: '/users/',
component: PageUsers
},
]; ];
export default routes; export default routes;

View file

@ -67,7 +67,7 @@ export default class MainPage extends Component {
<NavRight> <NavRight>
<Link id='btn-edit' icon='icon-edit-settings' href={false} onClick={e => this.handleClickToOpenOptions('edit')}></Link> <Link id='btn-edit' icon='icon-edit-settings' href={false} onClick={e => this.handleClickToOpenOptions('edit')}></Link>
<Link id='btn-add' icon='icon-plus' href={false} onClick={e => this.handleClickToOpenOptions('add')}></Link> <Link id='btn-add' icon='icon-plus' href={false} onClick={e => this.handleClickToOpenOptions('add')}></Link>
<Link href={false} icon='icon-collaboration' onClick={e => this.handleClickToOpenOptions('coauth')}></Link> <Link id='btn-coauth' href={false} icon='icon-collaboration' onClick={e => this.handleClickToOpenOptions('coauth')}></Link>
<Link id='btn-settings' icon='icon-settings' href={false} onClick={e => this.handleClickToOpenOptions('settings')}></Link> <Link id='btn-settings' icon='icon-settings' href={false} onClick={e => this.handleClickToOpenOptions('settings')}></Link>
</NavRight> </NavRight>
</Navbar> </Navbar>

View file

@ -1,17 +1,11 @@
import MainPage from '../page/main'; import MainPage from '../page/main';
import { PageCollaboration, PageUsers } from '../../../../common/mobile/lib/view/Collaboration.jsx';
var routes = [ var routes = [
{ {
path: '/', path: '/',
component: MainPage, component: MainPage,
}, }
{
path: '/users/',
component: PageUsers
},
]; ];
export default routes; export default routes;