Skip to content

Commit

Permalink
Merge branch 'release/0.10.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
stylesuxx committed Apr 3, 2021
2 parents 89e8684 + 6f76951 commit 76246d0
Show file tree
Hide file tree
Showing 100 changed files with 6,761 additions and 1,684 deletions.
18 changes: 14 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"extends": ["eslint:recommended", "plugin:react/all"],
"extends": ["eslint:recommended", "plugin:react/all", "plugin:jest/recommended"],
"ignorePatterns": ["service-worker.js"],
"plugins": [
"react"
],
Expand Down Expand Up @@ -32,9 +33,17 @@
"object-curly-newline": ["error", {
"ObjectExpression": { "multiline": true, "minProperties": 2 },
"ObjectPattern": { "multiline": true, "minProperties": 2 },
"ImportDeclaration": { "multiline": true, "minProperties": 1 },
"ImportDeclaration": { "multiline": true, "minProperties": 2 },
"ExportDeclaration": { "multiline": true, "minProperties": 1 }
}]
}],
"comma-dangle": ["error", {
"arrays": "always-multiline",
"objects": "always-multiline",
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "never"
}],
"object-property-newline": "error"
},
"settings": {
"react": {
Expand All @@ -59,7 +68,8 @@
"Promise": false,
"FileReader": false,
"Blob": false,
"localStorage": false
"localStorage": false,
"__dirname": false
},
"parser": "babel-eslint"
}
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
language: node_js
script:
- yarn coverage
node_js:
- node
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<img align="right" src="./public/logo512.png" alt="ESC Configurator" width="250">

[![Build Status](https://travis-ci.org/stylesuxx/esc-configurator.svg?branch=develop)](https://travis-ci.org/stylesuxx/esc-configurator) [![Crowdin](https://badges.crowdin.net/esc-configuratorcom/localized.svg)](https://crowdin.com/project/esc-configuratorcom) [![Netlify Status](https://api.netlify.com/api/v1/badges/d297f59c-7496-49fb-9803-1cf2876aaad4/deploy-status)](https://app.netlify.com/sites/sad-goodall-6b6045/deploys) [![Discord](https://img.shields.io/discord/822952715944460368.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/QvSS5dk23C)
[![Build Status](https://travis-ci.org/stylesuxx/esc-configurator.svg?branch=develop)](https://travis-ci.org/stylesuxx/esc-configurator) [![codecov](https://codecov.io/gh/stylesuxx/esc-configurator/branch/develop/graph/badge.svg?token=WLZXIOEDP7)](https://codecov.io/gh/stylesuxx/esc-configurator)
[![Crowdin](https://badges.crowdin.net/esc-configuratorcom/localized.svg)](https://crowdin.com/project/esc-configuratorcom) [![Netlify Status](https://api.netlify.com/api/v1/badges/d297f59c-7496-49fb-9803-1cf2876aaad4/deploy-status)](https://app.netlify.com/sites/sad-goodall-6b6045/deploys) [![Discord](https://img.shields.io/discord/822952715944460368.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/QvSS5dk23C)

# ESC Configurator - PWA (Progressive Web App)
A progressive web-app to flash your BLHELI_S capable ESC's directly from the web using the [Web Serial API](https://wicg.github.io/serial/) or the [Web USB API](https://wicg.github.io/webusb/) as a fallback for Chrome on Android. The Web USB solution will work on a majority of android devices, but not all. Unfortunately it is not possible to detect if it will work, you will simply have to try. Also see this [SO thread](https://stackoverflow.com/questions/66771484/webusb-can-not-claim-device-on-some-android-devices) and this [Chromium issue](https://bugs.chromium.org/p/chromium/issues/detail?id=1099521).
Expand Down
19 changes: 15 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"name": "esc-configurator",
"version": "0.9.1",
"version": "0.10.0",
"private": true,
"dependencies": {
"@palmabit/react-cookie-law": "^0.6.2",
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"compare-versions": "^3.6.0",
"date-fns": "^2.19.0",
"dateformat": "^4.5.1",
"i18next": "^19.9.0",
"rc-slider": "^9.7.2",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-gtm-module": "^2.0.11",
Expand Down Expand Up @@ -39,7 +42,8 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"coverage": "react-scripts test --coverage --watchAll=false",
"test-once": "yarn test --coverage --watchAll=false",
"coverage": "yarn test-once && codecov",
"eject": "react-scripts eject",
"lint": "eslint ./src --ext .jsx,.js"
},
Expand All @@ -65,12 +69,19 @@
"@typescript-eslint/eslint-plugin": "^4.0.0",
"@typescript-eslint/parser": "^4.0.0",
"babel-eslint": "^10.0.0",
"codecov": "^3.8.1",
"eslint": "^7.5.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^24.3.2",
"eslint-plugin-jsx-a11y": "^6.3.1",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^4.0.8"
}
"eslint-plugin-react-hooks": "^4.0.8",
"pre-commit": "^1.2.2"
},
"pre-commit": [
"lint",
"test-once"
]
}
File renamed without changes
File renamed without changes
File renamed without changes
253 changes: 253 additions & 0 deletions src/Components/App/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
import { ToastContainer } from 'react-toastify';
import { useTranslation } from 'react-i18next';
import React, { useRef } from 'react';
import PropTypes from 'prop-types';

import 'react-toastify/dist/ReactToastify.min.css';


import PortPicker from '../PortPicker';
import Log from '../Log';
import Statusbar from '../Statusbar';
import CookieConsent from '../CookieConsent';
import MainContent from '../MainContent';
import AppSettings from '../AppSettings';

import { useInterval } from '../../utils/helpers/React';

import changelogEntries from '../../changelog.json';
import './style.scss';

function App({
actions,
appSettings,
configs,
connected,
escs,
flashTargets,
fourWay,
hasPort,
hasSerial,
language,
languages,
onAllMotorSpeed,
onChangePort,
onCancelFirmwareSelection,
onClose,
onConnect,
onCookieAccept,
onDisconnect,
onFlashUrl,
onIndividualSettingsUpdate,
onLanguageSelection,
onLocalSubmit,
onOpenSettings,
onSetBaudRate,
onReadEscs,
onResetDefaultls,
onSaveLog,
onSelectFirmwareForAll,
onSetPort,
onSettingsUpdate,
onSingleFlash,
onSingleMotorSpeed,
onUpdate,
onWriteSetup,
open,
packetErrors,
portNames,
progress,
serial,
serialLog,
settings,
showSettings,
version,
}) {
const { t } = useTranslation('common');
const statusbarRef = useRef();

/* istanbul ignore next */
useInterval(async() => {
if(open && !actions.isReading && !fourWay) {
if(serial.getBatteryState) {
const batteryState = await serial.getBatteryState();
statusbarRef.current.updateBatteryState(batteryState);
}
} else {
statusbarRef.current.updateBatteryState(null);
}
}, 1000);

/* istanbul ignore next */
useInterval(async() => {
if(serial.getUtilization) {
const utilization = await serial.getUtilization();
statusbarRef.current.updateUtilization(utilization);
}
}, 1000);

const languageElements = languages.map((item) => (
<option
key={item.value}
value={item.value}
>
{item.label}
</option>
));

return (
<div className="App">
<div id="main-wrapper">
<div className="header-wrapper">
<div className="headerbar">
<div id="logo" />

<PortPicker
hasPort={hasPort}
hasSerial={hasSerial}
onChangePort={onChangePort}
onConnect={onConnect}
onDisconnect={onDisconnect}
onSetBaudRate={onSetBaudRate}
onSetPort={onSetPort}
open={open}
ports={portNames}
/>

<div className="language-select ">
<div className="dropdown dropdown-dark">
<select
className="dropdown-select"
defaultValue={language}
onChange={onLanguageSelection}
>
{languageElements}
</select>
</div>

<div className="button-dark">
<button
onClick={onOpenSettings}
type="button"
>
{t('settings')}
</button>
</div>

</div>
</div>

<div className="clear-both" />

<Log
messages={serialLog}
/>
</div>

<MainContent
actions={actions}
appSettings={appSettings}
changelogEntries={changelogEntries}
configs={configs}
connected={connected}
escs={escs}
flashTargets={flashTargets}
fourWay={fourWay}
onAllMotorSpeed={onAllMotorSpeed}
onCancelFirmwareSelection={onCancelFirmwareSelection}
onFlashUrl={onFlashUrl}
onIndividualSettingsUpdate={onIndividualSettingsUpdate}
onLocalSubmit={onLocalSubmit}
onReadEscs={onReadEscs}
onResetDefaultls={onResetDefaultls}
onSaveLog={onSaveLog}
onSelectFirmwareForAll={onSelectFirmwareForAll}
onSettingsUpdate={onSettingsUpdate}
onSingleFlash={onSingleFlash}
onSingleMotorSpeed={onSingleMotorSpeed}
onWriteSetup={onWriteSetup}
open={open}
progress={progress}
settings={settings}
/>

<Statusbar
packetErrors={packetErrors}
ref={statusbarRef}
version={version}
/>
</div>

<CookieConsent
onCookieAccept={onCookieAccept}
/>

{showSettings &&
<AppSettings
onClose={onClose}
onUpdate={onUpdate}
settings={appSettings}
/>}

<ToastContainer />
</div>
);
}

App.defaultProps = {
serial: {
getBatteryState: null,
getUtilization: null,
},
};

App.propTypes = {
actions: PropTypes.shape({ isReading: PropTypes.bool.isRequired }).isRequired,
appSettings: PropTypes.shape({}).isRequired,
configs: PropTypes.shape({}).isRequired,
connected: PropTypes.number.isRequired,
escs: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
flashTargets: PropTypes.arrayOf(PropTypes.number).isRequired,
fourWay: PropTypes.bool.isRequired,
hasPort: PropTypes.bool.isRequired,
hasSerial: PropTypes.bool.isRequired,
language: PropTypes.string.isRequired,
languages: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
onAllMotorSpeed: PropTypes.func.isRequired,
onCancelFirmwareSelection: PropTypes.func.isRequired,
onChangePort: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
onConnect: PropTypes.func.isRequired,
onCookieAccept: PropTypes.func.isRequired,
onDisconnect: PropTypes.func.isRequired,
onFlashUrl: PropTypes.func.isRequired,
onIndividualSettingsUpdate: PropTypes.func.isRequired,
onLanguageSelection: PropTypes.func.isRequired,
onLocalSubmit: PropTypes.func.isRequired,
onOpenSettings: PropTypes.func.isRequired,
onReadEscs: PropTypes.func.isRequired,
onResetDefaultls: PropTypes.func.isRequired,
onSaveLog: PropTypes.func.isRequired,
onSelectFirmwareForAll: PropTypes.func.isRequired,
onSetBaudRate: PropTypes.func.isRequired,
onSetPort: PropTypes.func.isRequired,
onSettingsUpdate: PropTypes.func.isRequired,
onSingleFlash: PropTypes.func.isRequired,
onSingleMotorSpeed: PropTypes.func.isRequired,
onUpdate: PropTypes.func.isRequired,
onWriteSetup: PropTypes.func.isRequired,
open: PropTypes.bool.isRequired,
packetErrors: PropTypes.number.isRequired,
portNames: PropTypes.arrayOf(PropTypes.string).isRequired,
progress: PropTypes.arrayOf(PropTypes.number).isRequired,
serial: PropTypes.shape({
getBatteryState:PropTypes.func,
getUtilization:PropTypes.func,
}),
serialLog: PropTypes.arrayOf(PropTypes.any).isRequired,
settings: PropTypes.shape({}).isRequired,
showSettings: PropTypes.bool.isRequired,
version: PropTypes.string.isRequired,
};

export default App;
File renamed without changes.
Loading

0 comments on commit 76246d0

Please sign in to comment.