 React = require 'kd-react'
 TimeAgo = require 'app/components/common/timeago'
 UnreadCount = require 'app/components/sidebarmachineslistitem/unreadcount'
+getBoundingClientReact = require 'app/util/getBoundingClientReact'
+StackUpdatedWidget = require 'app/components/sidebarstacksection/stackupdatedwidget'
 
 module.exports = class StackTemplateItem extends React.Component
+
+  constructor: ->
+
+    super
+
+    @state        =
+      coordinates :
+        left      : 0
+        top       : 0
+      showWidget  : no
+
+    $('.kdscrollview').on 'scroll', @bound 'scrollOnPage'
+
+
+  componentWillReceiveProps: -> @setCoordinates()
+
+
+  componentDidMount: -> @setCoordinates()
+
+  scrollOnPage: ->
+
+    @setState { showWidget: no }
+
+
+  setCoordinates: ->
+
+    return  unless @refs.stackTemplateItem
+
+    coordinates = getBoundingClientReact @refs.stackTemplateItem
+    @setState { coordinates: coordinates }
+
 
   renderButton: ->
 

      count={@getStackUnreadCount()}
      onClick={@bound 'handleUnreadCountClick'} />

  render: ->

    { template, stack, onOpen } = @props


    <div className='HomeAppViewListItem StackTemplateItem'>
      <a
        ref='stackTemplateItem'
        href={editorUrl}
        className='HomeAppViewListItem-label'
        onClick={onOpen}>
        { makeTitle { template, stack } }
      </a>
      {@renderUnreadCount()}
      {@renderStackUpdatedWidget()}
      <div className='HomeAppViewListItem-description'>
        Last updated <TimeAgo from={template.getIn ['meta', 'modifiedAt']} />
      </div>
