improve
This commit is contained in:
@@ -46,7 +46,7 @@ export class HighlightedText extends PureComponent {
|
|||||||
<pre>
|
<pre>
|
||||||
{parts.map((p,idx)=>(
|
{parts.map((p,idx)=>(
|
||||||
<span key={idx}>{
|
<span key={idx}>{
|
||||||
PID_RE.test(p) ? <a onClick={()=>{this.props.show_pid(p)}}>{p}</a> :
|
PID_RE.test(p) ? <a href={'##'+p} onClick={(e)=>{e.preventDefault(); this.props.show_pid(p);}}>{p}</a> :
|
||||||
NICKNAME_RE.test(p) ? <span style={{backgroundColor: this.props.color_picker.get(p)}}>{p}</span> :
|
NICKNAME_RE.test(p) ? <span style={{backgroundColor: this.props.color_picker.get(p)}}>{p}</span> :
|
||||||
p
|
p
|
||||||
}</span>
|
}</span>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
width: calc(100% - 625px);
|
width: calc(100% - 625px);
|
||||||
margin-left: -25px;
|
margin-left: -25px;
|
||||||
padding-left: 20px;
|
padding-left: 18px;
|
||||||
overflow-x: auto;
|
overflow-x: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
.left-container .flow-reply {
|
.left-container .flow-reply {
|
||||||
flex: 0 0 300px;
|
flex: 0 0 300px;
|
||||||
max-height: 15em;
|
max-height: 15em;
|
||||||
margin-right: -5px;
|
margin-right: -7px;
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
17
src/Flows.js
17
src/Flows.js
@@ -94,8 +94,15 @@ function FlowItem(props) {
|
|||||||
<Time stamp={props.info.timestamp} />
|
<Time stamp={props.info.timestamp} />
|
||||||
</div>
|
</div>
|
||||||
<HighlightedText text={props.info.text} color_picker={props.color_picker} show_pid={props.show_pid} />
|
<HighlightedText text={props.info.text} color_picker={props.color_picker} show_pid={props.show_pid} />
|
||||||
{props.info.type==='image' ? <p className="img"><img src={IMAGE_BASE+props.info.url} /></p> : null}
|
{props.info.type==='image' &&
|
||||||
{props.info.type==='audio' ? <AudioWidget src={AUDIO_BASE+props.info.url} /> : null}
|
<p className="img">
|
||||||
|
{props.img_clickable ?
|
||||||
|
<a href={IMAGE_BASE+props.info.url} target="_blank"><img src={IMAGE_BASE+props.info.url} /></a> :
|
||||||
|
<img src={IMAGE_BASE+props.info.url} />
|
||||||
|
}
|
||||||
|
</p>
|
||||||
|
}
|
||||||
|
{props.info.type==='audio' && <AudioWidget src={AUDIO_BASE+props.info.url} />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -209,7 +216,8 @@ class FlowSidebar extends PureComponent {
|
|||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
<FlowItem info={this.state.info} color_picker={this.color_picker} attention={this.state.attention} show_pid={this.show_pid} />
|
<FlowItem info={this.state.info} attention={this.state.attention} img_clickable={true}
|
||||||
|
color_picker={this.color_picker} show_pid={this.show_pid} />
|
||||||
{this.state.replies.map((reply)=>(
|
{this.state.replies.map((reply)=>(
|
||||||
<LazyLoad key={reply.cid} offset={500} height="5em" overflow={true} once={true}>
|
<LazyLoad key={reply.cid} offset={500} height="5em" overflow={true} once={true}>
|
||||||
<Reply info={reply} color_picker={this.color_picker} show_pid={this.show_pid} />
|
<Reply info={reply} color_picker={this.color_picker} show_pid={this.show_pid} />
|
||||||
@@ -283,7 +291,8 @@ class FlowItemRow extends PureComponent {
|
|||||||
if(!CLICKABLE_TAGS[event.target.tagName.toLowerCase()])
|
if(!CLICKABLE_TAGS[event.target.tagName.toLowerCase()])
|
||||||
this.show_sidebar();
|
this.show_sidebar();
|
||||||
}}>
|
}}>
|
||||||
<FlowItem info={this.state.info} color_picker={this.color_picker} attention={this.state.attention} show_pid={this.show_pid} />
|
<FlowItem info={this.state.info} attention={this.state.attention} img_clickable={false}
|
||||||
|
color_picker={this.color_picker} show_pid={this.show_pid} />
|
||||||
<div className="flow-reply-row">
|
<div className="flow-reply-row">
|
||||||
{this.state.reply_status==='loading' && <div className="box box-tip">加载中</div>}
|
{this.state.reply_status==='loading' && <div className="box box-tip">加载中</div>}
|
||||||
{this.state.reply_status==='failed' &&
|
{this.state.reply_status==='failed' &&
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import './UserAction.css';
|
|||||||
|
|
||||||
import {API_BASE} from './Common';
|
import {API_BASE} from './Common';
|
||||||
const LOGIN_BASE=window.location.protocol==='https:' ? '/login_proxy' : 'http://www.pkuhelper.com/services/login';
|
const LOGIN_BASE=window.location.protocol==='https:' ? '/login_proxy' : 'http://www.pkuhelper.com/services/login';
|
||||||
const MAX_IMG_PX=1000;
|
const MAX_IMG_PX=2000;
|
||||||
const MAX_IMG_FILESIZE=100000;
|
const MAX_IMG_FILESIZE=256000;
|
||||||
|
|
||||||
export const TokenCtx=React.createContext({
|
export const TokenCtx=React.createContext({
|
||||||
value: null,
|
value: null,
|
||||||
|
|||||||
@@ -100,8 +100,10 @@ export const API={
|
|||||||
)
|
)
|
||||||
.then((res)=>res.json())
|
.then((res)=>res.json())
|
||||||
.then((json)=>{
|
.then((json)=>{
|
||||||
if(json.code!==0)
|
if(json.code!==0) {
|
||||||
|
if(json.msg) alert(json.msg);
|
||||||
throw new Error(json);
|
throw new Error(json);
|
||||||
|
}
|
||||||
return json;
|
return json;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -114,8 +116,10 @@ export const API={
|
|||||||
)
|
)
|
||||||
.then((res)=>res.json())
|
.then((res)=>res.json())
|
||||||
.then((json)=>{
|
.then((json)=>{
|
||||||
if(json.code!==0)
|
if(json.code!==0) {
|
||||||
|
if(json.msg) alert(json.msg);
|
||||||
throw new Error(json);
|
throw new Error(json);
|
||||||
|
}
|
||||||
return json;
|
return json;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -127,8 +131,10 @@ export const API={
|
|||||||
)
|
)
|
||||||
.then((res)=>res.json())
|
.then((res)=>res.json())
|
||||||
.then((json)=>{
|
.then((json)=>{
|
||||||
if(json.code!==0)
|
if(json.code!==0) {
|
||||||
|
if(json.msg) alert(json.msg);
|
||||||
throw new Error(json);
|
throw new Error(json);
|
||||||
|
}
|
||||||
return json;
|
return json;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user