From 7d6f4dbd8c6895757ef794b2a9a217459c5ef5b8 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Tue, 23 Aug 2022 21:38:23 +0300 Subject: [PATCH] [DE mobile] Add snackbar for android --- apps/documenteditor/mobile/locale/en.json | 4 +- .../src/components/Snackbar/Snackbar.jsx | 13 ++++++ .../mobile/src/controller/Toolbar.jsx | 1 + .../src/controller/settings/Settings.jsx | 4 -- .../mobile/src/less/app-ios.less | 1 - .../mobile/src/less/app-material.less | 43 +++++++++++++++++++ apps/documenteditor/mobile/src/page/main.jsx | 33 +++++++++++--- .../mobile/src/view/Toolbar.jsx | 10 ++++- .../mobile/src/view/settings/Settings.jsx | 11 +++-- vendor/framework7-react/package.json | 1 + 10 files changed, 105 insertions(+), 16 deletions(-) create mode 100644 apps/documenteditor/mobile/src/components/Snackbar/Snackbar.jsx diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index c88d8d898..695f8ec8c 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -677,6 +677,8 @@ "dlgLeaveTitleText": "You leave the application", "leaveButtonText": "Leave this Page", "stayButtonText": "Stay on this page", - "textOk": "OK" + "textOk": "OK", + "textSwitchedMobileView": "Switched to Mobile view", + "textSwitchedStandardView": "Switched to Standard view" } } \ No newline at end of file diff --git a/apps/documenteditor/mobile/src/components/Snackbar/Snackbar.jsx b/apps/documenteditor/mobile/src/components/Snackbar/Snackbar.jsx new file mode 100644 index 000000000..ae94a2109 --- /dev/null +++ b/apps/documenteditor/mobile/src/components/Snackbar/Snackbar.jsx @@ -0,0 +1,13 @@ +import React from 'react'; + +const Snackbar = props => { + return ( +
+
+

{props.text}

+
+
+ ) +} + +export default Snackbar; \ No newline at end of file diff --git a/apps/documenteditor/mobile/src/controller/Toolbar.jsx b/apps/documenteditor/mobile/src/controller/Toolbar.jsx index f5f688d75..be71a2cdf 100644 --- a/apps/documenteditor/mobile/src/controller/Toolbar.jsx +++ b/apps/documenteditor/mobile/src/controller/Toolbar.jsx @@ -151,6 +151,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto return ( { appOptions.changeMobileView(); api.ChangeReaderMode(); - - if (Device.phone) { - closeModal(); - } } return } + { + + + + } {appOptions.isDocReady && } ) } } -export default inject("storeAppOptions")(observer(MainPage)); \ No newline at end of file +export default inject("storeAppOptions")(observer(withTranslation()(MainPage))); \ No newline at end of file diff --git a/apps/documenteditor/mobile/src/view/Toolbar.jsx b/apps/documenteditor/mobile/src/view/Toolbar.jsx index 2c35d3f64..3d6916ec3 100644 --- a/apps/documenteditor/mobile/src/view/Toolbar.jsx +++ b/apps/documenteditor/mobile/src/view/Toolbar.jsx @@ -2,7 +2,7 @@ import React, {Fragment} from 'react'; import { useTranslation } from 'react-i18next'; import {NavLeft, NavRight, NavTitle, Link, Icon} from 'framework7-react'; import { Device } from '../../../../common/mobile/utils/device'; -import EditorUIController from '../lib/patch' +import EditorUIController from '../lib/patch'; const ToolbarView = props => { const { t } = useTranslation(); @@ -44,7 +44,13 @@ const ToolbarView = props => { onUndoClick: props.onUndo, onRedoClick: props.onRedo })} - {(isViewer || !Device.phone) && props.changeMobileView()}>} + {(isViewer || !Device.phone) && { + props.changeMobileView(); + props.openOptions('snackbar'); + setTimeout(() => { + props.closeOptions('snackbar'); + }, 500); + }}>} {(props.showEditDocument && !isViewer) && } diff --git a/apps/documenteditor/mobile/src/view/settings/Settings.jsx b/apps/documenteditor/mobile/src/view/settings/Settings.jsx index 79d869d76..850e916e7 100644 --- a/apps/documenteditor/mobile/src/view/settings/Settings.jsx +++ b/apps/documenteditor/mobile/src/view/settings/Settings.jsx @@ -163,7 +163,12 @@ const SettingsList = inject("storeAppOptions", "storeReview")(observer(props => {!isViewer && Device.phone && - props.onChangeMobileView()} /> + { + // props.onclosed(); + props.onChangeMobileView(); + props.openOptions('snackbar'); + // if(Device.phone) closeModal(); + }} /> } {(_isEdit && !isViewer) && @@ -231,10 +236,10 @@ class SettingsView extends Component { return ( show_popover ? this.props.onclosed()}> - + : this.props.onclosed()}> - + ) } diff --git a/vendor/framework7-react/package.json b/vendor/framework7-react/package.json index 960e46be6..f7ad68807 100644 --- a/vendor/framework7-react/package.json +++ b/vendor/framework7-react/package.json @@ -38,6 +38,7 @@ "react": "^18.1.0", "react-dom": "^18.1.0", "react-i18next": "^11.8.5", + "react-transition-group": "^4.4.5", "swiper": "^8.2.4", "template7": "^1.4.2" },