From 94643bc4c39f2e24070ff4d222b15ec5db9a20b8 Mon Sep 17 00:00:00 2001 From: parachvte Date: Sun, 13 Dec 2020 17:58:19 +0800 Subject: [PATCH] Improvement: Re-check copywriting (#631) --- .../components/SMWidget/SMDropdownButton.jsx | 13 +- src/app/components/SMWidget/index.jsx | 9 +- src/app/containers/App.jsx | 1 - .../DevelopTools/DeveloperPanel.jsx | 4 +- src/app/containers/DevelopTools/Firmware.jsx | 4 +- .../containers/DevelopTools/HeaterControl.jsx | 2 +- src/app/containers/DevelopTools/Lamp.jsx | 2 +- src/app/containers/DevelopTools/Laser.jsx | 12 +- src/app/containers/DevelopTools/Setting.jsx | 2 +- .../MachineSettings/MachineSettings.jsx | 10 +- src/app/containers/Sidebar/Sidebar.jsx | 19 --- .../containers/Workspace/PrimaryWidgets.jsx | 22 ---- .../containers/Workspace/SecondaryWidgets.jsx | 22 ---- src/app/containers/Workspace/Workspace.jsx | 4 - src/app/flux/widget/WidgetState.js | 3 +- .../widgets/CanvasToolbar/PrimaryToolbar.jsx | 35 ------ .../CanvasToolbar/primary-toolbar.styl | 61 --------- .../widgets/CncLaserShared/TextParameters.jsx | 4 - src/app/widgets/Connection/PrintingState.jsx | 2 +- src/app/widgets/Control/ShuttleSettings.jsx | 117 ------------------ src/app/widgets/DevelopAxes/DisplayPanel.jsx | 4 +- .../widgets/DevelopAxes/ShuttleSettings.jsx | 117 ------------------ .../LaserParams/config/ConfigGreyscale.jsx | 2 +- .../gcodeconfig/GcodeConfigRasterBW.jsx | 2 +- src/app/widgets/Webcam/index.jsx | 5 - .../WorkspaceVisualizer/PrimaryToolbar.jsx | 96 -------------- .../WorkspaceVisualizer/Visualizer.jsx | 6 +- .../WorkspaceVisualizer/primary-toolbar.styl | 61 --------- 28 files changed, 29 insertions(+), 612 deletions(-) delete mode 100644 src/app/widgets/CanvasToolbar/PrimaryToolbar.jsx delete mode 100644 src/app/widgets/CanvasToolbar/primary-toolbar.styl delete mode 100644 src/app/widgets/Control/ShuttleSettings.jsx delete mode 100644 src/app/widgets/DevelopAxes/ShuttleSettings.jsx delete mode 100644 src/app/widgets/WorkspaceVisualizer/PrimaryToolbar.jsx delete mode 100644 src/app/widgets/WorkspaceVisualizer/primary-toolbar.styl diff --git a/src/app/components/SMWidget/SMDropdownButton.jsx b/src/app/components/SMWidget/SMDropdownButton.jsx index 4ba8166957..b0a4d1a89a 100644 --- a/src/app/components/SMWidget/SMDropdownButton.jsx +++ b/src/app/components/SMWidget/SMDropdownButton.jsx @@ -8,8 +8,8 @@ import i18n from '../../lib/i18n'; // Widget dropdown button (with fullscreen button) const SMDropdownButton = React.memo(({ state, actions }) => { - const { fullscreen, needRemove } = state; - const { onToggleFullscreen, onRemove } = actions; + const { fullscreen } = state; + const { onToggleFullscreen } = actions; return ( { onSelect={(eventKey) => { if (eventKey === 'fullscreen') { onToggleFullscreen(); - } else if (needRemove && eventKey === 'remove') { - onRemove && onRemove(); } }} > @@ -35,13 +33,6 @@ const SMDropdownButton = React.memo(({ state, actions }) => { {!fullscreen ? i18n._('Enter Full Screen') : i18n._('Exit Full Screen')} - {needRemove && onRemove && ( - - - - {i18n._('Remove Widget')} - - )} ); }); diff --git a/src/app/components/SMWidget/index.jsx b/src/app/components/SMWidget/index.jsx index 228b779f24..595077c36e 100644 --- a/src/app/components/SMWidget/index.jsx +++ b/src/app/components/SMWidget/index.jsx @@ -60,11 +60,10 @@ function createDefaultWidget(WrappedWidget) { const mapStateToProps = (state, ownProps) => { const { widgets } = state.widget; const { widgetId } = ownProps; - const { minimized = false, fullscreen = false, needRemove = false } = widgets[widgetId] || {}; + const { minimized = false, fullscreen = false } = widgets[widgetId] || {}; return { minimized, - fullscreen, - needRemove + fullscreen }; }; @@ -82,7 +81,6 @@ function createDefaultWidget(WrappedWidget) { minimized: PropTypes.bool.isRequired, fullscreen: PropTypes.bool.isRequired, - needRemove: PropTypes.bool, updateWidgetState: PropTypes.func.isRequired }; @@ -125,12 +123,11 @@ function createDefaultWidget(WrappedWidget) { }; render() { - const { widgetId, headType, minimized, fullscreen, needRemove, onToggle } = this.props; + const { widgetId, headType, minimized, fullscreen, onToggle } = this.props; const state = { title: this.state.title, minimized: minimized, fullscreen: fullscreen, - needRemove: needRemove, buttons: this.state.buttons }; const actions = this.actions; diff --git a/src/app/containers/App.jsx b/src/app/containers/App.jsx index a9afaa74d9..ffa246197b 100644 --- a/src/app/containers/App.jsx +++ b/src/app/containers/App.jsx @@ -294,7 +294,6 @@ class App extends PureComponent { '/laser', '/cnc', '/settings', - '/developTools', '/caselibrary', '/settings/general', '/settings/machine', diff --git a/src/app/containers/DevelopTools/DeveloperPanel.jsx b/src/app/containers/DevelopTools/DeveloperPanel.jsx index bebff317ce..f60107a57c 100644 --- a/src/app/containers/DevelopTools/DeveloperPanel.jsx +++ b/src/app/containers/DevelopTools/DeveloperPanel.jsx @@ -463,7 +463,7 @@ class DeveloperPanel extends PureComponent { disabled={isScreenProtocol} onClick={this.actions.switchOff} > - {i18n._('Screen')} + Screen )} @@ -478,7 +478,7 @@ class DeveloperPanel extends PureComponent { disabled={!canClick} onClick={this.actions.forceSwitch} > - {i18n._('Switch')} + Switch
-

{i18n._('Packet Type for Raw Update')}:

+

Packet Type for Raw Update:

{ )} -
  • - - - -
    • () => { - confirm({ - title: i18n._('Remove Widget'), - body: i18n._('Are you sure you want to remove this widget?') - }).then(() => { - const primaryWidgets = _.slice(this.props.primaryWidgets); - _.remove(primaryWidgets, (n) => (n === widgetId)); - this.onChangeWidgetOrder(primaryWidgets); - - if (widgetId.match(/\w+:[\w-]+/)) { - // Remove forked widget settings - this.onChangeWidgetOrder([]); - } - - this.props.onRemoveWidget(widgetId); - }); - }; - onChangeWidgetOrder = (widgets) => { this.props.updateTabContainer('left', { widgets: widgets }); }; @@ -56,7 +35,6 @@ class PrimaryWidgets extends PureComponent { > () => { - confirm({ - title: i18n._('Remove Widget'), - body: i18n._('Are you sure you want to remove this widget?') - }).then(() => { - const widgets = _.slice(this.props.secondaryWidgets); - _.remove(widgets, (n) => (n === widgetId)); - this.onChangeWidgetOrder(widgets); - - if (widgetId.match(/\w+:[\w-]+/)) { - // Remove forked widget settings - this.onChangeWidgetOrder([]); - } - - this.props.onRemoveWidget(widgetId); - }); - }; - onChangeWidgetOrder = (widgets) => { this.props.updateTabContainer('right', { widgets: widgets }); }; @@ -56,7 +35,6 @@ class SecondaryWidgets extends PureComponent { > { - }, onDragStart: () => { this.setState({ isDraggingWidget: true }); }, @@ -271,7 +269,6 @@ class Workspace extends PureComponent { defaultWidgets={defaultWidgets} primaryWidgets={primaryWidgets} toggleToDefault={this.actions.toggleToDefault} - onRemoveWidget={this.widgetEventHandler.onRemoveWidget} onDragStart={this.widgetEventHandler.onDragStart} onDragEnd={this.widgetEventHandler.onDragEnd} updateTabContainer={this.props.updateTabContainer} @@ -344,7 +341,6 @@ class Workspace extends PureComponent { defaultWidgets={defaultWidgets} secondaryWidgets={secondaryWidgets} toggleToDefault={this.actions.toggleToDefault} - onRemoveWidget={this.widgetEventHandler.onRemoveWidget} onDragStart={this.widgetEventHandler.onDragStart} onDragEnd={this.widgetEventHandler.onDragEnd} updateTabContainer={this.props.updateTabContainer} diff --git a/src/app/flux/widget/WidgetState.js b/src/app/flux/widget/WidgetState.js index e83e30436a..26f81dba07 100644 --- a/src/app/flux/widget/WidgetState.js +++ b/src/app/flux/widget/WidgetState.js @@ -96,8 +96,7 @@ const DEFAULT_STATE = { dataSource: PROTOCOL_TEXT }, gcode: { - minimized: false, - needRemove: false + minimized: false }, macro: { minimized: false, diff --git a/src/app/widgets/CanvasToolbar/PrimaryToolbar.jsx b/src/app/widgets/CanvasToolbar/PrimaryToolbar.jsx deleted file mode 100644 index 8577c2f486..0000000000 --- a/src/app/widgets/CanvasToolbar/PrimaryToolbar.jsx +++ /dev/null @@ -1,35 +0,0 @@ -import React, { Component } from 'react'; -import Detector from 'three/examples/js/Detector'; -import PropTypes from 'prop-types'; -import i18n from '../../lib/i18n'; -import styles from './primary-toolbar.styl'; - - -class PrimaryToolbar extends Component { - static propTypes = { - actions: PropTypes.object.isRequired, - state: PropTypes.object.isRequired - }; - - render() { - const { switchCoordinateVisibility } = { ...this.props.actions, ...this.props.state }; - return ( -
      -
      -
      -
      - ); - } -} - -export default PrimaryToolbar; diff --git a/src/app/widgets/CanvasToolbar/primary-toolbar.styl b/src/app/widgets/CanvasToolbar/primary-toolbar.styl deleted file mode 100644 index 993ee08e2b..0000000000 --- a/src/app/widgets/CanvasToolbar/primary-toolbar.styl +++ /dev/null @@ -1,61 +0,0 @@ -.controller-type { - display: inline-block; - font-size: 14px; - font-weight: bold; - margin-right: 10px; - padding: 2px 0; -} -.controller-state { - display: none; - color: #222; - font-size: 14px; - background-color: #fff; - border: 1px solid #e3e3e3; - border-radius: 3px; - min-width: 50px; - padding: 1px 10px; - text-align: center; - - &.controller-state-default { - display: inline-block; - color: #222; - background-color: #fff; - border: 1px solid #e3e3e3; - } - &.controller-state-primary { - display: inline-block; - color: #fff; - background-color: #337ab7; - border-color: #2e6da4; - } - &.controller-state-success { - display: inline-block; - color: #fff; - background-color: #5cb85c; - border-color: #4cae4c; - } - &.controller-state-info { - display: inline-block; - color: #fff; - background-color: #5bc0de; - border-color: #46b8da; - } - &.controller-state-warning { - display: inline-block; - color: #fff; - background-color: #f0ad4e; - border-color: #eea236; - } - &.controller-state-danger { - display: inline-block; - color: #fff; - background-color: #d9534f; - border-color: #d43f3a; - } -} -.dropdown-group { - position: absolute; - right: 0; - top: 0; - margin: 4px 8px; -} diff --git a/src/app/widgets/CncLaserShared/TextParameters.jsx b/src/app/widgets/CncLaserShared/TextParameters.jsx index d467e639e5..97288f8521 100644 --- a/src/app/widgets/CncLaserShared/TextParameters.jsx +++ b/src/app/widgets/CncLaserShared/TextParameters.jsx @@ -153,10 +153,6 @@ Start a new line manually according to your needs.')} clearable={false} searchable={false} options={[ - { label: i18n._('1.0'), value: 1 }, - { label: i18n._('1.2'), value: 1.2 }, - { label: i18n._('1.5'), value: 1.5 }, - { label: i18n._('2.0'), value: 2 } ]} value={lineHeight} onChange={actions.onChangeLineHeight} diff --git a/src/app/widgets/Connection/PrintingState.jsx b/src/app/widgets/Connection/PrintingState.jsx index 08f977a628..c43d096e23 100644 --- a/src/app/widgets/Connection/PrintingState.jsx +++ b/src/app/widgets/Connection/PrintingState.jsx @@ -20,7 +20,7 @@ class PrintingState extends PureComponent {
      -
      {i18n._('Nozzle Temp')}
      +
      {i18n._('Nozzle Temp.')}
      {nozzleTemperature}°C / {nozzleTargetTemperature}°C
      diff --git a/src/app/widgets/Control/ShuttleSettings.jsx b/src/app/widgets/Control/ShuttleSettings.jsx deleted file mode 100644 index c478927e14..0000000000 --- a/src/app/widgets/Control/ShuttleSettings.jsx +++ /dev/null @@ -1,117 +0,0 @@ -import Slider from 'rc-slider'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import i18n from '../../lib/i18n'; - -const FEEDRATE_RANGE = [100, 2500]; -const FEEDRATE_STEP = 50; -const OVERSHOOT_RANGE = [1, 1.5]; -const OVERSHOOT_STEP = 0.01; - -class ShuttleSettings extends Component { - static propTypes = { - feedrateMin: PropTypes.number, - feedrateMax: PropTypes.number, - hertz: PropTypes.number, - overshoot: PropTypes.number - }; - - state = this.getInitialState(); - - getInitialState() { - const { - feedrateMin, - feedrateMax, - hertz, - overshoot - } = this.props; - - return { feedrateMin, feedrateMax, hertz, overshoot }; - } - - componentWillReceiveProps(nextProps) { - const { - feedrateMin, - feedrateMax, - hertz, - overshoot - } = nextProps; - - this.setState({ feedrateMin, feedrateMax, hertz, overshoot }); - } - - onFeedrateSliderChange = (value) => { - const [min, max] = value; - this.setState({ - feedrateMin: min, - feedrateMax: max - }); - }; - - onHertzChange = (event) => { - const { value } = event.target; - const hertz = Number(value); - this.setState({ hertz }); - }; - - onOvershootSliderChange = (value) => { - const overshoot = value; - this.setState({ overshoot }); - }; - - render() { - const { feedrateMin, feedrateMax, hertz, overshoot } = this.state; - - return ( -
      -
      -

      {i18n._('Shuttle Settings')}

      -
      -
      -
      -

      - {i18n._('Feed Rate Range: {{min}} - {{max}} mm/min', { min: feedrateMin, max: feedrateMax })} -

      - -
      -
      - - {i18n._('Repeat Rate: {{hertz}}Hz', { hertz: hertz })} - - -
      -
      -

      - {i18n._('Distance Overshoot: {{overshoot}}x', { overshoot: overshoot })} -

      - -
      -
      -
      - ); - } -} - -export default ShuttleSettings; diff --git a/src/app/widgets/DevelopAxes/DisplayPanel.jsx b/src/app/widgets/DevelopAxes/DisplayPanel.jsx index ebd7729f42..56e7c4f764 100644 --- a/src/app/widgets/DevelopAxes/DisplayPanel.jsx +++ b/src/app/widgets/DevelopAxes/DisplayPanel.jsx @@ -40,8 +40,8 @@ class DisplayPanel extends PureComponent { {i18n._('Axis')} - {i18n._('Machine Position')} - {i18n._('Work Position')} + {i18n._('Machine Coordinates')} + {i18n._('Work Coordinates')} {i18n._('Action')} diff --git a/src/app/widgets/DevelopAxes/ShuttleSettings.jsx b/src/app/widgets/DevelopAxes/ShuttleSettings.jsx deleted file mode 100644 index c478927e14..0000000000 --- a/src/app/widgets/DevelopAxes/ShuttleSettings.jsx +++ /dev/null @@ -1,117 +0,0 @@ -import Slider from 'rc-slider'; -import PropTypes from 'prop-types'; -import React, { Component } from 'react'; -import i18n from '../../lib/i18n'; - -const FEEDRATE_RANGE = [100, 2500]; -const FEEDRATE_STEP = 50; -const OVERSHOOT_RANGE = [1, 1.5]; -const OVERSHOOT_STEP = 0.01; - -class ShuttleSettings extends Component { - static propTypes = { - feedrateMin: PropTypes.number, - feedrateMax: PropTypes.number, - hertz: PropTypes.number, - overshoot: PropTypes.number - }; - - state = this.getInitialState(); - - getInitialState() { - const { - feedrateMin, - feedrateMax, - hertz, - overshoot - } = this.props; - - return { feedrateMin, feedrateMax, hertz, overshoot }; - } - - componentWillReceiveProps(nextProps) { - const { - feedrateMin, - feedrateMax, - hertz, - overshoot - } = nextProps; - - this.setState({ feedrateMin, feedrateMax, hertz, overshoot }); - } - - onFeedrateSliderChange = (value) => { - const [min, max] = value; - this.setState({ - feedrateMin: min, - feedrateMax: max - }); - }; - - onHertzChange = (event) => { - const { value } = event.target; - const hertz = Number(value); - this.setState({ hertz }); - }; - - onOvershootSliderChange = (value) => { - const overshoot = value; - this.setState({ overshoot }); - }; - - render() { - const { feedrateMin, feedrateMax, hertz, overshoot } = this.state; - - return ( -
      -
      -

      {i18n._('Shuttle Settings')}

      -
      -
      -
      -

      - {i18n._('Feed Rate Range: {{min}} - {{max}} mm/min', { min: feedrateMin, max: feedrateMax })} -

      - -
      -
      - - {i18n._('Repeat Rate: {{hertz}}Hz', { hertz: hertz })} - - -
      -
      -

      - {i18n._('Distance Overshoot: {{overshoot}}x', { overshoot: overshoot })} -

      - -
      -
      -
      - ); - } -} - -export default ShuttleSettings; diff --git a/src/app/widgets/LaserParams/config/ConfigGreyscale.jsx b/src/app/widgets/LaserParams/config/ConfigGreyscale.jsx index 3ec0552b58..96729d17a3 100644 --- a/src/app/widgets/LaserParams/config/ConfigGreyscale.jsx +++ b/src/app/widgets/LaserParams/config/ConfigGreyscale.jsx @@ -191,7 +191,7 @@ class ConfigGreyscale extends PureComponent { value: 'SierraLite', label: 'Sierra Lite' }]} - placeholder={i18n._('Choose algorithms')} + placeholder="" searchable={false} value={algorithm} onChange={(value) => { diff --git a/src/app/widgets/LaserParams/gcodeconfig/GcodeConfigRasterBW.jsx b/src/app/widgets/LaserParams/gcodeconfig/GcodeConfigRasterBW.jsx index de57bf5e86..9b1a7a3835 100644 --- a/src/app/widgets/LaserParams/gcodeconfig/GcodeConfigRasterBW.jsx +++ b/src/app/widgets/LaserParams/gcodeconfig/GcodeConfigRasterBW.jsx @@ -80,7 +80,7 @@ class GcodeConfigRasterBW extends PureComponent { value: 'Diagonal2', label: i18n._('Diagonal2') }]} - placeholder={i18n._('Choose an algorithm')} + placeholder="" searchable={false} value={direction} onChange={this.actions.onChangeDirection} diff --git a/src/app/widgets/Webcam/index.jsx b/src/app/widgets/Webcam/index.jsx index ea654745ac..40905030d9 100644 --- a/src/app/widgets/Webcam/index.jsx +++ b/src/app/widgets/Webcam/index.jsx @@ -296,11 +296,6 @@ class WebcamWidget extends PureComponent { {!isFullscreen ? i18n._('Enter Full Screen') : i18n._('Exit Full Screen')} - - - - {i18n._('Remove Widget')} - diff --git a/src/app/widgets/WorkspaceVisualizer/PrimaryToolbar.jsx b/src/app/widgets/WorkspaceVisualizer/PrimaryToolbar.jsx deleted file mode 100644 index c604c63d3c..0000000000 --- a/src/app/widgets/WorkspaceVisualizer/PrimaryToolbar.jsx +++ /dev/null @@ -1,96 +0,0 @@ -import colornames from 'colornames'; -import React, { PureComponent } from 'react'; -import PropTypes from 'prop-types'; -import { Dropdown, MenuItem } from 'react-bootstrap'; -import Detector from 'three/examples/js/Detector'; -import Interpolate from '../../components/Interpolate'; -import i18n from '../../lib/i18n'; -import styles from './primary-toolbar.styl'; - - -class PrimaryToolbar extends PureComponent { - static propTypes = { - state: PropTypes.object, - actions: PropTypes.object - }; - - render() { - const { state, actions } = this.props; - const { coordinateVisible, toolheadVisible, gcodeFilenameVisible } = state; - return ( -
      -
      - - - - - - - {i18n._('Enabled')}) - : ({i18n._('Disabled')}) - }} - /> - - - - {i18n._('Scene Objects')} - - - {gcodeFilenameVisible - ? - : - } - - {i18n._('Display G-code Filename')} - - - {coordinateVisible - ? - : - } - - {coordinateVisible - ? i18n._('Hide Coordinate System') - : i18n._('Show Coordinate System') - } - - - {toolheadVisible - ? - : - } - - {toolheadVisible - ? i18n._('Hide Toolhead') - : i18n._('Show Toolhead') - } - - - -
      -
      - ); - } -} - -export default PrimaryToolbar; diff --git a/src/app/widgets/WorkspaceVisualizer/Visualizer.jsx b/src/app/widgets/WorkspaceVisualizer/Visualizer.jsx index 53859b0fe4..1a1250c53a 100644 --- a/src/app/widgets/WorkspaceVisualizer/Visualizer.jsx +++ b/src/app/widgets/WorkspaceVisualizer/Visualizer.jsx @@ -648,11 +648,11 @@ class Visualizer extends Component { case WORKSPACE_STAGE.EMPTY: return ''; case WORKSPACE_STAGE.LOADING_GCODE: - return i18n._('Loading Gcode...{{progress}}%', { progress: (100.0 * progress).toFixed(1) }); + return i18n._('Loading G-code...{{progress}}%', { progress: (100.0 * progress).toFixed(1) }); case WORKSPACE_STAGE.LOAD_GCODE_SUCCEED: - return i18n._('Loaded Gcode successfully.'); + return i18n._('Loaded G-code successfully.'); case WORKSPACE_STAGE.LOAD_GCODE_FAILED: - return i18n._('Failed to load Gcode.'); + return i18n._('Failed to load G-code.'); default: return ''; } diff --git a/src/app/widgets/WorkspaceVisualizer/primary-toolbar.styl b/src/app/widgets/WorkspaceVisualizer/primary-toolbar.styl deleted file mode 100644 index 993ee08e2b..0000000000 --- a/src/app/widgets/WorkspaceVisualizer/primary-toolbar.styl +++ /dev/null @@ -1,61 +0,0 @@ -.controller-type { - display: inline-block; - font-size: 14px; - font-weight: bold; - margin-right: 10px; - padding: 2px 0; -} -.controller-state { - display: none; - color: #222; - font-size: 14px; - background-color: #fff; - border: 1px solid #e3e3e3; - border-radius: 3px; - min-width: 50px; - padding: 1px 10px; - text-align: center; - - &.controller-state-default { - display: inline-block; - color: #222; - background-color: #fff; - border: 1px solid #e3e3e3; - } - &.controller-state-primary { - display: inline-block; - color: #fff; - background-color: #337ab7; - border-color: #2e6da4; - } - &.controller-state-success { - display: inline-block; - color: #fff; - background-color: #5cb85c; - border-color: #4cae4c; - } - &.controller-state-info { - display: inline-block; - color: #fff; - background-color: #5bc0de; - border-color: #46b8da; - } - &.controller-state-warning { - display: inline-block; - color: #fff; - background-color: #f0ad4e; - border-color: #eea236; - } - &.controller-state-danger { - display: inline-block; - color: #fff; - background-color: #d9534f; - border-color: #d43f3a; - } -} -.dropdown-group { - position: absolute; - right: 0; - top: 0; - margin: 4px 8px; -}