diff --git a/src/Flows.css b/src/Flows.css index ef29739e..b7588714 100644 --- a/src/Flows.css +++ b/src/Flows.css @@ -115,7 +115,7 @@ font-family: 'Consolas', 'Courier', monospace; } -.box-header { +.box-header, .box-footer { font-size: small; } diff --git a/src/Flows.js b/src/Flows.js index 2c5efeaa..b83df7ab 100644 --- a/src/Flows.js +++ b/src/Flows.js @@ -127,6 +127,9 @@ class FlowItem extends PureComponent { } {props.info.type==='audio' && } + {!!(props.attention && props.info.variant.latest_reply) && +

最新回复

+ } ); } @@ -154,14 +157,14 @@ class FlowSidebar extends PureComponent { return { replies: prev.replies.map((reply)=>{ if(reply.cid===cid) - return Object.assign({},reply,{variant: variant}); + return Object.assign({},reply,{variant: Object.assign({},reply.variant,variant)}); else return reply; }), }; else return { - info: Object.assign({},prev.info,{variant: variant}), + info: Object.assign({},prev.info,{variant: Object.assign({},prev.info.variant,variant)}), } },function() { this.syncState({ @@ -192,6 +195,8 @@ class FlowSidebar extends PureComponent { attention: this.state.attention, info: this.state.info, }); + if(this.state.replies.length) + this.set_variant(null,{latest_reply: Math.max.apply(null,this.state.replies.map((r)=>parseInt(r.timestamp)))}); }); }) .catch((e)=>{ @@ -349,9 +354,12 @@ class FlowItemRow extends PureComponent { .then((json)=>{ this.setState((prev,props)=>({ replies: json.data, - info: update_count ? Object.assign({}, prev.info, { - reply: ''+json.data.length, - }) : prev.info, + info: Object.assign({}, prev.info, { + reply: update_count ? ''+json.data.length : prev.info.reply, + variant: json.data.length ? { + latest_reply: Math.max.apply(null,json.data.map((r)=>parseInt(r.timestamp))), + } : {}, + }), attention: !!json.attention, reply_status: 'done', }),callback);