/**************************************************************************** * Copyright 2017 EPAM Systems * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. ***************************************************************************/ import { h } from 'preact'; import { connect } from 'preact-redux'; /** @jsx h */ import { updateFormState, setDefaultSettings } from '../state/form'; import { saveSettings } from '../state/options'; import settingsSchema from '../data/options-schema'; import { Form, Field } from '../component/form'; import { storage } from '../utils'; import Dialog from '../component/dialog'; import Accordion from '../component/accordion'; import SystemFonts from '../component/systemfonts'; import SaveButton from '../component/savebutton'; import OpenButton from '../component/openbutton'; import MeasureInput from '../component/measure-input'; function Settings(props) { const { initState, formState, server, onOpenFile, onReset, appOpts, ...prop } = props; const tabs = ['Rendering customization options', 'Atoms', 'Bonds', 'Server', '3D Viewer', 'Options for debugging']; const activeTabs = { 0: true, 1: false, 2: false, 3: false, 4: false, 5: false }; return ( formState.result} valid={() => formState.valid} params={prop} buttons={[ Open From File… , Save To File… , , "OK", "Cancel"]} >
{ !storage.isAvailable() ?
{storage.warningMessage}
: null }
); } function SelectCheckbox(props, {schema}) { const desc = { title: schema.properties[props.name].title, enum: [true, false], enumNames: ['on', 'off'], }; return ; } function FieldMeasure(props, {schema}) { return } export default connect(store => ({ appOpts: store.options.app, initState: store.options.settings, formState: store.modal.form }), (dispatch, props) => ({ onOpenFile: newOpts => { try { dispatch(updateFormState({ result: JSON.parse(newOpts) })); } catch (ex) { console.info('Bad file'); } }, onReset: () => dispatch(setDefaultSettings()), onOk: (res) => { dispatch(saveSettings(res)); props.onOk(res); } }))(Settings);