import React, {Component, PureComponent} from 'react'; import {LoginForm} from './UserAction'; import {TokenCtx} from './UserAction'; import './Title.css'; const HELP_TEXT=(

使用提示:

使用本网站时,您需要了解并同意:

By @xmcp


This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.


This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

); class ControlBar extends PureComponent { constructor(props) { super(props); this.state={ search_text: '', }; this.set_mode=props.set_mode; this.on_change_bound=this.on_change.bind(this); this.on_keypress_bound=this.on_keypress.bind(this); this.do_refresh_bound=this.do_refresh.bind(this); this.do_attention_bound=this.do_attention.bind(this); } componentDidMount() { if(window.location.hash) { const text=window.location.hash.substr(1); this.setState({ search_text: text, }, ()=>{ this.on_keypress({key: 'Enter'}); }); } } on_change(event) { this.setState({ search_text: event.target.value, }); } on_keypress(event) { if(event.key==='Enter') { const mode=this.state.search_text.startsWith('#') ? 'single' : 'search'; this.set_mode(mode,this.state.search_text||null); } } do_refresh() { window.scrollTo(0,0); this.setState({ search_text: '', }); this.set_mode('list',null); } do_attention() { window.scrollTo(0,0); this.setState({ search_text: '', }); this.set_mode('attention',null); } render() { return ( {({value: token})=>(
{!!token && } {this.props.show_sidebar('登录',)}}> {this.props.show_sidebar( '关于 P大树洞(非官方) 网页版', HELP_TEXT )}}>
)}
) } } export function Title(props) { return (

P大树洞

) }