Skip to content

Commit

Permalink
Added missing translations for ECS settings. Resolves #1
Browse files Browse the repository at this point in the history
  • Loading branch information
stylesuxx committed Mar 7, 2021
1 parent 15381fc commit 521fe87
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 70 deletions.
10 changes: 5 additions & 5 deletions src/Components/CommonSettings/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import {
useTranslation,
useTranslation,
} from 'react-i18next';

import {
Expand All @@ -26,12 +26,12 @@ function CommonSettings({
escs,
onSettingsUpdate,
}) {
const { t } = useTranslation('common');

if(escs.length === 0) {
return null;
}

const { t } = useTranslation('common');

const master = getMaster(escs);
//const availableSettings = master.settings;
const allSettings = getAllSettings(escs);
Expand All @@ -50,7 +50,7 @@ function CommonSettings({

function handleCheckboxChange(e) {
const {
name, checked,
name, checked,
} = e.target;
currentSettings[name] = checked ? 1 : 0;

Expand All @@ -59,7 +59,7 @@ function CommonSettings({

function handleSelectChange(e) {
const {
name, value,
name, value,
} = e.target;
currentSettings[name] = value;

Expand Down
4 changes: 2 additions & 2 deletions src/Components/Log/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import PropTypes from 'prop-types';
import React from 'react';

import {
useTranslation,
useTranslation,
} from 'react-i18next';
import {
useState,
useState,
} from 'react';
import './style.css';

Expand Down
52 changes: 52 additions & 0 deletions src/Components/Statusbar/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import PropTypes from 'prop-types';
import React from 'react';
import {
useTranslation,
} from 'react-i18next';


function Statusbar({
packetErrors,
version,
}) {
const { t } = useTranslation('common');

return (
<div id="status-bar">
<div>
<span>
{t('statusbarPortUtilization')}
</span>

<span className="port_usage_down">
D: 0%
</span>

<span className="port_usage_up">
U: 0%
</span>
</div>

<div>
<span>
{t('statusbarPacketError')}
</span>

<span className="packet-error">
{packetErrors}
</span>
</div>

<div className="version">
{version}
</div>
</div>
);
}

Statusbar.propTypes = {
packetErrors: PropTypes.number.isRequired,
version: PropTypes.string.isRequired,
};

export default Statusbar;
65 changes: 6 additions & 59 deletions src/Containers/App/index.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import PropTypes from 'prop-types';
import React, {
Component,
} from 'react';
Expand All @@ -9,6 +10,7 @@ import PortPicker from '../../Components/PortPicker';
import Log from '../../Components/Log';
import Buttonbar from '../../Components/Buttonbar';
import FirmwareSelector from '../../Components/FirmwareSelector';
import Statusbar from '../../Components/Statusbar';

import Serial from '../../utils/Serial';
import {
Expand Down Expand Up @@ -726,69 +728,14 @@ class App extends Component {
/>
</div>

{/*
<div className="tab_container">
<div id="tabs">
<ul className="mode-disconnected">
<li className="tab_landing">
<a
href="#"
i18n="tabLanding"
className="tabicon ic_welcome"
i18n_title="tabLanding">
</a>
</li>
</ul>
<ul className="mode-connected">
<li className="tab_esc">
<a
href="#"
i18n="tabESC"
className="tabicon ic_cli"
i18n_title="tabESC"></a>
</li>
</ul>
</div>
<div className="clear-both"></div>
</div>
*/}

<div id="content">
<MainContent />
</div>

<div id="status-bar">
<div>
<span i18n="statusbarPortUtilization" />

<span className="port_usage_down">
D: 0%
</span>

<span className="port_usage_up">
U: 0%
</span>
</div>

<div>
<span i18n="statusbarPacketError" />

<span className="packet-error">
{packetErrors}
</span>
</div>

<div className="version">
{version}
</div>
</div>

<div id="cache">
<div className="data-loading">
<p i18n="waitingForData" />
</div>
</div>
<Statusbar
packetErrors={packetErrors}
version={version}
/>
</div>
</div>
);
Expand Down
7 changes: 4 additions & 3 deletions src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ ReactDOM.render(
Bluejay ESC Configurator
</title>

<description>
Flash your BLHELI_S ESC&apos;s with Bluejay directly from an up to date browser supporting the Web Serial APi.
</description>
<meta
content="Flash your BLHELI_S ESC&apos;s with Bluejay directly from an up to date browser supporting the Web Serial APi."
name="description"
/>
</Helmet>

<App />
Expand Down
5 changes: 5 additions & 0 deletions src/translations/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
"escBeaconStrength": "Beacon Strength",
"escStartupBeep": "Staartup Beep",
"escDithering": "Dithering",
"escMotorDirection": "Motor Direction",
"escPPMMinThrottle": "PPM Min Throttle",
"escPPMMaxThrottle": "PPM Max Throttle",
"statusbarPortUtilization": "Port utilization:",
"statusbarPacketError": "Packet error:",
"_RPM Power Protection (Rampup)": "RPM Power Protection (Rampup)",
"_Minimum Startup Power (Boost)": "Minimum Startup Power (Boost)",
"_Maximum Startup Power (Protection)": "Maximum Startup Power (Protection)",
Expand Down
2 changes: 1 addition & 1 deletion src/utils/FourWay.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class FourWay {
});
}

sendMessagePromised(command, params = [0], address = 0, timeout = 5000) {
sendMessagePromised(command, params = [0], address = 0) {
const self = this;

const process = async (resolve) => {
Expand Down

0 comments on commit 521fe87

Please sign in to comment.