Browse Source

sort reply by time

dev
xmcp 7 years ago
parent
commit
4d11d39695
  1. 10
      src/Flows.js

10
src/Flows.js

@ -31,8 +31,8 @@ function FlowItem(props) {
return ( return (
<div className="flow-item box"> <div className="flow-item box">
<div className="box-header"> <div className="box-header">
{!!parseInt(props.info.likenum, 10) && <span className="box-header-badge">{props.info.likenum}</span>} {!!parseInt(props.info.likenum,10) && <span className="box-header-badge">{props.info.likenum}</span>}
{!!parseInt(props.info.reply, 10) && <span className="box-header-badge">{props.info.reply}回复</span>} {!!parseInt(props.info.reply,10) && <span className="box-header-badge">{props.info.reply}回复</span>}
<span className="box-id">#{props.info.pid}</span>&nbsp; <span className="box-id">#{props.info.pid}</span>&nbsp;
<Time stamp={props.info.timestamp} /> <Time stamp={props.info.timestamp} />
</div> </div>
@ -71,7 +71,11 @@ class FlowItemRow extends Component {
if(json.code!==0) if(json.code!==0)
throw new Error(json.code); throw new Error(json.code);
this.setState({ this.setState({
replies: json.data.map((info)=>{ replies: json.data
.sort((a,b)=>{
return parseInt(a.timestamp,10)-parseInt(b.timestamp,10);
})
.map((info)=>{
info._display_color=info.islz ? null : this.color_picker.get(info.name) info._display_color=info.islz ? null : this.color_picker.get(info.name)
return info; return info;
}), }),

Loading…
Cancel
Save