2019-03-25 20:53:33 +01:00
|
|
|
import React, { Component } from 'react';
|
2019-03-26 02:37:02 +01:00
|
|
|
import {MuiThemeProvider, CssBaseline, withStyles, Typography } from '@material-ui/core';
|
2019-03-27 22:39:25 +01:00
|
|
|
import { setHyperspaceTheme, darkMode } from './utilities/themes';
|
2019-03-26 02:37:02 +01:00
|
|
|
import AppLayout from './components/AppLayout';
|
|
|
|
import {styles} from './App.styles';
|
2019-03-27 01:35:30 +01:00
|
|
|
import {Route} from 'react-router-dom';
|
2019-03-27 22:39:25 +01:00
|
|
|
import AboutPage from './pages/About';
|
|
|
|
import Settings from './pages/Settings';
|
|
|
|
import { getUserDefaultBool, getUserDefaultTheme } from './utilities/settings';
|
2019-03-28 21:46:19 +01:00
|
|
|
import ProfilePage from './pages/ProfilePage';
|
2019-03-25 20:53:33 +01:00
|
|
|
|
2019-03-27 22:39:25 +01:00
|
|
|
let theme = setHyperspaceTheme(getUserDefaultTheme());
|
2019-03-28 00:24:52 +01:00
|
|
|
|
2019-03-25 22:01:39 +01:00
|
|
|
class App extends Component<any, any> {
|
2019-03-26 02:37:02 +01:00
|
|
|
|
2019-03-27 22:39:25 +01:00
|
|
|
constructor(props: any) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
theme: theme
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
componentWillMount() {
|
|
|
|
let newTheme = darkMode(this.state.theme, getUserDefaultBool('darkModeEnabled'));
|
|
|
|
this.setState({ theme: newTheme });
|
|
|
|
}
|
|
|
|
|
2019-03-25 20:53:33 +01:00
|
|
|
render() {
|
2019-03-25 22:01:39 +01:00
|
|
|
const { classes } = this.props;
|
2019-03-25 20:53:33 +01:00
|
|
|
return (
|
2019-03-27 22:39:25 +01:00
|
|
|
<MuiThemeProvider theme={this.state.theme}>
|
2019-03-26 02:37:02 +01:00
|
|
|
<CssBaseline/>
|
|
|
|
<AppLayout/>
|
2019-03-27 01:35:30 +01:00
|
|
|
<Route exact path="/"/>
|
|
|
|
<Route path="/home"/>
|
|
|
|
<Route path="/local"/>
|
2019-03-27 17:42:04 +01:00
|
|
|
<Route path="/public"/>
|
|
|
|
<Route path="/messages"/>
|
|
|
|
<Route path="/notifications"/>
|
2019-03-28 21:46:19 +01:00
|
|
|
<Route path="/profile/:profileId" component={ProfilePage}/>
|
2019-03-28 03:01:55 +01:00
|
|
|
<Route path="/conversation/:conversationId"/>
|
2019-03-27 22:39:25 +01:00
|
|
|
<Route path="/settings" component={Settings}/>
|
|
|
|
<Route path="/about" component={AboutPage}/>
|
2019-03-25 22:01:39 +01:00
|
|
|
</MuiThemeProvider>
|
2019-03-25 20:53:33 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-25 22:01:39 +01:00
|
|
|
export default withStyles(styles)(App);
|