[DE mobile] Add snackbar for android
This commit is contained in:
parent
e096d0cddb
commit
7d6f4dbd8c
|
@ -677,6 +677,8 @@
|
||||||
"dlgLeaveTitleText": "You leave the application",
|
"dlgLeaveTitleText": "You leave the application",
|
||||||
"leaveButtonText": "Leave this Page",
|
"leaveButtonText": "Leave this Page",
|
||||||
"stayButtonText": "Stay on this page",
|
"stayButtonText": "Stay on this page",
|
||||||
"textOk": "OK"
|
"textOk": "OK",
|
||||||
|
"textSwitchedMobileView": "Switched to Mobile view",
|
||||||
|
"textSwitchedStandardView": "Switched to Standard view"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
const Snackbar = props => {
|
||||||
|
return (
|
||||||
|
<div className="snackbar">
|
||||||
|
<div className="snackbar__content">
|
||||||
|
<p className="snackbar__text">{props.text}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Snackbar;
|
|
@ -151,6 +151,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ToolbarView openOptions={props.openOptions}
|
<ToolbarView openOptions={props.openOptions}
|
||||||
|
closeOptions={props.closeOptions}
|
||||||
isEdit={appOptions.isEdit}
|
isEdit={appOptions.isEdit}
|
||||||
docTitle={docTitle}
|
docTitle={docTitle}
|
||||||
isShowBack={isShowBack}
|
isShowBack={isShowBack}
|
||||||
|
|
|
@ -87,10 +87,6 @@ const Settings = props => {
|
||||||
|
|
||||||
appOptions.changeMobileView();
|
appOptions.changeMobileView();
|
||||||
api.ChangeReaderMode();
|
api.ChangeReaderMode();
|
||||||
|
|
||||||
if (Device.phone) {
|
|
||||||
closeModal();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return <SettingsView usePopover={!Device.phone}
|
return <SettingsView usePopover={!Device.phone}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
.ios {
|
.ios {
|
||||||
|
|
||||||
// Stepper
|
// Stepper
|
||||||
.content-block.stepper-block {
|
.content-block.stepper-block {
|
||||||
margin: 20px 0;
|
margin: 20px 0;
|
||||||
|
|
|
@ -105,4 +105,47 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Snackbar
|
||||||
|
.snackbar {
|
||||||
|
position: absolute;
|
||||||
|
width: 344px;
|
||||||
|
max-width: 344px;
|
||||||
|
height: 48px;
|
||||||
|
left: 8px;
|
||||||
|
bottom: 16px;
|
||||||
|
background: #333333;
|
||||||
|
border-radius: 4px;
|
||||||
|
z-index: 1000000;
|
||||||
|
&__content {
|
||||||
|
padding: 14px 16px;
|
||||||
|
}
|
||||||
|
&__text {
|
||||||
|
margin: 0;
|
||||||
|
color: @fill-white;
|
||||||
|
font-style: normal;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 20px;
|
||||||
|
letter-spacing: 0.25px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.snackbar-enter {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.snackbar-enter-active {
|
||||||
|
opacity: 1;
|
||||||
|
transition: opacity 200ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.snackbar-exit {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.snackbar-exit-active {
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 200ms;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
|
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
import { CSSTransition } from 'react-transition-group';
|
||||||
import { f7, Link } from 'framework7-react';
|
import { f7, Link } from 'framework7-react';
|
||||||
import { Page, View, Navbar, Subnavbar, Icon } from 'framework7-react';
|
import { Page, View, Navbar, Subnavbar, Icon } from 'framework7-react';
|
||||||
import { observer, inject } from "mobx-react";
|
import { observer, inject } from "mobx-react";
|
||||||
|
import { withTranslation } from 'react-i18next';
|
||||||
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 '../controller/settings/Settings';
|
import Settings from '../controller/settings/Settings';
|
||||||
|
@ -13,6 +14,7 @@ import { Search, SearchSettings } from '../controller/Search';
|
||||||
import ContextMenu from '../controller/ContextMenu';
|
import ContextMenu from '../controller/ContextMenu';
|
||||||
import { Toolbar } from "../controller/Toolbar";
|
import { Toolbar } from "../controller/Toolbar";
|
||||||
import NavigationController from '../controller/settings/Navigation';
|
import NavigationController from '../controller/settings/Navigation';
|
||||||
|
import Snackbar from "../components/Snackbar/Snackbar";
|
||||||
|
|
||||||
class MainPage extends Component {
|
class MainPage extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -23,7 +25,8 @@ class MainPage extends Component {
|
||||||
addShowOptions: null,
|
addShowOptions: null,
|
||||||
settingsVisible: false,
|
settingsVisible: false,
|
||||||
collaborationVisible: false,
|
collaborationVisible: false,
|
||||||
navigationVisible: false
|
navigationVisible: false,
|
||||||
|
snackbarVisible: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +52,9 @@ class MainPage extends Component {
|
||||||
} else if( opts === 'navigation') {
|
} else if( opts === 'navigation') {
|
||||||
this.state.navigationVisible && (opened = true);
|
this.state.navigationVisible && (opened = true);
|
||||||
newState.navigationVisible = true;
|
newState.navigationVisible = true;
|
||||||
|
} else if( opts === 'snackbar') {
|
||||||
|
this.state.snackbarVisible && (opened = true);
|
||||||
|
newState.snackbarVisible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let key in this.state) {
|
for (let key in this.state) {
|
||||||
|
@ -82,6 +88,8 @@ class MainPage extends Component {
|
||||||
return {collaborationVisible: false};
|
return {collaborationVisible: false};
|
||||||
else if( opts == 'navigation')
|
else if( opts == 'navigation')
|
||||||
return {navigationVisible: false}
|
return {navigationVisible: false}
|
||||||
|
else if( opts == 'snackbar')
|
||||||
|
return {snackbarVisible: false}
|
||||||
});
|
});
|
||||||
if ((opts === 'edit' || opts === 'coauth') && Device.phone) {
|
if ((opts === 'edit' || opts === 'coauth') && Device.phone) {
|
||||||
f7.navbar.show('.main-navbar');
|
f7.navbar.show('.main-navbar');
|
||||||
|
@ -91,9 +99,9 @@ class MainPage extends Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { t } = this.props;
|
||||||
const appOptions = this.props.storeAppOptions;
|
const appOptions = this.props.storeAppOptions;
|
||||||
// const isViewer = appOptions.isViewer;
|
const isMobileView = appOptions.isMobileView;
|
||||||
// console.log(isViewer);
|
|
||||||
const config = appOptions.config;
|
const config = appOptions.config;
|
||||||
|
|
||||||
let showLogo = !(appOptions.canBrandingExt && (config.customization && (config.customization.loaderName || config.customization.loaderLogo)));
|
let showLogo = !(appOptions.canBrandingExt && (config.customization && (config.customization.loaderName || config.customization.loaderLogo)));
|
||||||
|
@ -177,10 +185,25 @@ class MainPage extends Component {
|
||||||
!this.state.navigationVisible ? null :
|
!this.state.navigationVisible ? null :
|
||||||
<NavigationController onclosed={this.handleOptionsViewClosed.bind(this, 'navigation')} />
|
<NavigationController onclosed={this.handleOptionsViewClosed.bind(this, 'navigation')} />
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
<CSSTransition
|
||||||
|
in={this.state.snackbarVisible}
|
||||||
|
// timeout={300}
|
||||||
|
timeout={{
|
||||||
|
enter: 300,
|
||||||
|
exit: 300
|
||||||
|
}}
|
||||||
|
classNames="snackbar"
|
||||||
|
mountOnEnter
|
||||||
|
unmountOnExit
|
||||||
|
>
|
||||||
|
<Snackbar text={isMobileView ? t("Toolbar.textSwitchedMobileView") : t("Toolbar.textSwitchedStandardView")} />
|
||||||
|
</CSSTransition>
|
||||||
|
}
|
||||||
{appOptions.isDocReady && <ContextMenu openOptions={this.handleClickToOpenOptions.bind(this)} />}
|
{appOptions.isDocReady && <ContextMenu openOptions={this.handleClickToOpenOptions.bind(this)} />}
|
||||||
</Page>
|
</Page>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default inject("storeAppOptions")(observer(MainPage));
|
export default inject("storeAppOptions")(observer(withTranslation()(MainPage)));
|
|
@ -2,7 +2,7 @@ import React, {Fragment} from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import {NavLeft, NavRight, NavTitle, Link, Icon} from 'framework7-react';
|
import {NavLeft, NavRight, NavTitle, Link, Icon} from 'framework7-react';
|
||||||
import { Device } from '../../../../common/mobile/utils/device';
|
import { Device } from '../../../../common/mobile/utils/device';
|
||||||
import EditorUIController from '../lib/patch'
|
import EditorUIController from '../lib/patch';
|
||||||
|
|
||||||
const ToolbarView = props => {
|
const ToolbarView = props => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
@ -44,7 +44,13 @@ const ToolbarView = props => {
|
||||||
onUndoClick: props.onUndo,
|
onUndoClick: props.onUndo,
|
||||||
onRedoClick: props.onRedo
|
onRedoClick: props.onRedo
|
||||||
})}
|
})}
|
||||||
{(isViewer || !Device.phone) && <Link className={props.disabledControls ? 'disabled' : ''} icon={isMobileView ? 'icon-standard-view' : 'icon-mobile-view'} href={false} onClick={() => props.changeMobileView()}></Link>}
|
{(isViewer || !Device.phone) && <Link className={props.disabledControls ? 'disabled' : ''} icon={isMobileView ? 'icon-standard-view' : 'icon-mobile-view'} href={false} onClick={() => {
|
||||||
|
props.changeMobileView();
|
||||||
|
props.openOptions('snackbar');
|
||||||
|
setTimeout(() => {
|
||||||
|
props.closeOptions('snackbar');
|
||||||
|
}, 500);
|
||||||
|
}}></Link>}
|
||||||
{(props.showEditDocument && !isViewer) &&
|
{(props.showEditDocument && !isViewer) &&
|
||||||
<Link className={props.disabledControls ? 'disabled' : ''} icon='icon-edit' href={false} onClick={props.onEditDocument}></Link>
|
<Link className={props.disabledControls ? 'disabled' : ''} icon='icon-edit' href={false} onClick={props.onEditDocument}></Link>
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,7 +163,12 @@ const SettingsList = inject("storeAppOptions", "storeReview")(observer(props =>
|
||||||
{!isViewer && Device.phone &&
|
{!isViewer && Device.phone &&
|
||||||
<ListItem title={t('Settings.textMobileView')}>
|
<ListItem title={t('Settings.textMobileView')}>
|
||||||
<Icon slot="media" icon="icon-mobile-view"></Icon>
|
<Icon slot="media" icon="icon-mobile-view"></Icon>
|
||||||
<Toggle checked={isMobileView} onToggleChange={() => props.onChangeMobileView()} />
|
<Toggle checked={isMobileView} onToggleChange={() => {
|
||||||
|
// props.onclosed();
|
||||||
|
props.onChangeMobileView();
|
||||||
|
props.openOptions('snackbar');
|
||||||
|
// if(Device.phone) closeModal();
|
||||||
|
}} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
}
|
}
|
||||||
{(_isEdit && !isViewer) &&
|
{(_isEdit && !isViewer) &&
|
||||||
|
@ -231,10 +236,10 @@ class SettingsView extends Component {
|
||||||
return (
|
return (
|
||||||
show_popover ?
|
show_popover ?
|
||||||
<Popover id="settings-popover" closeByOutsideClick={false} className="popover__titled" onPopoverClosed={() => this.props.onclosed()}>
|
<Popover id="settings-popover" closeByOutsideClick={false} className="popover__titled" onPopoverClosed={() => this.props.onclosed()}>
|
||||||
<SettingsList inPopover={true} onOptionClick={this.onoptionclick} openOptions={this.props.openOptions} style={{height: '410px'}} onChangeMobileView={this.props.onChangeMobileView} onPrint={this.props.onPrint} showHelp={this.props.showHelp} showFeedback={this.props.showFeedback} onOrthographyCheck={this.props.onOrthographyCheck} onDownloadOrigin={this.props.onDownloadOrigin}/>
|
<SettingsList inPopover={true} onOptionClick={this.onoptionclick} onclosed={this.props.onclosed} openOptions={this.props.openOptions} style={{height: '410px'}} onChangeMobileView={this.props.onChangeMobileView} onPrint={this.props.onPrint} showHelp={this.props.showHelp} showFeedback={this.props.showFeedback} onOrthographyCheck={this.props.onOrthographyCheck} onDownloadOrigin={this.props.onDownloadOrigin}/>
|
||||||
</Popover> :
|
</Popover> :
|
||||||
<Popup className="settings-popup" onPopupClosed={() => this.props.onclosed()}>
|
<Popup className="settings-popup" onPopupClosed={() => this.props.onclosed()}>
|
||||||
<SettingsList onOptionClick={this.onoptionclick} openOptions={this.props.openOptions} onChangeMobileView={this.props.onChangeMobileView} onPrint={this.props.onPrint} showHelp={this.props.showHelp} showFeedback={this.props.showFeedback} onOrthographyCheck={this.props.onOrthographyCheck} onDownloadOrigin={this.props.onDownloadOrigin}/>
|
<SettingsList onOptionClick={this.onoptionclick} onclosed={this.props.onclosed} openOptions={this.props.openOptions} onChangeMobileView={this.props.onChangeMobileView} onPrint={this.props.onPrint} showHelp={this.props.showHelp} showFeedback={this.props.showFeedback} onOrthographyCheck={this.props.onOrthographyCheck} onDownloadOrigin={this.props.onDownloadOrigin}/>
|
||||||
</Popup>
|
</Popup>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
1
vendor/framework7-react/package.json
vendored
1
vendor/framework7-react/package.json
vendored
|
@ -38,6 +38,7 @@
|
||||||
"react": "^18.1.0",
|
"react": "^18.1.0",
|
||||||
"react-dom": "^18.1.0",
|
"react-dom": "^18.1.0",
|
||||||
"react-i18next": "^11.8.5",
|
"react-i18next": "^11.8.5",
|
||||||
|
"react-transition-group": "^4.4.5",
|
||||||
"swiper": "^8.2.4",
|
"swiper": "^8.2.4",
|
||||||
"template7": "^1.4.2"
|
"template7": "^1.4.2"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue