8000 Consistency fixes (#167) · adityathakekar/esp8266-react@f2b53a6 · GitHub
[go: up one dir, main page]

10000
Skip to content

Commit f2b53a6

Browse files
authored
Consistency fixes (rjwats#167)
Minor consistency fixes from @proddy's comments
1 parent 1f07dcd commit f2b53a6

14 files changed

+38
-37
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ const theme = createMuiTheme({
279279
main: '#666',
280280
},
281281
info: {
282-
main: blueGrey[900]
282+
main: blueGrey[500]
283283
},
284284
warning: {
285285
main: orange[500]
@@ -303,7 +303,7 @@ You can replace the app icon is located at ['interface/public/app/icon.png'](int
303303

304304
### Changing the app name
305305

306-
The app name displayed on the login page and on the menu bar can be modified by editing the REACT_APP_NAME property in ['interface/.env'](interface/.env)
306+
The app name displayed on the sign in page and on the menu bar can be modified by editing the REACT_APP_NAME property in ['interface/.env'](interface/.env)
307307

308308
```ini
309309
REACT_APP_NAME=Funky IoT Project
@@ -641,6 +641,7 @@ Configure the WiFi SSID and password manually:
641641
esp8266React.getWiFiSettingsService()->update([&](WiFiSettings& wifiSettings) {
642642
wifiSettings.ssid = "MyNetworkSSID";
643643
wifiSettings.password = "MySuperSecretPassword";
644+
return StateUpdateResult::CHANGED;
644645
}, "myapp");
645646
```
646647

factory_settings.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ build_flags =
66
-D FACTORY_WIFI_HOSTNAME=\"esp-react\"
77

88
; Access point settings
9-
-D FACTORY_AP_SSID=\"ESP8266-React\"
10-
-D FACTORY_AP_PASSWORD=\"esp-react\"
9+
-D FACTORY_AP_SSID=\"ESP8266-React\" ; 1-64 characters
10+
-D FACTORY_AP_PASSWORD=\"esp-react\" ; 8-64 characters
1111
-D FACTORY_AP_PROVISION_MODE=AP_MODE_DISCONNECTED
1212

1313
; User credentials for admin and guest user

interface/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

interface/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"lodash": "^4.17.15",
1919
"mime-types": "^2.1.25",
2020
"moment": "^2.26.0",
21-
"notistack": "^0.9.16",
21+
"notistack": "^0.9.17",
2222
"react": "^16.13.1",
2323
"react-dom": "^16.13.1",
2424
"react-dropzone": "^11.0.1",

interface/src/SignIn.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {PasswordValidator} from './components';
1111
import { PROJECT_NAME, SIGN_IN_ENDPOINT } from './api';
1212

1313
const styles = (theme: Theme) => createStyles({
14-
loginPage: {
14+
signInPage: {
1515
display: "flex",
1616
height: "100vh",
1717
margin: "auto",
@@ -20,7 +20,7 @@ const styles = (theme: Theme) => createStyles({
2020
flexDirection: "column",
2121
maxWidth: theme.breakpoints.values.sm
2222
},
23-
loginPanel: {
23+
signInPanel: {
2424
textAlign: "center",
2525
padding: theme.spacing(2),
2626
paddingTop: "200px",
@@ -81,7 +81,7 @@ class SignIn extends Component<SignInProps, SignInState> {
8181
if (response.status === 200) {
8282
return response.json();
8383
} else if (response.status === 401) {
84-
throw Error("Invalid login details.");
84+
throw Error("Invalid credentials.");
8585
} else {
8686
throw Error("Invalid status code: " + response.status);
8787
}
@@ -100,8 +100,8 @@ class SignIn extends Component<SignInProps, SignInState> {
100100
const { username, password, processing } = this.state;
101101
const { classes } = this.props;
102102
return (
103-
<div className={classes.loginPage}>
104-
<Paper className={classes.loginPanel}>
103+
<div className={classes.signInPage}>
104+
<Paper className={classes.signInPanel}>
105105
<Typography variant="h4">{PROJECT_NAME}</Typography>
106106
<ValidatorForm onSubmit={this.onSubmit}>
107107
<TextValidator

interface/src/ap/APSettingsForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ class APSettingsForm extends React.Component<APSettingsFormProps> {
4343
margin="normal"
4444
/>
4545
<PasswordValidator
46-
validators={['required', 'matchRegexp:^.{1,64}$']}
47-
errorMessages={['Access Point Password is required', 'Access Point Password must be 64 characters or less']}
46+
validators={['required', 'matchRegexp:^.{8,64}$']}
47+
errorMessages={['Access Point Password is required', 'Access Point Password must be 8-64 characters']}
4848
name="password"
4949
label="Access Point Password"
5050
fullWidth

interface/src/authentication/AuthenticatedRoute.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class AuthenticatedRoute extends React.Component<AuthenticatedRouteProps>
2727
);
2828
}
2929
Authentication.storeLoginRedirect(location);
30-
enqueueSnackbar("Please log in to continue.", { variant: 'info' });
30+
enqueueSnackbar("Please sign in to continue.", { variant: 'info' });
3131
return (
3232
<Redirect to='/' />
3333
);

interface/src/authentication/Authentication.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { Features } from '../features/types';
55
import { getDefaultRoute } from '../AppRouting';
66

77
export const ACCESS_TOKEN = 'access_token';
8-
export const LOGIN_PATHNAME = 'loginPathname';
9-
export const LOGIN_SEARCH = 'loginSearch';
8+
export const SIGN_IN_PATHNAME = 'signInPathname';
9+
export const SIGN_IN_SEARCH = 'signInSearch';
1010

1111
/**
1212
* Fallback to sessionStorage if localStorage is absent. WebView may not have local storage enabled.
@@ -17,23 +17,23 @@ export function getStorage() {
1717

1818
export function storeLoginRedirect(location?: H.Location) {
1919
if (location) {
20-
getStorage().setItem(LOGIN_PATHNAME, location.pathname);
21-
getStorage().setItem(LOGIN_SEARCH, location.search);
20+
getStorage().setItem(SIGN_IN_PATHNAME, location.pathname);
21+
getStorage().setItem(SIGN_IN_SEARCH, location.search);
2222
}
2323
}
2424

2525
export function clearLoginRedirect() {
26-
getStorage().removeItem(LOGIN_PATHNAME);
27-
getStorage().removeItem(LOGIN_SEARCH);
26+
getStorage().removeItem(SIGN_IN_PATHNAME);
27+
getStorage().removeItem(SIGN_IN_SEARCH);
2828
}
2929

3030
export function fetchLoginRedirect(features: Features): H.LocationDescriptorObject {
31-
const loginPathname = getStorage().getItem(LOGIN_PATHNAME);
32-
const loginSearch = getStorage().getItem(LOGIN_SEARCH);
31+
const signInPathname = getStorage().getItem(SIGN_IN_PATHNAME);
32+
const signInSearch = getStorage().getItem(SIGN_IN_SEARCH);
3333
clearLoginRedirect();
3434
return {
35-
pathname: loginPathname || getDefaultRoute(features),
36-
search: (loginPathname && loginSearch) || undefined
35+
pathname: signInPathname || getDefaultRoute(features),
36+
search: (signInPathname && signInSearch) || undefined
3737
};
3838
}
3939

interface/src/components/FullScreenLoading.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const FullScreenLoading = () => {
2323
<div className={classes.fullScreenLoading}>
2424
<CircularProgress className={classes.progress} size={100} />
2525
<Typography variant="h4">
26-
Loading &hellip;
26+
Loading&hellip;
2727
</Typography>
2828
</div>
2929
)

interface/src/components/RestController.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ export function restController<D, P extends RestControllerProps<D>>(endpointUrl:
8484
}
8585
throw Error("Invalid status code: " + response.status);
8686
}).then(json => {
87-
this.props.enqueueSnackbar("Changes successfully applied.", { variant: 'success' });
87+
this.props.enqueueSnackbar("Update successful.", { variant: 'success' });
8888
this.setState({ data: json, loading: false });
8989
}).catch(error => {
9090
const errorMessage = error.message || "Unknown error";
91-
this.props.enqueueSnackbar("Problem saving: " + errorMessage, { variant: 'error' });
91+
this.props.enqueueSnackbar("Problem updating: " + errorMessage, { variant: 'error' });
9292
this.setState({ data: undefined, loading: false, errorMessage });
9393
});
9494
}

0 commit comments

Comments
 (0)
0