Add status header
This commit is contained in:
parent
37d0a345ce
commit
7894511905
3 changed files with 56 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
||||||
//App preferences
|
//App preferences
|
||||||
export const windowSize = { width: 620, height: 320 };
|
export const windowSize = { width: 620, height: 350 };
|
||||||
export const windowOffset = 40;
|
export const windowOffset = 40;
|
||||||
export const appIconPath = '../../dist-assets/icon.ico';
|
export const appIconPath = '../../dist-assets/icon.ico';
|
||||||
export const trayIconPath = '../../dist-assets/tray.ico';
|
export const trayIconPath = '../../dist-assets/tray.ico';
|
||||||
|
|
|
@ -7,6 +7,7 @@ import CssBaseline from '@material-ui/core/CssBaseline';
|
||||||
import createMuiTheme from '@material-ui/core/styles/createMuiTheme';
|
import createMuiTheme from '@material-ui/core/styles/createMuiTheme';
|
||||||
import { ThemeProvider } from '@material-ui/core/styles';
|
import { ThemeProvider } from '@material-ui/core/styles';
|
||||||
import LampButtonList from './components/LampButtonList';
|
import LampButtonList from './components/LampButtonList';
|
||||||
|
import Header from './components/Header';
|
||||||
|
|
||||||
const store = createStore(
|
const store = createStore(
|
||||||
rootReducer,
|
rootReducer,
|
||||||
|
@ -31,6 +32,7 @@ ReactDOM.render(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<ThemeProvider theme={darkTheme}>
|
<ThemeProvider theme={darkTheme}>
|
||||||
<CssBaseline />
|
<CssBaseline />
|
||||||
|
<Header error={false} />
|
||||||
<LampButtonList />
|
<LampButtonList />
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
</Provider>,
|
</Provider>,
|
||||||
|
|
53
Dashboard/app/renderer/components/Header.js
Normal file
53
Dashboard/app/renderer/components/Header.js
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
import React from 'react';
|
||||||
|
import Box from '@material-ui/core/Box';
|
||||||
|
import SettingsIcon from '@material-ui/icons/Settings';
|
||||||
|
import IconButton from '@material-ui/core/IconButton';
|
||||||
|
import CheckCircleIcon from '@material-ui/icons/CheckCircle';
|
||||||
|
import ErrorIcon from '@material-ui/icons/Error';
|
||||||
|
import Tooltip from '@material-ui/core/Tooltip';
|
||||||
|
import { useSelector } from 'react-redux/';
|
||||||
|
|
||||||
|
function ConnectionStatus({ error }) {
|
||||||
|
if (error) {
|
||||||
|
return <ErrorIcon />;
|
||||||
|
} else {
|
||||||
|
return <CheckCircleIcon />;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Header() {
|
||||||
|
const comConnectionStatus = useSelector((state) => state.comConnectionStatusReducer);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<Box
|
||||||
|
bgcolor="primary.main"
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
height: 30,
|
||||||
|
}}>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
justifyItems: 'space-between',
|
||||||
|
width: '100%',
|
||||||
|
marginLeft: 10,
|
||||||
|
marginRight: 10,
|
||||||
|
}}>
|
||||||
|
<Tooltip title={comConnectionStatus ? 'Click to reconnect' : 'Click to disconnect'}>
|
||||||
|
<IconButton size="small">
|
||||||
|
<ConnectionStatus error={comConnectionStatus} />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
<Tooltip title="Open Settings">
|
||||||
|
<IconButton size="small">
|
||||||
|
<SettingsIcon />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
</div>
|
||||||
|
</Box>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
Reference in a new issue