add login and attention

This commit is contained in:
xmcp
2018-08-24 20:34:08 +08:00
parent 664409c026
commit 9b5154ea4d
16 changed files with 354 additions and 95 deletions

View File

@@ -2,6 +2,7 @@ import React, {Component} from 'react';
import {Flow} from './Flows';
import {Title} from './Title';
import {Sidebar} from './Sidebar';
import {TokenCtx} from './UserAction';
class App extends Component {
constructor(props) {
@@ -9,9 +10,10 @@ class App extends Component {
this.state={
sidebar_title: null,
sidebar_content: null,
mode: 'list', // list, single, search
mode: 'list', // list, single, search, attention
search_text: null,
flow_render_key: +new Date(),
token: localStorage['TOKEN']||null,
};
this.show_sidebar_bound=this.show_sidebar.bind(this);
this.set_mode_bound=this.set_mode.bind(this);
@@ -34,23 +36,35 @@ class App extends Component {
render() {
return (
<div>
<div className="bg-img" style={{
backgroundImage: 'url('+(localStorage['REPLACE_ERIRI_WITH_URL'] || 'static/eriri_bg.jpg')+')'
}} />
<Title show_sidebar={this.show_sidebar_bound} set_mode={this.set_mode_bound} />
<div className="left-container">
<Flow key={this.state.flow_render_key} show_sidebar={this.show_sidebar_bound}
mode={this.state.mode} search_text={this.state.search_text}
/>
<br />
</div>
<Sidebar do_close={()=>{
<TokenCtx.Provider value={{
value: this.state.token,
set_value: (x)=>{
localStorage['TOKEN']=x||'';
this.setState({
sidebar_content: null,
token: x,
});
}} content={this.state.sidebar_content} title={this.state.sidebar_title} />
</div>
},
}}>
<div>
<div className="bg-img" style={{
backgroundImage: 'url('+(localStorage['REPLACE_ERIRI_WITH_URL'] || 'static/eriri_bg.jpg')+')'
}} />
<Title show_sidebar={this.show_sidebar_bound} set_mode={this.set_mode_bound} />
<div className="left-container">
<TokenCtx.Consumer>{(token)=>(
<Flow key={this.state.flow_render_key} show_sidebar={this.show_sidebar_bound}
mode={this.state.mode} search_text={this.state.search_text} token={token.value}
/>
)}</TokenCtx.Consumer>
<br />
</div>
<Sidebar do_close={()=>{
this.setState({
sidebar_content: null,
});
}} content={this.state.sidebar_content} title={this.state.sidebar_title} />
</div>
</TokenCtx.Provider>
);
}
}