wochenbericht-manager/src/jsx/ui/nav.jsx

82 lines
2.7 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 {WorkTimes} from './worktimes';
import {TasksUI} from './tasks';
import {DB} from './../static/storage'
import { Notify } from '../static/notify';
import { Notes } from './notes';
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={()=>{this.setState({tab:(<Notes/>)})}}>Notizen</button>
<button onClick={()=>{DB.exportDB()}}>Exportieren </button>
<button onClick={()=>{this.setState({tab:(<Calender/>)})}}>Kalender</button>
<button onClick={()=>{this.setState({tab:(<TasksUI/>)})}}>Tasks</button>
<button onClick={()=>{this.setState({tab:(<WorkTimes/>)})}}>Arbeitszeiten</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>
<a href='https://ko-fi.com/W7W511YSC' target='_blank'><img height='36' style={{border:0+"px",height:36+'px'}} src='https://az743702.vo.msecnd.net/cdn/kofi5.png?v=2' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
</div>
<div id="content">
{this.state.tab}
</div>
<div id="notify-center">
{this.state.notify}
</div>
</div>);
}
}