75 lines
2.0 KiB
JavaScript
75 lines
2.0 KiB
JavaScript
import React from 'react';
|
|
|
|
import {Home} from './home';
|
|
import {Calender} from './calender';
|
|
import {Generator} from './generator';
|
|
import {Print} from './print';
|
|
import {Settings} from './settings';
|
|
|
|
import {DB} from './../static/storage'
|
|
import { Notify } from '../static/notify';
|
|
|
|
export class Nav extends React.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {
|
|
tab:(<Home/>),
|
|
notify:(<span></span>)
|
|
}
|
|
this.handleExportFile = this.handleExportFile.bind(this);
|
|
var me = this;
|
|
Notify.on((data)=>{
|
|
me.setState({notify:me.notify(data)});
|
|
setTimeout(function(){
|
|
me.setState({notify:(<span></span>)});
|
|
},3000)
|
|
});
|
|
}
|
|
handleExportFile(){
|
|
/**
|
|
* @TODO
|
|
* LOAD FILE
|
|
*/
|
|
}
|
|
handleCreateFile(){
|
|
/**
|
|
* @TODO
|
|
* CREATE FILE
|
|
*/
|
|
}
|
|
notify(data){
|
|
return(
|
|
<div className="notification success">
|
|
<div className="title">{data.title}</div>
|
|
<div className="body">{data.body}</div>
|
|
</div>
|
|
)
|
|
}
|
|
render() {
|
|
/*<button onClick={this.handleCreateFile}>Erstellen </button>*/
|
|
return (
|
|
<div id="container">
|
|
<div id="nav">
|
|
<div className="header">
|
|
WBM
|
|
</div>
|
|
<button onClick={()=>{this.setState({tab:(<Home/>)})}}>Home</button>
|
|
|
|
<button onClick={()=>{DB.exportDB()}}>Exportieren </button>
|
|
<button onClick={()=>{this.setState({tab:(<Calender/>)})}}>Kalender</button>
|
|
<button onClick={()=>{this.setState({tab:(<Generator/>)})}}>Generator</button>
|
|
<button onClick={()=>{this.setState({tab:(<Print/>)})}}>Drucken</button>
|
|
<button onClick={()=>{this.setState({tab:(<Settings/>)})}}>Einstellungen</button>
|
|
<hr/>
|
|
Erstellt von:<br/><a target="_blank" rel="noopener noreferrer" href="https://lucajaents.ch">Luca Jäntsch</a>
|
|
</div>
|
|
<div id="content">
|
|
{this.state.tab}
|
|
</div>
|
|
<div id="notify-center">
|
|
{this.state.notify}
|
|
</div>
|
|
</div>);
|
|
}
|
|
}
|