import React, {Component, useEffect} from 'react'; import {View,Page,Navbar,NavRight,Link,Popup,Popover,Icon,ListItem,List} from 'framework7-react'; import { useTranslation } from 'react-i18next'; import {f7} from 'framework7-react'; import {Device} from '../../../../../common/mobile/utils/device'; import { observer, inject } from "mobx-react"; import SpreadsheetSettingsController from '../../controller/settings/SpreadsheetSettings.jsx'; import ApplicationSettingsController from '../../controller/settings/ApplicationSettings.jsx'; import SpreadsheetInfoController from '../../controller/settings/SpreadsheetInfo.jsx'; import {DownloadWithTranslation} from '../../controller/settings/Download.jsx'; import {SpreadsheetColorSchemes, SpreadsheetFormats, SpreadsheetMargins} from './SpreadsheetSettings.jsx'; import {MacrosSettings, RegionalSettings, FormulaLanguage} from './ApplicationSettings.jsx'; // import SpreadsheetAbout from './SpreadsheetAbout.jsx'; import About from '../../../../../common/mobile/lib/view/About'; const routes = [ { path: '/', component: 'TSettingsView' }, { path: '/spreadsheet-settings/', component: SpreadsheetSettingsController, }, { path: "/color-schemes/", component: SpreadsheetColorSchemes }, { path: '/spreadsheet-formats/', component: SpreadsheetFormats }, { path: '/margins/', component: SpreadsheetMargins }, { path: '/download/', component: DownloadWithTranslation }, { path: '/application-settings/', component: ApplicationSettingsController }, { path: '/macros-settings/', component: MacrosSettings }, { path: '/regional-settings/', component: RegionalSettings }, { path: '/formula-languages/', component: FormulaLanguage }, { path: '/spreadsheet-info/', component: SpreadsheetInfoController }, { path: '/about/', component: About } ]; const SettingsList = inject("storeAppOptions", "storeEncoding")(observer(props => { const { t } = useTranslation(); const _t = t('View.Settings', {returnObjects: true}); const navbar = {!props.inPopover && {_t.textDone}} ; const onoptionclick = page => { if ( props.onOptionClick ) props.onOptionClick(page) }; const closeModal = () => { if (Device.phone) { f7.sheet.close('.settings-popup', false); } else { f7.popover.close('#settings-popover', false); } }; const onOpenCollaboration = async () => { await closeModal(); await props.openOptions('coauth'); } const onPrint = () => { closeModal(); const api = Common.EditorApi.get(); api.asc_Print(); }; const showHelp = () => { // let url = '{{HELP_URL}}'; // let url = 'https://helpcenter.onlyoffice.com'; let url = __HELP_URL__; if (url.charAt(url.length-1) !== '/') { url += '/'; } if (Device.sailfish || Device.android) { url+='mobile-applications/documents/mobile-web-editors/android/index.aspx'; } else { url+='mobile-applications/documents/mobile-web-editors/ios/index.aspx'; } closeModal(); window.open(url, "_blank"); }; const appOptions = props.storeAppOptions; let _isEdit = false; if (!appOptions.isDisconnected) { _isEdit = appOptions.isEdit; } return ( {navbar} {!props.inPopover && } {window.matchMedia("(max-width: 359px)").matches ? : null} {_isEdit && } ) })); class SettingsView 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()}> : this.props.onclosed()}> ) } } const Settings = props => { useEffect(() => { if ( Device.phone ) f7.popup.open('.settings-popup'); else f7.popover.open('#settings-popover', '#btn-settings'); return () => { } }); const onviewclosed = () => { if ( props.onclosed ) props.onclosed(); }; return }; export default Settings;