{React, PropTypes, Utils, DateUtils} = require 'mailspring-exports' ThreadListStore = require './thread-list-store' class ThreadListScrollTooltip extends React.Component @displayName: 'ThreadListScrollTooltip' @propTypes: viewportCenter: PropTypes.number.isRequired totalHeight: PropTypes.number.isRequired componentWillMount: => @setupForProps(@props) componentWillReceiveProps: (newProps) => @setupForProps(newProps) shouldComponentUpdate: (newProps, newState) => @state?.idx isnt newState.idx setupForProps: (props) -> idx = Math.floor(ThreadListStore.dataSource().count() / @props.totalHeight * @props.viewportCenter) @setState idx: idx item: ThreadListStore.dataSource().get(idx) render: -> if @state.item content = DateUtils.shortTimeString(@state.item.lastMessageReceivedTimestamp) else content = "Loading..."
{content}
module.exports = ThreadListScrollTooltip