Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: Re-check copywriting #631

Merged
merged 1 commit into from
Dec 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions src/app/components/SMWidget/SMDropdownButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Widget.DropdownButton
Expand All @@ -18,8 +18,6 @@ const SMDropdownButton = React.memo(({ state, actions }) => {
onSelect={(eventKey) => {
if (eventKey === 'fullscreen') {
onToggleFullscreen();
} else if (needRemove && eventKey === 'remove') {
onRemove && onRemove();
}
}}
>
Expand All @@ -35,13 +33,6 @@ const SMDropdownButton = React.memo(({ state, actions }) => {
<span className="space space-sm" />
{!fullscreen ? i18n._('Enter Full Screen') : i18n._('Exit Full Screen')}
</Widget.DropdownMenuItem>
{needRemove && onRemove && (
<Widget.DropdownMenuItem eventKey="remove">
<i className="fa fa-fw fa-times" />
<span className="space space-sm" />
{i18n._('Remove Widget')}
</Widget.DropdownMenuItem>
)}
</Widget.DropdownButton>
);
});
Expand Down
9 changes: 3 additions & 6 deletions src/app/components/SMWidget/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
};

Expand All @@ -82,7 +81,6 @@ function createDefaultWidget(WrappedWidget) {

minimized: PropTypes.bool.isRequired,
fullscreen: PropTypes.bool.isRequired,
needRemove: PropTypes.bool,

updateWidgetState: PropTypes.func.isRequired
};
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/app/containers/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,6 @@ class App extends PureComponent {
'/laser',
'/cnc',
'/settings',
'/developTools',
'/caselibrary',
'/settings/general',
'/settings/machine',
Expand Down
4 changes: 2 additions & 2 deletions src/app/containers/DevelopTools/DeveloperPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ class DeveloperPanel extends PureComponent {
disabled={isScreenProtocol}
onClick={this.actions.switchOff}
>
{i18n._('Screen')}
Screen
</button>
)}
</div>
Expand All @@ -478,7 +478,7 @@ class DeveloperPanel extends PureComponent {
disabled={!canClick}
onClick={this.actions.forceSwitch}
>
{i18n._('Switch')}
Switch
</button>
</div>
<div
Expand Down
4 changes: 2 additions & 2 deletions src/app/containers/DevelopTools/Firmware.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class Firmware extends PureComponent {
<tbody>
<tr>
<td style={{ paddingLeft: '0px', width: '60%' }}>
<p style={{ margin: '0' }}>{i18n._('Packet Type for Raw Update')}:</p>
<p style={{ margin: '0' }}>Packet Type for Raw Update:</p>
<Select
clearable={false}
options={[{
Expand Down Expand Up @@ -227,7 +227,7 @@ class Firmware extends PureComponent {
this.actions.updateOriginFile('start update origin file', { originFileUpdateType });
}}
>
{i18n._('Raw Update')}
Raw Update
</button>
<button
className={styles['btn-func']}
Expand Down
2 changes: 1 addition & 1 deletion src/app/containers/DevelopTools/HeaterControl.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class HeaterControl extends PureComponent {
</tr>
<tr>
<td style={{ padding: '0' }}>
<p style={{ margin: '0', padding: '0' }}>{i18n._('Bed')}</p>
<p style={{ margin: '0', padding: '0' }}>Bed</p>
</td>
<td style={{ width: '60px' }}>
<div className="input-group input-group-sm" style={{ float: 'right' }}>
Expand Down
2 changes: 1 addition & 1 deletion src/app/containers/DevelopTools/Lamp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class LightBar extends PureComponent {
checked={this.state.lightStatus}
onChange={this.actions.switchLightBar}
/>
{i18n._('Switch Light')}
Switch Light
<br />
</li>
<li>
Expand Down
12 changes: 3 additions & 9 deletions src/app/containers/DevelopTools/Laser.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ class CNC extends PureComponent {
render() {
const { laserState } = this.props;
const { onchangeLaserPrecent, onchangeFocusHeight, onchangeLaserState } = this.props;
const { laserPercent, focusHeight, txtFocusX, txtFocusY, txtFocusZ, txtMovementX, txtMovementY, txtMovementZ, relativeMode } = laserState;
const { laserPercent, focusHeight, txtFocusX, txtFocusY, txtFocusZ, txtMovementX, txtMovementY, txtMovementZ } = laserState;
return (
<div>
<div>
<p>{i18n._('Laser')}</p>
<ul style={{ listStyle: 'none' }}>
<li>
<p className={styles['title-row']}>{i18n._('Current Power')}:</p>
<p className={styles['title-row']}>Power</p>
<p className={styles['title-row']}>{laserPercent}%</p>
</li>
<li>
Expand Down Expand Up @@ -71,7 +71,7 @@ class CNC extends PureComponent {
</li>
<li>
<button className={styles['btn-func']} type="button" onClick={() => this.props.executeGcode('draw calibration')}>
{i18n._('Draw Bound')}
Draw Bound
</button>
<button className={styles['btn-func']} type="button" onClick={() => this.props.executeGcode('draw ruler')}>
{i18n._('Draw Ruler')}
Expand Down Expand Up @@ -116,12 +116,6 @@ class CNC extends PureComponent {
value={txtMovementZ}
onChange={(value) => { onchangeLaserState({ txtMovementZ: value }); }}
/>
<button className={styles['btn-func']} type="button" onClick={() => { onchangeLaserState({ relativeMode: !relativeMode }); }}>
{relativeMode ? i18n._('Relative coordinates') : i18n._('Absolute coordinates')}
</button>
<button className={styles['btn-func']} type="button" onClick={() => this.props.executeGcode('laser move require', { laserState })}>
{i18n._('Move Require')}
</button>
</li>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/containers/DevelopTools/Setting.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Setting extends PureComponent {
<li>
<p className={styles['title-row']}>{i18n._('Size')}</p>
<p className={styles['title-row']}>{i18n._('Offset')}</p>
<p className={styles['title-row']}>{i18n._('Direction')}</p>
<p className={styles['title-row']}>Direction</p>
<p className={styles['title-row']}>{i18n._('Home Location')}</p>
</li>
<li>
Expand Down
10 changes: 5 additions & 5 deletions src/app/containers/Settings/MachineSettings/MachineSettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class MachineSettings extends PureComponent {
clearable={false}
searchable={false}
disabled={isConnected}
name={i18n._('- Please Select -')}
name="select-machine"
options={machineSeriesOptions}
value={series}
onChange={this.actions.onChangeMachineSeries}
Expand Down Expand Up @@ -273,7 +273,7 @@ class MachineSettings extends PureComponent {
<Select
clearable={false}
searchable={false}
name={i18n._('Door detection')}
name={i18n._('Door Detection')}
options={doorDetectionOptions}
value={enclosureDoorDetection}
onChange={this.actions.onChangeEnclosureState}
Expand Down Expand Up @@ -305,15 +305,15 @@ class MachineSettings extends PureComponent {
options={[
{
value: 3000,
label: i18n._('3s')
label: '3s'
},
{
value: 15000,
label: i18n._('15s')
label: '15s'
},
{
value: 30000,
label: i18n._('30s')
label: '30s'
}
]}
value={connectionTimeout}
Expand Down
19 changes: 0 additions & 19 deletions src/app/containers/Sidebar/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,25 +88,6 @@ const Sidebar = (props) => {
</Link>
</li>
)}
<li
className={classNames(
'text-center',
{ [styles.active]: pathname.indexOf('/developTools') === 0 }
)}
style={{
display: 'none'
}}
>
<Link to="/developTools" title={i18n._('DevelopTools')} draggable="false">
<i
className={classNames(
styles.icon,
styles.iconInvert,
styles['icon-3dp']
)}
/>
</Link>
</li>
</ul>
<ul className={styles.navFixedBottom}>
<li
Expand Down
22 changes: 0 additions & 22 deletions src/app/containers/Workspace/PrimaryWidgets.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import _ from 'lodash';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import Sortable from 'react-sortablejs';
import confirm from '../../lib/confirm';
import i18n from '../../lib/i18n';
import Widget from '../../widgets';
import styles from './widgets.styl';

Expand All @@ -17,30 +15,11 @@ class PrimaryWidgets extends PureComponent {
primaryWidgets: PropTypes.array.isRequired,

toggleToDefault: PropTypes.func.isRequired,
onRemoveWidget: PropTypes.func.isRequired,
onDragStart: PropTypes.func.isRequired,
onDragEnd: PropTypes.func.isRequired,
updateTabContainer: PropTypes.func.isRequired
};

removeWidget = (widgetId) => () => {
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 });
};
Expand All @@ -56,7 +35,6 @@ class PrimaryWidgets extends PureComponent {
>
<Widget
widgetId={widgetId}
onRemove={this.removeWidget(widgetId)}
onToggle={this.props.toggleToDefault(widgetId)}
sortable={{
handleClassName: 'sortable-handle',
Expand Down
22 changes: 0 additions & 22 deletions src/app/containers/Workspace/SecondaryWidgets.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import _ from 'lodash';
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import Sortable from 'react-sortablejs';
import confirm from '../../lib/confirm';
import i18n from '../../lib/i18n';
import Widget from '../../widgets';
import styles from './widgets.styl';

Expand All @@ -17,30 +15,11 @@ class SecondaryWidgets extends PureComponent {
secondaryWidgets: PropTypes.array.isRequired,

toggleToDefault: PropTypes.func.isRequired,
onRemoveWidget: PropTypes.func.isRequired,
onDragStart: PropTypes.func.isRequired,
onDragEnd: PropTypes.func.isRequired,
updateTabContainer: PropTypes.func.isRequired
};

removeWidget = (widgetId) => () => {
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 });
};
Expand All @@ -56,7 +35,6 @@ class SecondaryWidgets extends PureComponent {
>
<Widget
widgetId={widgetId}
onRemove={this.removeWidget(widgetId)}
onToggle={this.props.toggleToDefault(widgetId)}
sortable={{
handleClassName: 'sortable-handle',
Expand Down
4 changes: 0 additions & 4 deletions src/app/containers/Workspace/Workspace.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ class Workspace extends PureComponent {
};

widgetEventHandler = {
onRemoveWidget: () => {
},
onDragStart: () => {
this.setState({ isDraggingWidget: true });
},
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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}
Expand Down
3 changes: 1 addition & 2 deletions src/app/flux/widget/WidgetState.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ const DEFAULT_STATE = {
dataSource: PROTOCOL_TEXT
},
gcode: {
minimized: false,
needRemove: false
minimized: false
},
macro: {
minimized: false,
Expand Down
Loading