From dd007b8bbf3580d4a1c98c79871e339c6a63981d Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Wed, 31 Jan 2018 11:46:03 +0100 Subject: [PATCH] Link to connect.doodle3d.com #37 --- src/interface/Settings.js | 123 +++++++++++++++++--------------------- 1 file changed, 55 insertions(+), 68 deletions(-) diff --git a/src/interface/Settings.js b/src/interface/Settings.js index ad0dc62..50f749c 100644 --- a/src/interface/Settings.js +++ b/src/interface/Settings.js @@ -19,6 +19,7 @@ import qualitySettings from '../settings/quality.yml'; import infillSettings from '../settings/infill.yml'; import update from 'react-addons-update'; import SettingsIcon from 'material-ui-icons/Settings'; +import ExitToAppIcon from 'material-ui-icons/ExitToApp'; import validateIp from 'validate-ip'; import { Doodle3DManager } from 'doodle3d-api'; @@ -26,6 +27,8 @@ const DOODLE_3D_MANAGER = new Doodle3DManager(); DOODLE_3D_MANAGER.checkNonServerBoxes = false; DOODLE_3D_MANAGER.setAutoUpdate(true, 5000); +const CONNECT_URL = 'http://connect.doodle3d.com/'; + const styles = { textFieldRow: { display: 'flex', @@ -455,77 +458,61 @@ class Settings extends React.Component { - , - - ]} - > - - {Object.entries(printerSettings).map(([value, { title }]) => ( - - ))} - - - {(addPrinter.printer === 'doodle3d_printer') ? - : - - {wifiBoxes.map(({ localip, id, wifiboxid }) => ())} - - } - {addPrinter.error &&

{addPrinter.error}

} -
- , - , - - ]} - > - - {Object.entries(printerSettings).map(([value, { title }]) => ( - - ))} - - - {(managePrinter.printer === 'doodle3d_printer') ? - : - - {wifiBoxes.map(({ localip, id, wifiboxid }) => ())} - - } - {managePrinter.error &&

{managePrinter.error}

} -
+ {printDialog(this.props, this.state, 'Add Printer', 'addPrinter', 'Add', addPrinter, this.closeAddPrinterDialog, null, this.addPrinter)} + {printDialog(this.props, this.state, 'Manage Printer', 'managePrinter', 'Save', managePrinter, this.closeManagePrinterDialog, this.removeActivePrinter, this.editPrinter)} ); } } +function printDialog(props, state, title, form, submitText, data, closeDialog, removeActivePrinter, save) { + const { classes } = props; + const { wifiBoxes } = state; + + return ( + , + removeActivePrinter && , + + ]} + > + + {Object.entries(printerSettings).map(([value, { title }]) => ( + + ))} + + + {(data.printer === 'doodle3d_printer') ? + : +
+ + {wifiBoxes.map(({ localip, id, wifiboxid }) => ())} + + {data.ip && window.open(`${CONNECT_URL}#box?localip=${data.ip}`, '_blank')} + style={{ fill: grey800, marginLeft: '10px', cursor: 'pointer' }} + />} +
+ } + {data.error &&

{data.error}

} +
+ ); +} + export default injectSheet(styles)(Settings);