Add Hackerspace Config

This commit is contained in:
uwap 2017-11-01 15:41:10 +01:00
parent a9619536d4
commit b2f1e2b07c
3 changed files with 16 additions and 3 deletions

View file

@ -2,6 +2,10 @@
import * as utils from './utils'; import * as utils from './utils';
const config : Config = { const config : Config = {
space: {
name: "RZL",
color: "orange"
},
topics: { topics: {
led_stahltraeger: { led_stahltraeger: {
state: "/service/openhab/out/pca301_ledstrips/state", state: "/service/openhab/out/pca301_ledstrips/state",

View file

@ -15,7 +15,7 @@ import SpaceMap from "./map.js";
import R from "ramda"; import R from "ramda";
import Config from "./config"; import Config from "./config";
import Toolbar from "material-ui/Toolbar"; import Toolbar from "material-ui/Toolbar";
import orange from 'material-ui/colors/orange'; import * as colors from 'material-ui/colors';
import Typography from 'material-ui/Typography'; import Typography from 'material-ui/Typography';
import List, { ListSubheader } from 'material-ui/List'; import List, { ListSubheader } from 'material-ui/List';
import IconButton from 'material-ui/IconButton'; import IconButton from 'material-ui/IconButton';
@ -24,6 +24,8 @@ import AppBar from 'material-ui/AppBar';
injectTapEventPlugin(); injectTapEventPlugin();
document.title = `${Config.space.name} Map`;
const UiItem = (state) => (props : ControlUI) => const UiItem = (state) => (props : ControlUI) =>
UiItems[props.type](state, props); UiItems[props.type](state, props);
@ -33,7 +35,7 @@ const renderUi = (state: State, key: ?string) =>
const theme = createMuiTheme({ const theme = createMuiTheme({
palette: { palette: {
primary: orange primary: colors[Config.space.color]
} }
}); });
@ -52,7 +54,7 @@ class app extends React.Component<{state: State, classes: Object}> {
<div> <div>
<MuiThemeProvider theme={theme}> <MuiThemeProvider theme={theme}>
<div> <div>
<SpaceMapBar title="RZL Map" {...state} /> <SpaceMapBar title={`${Config.space.name} Map`} {...state} />
<Drawer open={state.uiOpened != null} <Drawer open={state.uiOpened != null}
anchor="right" anchor="right"
onRequestClose={() => store.dispatch({type: Actions.CHANGE_UI})} onRequestClose={() => store.dispatch({type: Actions.CHANGE_UI})}

View file

@ -45,11 +45,18 @@ declare type Control = {
declare type Controls = Map<string,Control>; declare type Controls = Map<string,Control>;
declare type Config = { declare type Config = {
space: Space,
topics: Topics, topics: Topics,
controls: Controls, controls: Controls,
layers: Array<Layer> layers: Array<Layer>
}; };
declare type Space = {
name: string,
color: "red"|"pink"|"purple"|"deepPurple"|"indigo"|"blue"|"lightBlue"|"cyan"|"teal"|
"green"|"lightgreen"|"lime"|"yellow"|"amber"|"orange"|"deepOrange"|"brown"|"grey"|"blueGrey"
};
declare type State = { declare type State = {
mqtt: ?any, mqtt: ?any,
uiOpened: ?string, uiOpened: ?string,