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

Feature/mui #217

Draft
wants to merge 78 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
fa0a9a8
Added MUI dependencies #164
stylesuxx Jan 6, 2022
43859e8
Use MUI Dialog component instead of custom overlay #164
stylesuxx Jan 6, 2022
40e9162
Close text no longer needed since an icon is used now. #164
stylesuxx Jan 6, 2022
81e2302
Refactored react-tooltips to MUI tooltips #164
stylesuxx Jan 6, 2022
4fabeee
Refactored Checkboxes to MUI checkboxes #164
stylesuxx Jan 6, 2022
0ef5889
Refactored Selects to MUI Selects for common settings and singel sett…
stylesuxx Jan 6, 2022
403062e
Refactored Labeled Selects to MUI Selects, improved test cases #164
stylesuxx Jan 6, 2022
1c99ed6
Refactored Motor sliders to MUI sliders. Refactored Text. Improved La…
stylesuxx Jan 6, 2022
55a4a02
Refactored common settings and ESC settings to use MUI components. Di…
stylesuxx Jan 7, 2022
d919d6e
Refactored to use MUI Card component #164
stylesuxx Jan 7, 2022
1c91adc
Refactored Melody Editor to only use MUI components. #164
stylesuxx Jan 7, 2022
ab5e6b2
Added roboto font, more MUI refactoring. #164
stylesuxx Jan 7, 2022
3007632
Added MUI dependencies #164
stylesuxx Jan 6, 2022
d7f9245
Use MUI Dialog component instead of custom overlay #164
stylesuxx Jan 6, 2022
530ff1b
Close text no longer needed since an icon is used now. #164
stylesuxx Jan 6, 2022
639cefb
Refactored react-tooltips to MUI tooltips #164
stylesuxx Jan 6, 2022
2ebc0fc
Refactored Checkboxes to MUI checkboxes #164
stylesuxx Jan 6, 2022
c9b8993
Refactored Selects to MUI Selects for common settings and singel sett…
stylesuxx Jan 6, 2022
da24baf
Refactored Labeled Selects to MUI Selects, improved test cases #164
stylesuxx Jan 6, 2022
c38d0ac
Refactored Motor sliders to MUI sliders. Refactored Text. Improved La…
stylesuxx Jan 6, 2022
a870d3b
Refactored common settings and ESC settings to use MUI components. Di…
stylesuxx Jan 7, 2022
73a4ea3
Refactored to use MUI Card component #164
stylesuxx Jan 7, 2022
bc59178
Refactored Melody Editor to only use MUI components. #164
stylesuxx Jan 7, 2022
658907d
Added roboto font, more MUI refactoring. #164
stylesuxx Jan 7, 2022
918a433
More MUI refactoring
stylesuxx Jan 12, 2022
7e22d8a
fixed merge conflicts
stylesuxx Feb 4, 2022
46912e0
Fixed merge conflict, updated tests and fixed linting errors.
stylesuxx Feb 5, 2022
a36b1ce
Improved styling of Bluejay section #164
stylesuxx Feb 5, 2022
7b3035d
Improved styling of Discord part #164
stylesuxx Feb 5, 2022
0600fdc
Already returning from default switch case
stylesuxx Feb 5, 2022
ca68c7a
Explicitly use path to coverage reports (#218)
stylesuxx Feb 5, 2022
07f7042
Move individual sliders in disabled mode when moving master slider
stylesuxx Feb 6, 2022
aa13ec4
Removed debugging
stylesuxx Feb 6, 2022
004a9c4
Refactored direct Input element to use MUI #164
stylesuxx Feb 6, 2022
5fa8513
Refactored direct Input element to use MUI #164
stylesuxx Feb 6, 2022
9696fa3
Update changelog
stylesuxx Feb 6, 2022
f2bf824
Improved formatting of the home screen
stylesuxx Feb 6, 2022
aaa8ddc
Test to make sure a melody can be changed after it has been accepted …
stylesuxx Feb 7, 2022
cf7fa28
Improved PWA installatiton message on Home #164
stylesuxx Feb 7, 2022
fd365a5
Refactored changelog to use MUI component #164
stylesuxx Feb 7, 2022
9ae1f04
Refactored Log to use MUI components #164
stylesuxx Feb 7, 2022
ec61bed
Format log messages before rendering them. Use MUI components.
stylesuxx Feb 8, 2022
0debb0c
Adapted tests
stylesuxx Feb 8, 2022
b341183
Refactored Cookie Box to use MUI elements instead of 3rd party compon…
stylesuxx Feb 8, 2022
91339a6
Properly check for BLHeli_M
stylesuxx Feb 8, 2022
2548dbd
Fixed formatting
stylesuxx Feb 8, 2022
7b75e2c
Use MUI component for progress bar, hide buttons if progress bar is s…
stylesuxx Feb 9, 2022
a922bf6
Adjusted test cases. Set default props for non required props.
stylesuxx Feb 9, 2022
98af1c4
Added test to make sure clear log button triggers properly
stylesuxx Feb 9, 2022
13c7e02
Don't show unstable releases by default.
stylesuxx Feb 9, 2022
8019b43
Render markdown as span
stylesuxx Feb 9, 2022
06e31f1
Pass all required properties
stylesuxx Feb 9, 2022
4def3a7
Add tests for Cookie Consent
stylesuxx Feb 9, 2022
f461502
Improved tests
stylesuxx Feb 9, 2022
77340da
Simplified testing
stylesuxx Feb 9, 2022
15cec12
Improved test cases
stylesuxx Feb 9, 2022
ec5f1a8
Test changing a select value
stylesuxx Feb 9, 2022
63dc13e
Tests for setting handler
stylesuxx Feb 10, 2022
80f7501
Add tests for Settings element
stylesuxx Feb 10, 2022
ce57043
Improve testing of timeout hook
stylesuxx Feb 10, 2022
d9d3026
Use lower timeout when testing serial connection
stylesuxx Feb 10, 2022
0b727b1
Exclude BLHeli dir from coverage since we are not using it anyway.
stylesuxx Feb 10, 2022
5e44e31
Test LED settings with supported layout
stylesuxx Feb 10, 2022
217729f
Simplified logic
stylesuxx Feb 10, 2022
de59406
Exclude BLHeli settings from codecov report
stylesuxx Feb 11, 2022
4250b7f
codecov settings
stylesuxx Feb 11, 2022
d98b10a
codecov settings
stylesuxx Feb 11, 2022
34f36de
Added missing test cases for Flash helper
stylesuxx Feb 11, 2022
b4c4052
Check cookie banner
stylesuxx Feb 11, 2022
d89511b
Refactored fetching functionality. Added tests.
stylesuxx Feb 11, 2022
4d5bca4
Precache static json files and favicon.ico (#219)
mathiasvr Feb 12, 2022
d578cde
Removed debugging statement
stylesuxx Feb 12, 2022
d4a4ddc
Added test for local storage functionality
stylesuxx Feb 12, 2022
ed5f59f
Melodies: adds Pokémon & Extended Rick Astley (#222)
t413 Feb 13, 2022
7e5a713
Added melodies submitted by 'belrik' in Discord #94
stylesuxx Feb 13, 2022
e6068bb
Fixed merge conflict
stylesuxx Feb 22, 2022
55e56fc
Fixed merge conflict
stylesuxx Mar 28, 2022
b19f232
Updated to latest master state
stylesuxx Aug 9, 2022
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
3 changes: 3 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ignore:
- "src/sources/Blheli/*"
- "src/sources/Blheli/**/*"
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
"license": "AGPL-3.0",
"dependencies": {
"@babel/plugin-transform-react-jsx": "^7.16.7",
"@palmabit/react-cookie-law": "^0.6.2",
"@emotion/react": "^11.7.1",
"@emotion/styled": "^11.6.0",
"@fontsource/roboto": "^4.5.1",
"@mui/icons-material": "^5.2.5",
"@mui/material": "^5.2.7",
"autoprefixer": "^10.4.2",
"bluejay-rtttl-parse": "^2.0.2",
"compare-versions": "^4.1.3",
Expand Down
138 changes: 81 additions & 57 deletions src/Components/App/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import { useTranslation } from 'react-i18next';
import PropTypes from 'prop-types';
import React from 'react';

import {
createTheme,
ThemeProvider,
} from '@mui/material/styles';

import Box from '@mui/material/Box';

import AppSettings from '../AppSettings';
import CookieConsent from '../CookieConsent';
import LanguageSelection from '../LanguageSelection';
Expand All @@ -16,10 +23,21 @@ import Statusbar from '../Statusbar';
import changelogEntries from '../../changelog.json';
import './style.scss';

const theme = createTheme({
palette: {
primary: {
main: '#6a8347',
bright: '#71b238',
ph: '',
},
},
});

function App({
actions,
appSettings,
configs,
cookieDone,
escs,
language,
melodies,
Expand All @@ -36,45 +54,47 @@ function App({
const isIdle = !Object.values(actions).some((element) => element);

return (
<div>
<div className="main">
<ThemeProvider theme={theme}>
<Box className="main">
<header className="main__header">
<div className="main__bar">
<div className="main__logo" />

<PortPicker
hasPort={serial.connected}
hasSerial={serial.hasSerial}
isIdle={isIdle}
onChangePort={serial.actions.handleChangePort}
onConnect={serial.actions.handleConnect}
onDisconnect={serial.actions.handleDisconnect}
onSetBaudRate={serial.actions.handleSetBaudRate}
onSetPort={serial.actions.handleSetPort}
open={serial.open}
ports={serial.portNames}
/>

<div className="main__settings">
<LanguageSelection
current={language.current}
languages={language.available}
onChange={language.actions.handleChange}
<Box className="mui-fixed">
<div className="main__bar">
<div className="main__logo" />

<PortPicker
hasPort={serial.connected}
hasSerial={serial.hasSerial}
isIdle={isIdle}
onChangePort={serial.actions.handleChangePort}
onConnect={serial.actions.handleConnect}
onDisconnect={serial.actions.handleDisconnect}
onSetBaudRate={serial.actions.handleSetBaudRate}
onSetPort={serial.actions.handleSetPort}
open={serial.open}
ports={serial.portNames}
/>

<div className="button button--dark">
<button
onClick={appSettings.actions.handleOpen}
type="button"
>
{t('settings')}
</button>
</div>
<div className="main__settings">
<LanguageSelection
current={language.current}
languages={language.available}
onChange={language.actions.handleChange}
/>

<div className="button button--dark">
<button
onClick={appSettings.actions.handleOpen}
type="button"
>
{t('settings')}
</button>
</div>

</div>
</div>
</div>

<Log messages={serial.log} />
<Log messages={serial.log} />
</Box>
</header>

<MainContent
Expand Down Expand Up @@ -114,32 +134,35 @@ function App({
packetErrors={stats.packetErrors}
version={stats.version}
/>
</div>

{appSettings.show &&
<AppSettings
onClose={appSettings.actions.handleClose}
onUpdate={appSettings.actions.handleUpdate}
settings={appSettings.settings}
/>}

{melodies.show &&
<MelodyEditor
customMelodies={melodies.customMelodies}
defaultMelodies={melodies.defaultMelodies}
dummy={melodies.dummy}
melodies={melodies.escs}
onClose={melodies.actions.handleClose}
onDelete={melodies.actions.handleDelete}
onSave={melodies.actions.handleSave}
onWrite={melodies.actions.handleWrite}
writing={actions.isWriting}
/>}

<CookieConsent onCookieAccept={onCookieAccept} />
</Box>

<AppSettings
onClose={appSettings.actions.handleClose}
onUpdate={appSettings.actions.handleUpdate}
open={appSettings.show}
settings={appSettings.settings}
/>

<MelodyEditor
customMelodies={melodies.customMelodies}
defaultMelodies={melodies.defaultMelodies}
dummy={melodies.dummy}
melodies={melodies.escs}
onClose={melodies.actions.handleClose}
onDelete={melodies.actions.handleDelete}
onSave={melodies.actions.handleSave}
onWrite={melodies.actions.handleWrite}
open={melodies.show}
writing={actions.isWriting}
/>

<CookieConsent
onCookieAccept={onCookieAccept}
show={!cookieDone}
/>

<ToastContainer />
</div>
</ThemeProvider>
);
}

Expand Down Expand Up @@ -169,6 +192,7 @@ App.propTypes = {
show: PropTypes.bool.isRequired,
}).isRequired,
configs: PropTypes.shape({}).isRequired,
cookieDone: PropTypes.bool.isRequired,
escs: PropTypes.shape({
actions: PropTypes.shape({
handleMasterUpdate: PropTypes.func.isRequired,
Expand Down
13 changes: 7 additions & 6 deletions src/Components/App/style.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../../variables.scss';

* {
margin: 0;
padding: 0;
Expand All @@ -7,13 +9,9 @@
}

body {
font-family: 'open_sansregular', 'Segoe UI', Tahoma, sans-serif;
font-size: 12px;
color: #303030;
background-color: lightgray;
margin: 0px;
padding: 0px;
width: 100%;
overflow-x: hidden;
}

Expand Down Expand Up @@ -141,8 +139,10 @@ body {
}

.main {
/*
padding: 0px 0px 0 0px;
height: calc(100% - 7px);
*/

.main__header {
background: #3d3f3e;
Expand Down Expand Up @@ -239,7 +239,6 @@ body {
a {
text-decoration: none;
color: #000;
font-family: 'open_sanssemibold', Arial;
}

a:hover {
Expand Down Expand Up @@ -316,9 +315,11 @@ body {
border-radius: 4px;
border: 1px solid var(--color-tertiary);
color: var(--color-tertiary);
/*
font-family: 'open_sanssemibold', Arial;
font-size: 12px;
line-height: 13px;
*/
display: block;
width: 100%;
transition: all ease 0.2s;
Expand Down Expand Up @@ -363,7 +364,7 @@ body {
.content_wrapper {
padding: 20px;
position: relative;
margin-bottom: 50px;
margin-bottom: 70px;

@media only screen and (max-width: 600px) {
margin-bottom: 120px;
Expand Down
8 changes: 6 additions & 2 deletions src/Components/AppSettings/__tests__/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ describe('AppSettings', () => {
<AppSettings
onClose={onClose}
onUpdate={onUpdate}
open
settings={settings}
/>
);

expect(screen.getByText(/settingsHeader/i)).toBeInTheDocument();
expect(screen.getByText(/close/i)).toBeInTheDocument();
expect(screen.getByTestId('CloseIcon')).toBeInTheDocument();
});

it('should handle clicks on checkbox', () => {
Expand All @@ -51,6 +52,7 @@ describe('AppSettings', () => {
<AppSettings
onClose={onClose}
onUpdate={onUpdate}
open
settings={settings}
/>
);
Expand All @@ -71,11 +73,12 @@ describe('AppSettings', () => {
<AppSettings
onClose={onClose}
onUpdate={onUpdate}
open
settings={settings}
/>
);

userEvent.click(screen.getByText(/close/i));
userEvent.click(screen.getByTestId('CloseIcon'));
expect(onClose).toHaveBeenCalled();
});

Expand All @@ -94,6 +97,7 @@ describe('AppSettings', () => {
<AppSettings
onClose={onClose}
onUpdate={onUpdate}
open
settings={settings}
/>
);
Expand Down
32 changes: 20 additions & 12 deletions src/Components/AppSettings/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ import { useTranslation } from 'react-i18next';
import PropTypes from 'prop-types';
import React, { useCallback } from 'react';

import FormControl from '@mui/material/FormControl';
import Stack from '@mui/material/Stack';

import Checkbox from '../Input/Checkbox';
import Overlay from '../Overlay';

import './style.scss';

function AppSettings({
settings,
onClose,
onUpdate,
open,
}) {
const { t } = useTranslation('settings');

Expand Down Expand Up @@ -43,27 +45,33 @@ function AppSettings({
return null;
}
}

return null;
});

return (
<div className="settings">
<Overlay
headline={t('settingsHeader')}
onClose={onClose}
<Overlay
headline={t('settingsHeader')}
maxWidth='sm'
onClose={onClose}
open={open}
>
<FormControl
fullWidth
variant="standard"
>
<div>
<Stack
spacing={1}
>
{settingElements}
</div>
</Overlay>
</div>
</Stack>
</FormControl>
</Overlay>
);
}

AppSettings.propTypes = {
onClose: PropTypes.func.isRequired,
onUpdate: PropTypes.func.isRequired,
open: PropTypes.bool.isRequired,
settings: PropTypes.shape().isRequired,
};

Expand Down
5 changes: 0 additions & 5 deletions src/Components/AppSettings/style.scss

This file was deleted.

Loading