forked from newthuhole/hole_thu_frontend
fix ios pressure helper and click handler
This commit is contained in:
13
src/App.js
13
src/App.js
@@ -17,7 +17,7 @@ class App extends Component {
|
|||||||
super(props);
|
super(props);
|
||||||
load_config();
|
load_config();
|
||||||
this.state={
|
this.state={
|
||||||
sidebar_title: '',
|
sidebar_title: null,
|
||||||
sidebar_content: null, // determine status of sidebar
|
sidebar_content: null, // determine status of sidebar
|
||||||
mode: 'list', // list, single, search, attention
|
mode: 'list', // list, single, search, attention
|
||||||
search_text: null,
|
search_text: null,
|
||||||
@@ -33,11 +33,11 @@ class App extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
on_pressure() {
|
on_pressure() {
|
||||||
if(this.state.sidebar_content)
|
if(this.state.sidebar_title!==null)
|
||||||
this.setState({
|
this.setState((prevState)=>({
|
||||||
sidebar_title: '',
|
sidebar_title: null,
|
||||||
sidebar_content: null,
|
sidebar_content: prevState.sidebar_content,
|
||||||
});
|
}));
|
||||||
else
|
else
|
||||||
this.set_mode('list',null);
|
this.set_mode('list',null);
|
||||||
}
|
}
|
||||||
@@ -97,6 +97,7 @@ class App extends Component {
|
|||||||
)}</TokenCtx.Consumer>
|
)}</TokenCtx.Consumer>
|
||||||
<Sidebar do_close={()=>{
|
<Sidebar do_close={()=>{
|
||||||
this.setState({
|
this.setState({
|
||||||
|
sidebar_title: null,
|
||||||
sidebar_content: null,
|
sidebar_content: null,
|
||||||
});
|
});
|
||||||
}} content={this.state.sidebar_content} title={this.state.sidebar_title} />
|
}} content={this.state.sidebar_content} title={this.state.sidebar_title} />
|
||||||
|
|||||||
11
src/Flows.js
11
src/Flows.js
@@ -173,6 +173,17 @@ class FlowSidebar extends PureComponent {
|
|||||||
this.reply_ref=React.createRef();
|
this.reply_ref=React.createRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentWillReceiveProps(nextProps) {
|
||||||
|
this.setState({
|
||||||
|
attention: nextProps.attention,
|
||||||
|
info: nextProps.info,
|
||||||
|
replies: nextProps.replies,
|
||||||
|
loading_status: 'done',
|
||||||
|
});
|
||||||
|
this.color_picker=nextProps.color_picker;
|
||||||
|
this.syncState=nextProps.sync_state||(()=>{});
|
||||||
|
}
|
||||||
|
|
||||||
set_variant(cid,variant) {
|
set_variant(cid,variant) {
|
||||||
this.setState((prev)=>{
|
this.setState((prev)=>{
|
||||||
if(cid)
|
if(cid)
|
||||||
|
|||||||
@@ -10,10 +10,6 @@
|
|||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pressure-no-select * {
|
|
||||||
user-select: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pressure-box-fired {
|
.pressure-box-fired {
|
||||||
border-color: orangered;
|
border-color: orangered;
|
||||||
pointer-events: initial !important;
|
pointer-events: initial !important;
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ export class PressureHelper extends Component {
|
|||||||
change: (force)=>{
|
change: (force)=>{
|
||||||
if(!this.state.fired) {
|
if(!this.state.fired) {
|
||||||
if(force>=.999) {
|
if(force>=.999) {
|
||||||
document.body.classList.add('pressure-no-select');
|
|
||||||
this.do_fire();
|
this.do_fire();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -56,7 +55,6 @@ export class PressureHelper extends Component {
|
|||||||
level: 0,
|
level: 0,
|
||||||
fired: false,
|
fired: false,
|
||||||
});
|
});
|
||||||
document.body.classList.remove('pressure-no-select');
|
|
||||||
},
|
},
|
||||||
}, {
|
}, {
|
||||||
polyfill: false,
|
polyfill: false,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import './Sidebar.css';
|
|||||||
|
|
||||||
export function Sidebar(props) {
|
export function Sidebar(props) {
|
||||||
return (
|
return (
|
||||||
<div className={props.content ? 'sidebar-on' : ''}>
|
<div className={props.title!==null ? 'sidebar-on' : ''}>
|
||||||
<div className="sidebar-shadow" onClick={props.do_close} />
|
<div className="sidebar-shadow" onClick={props.do_close} />
|
||||||
<div className="sidebar">
|
<div className="sidebar">
|
||||||
{props.content}
|
{props.content}
|
||||||
|
|||||||
Submodule src/react-lazyload updated: b985b694ee...1b0c9e258d
Reference in New Issue
Block a user